/* Fight card: red corner left, green corner right, tale of the tape down the middle. */
:root {
  --ground: #F1F4EF;
  --surface: #FFFFFF;
  --ink: #13201A;
  --muted: #5A6862;
  --line: #D6DDD7;
  --red: #B3142D;
  --red-soft: #F8E4E7;
  --on-red: #FFFFFF;
  --pine: #1B6646;
  --pine-soft: #E1F0E7;
  --on-pine: #FFFFFF;
  --gold: #9A7210;
  --gold-soft: #F6EDD2;
  --silver: #6F7C85;
  --bronze: #9B5E33;
  --trunk: #85572A;
  --font-display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", sans-serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0D1612; --surface: #15211B; --ink: #EBF1EC; --muted: #9AA9A1; --line: #27372F;
    --red: #F2596D; --red-soft: #3B1B21; --on-red: #1B0A0D;
    --pine: #56C68F; --pine-soft: #173427; --on-pine: #06170F;
    --gold: #E4B853; --gold-soft: #372E17; --silver: #B6C1C9; --bronze: #D28B5A; --trunk: #B27C47;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0D1612; --surface: #15211B; --ink: #EBF1EC; --muted: #9AA9A1; --line: #27372F;
  --red: #F2596D; --red-soft: #3B1B21; --on-red: #1B0A0D;
  --pine: #56C68F; --pine-soft: #173427; --on-pine: #06170F;
  --gold: #E4B853; --gold-soft: #372E17; --silver: #B6C1C9; --bronze: #D28B5A; --trunk: #B27C47;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { background: var(--ground); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.app {
  max-width: 1240px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 18px 56px;
}

/* Header */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding-block: 6px 18px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.brand { flex: 1 1 280px; min-width: 0; }
.brand-name { font-family: var(--font-display); font-weight: 900; font-size: 32px; line-height: .95; text-transform: uppercase; letter-spacing: .01em; margin: 0; text-wrap: balance; }
.brand-name span { color: var(--red); }
.brand-sub { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tabs a { padding: 6px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--ground); }
.people { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 30px; }
.person-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 12.5px; font-weight: 600; }
.person-chip img { width: 22px; height: 22px; border-radius: 50%; display: block; }
.person-chip .count { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.person-chip.done .count { color: var(--pine); }

.banner { border: 1px solid var(--gold); background: var(--gold-soft); color: var(--ink); padding: 10px 14px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; }

/* Shared bits */
.btn { appearance: none; border: 0; border-radius: 999px; background: var(--ink); color: var(--ground); padding: 10px 18px; font: 600 15px var(--font-body); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.danger { background: var(--red); color: var(--on-red); }
.ghost { appearance: none; background: transparent; border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 8px 14px; font: 600 14px var(--font-body); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; text-decoration: none; }
.ghost:hover:not(:disabled) { border-color: var(--ink); }
.ghost:disabled { opacity: .4; cursor: default; }
kbd { font-family: var(--font-body); font-size: 11.5px; font-weight: 700; border: 1px solid currentColor; border-radius: 6px; padding: 0 6px; opacity: .75; line-height: 1.5; }
@media (hover: none) { kbd, .keys { display: none !important; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; text-align: center; max-width: 620px; margin: 28px auto; display: grid; gap: 12px; justify-items: center; }
.panel h2 { font-family: var(--font-display); font-weight: 900; font-size: 40px; line-height: .95; text-transform: uppercase; margin: 0; text-wrap: balance; }
.panel p { margin: 0; color: var(--muted); max-width: 46ch; }
.panel .row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; }
.section-title { font-family: var(--font-display); font-weight: 800; font-size: 26px; line-height: 1; text-transform: uppercase; margin: 36px 0 6px; }
.section-note { color: var(--muted); margin: 0 0 14px; font-size: 14px; max-width: 70ch; }

/* Round header */
.round { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.round-title { font-family: var(--font-display); font-weight: 800; font-size: 24px; line-height: 1; text-transform: uppercase; margin: 0; font-variant-numeric: tabular-nums; }
.round-meta { color: var(--muted); font-size: 13px; }
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 20px; }
.progress span { display: block; height: 100%; background: var(--gold); border-radius: inherit; transition: width .3s ease; }

/* Duel */
.duel { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(250px, 300px) minmax(0, 1fr); grid-template-areas: "left tape right"; align-items: stretch; }
.duel > .left { grid-area: left; }
.duel > .tape { grid-area: tape; align-self: start; }
.duel > .right { grid-area: right; }
@media (max-width: 999px) { .duel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "left right" "tape tape"; } }
@media (max-width: 639px) { .duel { grid-template-columns: minmax(0, 1fr); grid-template-areas: "left" "tape" "right"; } }

.corner-red { --corner: var(--red); --corner-soft: var(--red-soft); --on-corner: var(--on-red); }
.corner-green { --corner: var(--pine); --corner-soft: var(--pine-soft); --on-corner: var(--on-pine); }
.card { --corner: var(--pine); --corner-soft: var(--pine-soft); --on-corner: var(--on-pine);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 20px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; position: relative; overflow: hidden; }
.card.corner-red { --corner: var(--red); --corner-soft: var(--red-soft); --on-corner: var(--on-red); }
.card::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: var(--corner); }
.corner-tag { margin: 2px 0 -6px; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--corner); }
.name { font-family: var(--font-display); font-weight: 900; font-size: clamp(34px, 4vw, 50px); line-height: .9; text-transform: uppercase; margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
.name.small { font-size: 30px; }
.where { margin: -4px 0 0; color: var(--muted); font-size: 13.5px; }
.bestfor { margin: 0; font-weight: 600; font-size: 15.5px; line-height: 1.35; }
.bestfor span { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--on-corner); background: var(--corner); border-radius: 4px; padding: 1px 6px; margin-right: 6px; vertical-align: 2px; }
.facts { display: grid; gap: 9px; margin: 0; }
.facts > div { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 10px; }
.facts dt { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.facts dd { margin: 0; font-size: 14.5px; }
.facts .warn dt { color: var(--gold); }
.friend { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--corner-soft); }
.friend figcaption { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--corner); }
.friend blockquote { margin: 2px 0 0; font-style: italic; font-size: 14.5px; }
.menu-link { color: var(--corner); font-weight: 600; font-size: 14px; text-decoration: none; align-self: flex-start; }
.menu-link:hover { text-decoration: underline; }
.pick { margin-top: auto; appearance: none; border: 0; border-radius: 10px; background: var(--corner); color: var(--on-corner); font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1.05; text-transform: uppercase; letter-spacing: .02em; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; width: 100%; text-align: left; }
.pick span { min-width: 0; overflow-wrap: anywhere; }
.pick:hover { filter: brightness(1.07); }
.pick:active { transform: translateY(1px); }
.pick:disabled { opacity: .55; cursor: default; }
.card.won { box-shadow: 0 0 0 3px var(--corner); animation: won .34s ease-out; }
.card.lost { opacity: .4; transition: opacity .25s ease; }
.card.tied { opacity: .7; transition: opacity .25s ease; }
@keyframes won { 0% { transform: scale(1); } 45% { transform: scale(1.02); } 100% { transform: scale(1); } }

/* Tale of the tape */
.tape { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 12px; min-width: 0; }
.tape-head { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.tn { font-family: var(--font-display); font-weight: 800; font-size: 17px; line-height: 1; text-transform: uppercase; overflow-wrap: anywhere; }
.tn.left { color: var(--red); }
.tn.right { color: var(--pine); text-align: right; }
.vs { font-family: var(--font-display); font-weight: 900; font-size: 50px; line-height: .85; color: var(--gold); }
.tape-title { text-align: center; font-size: 10.5px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 6px 0 6px; }
.tape-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr); align-items: center; gap: 6px; padding: 8px 0; border-top: 1px solid var(--line); }
.tl { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-align: center; line-height: 1.25; }
.tv { font-weight: 600; font-size: 14px; line-height: 1.3; font-variant-numeric: tabular-nums; padding: 4px 7px; border-radius: 8px; min-width: 0; overflow-wrap: break-word; }
.tv.left { --corner: var(--red); --corner-soft: var(--red-soft); text-align: left; }
.tv.right { --corner: var(--pine); --corner-soft: var(--pine-soft); text-align: right; }
.tv.win { background: var(--corner-soft); color: var(--corner); }
.tv .sub { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.tv.win .sub { color: inherit; opacity: .85; }
.tape-foot { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); text-align: center; }

.range { display: block; position: relative; height: 5px; background: var(--line); border-radius: 3px; margin-top: 5px; }
.range i { position: absolute; top: 0; bottom: 0; background: var(--corner); border-radius: 3px; }

.trees { display: inline-flex; gap: 2px; vertical-align: -2px; }
.tree { width: 11px; height: 15px; display: block; }
.tree path { fill: var(--line); }
.tree rect { fill: var(--line); }
.tree.on path { fill: var(--pine); }
.tree.on rect { fill: var(--trunk); }

.duel-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.save-note { text-align: center; color: var(--muted); font-size: 12.5px; margin: 10px 0 0; min-height: 1.2em; }

/* Places */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card.place.out { opacity: .55; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 10px 0; border-block: 1px solid var(--line); }
.stat .k { display: block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.stat .v { display: block; font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; padding-top: 4px; border-top: 1px dashed var(--line); padding-block: 10px 0; }
.toggle input { width: 18px; height: 18px; accent-color: var(--pine); }
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 26px; }
.tool { background: var(--surface); border: 1px dashed var(--muted); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 8px; align-content: start; }
.tool h3 { margin: 0; font-size: 15px; }
.tool p { margin: 0; color: var(--muted); font-size: 14px; }
.tool .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tool .status { font-size: 13px; color: var(--muted); }
.tool .status.error { color: var(--red); }
.lineup-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.lineup-head h2 { font-family: var(--font-display); font-weight: 900; font-size: 34px; text-transform: uppercase; line-height: 1; margin: 0; }
.lineup-head p { margin: 0; color: var(--muted); font-size: 14px; }

/* Results */
.results-head h2 { font-family: var(--font-display); font-weight: 900; font-size: 40px; text-transform: uppercase; line-height: .95; margin: 0; }
.results-head p { margin: 6px 0 0; color: var(--muted); }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; margin: 22px 0 6px; max-width: 820px; }
.step { background: var(--surface); border: 1px solid var(--line); border-bottom-width: 4px; border-radius: var(--radius) var(--radius) 4px 4px; padding: 16px 12px; text-align: center; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; min-width: 0; }
.step .medal { font-family: var(--font-display); font-weight: 900; font-size: 52px; line-height: .85; }
.step .pname { font-family: var(--font-display); font-weight: 800; font-size: 24px; line-height: .95; text-transform: uppercase; overflow-wrap: anywhere; }
.step .pmeta { font-size: 12.5px; color: var(--muted); }
.step.p1 { min-height: 230px; border-color: var(--gold); background: var(--gold-soft); }
.step.p1 .medal { color: var(--gold); }
.step.p2 { min-height: 180px; border-bottom-color: var(--silver); }
.step.p2 .medal { color: var(--silver); }
.step.p3 { min-height: 145px; border-bottom-color: var(--bronze); }
.step.p3 .medal { color: var(--bronze); }
@media (max-width: 520px) { .step .pname { font-size: 18px; } .step .medal { font-size: 40px; } .step.p1 { min-height: 190px; } .step.p2 { min-height: 150px; } .step.p3 { min-height: 125px; } }
.callouts { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 0; }
.callout { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.callout b { font-weight: 700; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
td.rank { font-family: var(--font-display); font-weight: 900; font-size: 22px; width: 1%; }
td.pl { white-space: normal; min-width: 170px; }
td.pl b { display: block; font-weight: 700; }
td.pl small { color: var(--muted); font-size: 12.5px; }
.scorebar { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.scorebar .bar { flex: 1; height: 8px; background: var(--line); border-radius: 4px; position: relative; }
.scorebar .bar i { position: absolute; inset: 0 auto 0 0; background: var(--pine); border-radius: 4px; }
.scorebar .bar::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--muted); }
.scorebar b { width: 2.2em; text-align: right; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 8px; align-content: start; }
.pcard header { display: flex; align-items: center; gap: 10px; }
.pcard header img { width: 32px; height: 32px; border-radius: 50%; display: block; }
.pcard header b { display: block; }
.pcard header small { color: var(--muted); font-size: 12.5px; }
.pcard ol { margin: 0; padding-left: 1.3em; display: grid; gap: 2px; }
.pcard .row { display: flex; gap: 8px; flex-wrap: wrap; }
.matches { display: flex; flex-wrap: wrap; gap: 8px; }
.match { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.match b { font-variant-numeric: tabular-nums; color: var(--pine); }
.method { color: var(--muted); font-size: 13px; margin-top: 30px; max-width: 75ch; }
.sealed { position: relative; }
.sealed-content { filter: blur(10px); pointer-events: none; user-select: none; }
.seal { position: absolute; inset: 0; display: flex; justify-content: center; align-items: flex-start; padding-top: 40px; }
.seal .panel { margin: 0; box-shadow: 0 10px 40px rgba(0, 0, 0, .18); }

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

/* Hosted page: sign-in, picking your name, avatars, the organiser's import box. */
body { margin: 0; }
[hidden] { display: none !important; }
.field { width: 100%; max-width: 360px; font: 500 16px var(--font-body); padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--ground); color: var(--ink); }
.field:focus { border-color: var(--ink); }
textarea.field { max-width: none; min-height: 120px; font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
.panel form, .who-new { display: grid; gap: 10px; justify-items: center; width: 100%; }
.who-new { grid-template-columns: minmax(0, 1fr) auto; max-width: 440px; }
@media (max-width: 420px) { .who-new { grid-template-columns: minmax(0, 1fr); } }
.who-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.form-error { color: var(--red); font-size: 14px; min-height: 1.3em; }
.avatar { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font: 700 10.5px/1 var(--font-body); color: #FFFFFF; letter-spacing: .02em; }
.avatar.lg { width: 32px; height: 32px; font-size: 12.5px; }
.avatar.c0 { background: #B3142D; } .avatar.c1 { background: #1B6646; } .avatar.c2 { background: #8A6508; }
.avatar.c3 { background: #4A5BB0; } .avatar.c4 { background: #8A3F8F; } .avatar.c5 { background: #2C7178; }
.switch { appearance: none; background: none; border: 0; padding: 4px 6px; color: var(--muted); font: 600 12.5px var(--font-body); text-decoration: underline; cursor: pointer; }
.switch:hover { color: var(--ink); }
.tool.wide { grid-column: 1 / -1; }
.tool .status.ok { color: var(--pine); }

/* Photos: the restaurant's own picture, or its initial on the corner colour */
.card::before { z-index: 1; }
.photo { position: relative; overflow: hidden; display: grid; place-items: center; flex: none;
  background: var(--corner-soft, var(--pine-soft)); color: var(--corner, var(--pine)); }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo .mono { font-family: var(--font-display); font-weight: 900; font-size: 72px; line-height: 1; text-transform: uppercase; opacity: .55; }
.photo.hero { margin: -20px -20px 0; aspect-ratio: 16 / 9; }
.place .photo.hero { aspect-ratio: 2 / 1; }
@media (max-width: 639px) { .duel-card .photo.hero { aspect-ratio: 5 / 2; } }
.photo.thumb { width: 44px; height: 44px; border-radius: 10px; }
.photo.thumb .mono { font-size: 24px; }
.photo.disc { width: 56px; height: 56px; border-radius: 50%; align-self: center; box-shadow: 0 0 0 3px var(--surface); }
.photo.disc .mono { font-size: 30px; }
.step.p1 .photo.disc { width: 76px; height: 76px; }
.step.p1 { min-height: 300px; } .step.p2 { min-height: 240px; } .step.p3 { min-height: 200px; }
@media (max-width: 520px) {
  .photo.disc { width: 40px; height: 40px; } .step.p1 .photo.disc { width: 54px; height: 54px; }
  .step.p1 { min-height: 250px; } .step.p2 { min-height: 200px; } .step.p3 { min-height: 170px; }
}
.plrow { display: flex; align-items: center; gap: 10px; }
