/* Footy Boss: Aussie Rules Manager, playtest sign-up.
   Tokens come from design/tokens.json (dark theme). */

@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 800; font-display: swap; src: url(/fonts/barlow-condensed-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); }

:root {
  /* Colour */
  --ground: #0b0e11;
  --surface: #12171c;
  --surface-raised: #1a2128;
  --surface-hover: #222b34;
  --surface-selected: #24301a;
  --line: #262f38;
  --control-border: #5e6c7a;
  --ink: #e8edf1;
  --ink-muted: #9eabb7;
  --ink-disabled: #5f6b76;
  --accent: #c6ef4e;
  --on-accent: #11160a;
  --accent-text: #c6ef4e;
  --accent-soft: #252f12;
  --positive: #4ccbe2;
  --positive-soft: #10303a;
  --negative: #ff8259;
  --negative-soft: #3b1d14;
  --warning: #f2bc4f;
  --warning-soft: #36290d;
  --info: #a6b6ff;
  --info-soft: #1e2442;
  --rating-low: #2a3139;
  --on-rating-low: #a3afba;
  --rating-mid: #33424e;
  --on-rating-mid: #e8edf1;
  --rating-good: #2f7f85;
  --on-rating-good: #ffffff;
  --rating-elite: #c6ef4e;
  --on-rating-elite: #11160a;
  --series-home: #c6ef4e;
  --series-away: #ff9a5c;
  --scrim: #05070acc;

  /* Type */
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-ui: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --type-score-xl: 700 56px/56px var(--font-display);
  --type-score-md: 700 28px/32px var(--font-display);
  --type-screen-title: 600 26px/30px var(--font-display);
  --type-player-name: 600 22px/26px var(--font-display);
  --type-section-label: 600 13px/16px var(--font-display);
  --type-heading: 600 15px/20px var(--font-ui);
  --type-body: 400 13px/18px var(--font-ui);
  --type-body-strong: 600 13px/18px var(--font-ui);
  --type-table: 400 12px/16px var(--font-ui);
  --type-label: 500 11px/14px var(--font-ui);
  --type-caption: 400 11px/14px var(--font-ui);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  /* Radius */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;

  /* Size */
  --row-compact: 26px;
  --row-comfortable: 34px;
  --control-height: 30px;
  --control-height-sm: 24px;
  --topbar-height: 52px;
  --sidebar-width: 212px;
  --sidebar-width-collapsed: 56px;

  /* Layer */
  --layer-sticky: 10;
  --layer-menu: 100;
  --layer-modal: 200;
  --layer-toast: 300;

  /* Shadow */
  --shadow-float: 0 8px 24px #000000b3, 0 0 0 1px #2e3843;
  --shadow-modal: 0 24px 64px #000000cc, 0 0 0 1px #2e3843;
  --focus-ring: 0 0 0 2px #0b0e11, 0 0 0 4px #c6ef4e;

  /* Fictional club colours used in the preview (not design system tokens) */
  --club-bayside: #1d5a8a;
  --club-bayside-alt: #f2f2f2;
  --club-ironbark: #3d4a1f;
  --on-club: #ffffff;
  --accent-hover: #dcff7a;
  /* Game preview around the sign-up: greyscale, dimmed, on darker panels.
     0.78 keeps all preview text at 4.5:1 or better on those panels. */
  --preview-filter: grayscale(1);
  --preview-opacity: 0.78;

  color-scheme: dark;
}

/* Base */

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

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: var(--type-body);
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
}

p, h1, h2, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }

a { color: var(--accent-text); }

@media (hover: hover) {
  a:hover { color: var(--accent-hover); }
}

input::placeholder { color: var(--ink-muted); opacity: 1; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
.success:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--focus-ring);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--layer-toast);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus { transform: none; }
.skip-link:hover { color: var(--on-accent); }

svg { flex: 0 0 auto; }

/* Window */

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

/* Everything that is only a preview of the game is greyed out, so the sign-up is the one live thing */

.sidebar,
.tabstrip,
.screen-title,
.club-status,
.game-date,
.inbox,
.side {
  filter: var(--preview-filter);
  opacity: var(--preview-opacity);
}

/* Preview panels sit on darker surfaces than the offer, so the offer is the brightest panel */
.sidebar,
.inbox,
.side {
  --surface: #0e1215;
  --surface-raised: #12171b;
  --surface-selected: #1a2215;
  --line: #1b2128;
}

/* Top bar */

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

.stripe { display: flex; height: 3px; }
.stripe span:first-child { flex: 3; background: var(--club-bayside); }
.stripe span:last-child { flex: 1; background: var(--club-bayside-alt); }

.topbar-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: var(--topbar-height);
  padding: 0 var(--space-3) 0 0;
  flex-wrap: wrap;
}

.brand {
  flex: 0 0 var(--sidebar-width);
  padding: 0 var(--space-4);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  line-height: 24px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.brand-sub {
  font: var(--type-label);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.screen-title {
  font: var(--type-screen-title);
  letter-spacing: 0.01em;
}

.club-status {
  font: var(--type-caption);
  color: var(--ink-muted);
}

.topbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.game-date {
  flex-direction: column;
  align-items: flex-end;
}

.game-date { display: flex; }

.game-date-day { font-weight: 600; }

.game-date-phase {
  font: var(--type-caption);
  color: var(--ink-muted);
}

.continue {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.continue kbd {
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--on-accent);
  color: var(--accent-text);
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

@media (hover: hover) {
  .continue:hover { background: var(--accent-hover); color: var(--on-accent); }
}

/* Phone tab strip */

.tabstrip {
  display: flex;
  gap: 20px;
  height: 40px;
  padding: 0 var(--space-4);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  border-top: 1px solid var(--line);
  scrollbar-width: none;
}

.tabstrip::-webkit-scrollbar { display: none; }

.tab {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  color: var(--ink-muted);
}

.tab.is-active {
  gap: 6px;
  color: var(--accent-text);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent);
}

.tab .count {
  padding: 0 var(--space-1);
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  line-height: 16px;
}

/* Body: side menu and screen */

.body {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  min-height: 0;
}

.sidebar {
  flex: 0 0 var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: var(--space-3) 0;
}

.sidebar ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--row-comfortable);
  padding: 0 var(--space-4);
  color: var(--ink-muted);
}

.nav-item svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label { flex: 1 1 auto; }

.nav-item.is-active {
  background: var(--surface-selected);
  box-shadow: inset 3px 0 0 var(--accent);
  color: var(--ink);
  font-weight: 600;
}

.nav-item .count {
  min-width: 18px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  text-align: center;
}

.screen {
  flex: 999 1 560px;
  min-width: 0;
  padding: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-start;
}

/* Panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  padding: 0 var(--space-3);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--line);
}

.section-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-meta {
  font-size: 11px;
  color: var(--ink-muted);
}

.tag {
  align-self: flex-start;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
}

.tag-warning { background: var(--warning-soft); color: var(--warning); }
.tag-positive { background: var(--positive-soft); color: var(--positive); }

.crest {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--on-club);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
}

.crest-sm { width: 32px; height: 32px; font-size: 14px; }
.crest-bay { background: var(--club-bayside); }
.crest-irn { background: var(--club-ironbark); }

/* Inbox list */

.inbox {
  order: -1;
  flex: 1 1 260px;
  min-width: 0;
  max-width: 340px;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: 10px var(--space-3);
  border-bottom: 1px solid var(--line);
}

.msg.is-selected {
  background: var(--surface-selected);
  box-shadow: inset 3px 0 0 var(--accent);
}

.msg-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font: var(--type-caption);
  color: var(--ink-muted);
}

.msg-subject { color: var(--ink); }
.msg-subject.is-unread { font-weight: 600; }

/* Open message */

.message {
  flex: 3 1 440px;
  min-width: 0;
}

.message-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--line);
}

.message-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.message-meta h2 { font: var(--type-heading); }

.caption {
  font: var(--type-caption);
  color: var(--ink-muted);
}

.message-head > .tag {
  align-self: center;
  padding: 2px 6px;
  line-height: 18px;
}

.message-body {
  container-type: inline-size;
  padding: var(--space-8) var(--space-8) 28px;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.letterhead {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-weight: inherit;
}

.letterhead-name {
  font-family: var(--font-display);
  font-weight: 800;
  /* 96px in the design. Shrinks only when the panel is too narrow to hold it on one line. */
  font-size: min(96px, 23.1cqi);
  line-height: 0.84;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.letterhead-sub {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  line-height: 28px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.lede {
  max-width: 520px;
  font-size: 15px;
  line-height: 22px;
}

.terms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  max-width: 520px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.terms > div {
  background: var(--surface-raised);
  padding: var(--space-2) var(--space-3);
}

.terms dt,
.field-label {
  font: var(--type-label);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.terms dd {
  margin-top: 2px;
  font-weight: 600;
}

/* Sign-up */

.signup { max-width: 520px; }

.signup-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.signup-row {
  display: flex;
  gap: var(--space-2);
}

.signup-form input[type="email"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  margin: 0;
  padding: 0 var(--space-3);
  background: var(--surface-raised);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
}

.signup-form input[aria-invalid="true"] { border-color: var(--negative); }

.signup-form button {
  flex: 0 0 auto;
  height: 44px;
  margin: 0;
  padding: 0 20px;
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

@media (hover: hover) {
  .signup-form button:hover:not(:disabled) { background: var(--accent-hover); }
}

.signup-form button:disabled { cursor: progress; }

.field-error { color: var(--negative); }
.field-error:empty { display: none; }

.field-note { color: var(--ink-muted); }

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.success {
  display: none;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3);
  background: var(--positive-soft);
  border-radius: var(--radius-sm);
}

.success svg {
  margin-top: 1px;
  fill: none;
  stroke: var(--positive);
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.success-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.success-title {
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  color: var(--positive);
}

.success strong { font-weight: 600; }

/* Signed up: set on <html> by main.js, or by functions/index.js when JavaScript is off */
[data-signup="done"] .signup-form { display: none; }
[data-signup="done"] .success { display: flex; }

.when-done { display: none; }
[data-signup="done"] .when-pending { display: none; }
[data-signup="done"] .when-done { display: inline; }

/* Right column */

.side {
  flex: 1 1 260px;
  min-width: 0;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ladder table {
  width: 100%;
  border-collapse: collapse;
  font: var(--type-table);
  text-align: right;
}

.ladder thead tr {
  height: var(--row-compact);
  color: var(--ink-muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ladder th { font-weight: 500; }

.ladder th,
.ladder td { padding: 0 var(--space-1); }

.ladder .col-pos { padding-left: var(--space-3); text-align: left; width: 16px; }
.ladder td.col-pos { color: var(--ink-muted); }
.ladder .col-club { text-align: left; }
.ladder .col-pct { color: var(--ink-muted); }
.ladder .col-pts { padding-right: var(--space-3); }
.ladder td.col-pts { font-weight: 600; }

.ladder tbody tr {
  height: var(--row-compact);
  border-top: 1px solid var(--line);
}

.ladder tbody tr.is-selected { background: var(--surface-selected); }
.ladder tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.ladder tbody tr.is-selected .club { font-weight: 600; }

.club {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}

/* Fictional club guernseys. Each has its own pattern so they stay distinct in greyscale. */
.jumper { display: block; }

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.fixture {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3);
}

.team {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.team-name { font-weight: 600; }

.versus {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.odds {
  padding: 0 var(--space-3) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.odds-text {
  display: flex;
  justify-content: space-between;
  font: var(--type-caption);
  color: var(--ink-muted);
}

.odds-bar {
  display: flex;
  height: 6px;
  border-radius: var(--radius-xs);
  overflow: hidden;
}

.odds-home { flex: 58; background: var(--series-home); }
.odds-away { flex: 42; background: var(--series-away); }

/* Footer */

.footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  min-height: 28px;
  padding: 0 var(--space-3);
  background: var(--surface);
  border-top: 1px solid var(--line);
  font: var(--type-caption);
  color: var(--ink-muted);
}

.footer-link { order: 1; }
.footer-status { order: 2; margin-left: auto; }

/* Privacy and 404 pages */

.brand-link {
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
}

.brand-link:hover { color: var(--ink); }

.doc {
  flex: 1 1 auto;
  padding: var(--space-3);
}

.doc-panel {
  max-width: 720px;
  margin: 0 auto;
}

.doc-body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  font-size: 15px;
  line-height: 22px;
}

.doc-body h2 {
  margin-top: var(--space-3);
  font: var(--type-heading);
}

.doc-body ul {
  padding-left: 20px;
  list-style: disc;
}

/* 900 to 1279px: no right column, side menu collapses to icons */

@media (max-width: 1279.98px) {
  .side { display: none; }

  .sidebar { flex-basis: var(--sidebar-width-collapsed); }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .nav-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .nav-item .count {
    position: absolute;
    top: 0;
    left: 30px;
    min-width: 16px;
    padding: 0 3px;
    font-size: 10px;
    line-height: 14px;
  }
}

/* Below 900px: phone layout */

@media (max-width: 899.98px) {
  .wide-only { display: none !important; }

  .topbar-row {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 0;
    height: 56px;
    padding: 0 var(--space-3) 0 var(--space-4);
  }

  .brand {
    flex: 0 1 auto;
    padding: 0;
  }

  .topbar-end { margin-left: 0; }

  .continue {
    height: 44px;
    padding: 0 var(--space-4);
  }

  .body { display: block; }

  .screen {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
  }

  .inbox,
  .message,
  .side {
    flex: 0 0 auto;
    max-width: none;
  }

  .inbox { order: 0; }

  .side { display: flex; }

  .message-head { gap: 10px; }
  .message-head .crest { font-size: 15px; }

  .message-body {
    padding: var(--space-6) var(--space-4);
    gap: 20px;
  }

  .letterhead-name { font-size: min(76px, 32cqi); }

  .letterhead-sub {
    font-size: 20px;
    line-height: 24px;
  }

  .lede,
  .terms,
  .signup { max-width: none; }

  .terms > div { padding: var(--space-2) 10px; }

  .signup-row {
    flex-direction: column;
    gap: var(--space-2);
  }

  .signup-form input[type="email"] {
    height: 48px;
    font-size: 16px;
  }

  .signup-form button {
    height: 48px;
    padding: 0;
    font-size: 20px;
  }

  .msg {
    border-bottom: 0;
    border-top: 1px solid var(--line);
  }

  .ladder tbody tr { height: var(--row-comfortable); }

  .footer {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: var(--space-3) var(--space-4) 20px;
  }

  .footer-status { order: 0; margin-left: 0; }

  .footer-link {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    min-height: 44px;
  }
}

@media (min-width: 900px) {
  .phone-only { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
