/* Escalate. The whytho look: white, thick ink lines, hard shadows, one loud colour at a time. Phone first. */

:root {
  --bg: #fff;
  --ink: #1d1a17;
  --muted: #5a5249;
  --red: #d9402a;
  --lime: #d6f25a;
  --pink: #f7a8c8;
  --violet: #9b7cf0;
  --ochre: #c8963e;
  --paper: #fbf7f0;
  --line: 2.5px solid var(--ink);
  --shadow: 6px 6px 0 var(--ink);
  --shadow-s: 3px 3px 0 var(--ink);
  --radius: 14px;
  --spring: linear(0, 0.22 7%, 0.86 21%, 1.06 30%, 1.09 35%, 1.03 47%, 0.99 58%, 1);
  --gutter: 16px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.0625rem/1.5 'Bricolage Grotesque', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.has-devbar { padding-bottom: 64px; }

a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--red); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
canvas:focus-visible { outline-offset: -3px; }
h1, h2, h3 { line-height: 1.05; margin: 0 0 0.5em; letter-spacing: -0.02em; }
h2 { font-size: 1.6rem; font-weight: 800; }
h3 { font-size: 1.2rem; font-weight: 800; }
p { margin: 0 0 0.75em; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
bdi { unicode-bidi: isolate; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--lime); border: var(--line); padding: 6px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---- Header and footer ---- */

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1080px; margin: 0 auto; padding: 14px var(--gutter);
}
.mark { font-weight: 800; font-size: 1.35rem; text-decoration: none; letter-spacing: -0.02em; }
.mark span { color: var(--red); }
.count {
  background: var(--lime); border: var(--line); border-radius: 999px; padding: 3px 12px;
  font-size: 0.85rem; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.foot { max-width: 1080px; margin: 48px auto 0; padding: 20px var(--gutter) 32px; border-top: var(--line); color: var(--muted); font-size: 0.9rem; }

main { display: block; max-width: 1080px; margin: 0 auto; padding: 0 var(--gutter); outline: none; }
.note { border: var(--line); padding: 12px; }

/* ---- Bits ---- */

.card {
  background: var(--bg); border: var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin: 0 0 28px; min-width: 0;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  padding: 8px 18px; border: var(--line); border-radius: 999px; background: var(--lime); color: var(--ink);
  font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; box-shadow: var(--shadow-s);
  transition: transform 0.12s, box-shadow 0.12s; max-width: 100%;
}
.btn:hover { color: var(--ink); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn.big { font-size: 1.2rem; min-height: 54px; padding: 10px 26px; }
.btn.ghost { background: var(--bg); }
.btn.danger { background: var(--bg); color: var(--red); border-color: var(--red); box-shadow: 3px 3px 0 var(--red); }
.pill {
  display: inline-block; border: 2px solid var(--ink); border-radius: 999px; padding: 0 10px;
  font-size: 0.8rem; font-weight: 800; background: var(--paper); white-space: nowrap;
}
.error {
  border: 2.5px solid var(--red); border-radius: 10px; color: var(--red); background: #fff4f1;
  padding: 8px 12px; font-weight: 700;
}
fieldset { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
legend { font-weight: 800; margin-bottom: 8px; padding: 0; }

/* A name with its colour dot. Names are any text up to ten characters, wide ones included, so they wrap anywhere. */
.who { display: inline-flex; align-items: baseline; gap: 0.35em; min-width: 0; max-width: 100%; }
.who-dot {
  flex: none; width: 0.7em; height: 0.7em; border-radius: 50%; background: var(--c); border: 2px solid var(--ink);
  align-self: center;
}
.who-name { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }

/* ---- Home ---- */

.hero { padding: 12px 0 28px; }
.hero h1 {
  font-size: clamp(4rem, 19vw, 11rem); font-weight: 800; line-height: 0.9; margin: 0 0 12px;
  color: #fffaf0; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 6px 6px 0 var(--red);
  animation: land 0.7s var(--spring) both;
}
@keyframes land { from { transform: translateY(-30px) rotate(-3deg); opacity: 0; } }
.tagline { font-size: clamp(1.4rem, 5vw, 2.1rem); font-weight: 800; margin: 0 0 8px; }
.sub { max-width: 36em; color: var(--muted); }

.field { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: end; margin-bottom: 16px; }
.field label { font-weight: 800; grid-column: 1 / -1; }
.field input {
  grid-column: 1 / -1; width: 100%; min-width: 0; font: inherit; font-size: 1.25rem; font-weight: 700;
  padding: 10px 14px; border: var(--line); border-radius: 12px; background: var(--paper);
}
.count-left { grid-column: 2; font-size: 0.85rem; color: var(--muted); }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; width: 44px; height: 44px; border-radius: 50%; background: var(--c); border: var(--line); cursor: pointer; }
.swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch:has(input:checked) { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--ink); }
.swatch:has(input:focus-visible) { outline: 3px solid var(--red); outline-offset: 6px; }

.picker { display: grid; gap: 12px; }
.preview canvas, .panel-canvas, .ring-canvas {
  display: block; width: 100%; border: var(--line); border-radius: 12px; background: var(--paper);
}
.preview-cap { font-size: 0.9rem; color: var(--muted); margin: 0; }
.moves { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.move {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: var(--line);
  border-radius: 12px; cursor: pointer; background: var(--bg); min-width: 0;
}
.move input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.move:has(input:checked) { background: var(--lime); box-shadow: var(--shadow-s); }
.move:has(input:focus-visible) { outline: 3px solid var(--red); outline-offset: 2px; }
.move-name { font-weight: 800; line-height: 1.15; }
.move-does { font-size: 0.85rem; color: var(--muted); line-height: 1.3; }
.move:has(input:checked) .move-does { color: var(--ink); }
.tag { align-self: flex-start; white-space: nowrap; font-size: 0.72rem; font-weight: 800; background: var(--pink); border: 2px solid var(--ink); border-radius: 999px; padding: 0 8px; }

.share h2 { font-size: 1.8rem; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.share-url {
  flex: 1 1 220px; min-width: 0; font: inherit; font-weight: 700; padding: 10px 12px; border: var(--line);
  border-radius: 12px; background: var(--paper);
}
.said { display: block; min-height: 1.5em; font-weight: 700; margin-top: 6px; }

.board h2 { font-size: 2rem; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.fight-card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; margin: 0; padding: 12px; height: 100%; }
.fight-card:hover { color: var(--ink); transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }
.fight-card canvas { display: block; width: 100%; border: 2px solid var(--ink); border-radius: 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.9rem; }
.turn { min-width: 0; overflow-wrap: anywhere; }
.crowd-line { font-size: 0.85rem; }

/* ---- The fight ---- */

.versus { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2em 0.45em; font-weight: 800; min-width: 0; }
h1.versus { font-size: clamp(2rem, 9vw, 3.6rem); margin: 8px 0 12px; }
.versus.small { font-size: 1.15rem; }
.vs { color: var(--red); font-size: 0.6em; font-style: italic; }
.verdict {
  display: inline-block; max-width: 100%; overflow-wrap: anywhere; font-size: clamp(1.3rem, 5vw, 1.9rem); font-weight: 800;
  background: var(--pink); border: var(--line); border-radius: 12px; padding: 6px 14px; box-shadow: var(--shadow-s);
  transform: rotate(-1deg);
}
.status { font-weight: 600; overflow-wrap: anywhere; }
.status bdi { font-weight: 800; }

.strip { list-style: none; margin: 16px 0 28px; padding: 0; display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }
.panel { min-width: 0; }
.panel-cap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 6px; font-weight: 700; overflow-wrap: anywhere; min-width: 0; }
.panel-cap > span:last-child { min-width: 0; }
.panel .panel-canvas { cursor: pointer; box-shadow: var(--shadow-s); }

.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.your-move .btn.big, .join .btn.big { width: 100%; margin-top: 8px; }

details.more { margin: 0 0 28px; }
details.more summary { cursor: pointer; font-weight: 700; color: var(--muted); padding: 6px 0; }
details.more[open] summary { margin-bottom: 8px; }
details.more .btn { margin: 0 0 14px; }

.ringside { margin: 8px 0 28px; }
.counts { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; font-weight: 800; margin: 10px 0; }
.counts > span { min-width: 0; overflow-wrap: anywhere; }
.ring-act h3 { overflow-wrap: anywhere; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.btn.side { background: var(--c); width: 100%; min-width: 0; overflow-wrap: anywhere; font-size: 1.15rem; }
.btn.side bdi { min-width: 0; }
.cheers { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 8px; }
.btn.cheer { background: var(--bg); padding: 8px 10px; }

.again { text-align: center; }
.gone { margin-top: 24px; }
.small-h1 { font-size: 2.2rem; }

@media (min-width: 760px) {
  .start, .join, .your-move { padding: 24px; }
  .picker { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
  .picker .preview { grid-row: 1 / span 2; }
  .moves { grid-template-columns: 1fr 1fr; }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ringside { max-width: 720px; margin-inline: auto; }
}
@media (min-width: 1040px) {
  .strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---- The mock's dev bar (only with ?mock=1) ---- */

.devbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 8px var(--gutter); background: var(--ink); color: #fff; font-size: 0.8rem;
}
.devbar b { color: var(--lime); }
.devbar button {
  font: inherit; font-weight: 700; background: #fff; color: var(--ink); border: 0; border-radius: 999px; padding: 4px 10px; cursor: pointer;
}

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