/* Gridiron Gauntlet: styles
   Theme: every color is a token on :root, with dark values under prefers-color-scheme.
   Sections: tokens, hero/home, team page, game card, bracket, result screen, setup sheet. */
/* Layout: a scouting program. Quiet chalk field, team-color tiles, one big swipeable scouting card in the game. */
:root {
  color-scheme: light;
  --bg: #edf0ea;
  --surface: #fafbf8;
  --ink: #14201a;
  --muted: #58675f;
  --line: #ccd4cb;
  --gold: #f2b705;
  --gold-ink: #2e2200;
  --good: #1e8a4e;
  --bad: #c43d2f;
  --field: #1d5a39;
  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1512;
    --surface: #17211c;
    --ink: #eaf0eb;
    --muted: #93a399;
    --line: #2a3a32;
    --gold: #f5c518;
    --gold-ink: #2e2200;
    --good: #3dd17a;
    --bad: #ff6b5b;
    --field: #4fa877;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1512;
  --surface: #17211c;
  --ink: #eaf0eb;
  --muted: #93a399;
  --line: #2a3a32;
  --gold: #f5c518;
  --gold-ink: #2e2200;
  --good: #3dd17a;
  --bad: #ff6b5b;
  --field: #4fa877;
  color-scheme: dark;
}
html {
  padding-block: env(safe-area-inset-top, 0px) env(safe-area-inset-bottom, 0px);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
  padding-block: 16px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.wrap {
  max-width: 880px;
  margin: 0 auto;
}
h1,
h2,
h3,
p,
ol,
ul {
  margin: 0;
}
ol,
ul {
  padding: 0;
  list-style: none;
}
h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 26px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* hero */
.kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero {
  display: grid;
  gap: 14px;
  padding-block: 8px 22px;
}
h1 {
  font-family: var(--display);
  font-weight: 900;
  text-transform: uppercase;
  font-size: clamp(44px, 13.5vw, 104px);
  line-height: 0.9;
  overflow-wrap: anywhere;
  letter-spacing: 0.005em;
  text-wrap: balance;
}
h1 span {
  color: var(--field);
}
.yard {
  height: 12px;
  background: repeating-linear-gradient(
    90deg,
    var(--line) 0 2px,
    transparent 2px 18px
  );
  border-top: 2px solid var(--line);
}
.lede {
  max-width: 46ch;
  font-size: 17px;
}
.btn {
  background: var(--gold);
  color: var(--gold-ink);
  border: 0;
  border-radius: 6px;
  padding: 13px 20px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 21px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--ink);
}
.btn.sm {
  font-size: 17px;
  padding: 9px 14px;
}
.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.join {
  display: grid;
  gap: 8px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 26px;
}
.join label {
  font-size: 14px;
  color: var(--muted);
}
.joinrow {
  display: flex;
  gap: 8px;
}
.joinrow input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 13px;
}
.sechead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
section + section {
  margin-top: 0;
}
.block {
  margin-bottom: 28px;
}
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
}
.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.tile {
  background: var(--c1);
  color: var(--tc);
  border: 0;
  border-radius: 6px;
  padding: 12px;
  min-height: 96px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
.tile .ab {
  font-family: var(--display);
  font-weight: 900;
  font-size: 44px;
  line-height: 0.85;
}
.tile .nm {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}
.tile .ct {
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.85;
}
.hist li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.hist .hn {
  font-weight: 700;
}
.hist small,
.muted {
  color: var(--muted);
}
.hist .tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.foot {
  font-size: 12px;
  color: var(--muted);
  max-width: 60ch;
}
.legal {
  margin-top: 28px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  max-width: 60ch;
}

/* shared bits */
.pos {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--ink);
  color: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
  min-width: 34px;
  text-align: center;
  display: inline-block;
  line-height: 1.5;
}
.link {
  background: none;
  border: 0;
  padding: 6px 0;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* team view */
.thead {
  background: var(--c1);
  color: var(--tc);
  border-radius: 8px;
  padding: 18px 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-block: 10px 14px;
  flex-wrap: wrap;
}
.thead .city {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}
.thead h2 {
  font-size: clamp(40px, 12vw, 64px);
  line-height: 0.9;
  font-weight: 900;
}
.thead .btn {
  background: var(--tc);
  color: var(--c1);
}
.filters {
  display: grid;
  gap: 10px;
  margin-bottom: 6px;
}
.search {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-block: 8px;
}
.prow {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.prow b {
  display: block;
  overflow-wrap: anywhere;
}
.prow small {
  color: var(--muted);
}
.prow .rsn {
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.prow a {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}
.more {
  margin-top: 14px;
  width: 100%;
}

/* game */
.game {
  max-width: 480px;
  margin: 0 auto;
}
.ghead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.gtitle {
  font-family: var(--display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 17px;
  white-space: nowrap;
}
.gcount {
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
.bar {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 14px;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--field);
  transition: width 0.25s;
}
.reign {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.mini {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: var(--c1);
  color: var(--tc);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 900;
  font-size: 20px;
  flex: none;
}
.reign .rt {
  min-width: 0;
  flex: 1;
}
.reign b {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.2;
}
.reign small {
  color: var(--muted);
}
.reign svg {
  flex: none;
  color: var(--gold);
}
.ask {
  margin-block: 14px 10px;
  font-size: 16px;
  text-align: center;
}
.stage {
  position: relative;
  height: 392px;
}
.back-card {
  position: absolute;
  inset: 10px 10px -2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.pc {
  position: absolute;
  inset: 0 0 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  animation: rise 0.28s ease-out;
}
.pc:active {
  cursor: grabbing;
}
.pav {
  background: var(--c1);
  color: var(--tc);
  height: 138px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.1) 0 2px,
    transparent 2px 22px
  );
}
.ini {
  font-family: var(--display);
  font-weight: 900;
  font-size: 76px;
  line-height: 0.9;
}
.pteam {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
}
.pbody {
  padding: 12px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  flex: 1;
}
.nameline {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nameline .pname {
  flex: 1;
  min-width: 0;
}
.jnum {
  font-family: var(--display);
  font-weight: 900;
  font-size: 34px;
  line-height: 1;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.jnum small {
  font-size: 0.55em;
  margin-right: 1px;
  opacity: 0.8;
}
.jnum:empty {
  display: none;
}
.helm {
  width: 54px;
  height: 41px;
  flex: none;
}
.helm .sh {
  fill: var(--sh);
  stroke: var(--ink);
  stroke-opacity: 0.4;
  stroke-width: 1.2;
}
.helm .sp {
  stroke: var(--sp);
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
}
.helm .ear {
  fill: rgba(0, 0, 0, 0.35);
}
.helm .fm {
  stroke: #9aa3a8;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pname {
  font-family: var(--display);
  font-weight: 900;
  text-transform: uppercase;
  font-size: clamp(24px, 7vw, 32px);
  line-height: 0.95;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.pmeta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.pcol {
  font-size: 14px;
}
.sts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.st {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  background: var(--bg);
}
.st i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  border: 1px solid var(--line);
  display: inline-block;
}
.pfr {
  margin-top: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  width: max-content;
}
.stamp {
  position: absolute;
  top: 16px;
  padding: 2px 10px;
  border: 3px solid;
  border-radius: 4px;
  background: var(--surface);
  font-family: var(--display);
  font-weight: 900;
  font-size: 28px;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
}
.stamp.yes {
  left: 16px;
  color: var(--good);
  transform: rotate(-10deg);
}
.stamp.no {
  right: 16px;
  color: var(--bad);
  transform: rotate(10deg);
}
.votes {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.vote {
  flex: 1;
  padding: 12px;
  border: 2px solid;
  border-radius: 6px;
  background: var(--surface);
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.vote.no {
  color: var(--bad);
  border-color: var(--bad);
}
.vote.yes {
  color: var(--good);
  border-color: var(--good);
}
.hint {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
@keyframes rise {
  from {
    transform: translateY(14px);
    opacity: 0.4;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* bracket */
.duel {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  margin-top: 6px;
}
.dcard {
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  width: 100%;
  padding: 12px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 8px;
  transition:
    transform 0.2s,
    opacity 0.2s,
    border-color 0.2s;
}
.dcard:hover {
  border-color: var(--ink);
}
.dcard .jnum {
  font-size: 38px;
  min-width: 2ch;
  text-align: center;
}
.dinfo {
  display: grid;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.dinfo b {
  font-family: var(--display);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 26px;
  line-height: 0.95;
  overflow-wrap: anywhere;
}
.dinfo span {
  font-size: 13px;
  color: var(--muted);
}
.dcard.won {
  border-color: var(--good);
  transform: scale(1.02);
}
.dcard.lost {
  opacity: 0.35;
}
.vs {
  font-family: var(--display);
  font-weight: 900;
  font-size: 22px;
  text-align: center;
  color: var(--muted);
}
@media (min-width: 640px) {
  .duel {
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
  }
  .dcard {
    padding: 22px 14px;
    min-height: 120px;
  }
  .vs {
    align-self: center;
  }
}

/* result */
.crown-hero {
  position: relative;
  overflow: hidden;
  background: var(--c1);
  color: var(--tc);
  border-radius: 10px;
  padding: 26px 16px 24px;
  text-align: center;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.09) 0 2px,
    transparent 2px 22px
  );
}
.crown-hero svg {
  width: 64px;
  height: 64px;
  color: var(--gold);
  animation: drop 0.7s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.crown-hero .lab {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.9;
  margin-top: 4px;
}
.heroname {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-block: 8px 12px;
  animation: rise 0.6s 0.25s ease-out both;
}
.heroname .jnum {
  color: var(--tc);
  opacity: 0.85;
  font-size: clamp(28px, 8vw, 44px);
}
.heroname .helm {
  width: 62px;
  height: 47px;
}
.heroname .helm .sh {
  stroke: var(--tc);
  stroke-opacity: 0.75;
}
.crown-hero h2 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(34px, 10vw, 64px);
  line-height: 0.98;
  margin: 0;
  text-wrap: balance;
  min-width: 0;
  overflow-wrap: anywhere;
}
.crown-hero p {
  font-size: 14px;
  opacity: 0.92;
}
.crown-hero .st {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--tc);
  margin: 2px;
}
.crown-hero .st i {
  border-color: rgba(255, 255, 255, 0.4);
}
.crown-hero a {
  color: var(--tc);
  font-weight: 700;
  font-size: 13px;
}
@keyframes drop {
  from {
    transform: translateY(-40px) rotate(-12deg);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.rstats {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-block: 14px 6px;
}
.code {
  display: grid;
  gap: 6px;
  margin-block: 16px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.code label {
  font-size: 13px;
  color: var(--muted);
}
.code .row {
  display: flex;
  gap: 8px;
}
.code input {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 13px;
}
.acts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-block: 6px 22px;
}
.acts .btn {
  flex: 1 1 150px;
}
.thr li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.thr b {
  overflow-wrap: anywhere;
}
.thr .win b {
  color: var(--field);
}
.thr small {
  color: var(--muted);
}
.thr .n {
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  align-self: center;
}
.rd {
  font-family: var(--display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 18px;
  margin: 16px 0 4px;
}

/* setup sheet */
#sheetback {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 14px 14px 0 0;
  padding-top: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  gap: 16px;
  align-content: start;
}
.sheet h2 {
  font-size: 30px;
}
.grp {
  display: grid;
  gap: 8px;
}
.grp > label,
.grp > .lbl {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.tpick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 6px;
}
.tpick .chip {
  padding: 7px 0;
  text-align: center;
}
.pool {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.sheetactions {
  display: flex;
  gap: 8px;
}
.sheetactions .btn:first-child {
  flex: 1;
}
details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

#toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  max-width: calc(100vw - 32px);
}
#toast.on {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
