:root {
  --ink: #090b10;
  --ink-2: #10141c;
  --panel: #161b25;
  --panel-2: #1c2330;
  --line: #2c3648;
  --line-strong: #3d4b63;
  --text: #f3f6fb;
  --muted: #b4c0d2;
  --faint: #8b98ad;
  --lime: #c6f542;
  --lime-dim: #8fb82e;
  --lime-ink: #10140a;
  --warn: #ff6b4a;
  --qb: #ff5a6a;
  --rb: #3ee0a0;
  --wr: #5aa8ff;
  --te: #ffb020;
  --k: #c084fc;
  --def: #2dd4bf;
  --flex: #94a3b8;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  height: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

html, body { margin: 0; }

body {
  min-height: 100%;
  background:
    radial-gradient(900px 420px at 8% -12%, rgba(198, 245, 66, 0.09), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(90, 168, 255, 0.07), transparent 46%),
    var(--ink);
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  overscroll-behavior: none;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.42; cursor: not-allowed; }
button, select, .rec, .match, .filter, .chip, .badge {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}
::selection { background: rgba(198, 245, 66, 0.28); color: var(--text); }

#app {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.boot {
  margin: auto;
  padding: 48px 24px;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-align: center;
}

.top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 20px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 11, 16, 0.9);
  flex: none;
}
.brand {
  font-family: Syne, "Segoe UI", sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  line-height: 1;
}
.brand i {
  width: 10px;
  height: 22px;
  background: var(--lime);
  display: inline-block;
  transform: skewX(-16deg);
  box-shadow: 0 0 18px rgba(198, 245, 66, 0.45);
}
.meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.meta .name {
  font-weight: 650;
  font-size: 16px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meta .sub {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clock-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  flex: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.clock-wrap:has(.yours) {
  border-color: rgba(198, 245, 66, 0.5);
  background: rgba(198, 245, 66, 0.08);
}
.clock {
  font-family: Syne, "Segoe UI", sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  white-space: nowrap;
}
.clock.yours { color: var(--lime); }
.pick-num {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
  font-variant-numeric: tabular-nums;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--lime-dim);
  color: var(--lime);
}
.badge.idle { border-color: var(--line); color: var(--muted); }
.badge.live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.6s var(--ease-in-out) infinite;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--ink-2);
  flex: none;
}
.slots, .tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
  border: 1px dashed var(--line-strong);
  background: transparent;
  border-radius: 999px;
  padding: 4px 8px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: none;
  white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 650; letter-spacing: 0.04em; }
.chip.ok {
  border-style: solid;
  border-color: rgba(198, 245, 66, 0.45);
  background: rgba(198, 245, 66, 0.1);
  color: var(--lime);
}
.chip.ok b { color: var(--lime); }

.slot-label, .tools button { flex: none; white-space: nowrap; }
.tools button, .dock button, .slot-label select, .more {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 11px;
  min-height: 36px;
  transition:
    transform 160ms var(--ease-out),
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}
.tools button:active:not(:disabled),
.dock button:active:not(:disabled),
.more:active,
.rec:active,
.match:active,
.filter:active {
  transform: scale(0.97);
}
.slot-label {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.slot-label select {
  color: var(--text);
  font-size: 14px;
  accent-color: var(--lime);
}

.banner {
  padding: 9px 18px;
  background: rgba(198, 245, 66, 0.08);
  color: var(--lime);
  border-bottom: 1px solid rgba(198, 245, 66, 0.22);
  font-size: 13px;
  line-height: 1.4;
  flex: none;
}
.banner.note {
  color: var(--text);
  background: rgba(90, 168, 255, 0.1);
  border-bottom-color: rgba(90, 168, 255, 0.28);
}

.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 348px;
}
.board-wrap {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.more {
  display: block;
  width: min(100%, 960px);
  margin-top: 10px;
  background: transparent;
  border-style: dashed;
  color: var(--muted);
  min-height: 40px;
}
.board { display: grid; gap: 5px; min-width: 1030px; }
.board-row { display: grid; gap: 5px; }
.board-row.head { position: sticky; top: 0; z-index: 3; }

.cell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 56px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.head .cell {
  min-height: 46px;
  background: #121820;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  box-shadow: none;
}
.head .abbrev {
  text-transform: uppercase;
  color: var(--text);
  font-size: 12px;
  letter-spacing: 0.07em;
}
.head .meta-line {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.cell.mine {
  background:
    linear-gradient(180deg, rgba(198, 245, 66, 0.07), rgba(198, 245, 66, 0.02)),
    var(--panel);
}
.head .cell.mine,
.head .cell.otc-col {
  background: #17210e;
  color: var(--lime);
}
.head .cell.mine .abbrev,
.head .cell.otc-col .abbrev { color: var(--lime); }
.you {
  display: inline-block;
  margin-left: 6px;
  color: var(--lime-ink);
  background: var(--lime);
  border-radius: 999px;
  padding: 1px 5px;
  font-size: 9px;
  letter-spacing: 0.08em;
  vertical-align: 1px;
}
.round-tag {
  min-width: 42px;
  background: var(--ink);
  border-color: transparent;
  color: var(--faint);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  justify-content: center;
  align-items: center;
  position: sticky;
  left: 0;
  z-index: 1;
  box-shadow: none;
  font-variant-numeric: tabular-nums;
}
.dir { display: block; font-size: 11px; color: var(--lime-dim); line-height: 1; }
.head .round-tag { z-index: 4; background: #121820; border-color: transparent; }

.cell:has(.pos.QB) { --stripe: var(--qb); }
.cell:has(.pos.RB) { --stripe: var(--rb); }
.cell:has(.pos.WR) { --stripe: var(--wr); }
.cell:has(.pos.TE) { --stripe: var(--te); }
.cell:has(.pos.K) { --stripe: var(--k); }
.cell:has(.pos.DEF) { --stripe: var(--def); }
.cell:has(.pos) { box-shadow: inset 3px 0 0 var(--stripe), inset 0 1px 0 rgba(255, 255, 255, 0.04); }

.cell .who {
  flex-shrink: 0;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.num {
  flex: none;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.cell .meta-line, .match .meta-line {
  display: flex;
  gap: 5px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.cell .team { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cell.empty {
  background: transparent;
  color: var(--faint);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  box-shadow: none;
  border-color: rgba(44, 54, 72, 0.7);
}
.cell.empty.mine { background: rgba(198, 245, 66, 0.035); }
.cell.now {
  border-color: var(--lime);
  background: rgba(198, 245, 66, 0.1);
  color: var(--lime);
  box-shadow: none;
}
.cell.now::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--lime);
  pointer-events: none;
  animation: ring 1.6s var(--ease-in-out) infinite;
}
.slot { letter-spacing: 0.04em; }

.pos {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 4px;
  color: #07100a;
  flex: none;
}
.pos.QB { background: var(--qb); }
.pos.RB { background: var(--rb); }
.pos.WR { background: var(--wr); color: #061018; }
.pos.TE { background: var(--te); }
.pos.K { background: var(--k); }
.pos.DEF { background: var(--def); color: #06211e; }
.pos.\? { background: var(--flex); }

.recs {
  border-left: 1px solid var(--line);
  background: var(--ink-2);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.recs h2 {
  margin: 0;
  padding: 14px 16px 4px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--lime);
}
.otc { padding: 0 16px 12px; color: var(--muted); font-size: 13px; }
.otc strong { color: var(--text); font-weight: 650; }
.finder { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.finder input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  min-height: 40px;
  font-size: 16px;
  transition: border-color 140ms ease;
}
.finder input::placeholder { color: var(--faint); }
.filters { display: flex; flex-wrap: wrap; gap: 4px; }
.filter {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 8px;
  min-height: 28px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  transition:
    transform 160ms var(--ease-out),
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}
.filter.on {
  background: var(--lime);
  color: var(--lime-ink);
  border-color: transparent;
  font-weight: 700;
}
.rec-list {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.rec, .match {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  width: 100%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    transform 160ms var(--ease-out),
    background-color 140ms ease,
    border-color 140ms ease;
}
.rec.top {
  border-color: rgba(198, 245, 66, 0.55);
  background:
    linear-gradient(180deg, rgba(198, 245, 66, 0.12), rgba(198, 245, 66, 0.03)),
    var(--panel);
  padding: 12px 12px 11px;
}
.rec-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.rec-name { font-weight: 650; font-size: 14px; line-height: 1.3; min-width: 0; }
.rec.top .rec-name { font-size: 16px; letter-spacing: -0.015em; }
.rec-score {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: var(--lime);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.rec.top .rec-score { font-size: 15px; }
.bar {
  height: 3px;
  background: #222a38;
  border-radius: 99px;
  margin: 8px 0 7px;
  overflow: hidden;
}
.rec.top .bar { height: 4px; }
.bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--lime-dim), var(--lime));
}
.why, .empty-copy { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.empty-copy {
  margin: 4px 2px;
  padding: 22px 14px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.match { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.match .who { font-weight: 650; flex: 1; min-width: 0; }
.foot {
  padding: 12px 16px 14px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--faint);
  border-top: 1px solid var(--line);
}
.model { display: block; margin-top: 4px; color: var(--muted); }
.dock { display: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes ring {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

@media (hover: hover) and (pointer: fine) {
  .tools button:hover:not(:disabled),
  .dock button:not(.primary):hover:not(:disabled),
  .more:hover,
  .rec:hover,
  .match:hover,
  .filter:hover:not(.on) {
    border-color: var(--line-strong);
    background: var(--panel-2);
  }
  .dock .primary:hover:not(:disabled) { filter: brightness(1.06); }
  .finder input:hover { border-color: var(--line-strong); }
}

@media (pointer: coarse) {
  .slot-label select { font-size: 16px; }
  .tools button, .dock button, .more { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .badge.live::before,
  .cell.now::after { animation: none; opacity: 1; }
  .tools button, .dock button, .more, .rec, .match, .filter {
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
  }
}

@media (max-width: 860px) {
  .top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 10px;
    row-gap: 2px;
    align-items: center;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
  }
  .brand { grid-column: 1; grid-row: 1; font-size: 17px; }
  .meta { grid-column: 1; grid-row: 2; }
  .meta .name { font-size: 14px; }
  .meta .sub {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .clock-wrap { grid-column: 2; grid-row: 1 / span 2; padding: 6px 8px 6px 10px; }
  .clock { font-size: 16px; }
  .pick-num { max-width: 34vw; }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }
  .banner { padding: 8px 12px; }
  .stage {
    display: flex;
    flex-direction: column;
    overflow: auto;
    overscroll-behavior: contain;
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
  .recs { border-left: none; border-top: 1px solid var(--line); flex: none; }
  .board-wrap {
    flex: none;
    overflow-x: auto;
    overflow-y: visible;
    padding: 10px 12px 16px;
  }
  .round-tag, .head .round-tag { position: static; left: auto; }
  .rec-list { max-height: min(220px, 28dvh); flex: none; }
  .recs h2 { padding-top: 12px; }
  .dock {
    display: flex;
    gap: 8px;
    position: fixed;
    left: env(safe-area-inset-left, 0px);
    right: env(safe-area-inset-right, 0px);
    bottom: 0;
    z-index: 8;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(9, 11, 16, 0.94);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(12px);
  }
  .dock .primary {
    flex: 1;
    background: var(--lime);
    color: var(--lime-ink);
    border-color: transparent;
    font-weight: 750;
  }
}
