/* Fantasy Draft — design system
   Calm, premium foundation; football energy reserved for hero moments
   (the draft bid slip and the settlement reveal). Mobile-first, light + dark. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  --bg: #eef2ef;
  --surface: #ffffff;
  --surface-2: #f5f8f6;
  --surface-3: #eaefeb;
  --border: #e0e6e2;
  --border-strong: #ccd6cf;
  --text: #14211c;
  --text-2: #40514a;
  --muted: #697a71;

  --accent: #0f9d63;
  --accent-strong: #0a7d4d;
  --accent-weak: #e2f4ea;
  --on-accent: #ffffff;

  --gold: #b4841f;
  --gold-weak: #f6edd4;
  --danger: #c23b2c;
  --danger-weak: #fbe8e5;
  --warn: #b9761a;
  --warn-weak: #f7ecd8;
  --info: #2e6fd0;

  --pos-gk: #b07d16;
  --pos-gk-bg: #f6ecd2;
  --pos-df: #2e6fd0;
  --pos-df-bg: #e4edfb;
  --pos-mf: #0f9d63;
  --pos-mf-bg: #e0f4ea;
  --pos-fw: #d1502f;
  --pos-fw-bg: #fbe7e0;

  --shadow-sm: 0 1px 2px rgba(16, 33, 28, 0.06);
  --shadow: 0 6px 20px -6px rgba(16, 33, 28, 0.14);
  --shadow-lg: 0 18px 44px -12px rgba(16, 33, 28, 0.22);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --pill: 999px;

  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.25rem;
  --s6: 1.5rem;
  --s8: 2rem;
  --s10: 2.75rem;

  --tabbar-h: 62px;
  --topbar-h: 60px;

  --f-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --f-num: "Inter", ui-sans-serif, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0c1512;
    --surface: #12201a;
    --surface-2: #16261f;
    --surface-3: #1c2f26;
    --border: #24352c;
    --border-strong: #33473b;
    --text: #e9f1ec;
    --text-2: #b6c5bd;
    --muted: #859a8f;

    --accent: #2cbd7e;
    --accent-strong: #23a86e;
    --accent-weak: #143026;
    --on-accent: #06130c;

    --gold: #dcb054;
    --gold-weak: #2c2716;
    --danger: #e2685a;
    --danger-weak: #331a1a;
    --warn: #dda152;
    --warn-weak: #2d2413;
    --info: #6ea2ec;

    --pos-gk: #dcb054;
    --pos-gk-bg: #2c2716;
    --pos-df: #6ea2ec;
    --pos-df-bg: #172537;
    --pos-mf: #2cbd7e;
    --pos-mf-bg: #143026;
    --pos-fw: #ec8168;
    --pos-fw-bg: #331f1a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 20px 46px -14px rgba(0, 0, 0, 0.65);
  }
}

/* Explicit toggle wins over the OS preference in both directions. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2ef;
  --surface: #ffffff;
  --surface-2: #f5f8f6;
  --surface-3: #eaefeb;
  --border: #e0e6e2;
  --border-strong: #ccd6cf;
  --text: #14211c;
  --text-2: #40514a;
  --muted: #697a71;
  --accent: #0f9d63;
  --accent-strong: #0a7d4d;
  --accent-weak: #e2f4ea;
  --on-accent: #ffffff;
  --gold: #b4841f;
  --gold-weak: #f6edd4;
  --danger: #c23b2c;
  --danger-weak: #fbe8e5;
  --warn: #b9761a;
  --warn-weak: #f7ecd8;
  --info: #2e6fd0;
  --pos-gk: #b07d16;
  --pos-gk-bg: #f6ecd2;
  --pos-df: #2e6fd0;
  --pos-df-bg: #e4edfb;
  --pos-mf: #0f9d63;
  --pos-mf-bg: #e0f4ea;
  --pos-fw: #d1502f;
  --pos-fw-bg: #fbe7e0;
  --shadow-sm: 0 1px 2px rgba(16, 33, 28, 0.06);
  --shadow: 0 6px 20px -6px rgba(16, 33, 28, 0.14);
  --shadow-lg: 0 18px 44px -12px rgba(16, 33, 28, 0.22);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1512;
  --surface: #12201a;
  --surface-2: #16261f;
  --surface-3: #1c2f26;
  --border: #24352c;
  --border-strong: #33473b;
  --text: #e9f1ec;
  --text-2: #b6c5bd;
  --muted: #859a8f;
  --accent: #2cbd7e;
  --accent-strong: #23a86e;
  --accent-weak: #143026;
  --on-accent: #06130c;
  --gold: #dcb054;
  --gold-weak: #2c2716;
  --danger: #e2685a;
  --danger-weak: #331a1a;
  --warn: #dda152;
  --warn-weak: #2d2413;
  --info: #6ea2ec;
  --pos-gk: #dcb054;
  --pos-gk-bg: #2c2716;
  --pos-df: #6ea2ec;
  --pos-df-bg: #172537;
  --pos-mf: #2cbd7e;
  --pos-mf-bg: #143026;
  --pos-fw: #ec8168;
  --pos-fw-bg: #331f1a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 20px 46px -14px rgba(0, 0, 0, 0.65);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

img {
  max-width: 100%;
}

.tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- App shell ---------- */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: var(--topbar-h);
  padding: 0 clamp(var(--s4), 4vw, var(--s8));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand:hover {
  text-decoration: none;
}
.brand .crest {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--accent), var(--accent-strong));
  color: var(--on-accent);
  font-size: 16px;
  box-shadow: var(--shadow-sm);
}
.brand .brand-league {
  color: var(--muted);
  font-weight: 600;
  border-left: 1px solid var(--border-strong);
  padding-left: var(--s3);
  margin-left: var(--s1);
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-spacer {
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.topbar-actions form {
  margin: 0;
  display: flex;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  color: var(--muted);
  font-size: 0.9rem;
}
.avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--pill);
  background: var(--accent-weak);
  color: var(--accent-strong);
  font-weight: 800;
  font-size: 0.78rem;
  flex: none;
}
.user-chip .email {
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  line-height: 1;
}
.theme-toggle:hover {
  border-color: var(--border-strong);
}
/* Icon shows the theme you'd switch TO: moon while light, sun while dark. */
.theme-toggle .i-sun {
  display: none;
}
.theme-toggle .i-moon {
  display: inline;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun {
    display: inline;
  }
  :root:not([data-theme="light"]) .theme-toggle .i-moon {
    display: none;
  }
}
:root[data-theme="dark"] .theme-toggle .i-sun {
  display: inline;
}
:root[data-theme="dark"] .theme-toggle .i-moon {
  display: none;
}
:root[data-theme="light"] .theme-toggle .i-sun {
  display: none;
}
:root[data-theme="light"] .theme-toggle .i-moon {
  display: inline;
}

/* league sub-nav (desktop tabs) */
.subnav {
  position: sticky;
  top: var(--topbar-h);
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.subnav::-webkit-scrollbar {
  display: none;
}
.subnav-inner {
  display: flex;
  align-items: center;
  gap: var(--s1);
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(var(--s4), 4vw, var(--s8));
}
.subnav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s3) var(--s3);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.94rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.subnav a:hover {
  color: var(--text);
  text-decoration: none;
}
.subnav a.is-active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
}
.subnav a.manage {
  margin-left: auto;
  color: var(--text-2);
}
.subnav a.manage.is-active {
  color: var(--accent-strong);
}

.main {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(var(--s5), 3vw, var(--s8)) clamp(var(--s4), 4vw, var(--s8));
}
.main.has-tray {
  padding-bottom: 8rem;
}

/* bottom tab bar (mobile) */
.tabbar {
  display: none;
}

/* ---------- Flash toast ---------- */
.flash {
  position: fixed;
  left: 50%;
  top: calc(var(--topbar-h) + 10px);
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(92vw, 460px);
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s3) var(--s4);
  border-radius: var(--pill);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  font-size: 0.92rem;
  animation: toast-in 0.3s ease both;
}
.flash.is-error {
  background: var(--danger);
  color: #fff;
}
.flash::before {
  content: "✓";
  font-weight: 800;
}
.flash.is-error::before {
  content: "!";
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
}

/* ---------- Typography helpers ---------- */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s6);
}
.page-head h1 {
  font-size: clamp(1.55rem, 1rem + 2.4vw, 2.15rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent-strong);
  margin-bottom: var(--s2);
}
.lede {
  color: var(--muted);
  max-width: 62ch;
  margin-top: var(--s2);
}
.section {
  margin-top: var(--s8);
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s4);
}
.section-head h2 {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.muted {
  color: var(--muted);
  font-size: 0.92rem;
}
.h-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 42px;
  padding: 0 var(--s4);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.94rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover {
  text-decoration: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--accent-strong);
}
.btn-ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover {
  background: var(--surface-2);
}
.btn-quiet {
  background: transparent;
  color: var(--text-2);
}
.btn-quiet:hover {
  background: var(--surface-3);
}
.btn-danger {
  background: var(--danger-weak);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}
.btn-sm {
  min-height: 34px;
  padding: 0 var(--s3);
  font-size: 0.85rem;
}
.btn-block {
  width: 100%;
}
.btn-lg {
  min-height: 50px;
  font-size: 1rem;
  padding: 0 var(--s6);
}

/* ---------- Cards & tiles ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--s5);
}
.card-pad {
  padding: var(--s6);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--s4);
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--s4) var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.tile .label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--muted);
}
.tile .value {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}
.tile .sub {
  color: var(--muted);
  font-size: 0.85rem;
}
.tile.accent {
  background: linear-gradient(160deg, var(--accent-weak), var(--surface) 80%);
  border-color: color-mix(in srgb, var(--accent) 25%, var(--border));
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--s5);
}
.stack {
  display: grid;
  gap: var(--s4);
}
.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: center;
}

/* ---------- Chips, pills, badges ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.28em 0.66em;
  border-radius: var(--pill);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill.dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.pill-open,
.pill-active,
.pill-won,
.pill-published {
  background: var(--accent-weak);
  color: var(--accent-strong);
}
.pill-scheduled,
.pill-draft {
  background: var(--surface-3);
  color: var(--text-2);
}
.pill-closed,
.pill-settled {
  background: var(--warn-weak);
  color: var(--warn);
}
.pill-tied {
  background: var(--warn-weak);
  color: var(--warn);
}
.pill-failed,
.pill-complete {
  background: var(--surface-3);
  color: var(--muted);
}
.pill-gold {
  background: var(--gold-weak);
  color: var(--gold);
}

.pos {
  display: inline-grid;
  place-items: center;
  min-width: 2.35em;
  padding: 0.2em 0.45em;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.pos-GK {
  background: var(--pos-gk-bg);
  color: var(--pos-gk);
}
.pos-DF {
  background: var(--pos-df-bg);
  color: var(--pos-df);
}
.pos-MF {
  background: var(--pos-mf-bg);
  color: var(--pos-mf);
}
.pos-FW {
  background: var(--pos-fw-bg);
  color: var(--pos-fw);
}

/* ---------- Countdown ---------- */
.countdown {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15em;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.countdown .seg {
  font-size: 1.9rem;
  line-height: 1;
}
.countdown .u {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
  margin-right: 0.25em;
}
.countdown.done {
  color: var(--muted);
}

/* ---------- Budget meter ---------- */
.meter {
  height: 10px;
  border-radius: var(--pill);
  background: var(--surface-3);
  overflow: hidden;
  border: 1px solid var(--border);
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: var(--pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 0.35s ease, background 0.3s ease;
}
.meter.warn > span {
  background: linear-gradient(90deg, var(--warn), #d98a1f);
}
.meter.over > span {
  background: linear-gradient(90deg, var(--danger), #d64535);
}

/* ---------- Hero (league home) ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 55%),
    linear-gradient(165deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
  padding: clamp(var(--s5), 3vw, var(--s8));
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s6);
  align-items: center;
}
.hero .window-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: var(--s1) 0 var(--s2);
}
.hero .cta {
  margin-top: var(--s5);
}
.hero .clock {
  text-align: right;
}
.hero .clock .lbl {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: var(--s2);
}

.hero-progress {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s5);
  margin-top: var(--s5);
  padding-top: var(--s5);
  border-top: 1px solid var(--border);
}
.hero-progress .metric .n {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.hero-progress .metric .k {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

/* ---------- Tables (responsive) ---------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}
table.data th,
table.data td {
  text-align: left;
  padding: 0.8rem var(--s4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 800;
  background: var(--surface-2);
}
table.data tbody tr:last-child td {
  border-bottom: 0;
}
table.data tbody tr:hover {
  background: var(--surface-2);
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.right {
  text-align: right;
}

/* ---------- Forms ---------- */
.form {
  display: grid;
  gap: var(--s4);
}
.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.field {
  display: grid;
  gap: var(--s2);
}
.field.full {
  grid-column: 1 / -1;
}
.field > span {
  font-weight: 700;
  font-size: 0.88rem;
}
.field .hint {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
textarea {
  min-height: 96px;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: 0.9rem;
}
.check input {
  width: 18px;
  height: 18px;
  min-height: 0;
}

.alert {
  border-radius: var(--radius-sm);
  padding: var(--s3) var(--s4);
  margin-bottom: var(--s4);
  font-size: 0.92rem;
}
.alert-error {
  background: var(--danger-weak);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger);
}
.alert-error p {
  margin: 0;
}

.auth-wrap {
  min-height: calc(100dvh - var(--topbar-h));
  display: grid;
  place-items: center;
  padding: var(--s6) var(--s4);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(var(--s5), 4vw, var(--s8));
}
.auth-card.wide {
  max-width: 640px;
}
.auth-card h1 {
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}

/* ---------- Empty states ---------- */
.empty {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: var(--s8) var(--s5);
  text-align: center;
}
.empty .ico {
  font-size: 2rem;
}
.empty h2 {
  margin: var(--s3) 0 var(--s2);
  font-size: 1.1rem;
}
.empty p {
  color: var(--muted);
  max-width: 44ch;
  margin: 0 auto;
}

/* ---------- Draft: bid slip ---------- */
.filterbar {
  position: sticky;
  top: calc(var(--topbar-h) + 45px);
  z-index: 15;
  display: flex;
  gap: var(--s2);
  padding: var(--s2) 0;
  margin-bottom: var(--s4);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  overflow-x: auto;
  scrollbar-width: none;
}
.filterbar::-webkit-scrollbar {
  display: none;
}
.chip-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 0.5rem 0.9rem;
  border-radius: var(--pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}
.chip-tab .cnt {
  font-size: 0.76rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.chip-tab[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.chip-tab[aria-pressed="true"] .cnt {
  color: color-mix(in srgb, var(--on-accent) 80%, transparent);
}

.players {
  display: grid;
  gap: var(--s2);
}
.player {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.player.bidding {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 0 0 1px var(--accent-weak), var(--shadow-sm);
}
.player .who {
  min-width: 0;
}
.player .name {
  font-weight: 700;
  letter-spacing: -0.01em;
}
.player .meta {
  color: var(--muted);
  font-size: 0.82rem;
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  align-items: center;
  margin-top: 2px;
}
.player .bid-in {
  display: flex;
  align-items: center;
  gap: var(--s1);
}
.player .bid-in .cur {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}
.player .bid-in input {
  width: 92px;
  min-height: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* sticky bid tray */
.bidtray {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  padding: var(--s3) clamp(var(--s3), 4vw, var(--s6));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-top: 1px solid var(--border-strong);
  box-shadow: 0 -8px 28px -12px rgba(0, 0, 0, 0.28);
}
.bidtray-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s4);
  align-items: center;
}
.tray-stats {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  min-width: 0;
}
.tray-line {
  display: flex;
  align-items: baseline;
  gap: var(--s3);
  flex-wrap: wrap;
}
.tray-line .big {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.tray-line .big.over {
  color: var(--danger);
}
.tray-line .lbl {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.shape {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
}
.shape .s {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.shape .s b {
  color: var(--text);
}
.shape .s.full b {
  color: var(--accent-strong);
}
.shape .s.over b {
  color: var(--danger);
}
.tray-warn {
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 600;
}

/* ---------- Squad: formation pitch ---------- */
.pitch {
  border-radius: var(--radius-lg);
  padding: var(--s5) var(--s4);
  background:
    repeating-linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, var(--surface)) 0 46px, color-mix(in srgb, var(--accent) 7%, var(--surface)) 46px 92px);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  display: grid;
  gap: var(--s5);
}
.pitch-line {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.pitch-line .row-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: var(--text-2);
}
.pitch-players {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  justify-content: center;
}
.jersey {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 92px;
  padding: var(--s3);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.jersey .nm {
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.15;
}
.jersey .pr {
  font-size: 0.74rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.jersey.empty-slot {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
  justify-content: center;
}

/* ---------- Table: podium ---------- */
.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s3);
  align-items: end;
  margin-bottom: var(--s5);
}
.podium .step {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: var(--s4);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}
.podium .step .rank {
  font-size: 1.4rem;
}
.podium .step .who {
  font-weight: 700;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.podium .step .pts {
  font-size: 1.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.podium .step .pts small {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 700;
}
.podium .p1 {
  background: linear-gradient(165deg, var(--gold-weak), var(--surface));
  border-color: color-mix(in srgb, var(--gold) 45%, var(--border));
  order: 2;
}
.podium .p2 {
  order: 1;
}
.podium .p3 {
  order: 3;
}
.rank-cell {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--pill);
  background: var(--surface-3);
  font-weight: 800;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.rank-cell.top {
  background: var(--gold-weak);
  color: var(--gold);
}
tr.me td {
  background: var(--accent-weak);
}
tr.me .name-cell {
  font-weight: 800;
}

/* ---------- Reveal ---------- */
.reveal-list {
  display: grid;
  gap: var(--s4);
}
.reveal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.reveal-card.won {
  border-color: color-mix(in srgb, var(--gold) 40%, var(--border));
}
.reveal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s4);
  border-bottom: 1px solid var(--border);
}
.reveal-head .p {
  font-weight: 800;
  letter-spacing: -0.01em;
}
.reveal-head .pm {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}
.bid-line {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 0.6rem var(--s4);
  border-bottom: 1px solid var(--border);
}
.bid-line:last-child {
  border-bottom: 0;
}
.bid-line.winner {
  background: var(--gold-weak);
}
.bid-line .bidder {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex: 1;
  min-width: 0;
  font-weight: 600;
}
.bid-line .amt {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}
.bid-line .trophy {
  color: var(--gold);
}
.super {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s3);
  margin-bottom: var(--s5);
}
.super .s {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s4);
  box-shadow: var(--shadow-sm);
}
.super .s .k {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 800;
}
.super .s .v {
  font-weight: 800;
  margin-top: var(--s1);
}
.super .s .d {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Setup checklist ---------- */
.checklist {
  display: grid;
  gap: var(--s3);
  counter-reset: step;
}
.step-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.step-card .n {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--pill);
  background: var(--surface-3);
  color: var(--text-2);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.step-card.done .n {
  background: var(--accent);
  color: var(--on-accent);
}
.step-card .t {
  font-weight: 700;
}
.step-card .m {
  color: var(--muted);
  font-size: 0.86rem;
}

/* inline admin CRUD */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: center;
  padding: var(--s4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--s4);
}
.inline-form input,
.inline-form select {
  min-height: 40px;
  width: auto;
  flex: 1 1 130px;
}
.inline-form input[type="number"] {
  flex: 0 1 100px;
}
.row-edit {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: center;
  width: 100%;
}
.row-edit input,
.row-edit select {
  min-height: 38px;
  width: auto;
  flex: 1 1 120px;
}
.row-edit input[type="number"] {
  flex: 0 1 90px;
}
.event-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1);
}
.event-chips .pill {
  font-size: 0.72rem;
}

/* utility */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--s5) 0;
}
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.copy-row {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}

/* ---------- Landing ---------- */
.landing {
  display: grid;
  gap: var(--s8);
}
.landing-hero {
  text-align: center;
  padding: clamp(var(--s6), 6vw, var(--s10)) var(--s4) var(--s4);
}
.landing-hero h1 {
  font-size: clamp(2rem, 1rem + 5vw, 3.4rem);
  letter-spacing: -0.03em;
  line-height: 1.02;
  text-wrap: balance;
  margin: var(--s4) auto var(--s3);
  max-width: 16ch;
}
.landing-hero .lede {
  margin: 0 auto var(--s6);
  font-size: 1.1rem;
}
.landing-hero .h-actions {
  justify-content: center;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s4);
}
.feature .ico {
  font-size: 1.5rem;
}
.feature h3 {
  margin: var(--s2) 0;
  font-size: 1.02rem;
}
.feature p {
  color: var(--muted);
  font-size: 0.92rem;
}

/* league cards */
.league-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s4);
}
.league-card {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.league-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
  text-decoration: none;
}
.league-card .lc-name {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}
.league-card .lc-foot {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: auto;
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .subnav {
    display: none;
  }
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    align-items: stretch;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    backdrop-filter: saturate(140%) blur(12px);
    border-top: 1px solid var(--border);
  }
  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 700;
  }
  .tabbar a .ico {
    font-size: 1.15rem;
    line-height: 1;
  }
  .tabbar a.is-active {
    color: var(--accent-strong);
  }
  .tabbar a:hover {
    text-decoration: none;
  }
  body.has-tabbar .main {
    padding-bottom: calc(var(--tabbar-h) + var(--s6));
  }
  .brand .brand-league {
    display: none;
  }
  .user-chip .email {
    display: none;
  }
  .bidtray {
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  }
  .main.has-tray {
    padding-bottom: 11rem;
  }
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .hero .clock {
    text-align: left;
  }
  .podium {
    gap: var(--s2);
  }
  .filterbar {
    top: var(--topbar-h);
  }
}

@media (max-width: 520px) {
  .bidtray-inner {
    grid-template-columns: 1fr;
    gap: var(--s2);
  }
  .bidtray .btn {
    width: 100%;
  }
  .tile .value {
    font-size: 1.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
