:root {
  color-scheme: dark;
  --bg: #09100f;
  --panel: #111c1a;
  --panel-2: #172724;
  --line: rgba(216, 231, 222, .18);
  --text: #f4f7f3;
  --muted: #a8b7af;
  --accent: #8ce05c;
  --accent-2: #3dbb86;
  --warn: #f3c05f;
  --bad: #ef7b7b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(circle at 30% 0%, rgba(61, 187, 134, .16), transparent 34%), var(--bg);
  color: var(--text);
}

button, input, textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #08100d;
  font-weight: 800;
  padding: 10px 14px;
  cursor: pointer;
}

button.secondary, button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

button:hover { filter: brightness(1.06); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(140, 224, 92, .45);
  outline-offset: 2px;
}

a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 72px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 14px clamp(16px, 4vw, 44px);
  background: rgba(9, 16, 15, .88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07110d;
  font-weight: 950;
}

.brand small, .session-label, .eyebrow, .form-message {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.nav, .account-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav { justify-content: center; }
.account-actions { justify-content: flex-end; }
.nav a { color: var(--muted); font-weight: 750; }
.nav a:hover { color: var(--text); }

.hero {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  gap: clamp(24px, 5vw, 60px);
  align-items: center;
  padding: clamp(32px, 6vw, 80px) clamp(16px, 5vw, 72px);
}

.hero h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(42px, 7vw, 86px);
  line-height: .95;
  letter-spacing: 0;
}

.lead {
  max-width: 660px;
  color: #d9e4dd;
  font-size: 19px;
  line-height: 1.6;
}

.hero-actions, .panel-head, .inline-form, .two-cols {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.hero-board {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(23, 39, 36, .96), rgba(10, 20, 18, .96));
  padding: 16px;
  border-radius: 8px;
}

.preview-grid, .board-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(38px, 1fr));
  gap: 4px;
}

.preview-grid div, .board-cell {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 4px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 12px;
  color: #dce9e1;
  background: rgba(255, 255, 255, .045);
  overflow: hidden;
}

.preview-grid div:nth-child(7n), .board-cell.claimed {
  background: rgba(140, 224, 92, .18);
  border-color: rgba(140, 224, 92, .5);
}

.band, .app-shell {
  padding: clamp(36px, 5vw, 72px) clamp(16px, 5vw, 72px);
  border-top: 1px solid var(--line);
}

.muted-band { background: rgba(255, 255, 255, .035); }

.section-head {
  max-width: 860px;
  margin-bottom: 22px;
}

.section-head h2, .panel h2 {
  margin: 0;
  font-size: clamp(26px, 4vw, 44px);
  letter-spacing: 0;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.steps article, .template-row, .panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 28, 26, .92);
  padding: 18px;
}

.steps strong {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #08100d;
  background: var(--accent);
}

.template-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.status-pill {
  border: 1px solid rgba(140, 224, 92, .45);
  color: #baf0a0;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.app-shell {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel.wide { grid-column: 1 / -1; }
.panel-head { justify-content: space-between; margin-bottom: 16px; }

.stack-form {
  display: grid;
  gap: 10px;
}

label {
  color: #dce7df;
  font-weight: 750;
  font-size: 14px;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0c1513;
  color: var(--text);
  padding: 11px 12px;
}

.inline-form {
  align-items: end;
  margin-bottom: 16px;
}

.inline-form label { width: 100%; max-width: 160px; }
.inline-form input { width: min(260px, 100%); }

.two-cols {
  align-items: stretch;
}

.two-cols > div {
  flex: 1 1 180px;
}

.pool-list, .admin-content {
  display: grid;
  gap: 10px;
}

.pool-item, .admin-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, .035);
}

.board-wrap {
  overflow-x: auto;
  padding-bottom: 8px;
}

.board-grid {
  min-width: 620px;
}

.board-cell {
  position: relative;
  padding: 4px;
}

.board-cell span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-dialog {
  width: min(520px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
}

.dialog-card {
  padding: 20px;
}

.dialog-close {
  float: right;
  width: 34px;
  height: 34px;
  padding: 0;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.tabs button {
  flex: 1;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.tabs button.active {
  background: var(--accent);
  color: #08100d;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #13231f;
  box-shadow: 0 18px 70px rgba(0, 0, 0, .35);
}

@media (max-width: 900px) {
  .topbar, .hero, .app-shell, .steps {
    grid-template-columns: 1fr;
  }

  .nav {
    justify-content: flex-start;
    order: 3;
  }

  .account-actions {
    justify-content: flex-start;
  }

  .hero {
    min-height: 0;
  }

  .template-row, .pool-item, .admin-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 12px;
  }

  .hero h1 {
    font-size: 40px;
  }

  .inline-form {
    display: grid;
  }

  .inline-form label, .inline-form input {
    width: 100%;
    max-width: none;
  }

  .board-grid {
    min-width: 520px;
  }
}

/* Keep the 10×10 board readable without widening the page. */
.panel, .hero-board, .hero-copy { min-width: 0; }
section, #boardPanel, #organizerHint { scroll-margin-top: 100px; }
.preview-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); }
.preview-grid div { font-size: clamp(7px, 1.5vw, 12px); }
.board-grid { grid-template-columns: 30px repeat(10, minmax(48px, 1fr)); min-width: 600px; }
.board-wrap { overflow-x: auto; margin-top: 18px; padding: 4px; }
.axis-cell { display: grid; place-items: center; color: var(--muted); min-height: 28px; }
button.board-cell { padding: 5px 2px; font-weight: 400; min-height: 48px; }
.board-cell.mine { background: #285748; border-color: #71d8b4; }
.board-cell[aria-pressed="true"] { outline: 3px solid var(--accent); outline-offset: -3px; background: #304529; }
button:disabled { cursor: default; opacity: .55; }
button.board-cell:disabled { opacity: 1; }
button.board-cell:disabled:hover { filter: none; }
[aria-busy="true"] { cursor: progress; }
.invite-panel { margin: 18px 0; padding: 16px; border: 1px solid var(--accent-2); border-radius: 8px; background: var(--panel-2); }
.invite-panel textarea { margin: 10px 0; }
#claimSquareForm { margin-top: 16px; }
#organizerHint, #boardHint, #dashboardHint { line-height: 1.7; }
.form-message { line-height: 1.6; }
.pool-item strong, .admin-row strong, .admin-row p { overflow-wrap: anywhere; }
.toast { z-index: 30; }
@media (max-width: 900px) {
  .topbar { position: static; }
  section, #boardPanel, #organizerHint { scroll-margin-top: 16px; }
}
@media (max-width: 560px) {
  .panel { padding: 14px; }
  .nav { font-size: 13px; }
  .preview-grid { gap: 2px; }
  .two-cols > div { width: 100%; }
  .hero h1 { font-size: 38px; }
  button { min-height: 44px; }
  .dialog-close { min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* A focused, three-step contest builder. */
.contest-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: #fafbf8; color: #14221c; color-scheme: light; }
.contest-dialog::backdrop { background: #09100f; }
body:has(.contest-dialog[open]) { overflow: hidden; }
.contest-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 88px; padding: 20px 4vw; border-bottom: 1px solid #e2e7de; }
.contest-close { background: transparent; color: #31463a; font-size: 26px; padding: 6px 14px; }
.contest-progress { display: flex; gap: 24px; list-style: none; margin: 0; padding: 0; text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 800; color: #88958b; }
.contest-progress li { border-bottom: 2px solid transparent; padding: 12px 0; }
.contest-progress [aria-current="step"] { color: #193524; border-color: #69b540; }
.contest-progress .complete { color: #42772b; }
.contest-layout { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100dvh - 89px); }
.contest-story { background: #142b21; color: #f5f6eb; padding: clamp(36px, 6vw, 90px); display: flex; flex-direction: column; justify-content: center; }
.contest-story h2 { font-size: clamp(44px, 5.5vw, 80px); line-height: 1.05; letter-spacing: -.04em; margin: 12px 0 24px; }
.contest-story > p { max-width: 370px; line-height: 1.7; color: #c0d0be; }
.contest-story .eyebrow { color: #b5ec82; letter-spacing: .16em; }
.contest-art { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: min(280px, 100%); margin: 28px 0 8px; transform: rotate(-5deg); }
.contest-art span { aspect-ratio: 1; border: 1px solid #597455; border-radius: 9px; display: grid; place-items: center; color: #163320; font-weight: 900; }
.contest-art .filled { background: #b5ec82; border-color: #b5ec82; }
.contest-footnote { font-size: 12px; }
.contest-content { width: min(580px, 100%); padding: 60px 36px; align-self: center; justify-self: center; }
.contest-content h1 { font-size: clamp(28px, 3vw, 36px); letter-spacing: -.03em; margin: 12px 0; line-height: 1.2; }
.contest-content > .eyebrow { letter-spacing: .12em; font-size: 11px; color: #47742f; font-weight: 800; }
.contest-subtitle { color: #657365; line-height: 1.6; margin-bottom: 30px; }
.contest-dialog label { color: #253b2c; }
.contest-dialog input, .contest-dialog textarea { background: #f0f3ed; color: #14221c; border: 1px solid #d5ddcf; margin-top: 8px; }
.contest-dialog input::placeholder { color: #74816e; }
.contest-dialog input:focus-visible, .contest-dialog button:focus-visible { outline: 3px solid #508831; }
.league-options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.contest-choice { background: white; color: #172d20; border: 1px solid #dce3d6; border-radius: 14px; padding: 28px 16px; display: flex; align-items: center; flex-direction: column; gap: 12px; text-align: center; }
.contest-choice strong { font-size: 17px; }
.contest-choice small { color: #6c7968; font-weight: 400; line-height: 1.5; }
.contest-choice[aria-pressed="true"] { border: 2px solid #609b38; padding: 27px 15px; background: #f0f9e8; }
.contest-choice.unavailable { background: #f3f5f0; color: #7a8676; }
.sport-icon { font-size: 36px; }
.format-choice { width: 100%; flex-direction: row; text-align: left; gap: 18px; padding: 24px; }
.format-choice[aria-pressed="true"] { padding: 23px; }
.format-choice small { display: block; margin-top: 8px; }
.format-icon { font-size: 42px; color: #548c35; }
.choice-check { visibility: hidden; color: #477b2a; }
[aria-pressed="true"] .choice-check { visibility: visible; }
.format-details { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; font-size: 11px; color: #53634d; }
.format-details span { border-radius: 20px; padding: 8px 12px; background: #eaf0e4; }
.contest-note { font-size: 12px; color: #6b7864; line-height: 1.7; margin: 16px 0; }
.contest-actions { display: flex; gap: 12px; margin-top: 24px; }
.contest-actions button { flex: 1; min-height: 48px; border-radius: 10px; }
.contest-dialog .secondary { background: #e9ede4; color: #253b2c; border: 0; }
.contest-summary { display: grid; gap: 10px; padding: 22px; background: #eff3e9; border-radius: 12px; margin-top: 28px; }
.contest-summary span, .contest-summary small { color: #66785b; font-size: 12px; }
.contest-access { padding: 18px; border-left: 3px solid #82ba56; background: #eff4e8; font-size: 14px; line-height: 1.7; }
.contest-error { color: #a52f29; font-size: 14px; line-height: 1.6; }
.contest-dialog .session-label, .optional { color: #6b7864; font-weight: 400; }
.auth-dialog::backdrop { background: #07110ddd; }
@media(max-width: 850px) { .contest-story { display: none; } .contest-layout { grid-template-columns: 1fr; } .contest-header { flex-wrap: wrap; gap: 6px; } .contest-progress { order: 3; width: 100%; justify-content: center; gap: 20px; } .contest-content { padding: 36px 24px; } .contest-layout { min-height: calc(100dvh - 142px); } }
@media(max-width: 400px) { .contest-progress { font-size: 9px; gap: 14px; } .contest-content { padding: 28px 20px; } .league-options { gap: 10px; } .contest-choice { padding: 24px 10px; } .contest-choice[aria-pressed="true"] { padding: 23px 9px; } }
