:root {
  --bg: #070b14;
  --bg-soft: #0d1424;
  --card: #111a2c;
  --card-2: #16213a;
  --line: #23304d;
  --text: #e8eefc;
  --muted: #8ea0c4;
  --dim: #64748b;
  --accent: #d9f21c;

  --won: #22c55e;
  --leading: #4ade80;
  --even: #fbbf24;
  --trailing: #fb7185;
  --lost: #ef4444;
  --pending: #64748b;
  --void: #a78bfa;
  --unknown: #7c8db5;

  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  font-synthesis-weight: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #14203a 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

body { padding-bottom: env(safe-area-inset-bottom); }
h1, h2, h3 { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
code { background: #0b1220; padding: 1px 5px; border-radius: 5px; font-size: .85em; }

/* ------------------------------------------------------------- topbar */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px calc(10px);
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(7, 11, 20, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .ball { color: var(--accent); font-size: 26px; line-height: 1; }
.brand h1 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.brand p { margin: 1px 0 0; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tools { display: flex; align-items: center; gap: 6px; }
.updated { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center; font-size: 15px; color: var(--muted);
  transition: .15s;
}
.icon-btn:hover { border-color: #3a4d75; color: var(--text); }
.icon-btn.on { color: var(--accent); border-color: #3d4a1f; background: #1a2113; }
.icon-btn.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.banner {
  margin: 10px 14px 0; padding: 9px 12px; border-radius: 10px;
  background: #2a1c14; border: 1px solid #5a3a22; color: #fbbf24; font-size: 12.5px;
}

main { max-width: none; margin: 0 auto; padding: 14px 16px 110px; }

/* ----------------------------------------------------------- overview */

.overview {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px; margin-bottom: 14px; max-width: 1400px;
}
.stat {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 13px;
}
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-size: 21px; font-weight: 680; margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .s { font-size: 11.5px; color: var(--dim); }
.stat.good .v { color: var(--won); }
.stat.bad .v { color: var(--lost); }
.stat.warn .v { color: var(--even); }

.listhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.filters { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filters::-webkit-scrollbar { display: none; }
.filters .chip {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  padding: 5px 11px; border-radius: 999px; font-size: 12.5px; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.filters .chip.active { color: var(--text); border-color: #4b6099; background: var(--card-2); }
.filters .chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.filters .chip .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filters .chip { max-width: min(320px, 50vw); }
.linkbtn { background: none; border: 0; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }

/* ------------------------------------------------------------ parlays */

.parlays {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr));
  gap: 14px;
  align-items: start;
}
/* En modo automático la tarjeta no crece más allá de lo cómodo de leer: se centra
   en su columna y así las pocas tarjetas se reparten una pantalla ultra ancha. */
.parlays.auto > .parlay { max-width: 900px; justify-self: center; width: 100%; }

.parlay {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  border-left: 4px solid var(--pending);
}
.parlay[data-status="live"] { border-left-color: var(--even); }
.parlay[data-status="won"] { border-left-color: var(--won); }
.parlay[data-status="lost"] { border-left-color: var(--lost); }

.parlay-head { display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px 11px; position: relative; }
.parlay-head .title { flex: 1; min-width: 0; }
.parlay-head h2 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.parlay-head .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

.pill {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.pill.live { background: #3a2f0c; color: #fbbf24; border-color: #6b5410; }
.pill.won { background: #06301c; color: #4ade80; border-color: #14663a; }
.pill.lost { background: #3a1113; color: #fca5a5; border-color: #7f1d1d; }
.pill.open { background: #16213a; color: var(--muted); border-color: var(--line); }
.pill.proj { background: transparent; border-color: var(--line); color: var(--muted); }
.pill.proj.won { color: #4ade80; border-color: #14663a; }
.pill.proj.lost { color: #fca5a5; border-color: #7f1d1d; }

.money { text-align: right; white-space: nowrap; }
.money .big { font-size: 17px; font-weight: 680; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.money .small { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.segbar { display: flex; gap: 3px; padding: 0 14px 11px; }
.segbar span { height: 6px; flex: 1; border-radius: 3px; background: var(--pending); opacity: .45; }
.segbar span[data-s="won"] { background: var(--won); opacity: 1; }
.segbar span[data-s="lost"] { background: var(--lost); opacity: 1; }
.segbar span[data-s="leading"] { background: var(--leading); opacity: 1; }
.segbar span[data-s="trailing"] { background: var(--trailing); opacity: 1; }
.segbar span[data-s="even"] { background: var(--even); opacity: 1; }
.segbar span[data-s="void"] { background: var(--void); opacity: .8; }
.segbar span[data-s="unknown"] { background: var(--unknown); opacity: .5; }

.legs { border-top: 1px solid var(--line); }

.leg {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center;
  grid-template-areas: "mark who right";
  padding: 11px 14px; border-bottom: 1px solid rgba(35, 48, 77, .55);
  transition: background .4s;
}
.leg .mark { grid-area: mark; }
.leg .who { grid-area: who; }
.leg .right { grid-area: right; }
.leg.hasboard { grid-template-areas: "mark who right" ". board board"; row-gap: 8px; }
.leg:last-child { border-bottom: 0; }
.leg.flash { background: rgba(217, 242, 28, .09); }

.mark {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #07131e; line-height: 1;
}
.leg[data-state="won"] .mark { background: var(--won); }
.leg[data-state="lost"] .mark { background: var(--lost); color: #fff; }
.leg[data-state="leading"] .mark { background: var(--leading); }
.leg[data-state="trailing"] .mark { background: var(--trailing); color: #fff; }
.leg[data-state="even"] .mark { background: var(--even); }
.leg[data-state="pending"] .mark { background: #22304d; color: var(--muted); }
.leg[data-state="void"] .mark { background: var(--void); }
.leg[data-state="unknown"] .mark { background: #22304d; color: var(--unknown); border: 1px dashed var(--unknown); }
.leg[data-state="leading"] .mark, .leg[data-state="trailing"] .mark, .leg[data-state="even"] .mark { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.0); } 50% { box-shadow: 0 0 0 5px rgba(255,255,255,.07); } }

.leg .who { min-width: 0; }
.leg .pick { font-weight: 620; font-size: 14.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.leg .pick .odds { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; background: #0d1526; border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
.leg .meta { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.leg .meta .sep { color: var(--dim); margin: 0 5px; }
.leg .note { font-size: 11.5px; color: var(--dim); margin-top: 2px; }

.leg .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.leg .sets { font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 620; letter-spacing: .01em; white-space: nowrap; }
.leg .state { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.leg[data-state="won"] .state, .leg[data-state="leading"] .state { color: var(--leading); }
.leg[data-state="lost"] .state, .leg[data-state="trailing"] .state { color: var(--trailing); }
.leg[data-state="even"] .state { color: var(--even); }
.leg[data-state="pending"] .state, .leg[data-state="unknown"] .state { color: var(--muted); }
.leg[data-state="void"] .state { color: var(--void); }
.leg .time { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.leg .linkbtn { font-size: 11px; }

.parlay-foot { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); background: rgba(11, 17, 32, .5); }
.parlay-foot .hint { font-size: 11.5px; color: var(--dim); flex: 1; }

/* --------------------------------------------------------------- misc */

.empty { display: grid; place-items: center; padding: 40px 0; }
.empty-card { max-width: 460px; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 22px; }
.empty-card h2 { font-size: 18px; margin-bottom: 8px; }
.empty-card p { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }

.primary { background: var(--accent); color: #10160a; border: 0; padding: 9px 16px; border-radius: 10px; font-weight: 650; font-size: 14px; }
.primary:hover { filter: brightness(1.08); }
.ghost { background: transparent; border: 1px solid var(--line); padding: 8px 14px; border-radius: 10px; color: var(--muted); font-size: 13.5px; }
.ghost:hover { color: var(--text); border-color: #3a4d75; }
.danger { color: #fca5a5; border-color: #7f1d1d; }

.fab {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  width: 54px; height: 54px; border-radius: 50%; border: 0;
  background: var(--accent); color: #10160a; font-size: 30px; font-weight: 400; line-height: 1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45); z-index: 25;
}

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { background: var(--card-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; padding: 9px 13px; font-size: 13px; box-shadow: var(--shadow); animation: rise .25s ease-out; width: 100%; }
.toast.good { border-left-color: var(--won); }
.toast.bad { border-left-color: var(--lost); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.hidden { display: none !important; }

/* ------------------------------------------------------------- editor */

dialog.editor {
  width: min(720px, 100vw); max-height: 92vh; padding: 0; border: 1px solid var(--line);
  border-radius: 16px; background: var(--bg-soft); color: var(--text); box-shadow: var(--shadow);
}
dialog.editor::backdrop { background: rgba(2, 5, 12, .72); backdrop-filter: blur(3px); }
/* Los tres diálogos (parlay, cuenta y alta de usuario) comparten el armado:
   encabezado fijo, cuerpo que crece y hace scroll, y pie siempre a la vista. */
#editorForm, dialog.editor form { display: flex; flex-direction: column; max-height: 92vh; }
.editor-body { flex: 1 1 auto; }
.editor-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.editor-head h2 { font-size: 16px; }
.editor-body { padding: 14px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.editor-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--card); }
.editor-foot .spacer { flex: 1; }

.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 16px; }
label { display: block; font-size: 11.5px; color: var(--muted); }
input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="date"], input[type="datetime-local"], textarea, select {
  width: 100%; margin-top: 4px; background: #0a1120; border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 8px 10px; font: inherit; font-size: 14px;
}
input:focus, textarea:focus { outline: 2px solid #38507f; outline-offset: -1px; }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5; }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 7px 10px; color: var(--muted); font-size: 13px; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabpanel { margin-bottom: 16px; }
.hint { font-size: 12px; color: var(--dim); margin: 0 0 8px; }
.row-end { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.row-end .hint { margin: 0; flex: 1; }

.search-row { display: grid; grid-template-columns: auto 1fr 150px; gap: 8px; align-items: center; }
.check { display: flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; }
.check input { width: auto; margin: 0; }
.results { margin-top: 10px; max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.result { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; text-align: left; width: 100%; }
.result:hover { border-color: #4b6099; }
.result .r-main { flex: 1; min-width: 0; }
.result .r-title { font-size: 13.5px; font-weight: 600; }
.result .r-sub { font-size: 11.5px; color: var(--muted); }
.result .r-state { font-size: 11px; color: var(--dim); white-space: nowrap; }

.legs-editor-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.legs-editor-head h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.leg-edit { background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 10px; margin-bottom: 8px; }
.leg-edit .le-top { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.leg-edit .le-grid { display: grid; grid-template-columns: 1fr 110px 150px; gap: 8px; margin-top: 8px; }
@media (max-width: 620px) { .leg-edit .le-grid { grid-template-columns: 1fr 1fr; } .leg-edit .le-grid select { grid-column: 1 / -1; } }
.leg-edit .picks { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.leg-edit .pickbtn { border: 1px solid var(--line); background: #0a1120; color: var(--muted); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; }
.leg-edit .pickbtn.active { background: #1a2113; border-color: #5d7020; color: var(--accent); font-weight: 600; }
.leg-edit .del { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #0a1120; color: var(--muted); }
.leg-edit .del:hover { color: #fca5a5; border-color: #7f1d1d; }
.leg-edit .tag { font-size: 11px; color: var(--dim); margin-top: 6px; }

@media (max-width: 620px) {
  .updated { display: none; }
  .brand h1 { font-size: 15px; }
  .brand p { font-size: 11px; }
  .leg .meta .opt { display: none; }
  .listhead { align-items: center; }
  .leg { grid-template-columns: 24px 1fr auto; gap: 8px; padding: 10px 12px; }
  .leg .pick { font-size: 14px; }
  .leg .sets { font-size: 13px; }
  .parlay-head { flex-wrap: wrap; }
  .money { width: 100%; text-align: left; display: flex; gap: 10px; align-items: baseline; }
  .search-row { grid-template-columns: 1fr; }
  /* A pantalla completa de verdad.
   *
   * En iOS `100vh` mide la pantalla COMO SI la barra de direcciones no existiera,
   * así que un diálogo de 100vh deja su pie —y el botón de Guardar— por debajo de
   * lo que se ve. Se usa la altura real del área visible (--vvh, que el portal
   * actualiza con visualViewport y que además se encoge cuando sale el teclado),
   * con 100dvh y 100vh como respaldos para navegadores viejos.
   * `inset: 0` y `margin: 0` son necesarios: sin ellos el navegador centra el
   * diálogo y le impone su propio ancho máximo. */
  dialog.editor {
    width: 100vw; max-width: 100vw;
    margin: 0; inset: 0;
    border: 0; border-radius: 0;
    height: 100vh; height: 100dvh; height: var(--vvh, 100dvh);
    max-height: 100vh; max-height: 100dvh; max-height: var(--vvh, 100dvh);
  }
  /* Se nombra #editorForm además del selector general: la regla base usa ese id
     y por especificidad le ganaría, dejando el formulario en 92vh. */
  dialog.editor form, #editorForm {
    height: 100vh; height: 100dvh; height: var(--vvh, 100dvh);
    max-height: 100vh; max-height: 100dvh; max-height: var(--vvh, 100dvh);
  }
  /* El botón nunca debajo de la barra del iPhone. */
  .editor-foot { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  /* Que el cuerpo ocupe el espacio libre: si no, con poco contenido el pie se sube
     y deja un hueco raro debajo. */
  .editor-body { flex: 1 1 auto; padding-bottom: 18px; }
}


/* ------------------------------------------------------- pestañas y vistas */

.maintabs {
  display: flex; gap: 4px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--line); padding-bottom: 0;
}
.maintabs::-webkit-scrollbar { display: none; }
.mtab {
  background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted);
  padding: 9px 13px; font-size: 14px; font-weight: 550; white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.mtab .n {
  font-size: 11px; font-weight: 700; background: var(--card-2); border: 1px solid var(--line);
  color: var(--muted); border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center;
}
.mtab.active { color: var(--text); border-bottom-color: var(--accent); }
.mtab.active .n { background: #1a2113; border-color: #5d7020; color: var(--accent); }
.mtab[data-view="won"].active { border-bottom-color: var(--won); }
.mtab[data-view="won"].active .n { background: #06301c; border-color: #14663a; color: var(--leading); }
.mtab[data-view="lost"].active { border-bottom-color: var(--lost); }
.mtab[data-view="lost"].active .n { background: #3a1113; border-color: #7f1d1d; color: #fca5a5; }
.viewhint { font-size: 12px; color: var(--dim); }

/* ------------------------------------------------------- tarjeta plegable */

.parlay-head { cursor: pointer; }
.parlay-head .chev {
  color: var(--dim); font-size: 12px; align-self: center; transition: transform .18s; flex: none;
}
.parlay.collapsed .parlay-head .chev { transform: rotate(-90deg); }
.parlay.collapsed .legs, .parlay.collapsed .parlay-foot, .parlay.collapsed .segbar { display: none; }
.parlay.collapsed .parlay-head { padding-bottom: 13px; }
.parlay .closedline { font-size: 11.5px; color: var(--dim); margin-top: 3px; }
.net { font-weight: 700; font-variant-numeric: tabular-nums; }
.net.pos { color: var(--leading); }
.net.neg { color: var(--trailing); }

/* ------------------------------------------------------------ contabilidad */

.ledger { display: flex; flex-direction: column; gap: 14px; }
.ledger-note { font-size: 12px; color: var(--dim); }
.ledger-wrap {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow-x: auto; box-shadow: var(--shadow);
}
table.ledger-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; min-width: 640px; }
table.ledger-table th {
  text-align: right; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line);
  background: rgba(11, 17, 32, .6); position: sticky; top: 0;
}
table.ledger-table th:first-child, table.ledger-table td:first-child { text-align: left; }
table.ledger-table td { padding: 10px 14px; font-size: 13.5px; border-bottom: 1px solid rgba(35, 48, 77, .5); text-align: right; }
table.ledger-table tr.day { cursor: pointer; }
table.ledger-table tr.day:hover td { background: rgba(35, 48, 77, .25); }
table.ledger-table tr.day td:first-child { font-weight: 620; }
table.ledger-table tr.detail td { font-size: 12.5px; color: var(--muted); background: rgba(7, 11, 20, .45); padding: 7px 14px; }
table.ledger-table tr.detail td:first-child { padding-left: 30px; }
table.ledger-table tfoot td { font-weight: 700; font-size: 14px; border-top: 1px solid var(--line); border-bottom: 0; background: rgba(11, 17, 32, .6); }
.badge-mini { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge-mini.won { color: var(--leading); border-color: #14663a; }
.badge-mini.lost { color: #fca5a5; border-color: #7f1d1d; }

/* ------------------------------------------------------------- misceláneos */

/* El video NO puede estar oculto: iOS sólo mantiene la pantalla encendida si se
   reproduce de verdad y está a la vista. Se muestra como un punto bajo el botón ☾,
   que además sirve de indicador de que el mecanismo está corriendo. */
#awakeVideo {
  position: fixed; right: 16px; width: 16px; height: 16px; border-radius: 5px;
  top: calc(max(10px, env(safe-area-inset-top)) + 42px);
  opacity: 0; pointer-events: none; z-index: 40; transition: opacity .2s;
  object-fit: cover; background: #000;
}
body.awake #awakeVideo { opacity: 1; box-shadow: 0 0 0 1.5px var(--leading), 0 0 10px rgba(74, 222, 128, .35); }
.lbl-hint { color: var(--dim); font-weight: 400; }
.moneyline {
  margin: -6px 0 16px; font-size: 12.5px; color: var(--muted);
  background: #0a1120; border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px;
}
.moneyline b { color: var(--text); font-variant-numeric: tabular-nums; }
.moneyline .warn { color: var(--even); }

@media (max-width: 620px) {
  main { padding: 12px 12px 110px; }
  .overview { grid-template-columns: 1fr 1fr; }
  .maintabs { gap: 1px; }
  .mtab { padding: 8px 5px; font-size: 11.5px; gap: 4px; letter-spacing: -.01em; }
  .mtab .n { font-size: 10px; padding: 1px 5px; min-width: 17px; }
  .parlay-head { padding-right: 30px; }
  .parlay-head .chev { position: absolute; top: 15px; right: 12px; }
  .money { padding-right: 4px; }
}

.ghost.tiny { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; color: var(--accent); border-color: #5d7020; }


/* ------------------------------------- tarjeta doble en el panel superior */

.stat.duo .duo-row { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 3px; }
.stat.duo .duo-cell { min-width: 0; }
.stat.duo .v { font-size: 21px; }          /* mismo tamaño para ambas cifras */
.stat.duo .v.accent { color: var(--leading); }
.stat.duo .s { margin-top: 1px; }

/* -------------------------------------------- acomodo (arrastrar tarjetas) */

.drag-handle {
  border: 0; background: none; color: var(--dim); font-size: 15px; line-height: 1;
  padding: 2px 4px; border-radius: 6px; cursor: grab; align-self: center; flex: none;
}
.drag-handle:hover { color: var(--text); background: var(--card-2); }
.drag-handle:active { cursor: grabbing; }
.parlay.dragging { opacity: .45; outline: 2px dashed var(--accent); outline-offset: -2px; }
@media (hover: none) { .drag-handle { display: none; } }

/* ------------------------------------------------------ selector de ancho */

.cols-ctl {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted);
  white-space: nowrap;
}
.cols-ctl select {
  width: auto; margin: 0; padding: 4px 8px; font-size: 12.5px; border-radius: 8px;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
}
.colsinfo { color: var(--dim); font-variant-numeric: tabular-nums; }

@media (max-width: 620px) {
  .cols-ctl { display: none; }
  .stat.duo .duo-row { gap: 12px; }
  .stat.duo .v { font-size: 18px; }
}

.leg .note.warnnote { color: var(--even); }


/* ---------------------------------- marcador en vivo (estilo tablero ESPN) */

.board {
  grid-area: board;
  background: #0a1120; border: 1px solid var(--line); border-radius: 9px;
  padding: 6px 8px; display: flex; flex-direction: column; gap: 3px;
  font-variant-numeric: tabular-nums;
}
.brow { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.brow.pick { color: var(--text); font-weight: 620; }
.brow .serve { width: 9px; font-size: 9px; color: var(--accent); line-height: 1; flex: none; }
.brow .bname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow .bset {
  width: 26px; text-align: center; flex: none; border-radius: 5px; padding: 1px 0;
  color: var(--dim); font-size: 13px;
}
.brow.pick .bset { color: var(--muted); }
.brow .bset.won { color: var(--text); font-weight: 700; }
.brow .bset.cur { background: var(--card-2); color: var(--text); font-weight: 700; }
.brow .bset .tb { font-size: 9px; color: var(--dim); margin-left: 1px; top: -.4em; }


/* --------------------------------- tablero de deportes de equipo (escudos) */

.brow .crest { width: 15px; height: 15px; object-fit: contain; flex: none; border-radius: 2px; }
.brow .bset.total { width: 34px; font-size: 15px; font-weight: 700; color: var(--muted); }
.brow.up .bset.total, .brow.pick .bset.total { color: var(--text); }
.leg-edit select { width: 100%; margin-top: 4px; background: #0a1120; border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 8px 10px; font-size: 13px; }
#fSearchLeague { width: 100%; margin: 0; background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 8px 10px; font-size: 13px; }

/* ------------------------------------------------- puerta de entrada */

body.gate { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.gate-wrap { width: min(400px, 100%); }
.gate-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px;
}
.gate-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.gate-brand h1 { font-size: 17px; letter-spacing: -.01em; }
.gate-brand p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.gate-card label { font-size: 12px; color: var(--muted); }
.gate-btn { width: 100%; padding: 11px; font-size: 15px; margin-top: 4px; }
.gate-btn:disabled { opacity: .6; }
.gate-error {
  margin: 0; padding: 9px 11px; border-radius: 9px; font-size: 13px;
  background: #3a1113; border: 1px solid #7f1d1d; color: #fca5a5;
}
.gate-foot { margin: 2px 0 0; font-size: 11.5px; color: var(--dim); text-align: center; }
.gate-help { margin: 0; font-size: 13px; color: var(--muted); }
.gate-code {
  margin: 0; background: #0a1120; border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: var(--accent); overflow-x: auto;
}

.who-btn {
  font-weight: 700; font-size: 13px; color: var(--accent);
  background: #1a2113; border-color: #3d4a1f; text-transform: uppercase;
}
.acc-who { margin: 0 0 16px; font-size: 13px; color: var(--muted); }
.acc-title { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
dialog.account { width: min(460px, 100vw); }

/* ------------------------------------------------- administración de cuentas */

.acc-forced {
  margin: 0 0 16px; padding: 10px 12px; border-radius: 9px; font-size: 13px;
  background: #2a1c14; border: 1px solid #5a3a22; color: #fbbf24;
}
.users-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.users-head h2 { font-size: 16px; }
.role-tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.role-tag.admin { color: var(--accent); border-color: #5d7020; background: #1a2113; }
.pending-tag { font-size: 10.5px; color: var(--even); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.row-actions button { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
table.ledger-table td.left, table.ledger-table th.left { text-align: left; }
.row-actions button:disabled { opacity: .35; cursor: not-allowed; }

/* Tarjeta recién guardada: un destello para no perderla de vista. */
.parlay.justsaved { outline: 2px solid var(--accent); outline-offset: -2px; animation: justsaved 3s ease-out; }
@keyframes justsaved {
  0%, 40% { box-shadow: 0 0 0 4px rgba(217, 242, 28, .18), var(--shadow); }
  100% { box-shadow: var(--shadow); }
}

/* Patas que ESPN no puede resolver: el resultado se marca a mano. */
.manual-marks { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.manual-marks .linkbtn { text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; font-size: 11px; }
.manual-marks .linkbtn:hover { border-color: #4b6099; color: var(--text); }
.manual-marks .linkbtn.on { background: #1a2113; border-color: #5d7020; color: var(--accent); font-weight: 600; }
.brow .serve.guess { color: var(--muted); }

.editor-note {
  margin: 0 0 14px; padding: 10px 12px; border-radius: 9px; font-size: 12.5px;
  background: #1a2113; border: 1px solid #3d4a1f; color: var(--accent);
}

/* Americano: balón y situación de juego en el tablero. */
.brow .serve.ball { width: 16px; font-size: 12px; }
.bsit {
  margin-top: 4px; padding-top: 5px; border-top: 1px solid rgba(35, 48, 77, .6);
  font-size: 11.5px; color: var(--muted); letter-spacing: .01em;
}
.bsit.rz { color: var(--trailing); font-weight: 600; }
.legs-loading { padding: 14px; font-size: 12.5px; color: var(--dim); }
