/* The Mirrorball Desk — ballroom floor under the lights.
   Display: Bodoni Moda. Body/UI: Archivo. Accent: brass. */

:root {
  --ground: #13111C;
  --surface: #1E1B29;
  --surface-2: #262234;
  --line: #332E44;
  --line-soft: #292536;
  --ink: #F3F0E8;
  --ink-muted: #9C96AE;
  --ink-faint: #6E6883;
  --brass: #C9A227;
  --brass-dim: #8C7220;
  --safe: #5FB98A;
  --danger: #D9645F;

  --f-display: "Bodoni Moda", Didot, "Times New Roman", serif;
  --f-body: "Archivo", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brass); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--brass); outline-offset: 3px;
}

img { max-width: 100%; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px 80px; }

/* ---------------------------------------------------- top bar */

.topbar { border-bottom: 1px solid var(--line); background: var(--surface); }

.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}

.brand {
  font-family: var(--f-display); font-weight: 700; font-size: 19px;
  color: var(--ink); text-decoration: none; letter-spacing: -.01em;
  display: inline-flex; align-items: center; min-height: 44px;
}

.navlinks { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* Every nav item clears 44px of touch height. The negative margin keeps the bar
   visually tight while the hit area stays thumb-sized. */
.navlinks a, .linkbtn {
  font-size: 13.5px; font-weight: 500; color: var(--ink-muted);
  text-decoration: none; display: inline-flex; align-items: center;
  min-height: 44px; padding: 0 10px;
}

.navlinks a:hover, .linkbtn:hover { color: var(--ink); }

.navlinks a.cta {
  color: var(--ground); background: var(--brass); font-weight: 600;
  padding: 0 16px;
}

.inline { display: inline-flex; margin: 0; }

.linkbtn {
  background: none; border: 0; cursor: pointer;
  font-family: var(--f-body); color: var(--ink-faint);
}

.ticker {
  background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--ink-muted);
  padding: 9px 24px; text-align: center;
}

.ticker strong { color: var(--brass); font-weight: 600; }

/* ---------------------------------------------------- masthead */

.masthead {
  border-bottom: 1px solid var(--line);
  padding: 52px 0 28px; margin-bottom: 8px;
  display: flex; flex-wrap: wrap; align-items: flex-end;
  gap: 28px; justify-content: space-between;
}

.masthead.narrow { padding-bottom: 24px; }

.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: var(--brass); margin: 0 0 10px;
}

h1 {
  font-family: var(--f-display); font-weight: 700;
  font-size: clamp(34px, 6vw, 60px); line-height: 1;
  letter-spacing: -.015em; margin: 0; text-wrap: balance;
}

.masthead .sub {
  color: var(--ink-muted); font-size: 15px; margin: 14px 0 0; max-width: 52ch;
}

.bigcta {
  background: var(--brass); color: var(--ground);
  font-weight: 600; font-size: 15px; text-decoration: none;
  padding: 13px 26px; flex-shrink: 0;
}

/* ---------------------------------------------------- sections */

section { padding-top: 48px; }

h2 {
  font-family: var(--f-display); font-size: 26px; font-weight: 600;
  letter-spacing: -.01em; margin: 0 0 4px;
}

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 20px;
}

.section-head h2 { margin: 0; }

.more {
  font-size: 13px; text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; min-height: 44px; padding-left: 12px;
}

.section-note {
  color: var(--ink-muted); font-size: 14px; margin: 0 0 22px; max-width: 64ch;
}

.empty { color: var(--ink-faint); font-style: italic; font-family: var(--f-display); font-size: 17px; }

/* ---------------------------------------------------- rundown */

.rundown {
  border: 1px solid var(--line); border-left: 3px solid var(--brass);
  background: var(--surface); padding: 26px 30px;
}

.rundown p { margin: 0 0 12px; font-size: 15px; color: var(--ink-muted); }
.rundown p:last-child { margin-bottom: 0; }
.rundown strong { color: var(--ink); font-weight: 600; }

.rundown .pending {
  font-family: var(--f-display); font-style: italic;
  font-size: 21px; color: var(--ink); margin-bottom: 14px;
}

.rundown ul { margin: 0; padding-left: 18px; color: var(--ink-muted); font-size: 14.5px; }
.rundown li { margin-bottom: 6px; }

/* ---------------------------------------------------- standings */

.standings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); }

.standings li {
  display: grid; grid-template-columns: 34px 1fr auto auto;
  align-items: center; gap: 16px;
  background: var(--surface); padding: 11px 18px;
}

.standings li.me { background: var(--surface-2); }

.standings .rank {
  font-family: var(--f-display); font-weight: 700; font-size: 17px;
  color: var(--brass); font-variant-numeric: tabular-nums;
}

.standings .who { font-size: 15px; font-weight: 500; }
.standings .who em { color: var(--brass); font-style: normal; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.standings .acc { font-size: 12.5px; color: var(--ink-faint); }

.standings .pts {
  font-family: var(--f-display); font-weight: 700; font-size: 20px;
  font-variant-numeric: tabular-nums; min-width: 40px; text-align: right;
}

/* ---------------------------------------------------- market */

.caveat {
  border: 1px solid var(--brass-dim); background: var(--surface);
  padding: 16px 20px; margin-bottom: 20px; font-size: 14px; color: var(--ink-muted);
}

.caveat strong { color: var(--brass); font-weight: 600; }

.odds { display: flex; flex-direction: column; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); }

.odds-row {
  display: grid; grid-template-columns: 1.1fr minmax(110px, 2fr) auto;
  align-items: center; gap: 18px; background: var(--surface); padding: 11px 18px;
}

.odds-row .who { font-size: 14.5px; font-weight: 500; }
.odds-row .who span { color: var(--ink-faint); font-weight: 400; }

.bar { height: 7px; background: var(--surface-2); }
.bar i { display: block; height: 100%; background: var(--brass); }
.odds-row.cold .bar i { background: var(--brass-dim); }

.odds-row .px {
  font-family: var(--f-display); font-weight: 700; font-size: 18px;
  font-variant-numeric: tabular-nums; min-width: 46px; text-align: right;
}

.odds-row.cold .px { color: var(--ink-faint); }

/* ---------------------------------------------------- the field */

.field {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft);
}

.couple {
  background: var(--surface); padding: 18px 20px;
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 2px 14px; align-items: start;
}

.couple.out { opacity: .5; }

.face, .mono {
  grid-column: 1; grid-row: 1 / span 2;
  width: 54px; height: 54px; flex-shrink: 0; overflow: hidden;
  border: 1px solid var(--brass-dim);
  background:
    linear-gradient(135deg, rgba(201,162,39,.14) 0%, rgba(201,162,39,0) 55%),
    var(--surface-2);
}

.face img { width: 100%; height: 100%; object-fit: cover; display: block; }

.mono {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-display); font-weight: 700; font-size: 19px; color: var(--brass);
}

.couple .celeb {
  grid-column: 2; grid-row: 1; margin: 0;
  font-family: var(--f-display); font-size: 20px; font-weight: 600; line-height: 1.2;
}

.couple .pro {
  grid-column: 2; grid-row: 2; margin: 2px 0 0;
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--brass);
}

.paddle {
  grid-column: 3; grid-row: 1 / span 2;
  width: 54px; height: 54px; flex-shrink: 0;
  border: 1px solid var(--line); background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}

.paddle .score {
  font-family: var(--f-display); font-size: 21px; font-weight: 700; line-height: 1;
  color: var(--ink); font-variant-numeric: tabular-nums;
}

.paddle .of {
  font-size: 9px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); margin-top: 3px;
}

.couple .known {
  grid-column: 1 / -1; grid-row: 3; margin: 11px 0 0;
  font-size: 13.5px; color: var(--ink-muted); line-height: 1.45;
}

.tags { grid-column: 1 / -1; grid-row: 4; margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--brass); border: 1px solid var(--brass-dim); padding: 2px 7px;
}

.tag.note { color: var(--ink-muted); border-color: var(--line); }
.tag.out { color: var(--danger); border-color: var(--danger); }

/* ---------------------------------------------------- forms */

.formwrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; align-items: start; }

.formwrap form { display: flex; flex-direction: column; gap: 20px; }

.card { border: 1px solid var(--line); background: var(--surface); padding: 22px 24px; }

.card h3 {
  font-family: var(--f-display); font-size: 19px; font-weight: 600;
  margin: 0 0 14px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}

.worth {
  font-family: var(--f-body); font-size: 11px; font-weight: 700;
  letter-spacing: .1em; color: var(--brass);
  border: 1px solid var(--brass-dim); padding: 2px 8px; flex-shrink: 0;
}

.card label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.card label > span { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--brass); font-weight: 600; }

.card input[type=text] {
  background: var(--ground); border: 1px solid var(--line); color: var(--ink);
  font-family: var(--f-body); padding: 13px; min-height: 48px;
  /* 16px exactly: iOS zooms the whole page when you focus anything smaller. */
  font-size: 16px;
}

.card small { font-size: 12.5px; color: var(--ink-faint); }

.hint, .lockednote { font-size: 14px; color: var(--ink-muted); margin: 0 0 14px; }
.lockednote { margin-bottom: 0; }
.lockednote strong { color: var(--brass); }
.card.locked { border-style: dashed; }

.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 2px; }

.choice {
  display: flex !important; flex-direction: row !important; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--surface-2); cursor: pointer; margin: 0 !important;
  font-size: 14px; min-height: 48px;
  -webkit-tap-highlight-color: transparent;
}

.choice:hover { background: var(--line-soft); }
.choice input { accent-color: var(--brass); flex-shrink: 0; width: 18px; height: 18px; }
.choice span { text-transform: none !important; letter-spacing: 0 !important; color: var(--ink) !important; font-size: 14px !important; font-weight: 400 !important; }
.choice em { color: var(--ink-faint); font-style: normal; }
.choice:has(input:checked) { background: var(--line); box-shadow: inset 3px 0 0 var(--brass); }

.primary {
  background: var(--brass); color: var(--ground); border: 0;
  font-family: var(--f-body); font-size: 15px; font-weight: 600;
  padding: 0 28px; min-height: 48px; cursor: pointer; align-self: flex-start;
}

/* Sticky save bar. The three pick lists run long; this keeps Save and a
   summary of what you have chosen in reach without scrolling back. */
.savebar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(19, 17, 28, .75);
}

.savebar .primary { align-self: auto; flex-shrink: 0; }

.savebar-status {
  font-size: 12.5px; color: var(--ink-faint); line-height: 1.35;
  min-width: 0; overflow-wrap: anywhere;
}

.savebar-status.has { color: var(--ink-muted); }

.rules dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0 0 16px; }
.rules dt { font-family: var(--f-display); font-weight: 700; font-size: 19px; color: var(--brass); }
.rules dd { margin: 0; font-size: 14px; color: var(--ink-muted); align-self: center; }
.rules p { font-size: 13.5px; color: var(--ink-faint); margin: 0; }

/* ---------------------------------------------------- handles */

.fieldlabel {
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--brass); font-weight: 600; display: block; margin-bottom: 8px;
}

.initials { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; }

.init { display: flex !important; flex-direction: column !important; gap: 4px; margin: 0 !important; width: 76px; }

.init input {
  background: var(--ground); border: 1px solid var(--line); color: var(--ink);
  font-family: var(--f-display); font-weight: 700; font-size: 30px;
  text-align: center; text-transform: uppercase;
  padding: 8px 0; min-height: 62px; width: 100%;
}

.init small {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); text-align: center;
}

.initdot {
  font-family: var(--f-display); font-size: 30px; color: var(--brass);
  line-height: 62px; flex-shrink: 0;
}

.handlebox {
  border: 1px dashed var(--line); background: var(--surface-2);
  padding: 16px 18px; margin-bottom: 20px; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
  -webkit-tap-highlight-color: transparent;
}

.handlebox.ready { border-style: solid; border-color: var(--brass-dim); }

.handlelabel {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--brass); font-weight: 600;
}

.handlebox strong {
  font-family: var(--f-display); font-size: clamp(22px, 5.5vw, 28px);
  font-weight: 700; line-height: 1.15; color: var(--ink);
}

.handlebox small { font-size: 12px; color: var(--ink-faint); }

.namecard {
  border: 1px solid var(--brass-dim); background: var(--surface);
  padding: 20px 22px; margin-top: 22px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
}

.namelabel {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--brass); font-weight: 600;
}

.namebig {
  font-family: var(--f-display); font-weight: 700;
  font-size: clamp(24px, 6vw, 34px); line-height: 1.1;
}

.namecard small { font-size: 12.5px; color: var(--ink-faint); }

.reroll {
  background: none; border: 1px solid var(--line); color: var(--ink-muted);
  font-family: var(--f-body); font-size: 13px; font-weight: 500;
  padding: 0 16px; min-height: 44px; cursor: pointer;
}

.reroll:hover { border-color: var(--brass-dim); color: var(--brass); }

.error, .flash { padding: 12px 18px; font-size: 14px; margin-top: 22px; }
.error { border: 1px solid var(--danger); color: var(--danger); }
.flash { border: 1px solid var(--safe); color: var(--safe); }

/* ---------------------------------------------------- leaderboard table */

.tablewrap { overflow-x: auto; border: 1px solid var(--line); }

.board { border-collapse: collapse; width: 100%; font-size: 14px; }

.board th {
  background: var(--surface-2); text-align: left; font-weight: 600;
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--brass); padding: 11px 14px; white-space: nowrap;
}

.board td { padding: 11px 14px; border-top: 1px solid var(--line-soft); background: var(--surface); }
.board tr.me td { background: var(--surface-2); }

.board .r { text-align: right; }
.board .c { text-align: center; font-variant-numeric: tabular-nums; }
.board .rank { font-family: var(--f-display); font-weight: 700; color: var(--brass); }
.board .who { font-weight: 500; white-space: nowrap; }
.board .who em { color: var(--brass); font-style: normal; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; }
.board .pts { font-family: var(--f-display); font-weight: 700; font-size: 18px; }
.board .hit { color: var(--safe); font-weight: 600; }
.board .skip { color: var(--ink-faint); }
.board .pickcell { white-space: nowrap; font-size: 13px; }

/* ---------------------------------------------------- footer */

footer {
  max-width: 1080px; margin: 0 auto; padding: 22px 24px 40px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint); font-size: 12.5px;
  display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: space-between;
}

@media (max-width: 720px) {
  .wrap { padding: 0 16px 56px; }

  /* One compact row instead of three stacked ones. The nav scrolls sideways
     rather than wrapping — three lines of chrome was eating a quarter of the
     screen before any content. */
  .topbar-inner { padding: 0 12px; gap: 10px; flex-wrap: nowrap; }
  .brand { font-size: 16px; min-height: 46px; flex-shrink: 0; }
  .navlinks {
    flex-wrap: nowrap; gap: 0; overflow-x: auto; min-width: 0;
    scrollbar-width: none; -ms-overflow-style: none;
  }
  .navlinks::-webkit-scrollbar { display: none; }
  .navlinks a, .linkbtn {
    padding: 0 9px; font-size: 13px; white-space: nowrap; flex-shrink: 0;
  }
  .linkbtn { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; display: block;
             line-height: 44px; }
  .ticker { padding: 8px 16px; font-size: 12.5px; }

  .masthead { padding-top: 28px; gap: 20px; }
  .masthead .sub { font-size: 14.5px; }
  section { padding-top: 36px; }

  .odds-row { grid-template-columns: 1fr auto; gap: 4px 14px; }
  .odds-row .bar { grid-column: 1 / -1; }

  .standings li { grid-template-columns: 28px 1fr auto; }
  .standings .acc { display: none; }

  .rundown { padding: 20px 18px; }
  .card { padding: 18px 16px; }
  .formwrap { gap: 18px; }

  /* Spans the gutters so it reads as a real bottom bar, not a card. Status on
     its own line, button full width — deliberate rather than wrapped. */
  .savebar {
    margin: 0 -16px; border-left: 0; border-right: 0;
    flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 16px
      calc(10px + env(safe-area-inset-bottom));
  }
  .savebar .primary { width: 100%; text-align: center; }
  .savebar-status { text-align: center; }

  .bigcta { width: 100%; text-align: center; }

  /* Keep rank and name pinned while the week columns scroll under them —
     otherwise you scroll right and lose track of whose row you are reading. */
  .board th:nth-child(1), .board td:nth-child(1) {
    position: sticky; left: 0; z-index: 2; min-width: 34px;
  }
  .board th:nth-child(2), .board td:nth-child(2) {
    position: sticky; left: 34px; z-index: 2;
    box-shadow: 1px 0 0 var(--line);
  }
  .board th { z-index: 3; }
}

@media (max-width: 400px) {
  .couple { grid-template-columns: auto 1fr; }
  .couple .paddle { grid-column: 1 / -1; grid-row: 5; width: auto; height: 38px;
                    flex-direction: row; gap: 8px; margin-top: 10px; }
  .couple .paddle .of { margin-top: 0; }
}

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