/* Pig Soccer — UI chrome. The pitch itself is drawn on the canvas in game.js. */
:root {
  --grass-0: #1c6b34;
  --grass-1: #0d3f1e;
  --ink: #f2fff4;
  --muted: rgba(226, 255, 232, 0.68);
  --pink: #ff8fc0;
  --pink-deep: #d8467f;
  --brown: #a9714a;
  --brown-deep: #6f4227;
  --panel: rgba(9, 32, 19, 0.92);
  --edge: rgba(255, 255, 255, 0.16);
  --gold: #ffd75e;
}

* { box-sizing: border-box; }

/* The `hidden` attribute loses to any class that sets `display`, which is most of
   them here (.hud is flex, .btn is block, .field is block). Make it win. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(circle at 50% 12%, #1e7a3b, #06240f 72%);
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 50;
  background: #fff; color: #063; padding: .6rem 1rem; border-radius: 0 0 .6rem 0;
}
.skip-link:focus { left: 0; }

/* ---------------- Stage + canvas ---------------- */
.stage {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
canvas {
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
}

/* ---------------- HUD ---------------- */
.hud {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: flex-start; justify-content: center;
  padding: .55rem .7rem; pointer-events: none; z-index: 6;
}
.scoreboard {
  display: flex; align-items: center; gap: .5rem;
  background: rgba(6, 26, 14, .78);
  border: 2px solid var(--edge);
  border-radius: 999px;
  padding: .3rem .55rem;
  box-shadow: 0 .35rem 1.1rem rgba(0, 0, 0, .35);
  font-weight: 700;
}
.team { display: flex; align-items: center; gap: .45rem; }
.tname {
  max-width: 7.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .82rem; letter-spacing: .02em;
}
.team.pink .tname { color: var(--pink); }
.team.brown .tname { color: #e0b48c; }
.tscore {
  font-size: 1.4rem; line-height: 1; min-width: 1.5rem; text-align: center;
  padding: .15rem .35rem; border-radius: .5rem;
}
.team.pink .tscore { background: rgba(216, 70, 127, .35); }
.team.brown .tscore { background: rgba(111, 66, 39, .5); }
.target { font-size: .62rem; letter-spacing: .12em; color: var(--muted); padding: 0 .3rem; }
.hud-quit {
  position: fixed; top: .55rem; right: .7rem; pointer-events: auto;
  background: rgba(6, 26, 14, .78); color: var(--ink);
  border: 2px solid var(--edge); border-radius: .7rem;
  padding: .35rem .7rem; font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer;
}
.hud-quit:hover { border-color: var(--gold); }
.hud-sound { right: 5.4rem; padding: .35rem .5rem; }

.banner {
  position: fixed; inset: 0; display: grid; place-items: center;
  pointer-events: none; z-index: 7;
}
.banner span {
  font-size: clamp(2rem, 9vw, 4.6rem);
  font-weight: 900; letter-spacing: .04em; text-align: center;
  color: #fff;
  text-shadow: 0 .3rem 0 rgba(0, 0, 0, .35), 0 0 2.4rem rgba(255, 215, 94, .7);
  animation: pop .32s cubic-bezier(.2, 1.5, .4, 1);
  padding: 0 1rem;
}
@keyframes pop { from { transform: scale(.55); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------------- 🥅 Penalty overlays ---------------- */
.penchoose {
  position: fixed; inset: 0; z-index: 9;
  display: grid; place-items: center;
  background: rgba(4, 20, 11, .72); backdrop-filter: blur(2px);
  padding: 1rem;
}
.penpanel {
  width: min(26rem, 100%);
  background: var(--panel); border: 2px solid var(--gold);
  border-radius: 1rem; padding: .9rem 1rem 1rem;
  box-shadow: 0 1rem 2.4rem rgba(0, 0, 0, .5);
  max-height: 92vh; overflow-y: auto;
}
.penhead { display: flex; align-items: center; gap: .6rem; font-weight: 900; font-size: 1.15rem; }
.penclock {
  margin-left: auto; min-width: 2.2rem; text-align: center;
  background: var(--gold); color: #08240f; border-radius: .5rem;
  padding: .1rem .45rem; font-size: 1.15rem; font-variant-numeric: tabular-nums;
}
.penpanel .tiny { color: var(--muted); margin: .25rem 0 .7rem; line-height: 1.4; }
.penlist { display: grid; gap: .4rem; }
.penpick {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  font: inherit; text-align: left; cursor: pointer;
  padding: .5rem .6rem;
  background: rgba(255, 255, 255, .07);
  border: 2px solid var(--edge); border-radius: .7rem; color: var(--ink);
}
.penpick:hover { border-color: rgba(255, 255, 255, .35); }
.penpick.rec { border-color: var(--gold); background: rgba(255, 215, 94, .14); }
.penpick .pnum {
  flex: none; width: 1.4rem; height: 1.4rem; border-radius: .35rem;
  background: rgba(255, 255, 255, .14); color: var(--muted);
  font-size: .72rem; font-weight: 900; display: grid; place-items: center;
}
.penpick .picon { font-size: 1.2rem; flex: none; }
.penpick .pbody { flex: 1; min-width: 0; }
.penpick .pname { display: block; font-weight: 800; font-size: .95rem; }
.penpick .pwhy { display: block; font-size: .72rem; color: var(--muted); }
.penpick .pstar { flex: none; font-size: 1rem; }

.penside {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(52vh); z-index: 9;
  display: flex; align-items: center; gap: .35rem;
  background: rgba(6, 26, 14, .88); border: 2px solid var(--edge);
  border-radius: .9rem; padding: .4rem .5rem;
}
.penside .pslabel { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 .2rem; }
.pszone {
  font: inherit; font-weight: 900; font-size: .78rem; cursor: pointer;
  padding: .45rem .6rem .3rem; border-radius: .6rem;
  background: rgba(255, 255, 255, .1); color: var(--ink);
  border: 2px solid var(--edge);
  display: flex; flex-direction: column; align-items: center; line-height: 1.1;
}
.pszone small { font-size: .58rem; color: var(--muted); font-weight: 700; }
.pszone[aria-checked="true"] { background: var(--gold); color: #08240f; border-color: #fff; }
.pszone[aria-checked="true"] small { color: rgba(8, 36, 15, .7); }
/* Two people sharing one phone: keep it off the halfway line where the score is. */
body.two-players .penside { bottom: 58vh; }

/* ---------------- Touch controls ---------------- */
.touch { position: fixed; inset: auto 0 0 0; height: 42vh; z-index: 8; pointer-events: none; }
/* Player 2 sits at the other end of the phone, so their pad is turned around. */
.touch2 { inset: 0 0 auto 0; transform: rotate(180deg); }

.stick {
  position: absolute; left: 4vw; bottom: calc(4vh + env(safe-area-inset-bottom, 0px));
  width: 33vw; max-width: 10.5rem; aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  border: 3px solid rgba(255, 255, 255, .25);
  pointer-events: auto; touch-action: none;
}
.knob {
  position: absolute; left: 50%; top: 50%;
  width: 42%; aspect-ratio: 1; margin: -21% 0 0 -21%;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  box-shadow: 0 .2rem .6rem rgba(0, 0, 0, .35);
}
/* Four buttons now, so they sit in a fixed 2×2 block. Explicit grid cells, not
   document order — otherwise hiding SKILL (a pig with no position yet) would
   slide KICK out from under the player's thumb. */
.tbuttons {
  position: absolute; right: 4vw; bottom: calc(4vh + env(safe-area-inset-bottom, 0px));
  display: grid; grid-template-columns: auto auto; gap: .5rem;
  align-items: end; justify-items: end;
}
.tbtn {
  pointer-events: auto; touch-action: none;
  border: 3px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  width: 19vw; max-width: 5.4rem; aspect-ratio: 1;
  font: inherit; font-weight: 900; font-size: .72rem; letter-spacing: .04em;
  line-height: 1; overflow: hidden; padding: 0 .15rem;
  color: #08240f; cursor: pointer;
}
/* Translucent on purpose: five buttons is a tall stack, and on a phone it sits
   over your own goal. Seeing the ball through them beats a solid wall of pad. */
.tbtn.move  { grid-area: 1 / 1; background: rgba(158, 200, 255, .82); font-size: .6rem; }
.tbtn.slide { grid-area: 1 / 2; background: rgba(155, 232, 180, .82); }
.tbtn.pass  { grid-area: 2 / 1; background: rgba(185, 242, 211, .82); }
.tbtn.dash  { grid-area: 2 / 2; background: rgba(255, 255, 255, .62); }
.tbtn.kick  { grid-area: 3 / 2; background: rgba(255, 215, 94, .85); width: 26vw; max-width: 7rem; font-size: .82rem; }
/* A short screen has no room for a three-high stack — tighten it up. */
@media (max-height: 46rem) {
  .tbtn { width: 15vw; max-width: 4rem; font-size: .58rem; }
  .tbtn.kick { width: 20vw; max-width: 5.4rem; font-size: .68rem; }
  .tbuttons { gap: .4rem; }
  .stick { width: 26vw; max-width: 8rem; }
}
.tbtn:active { transform: scale(.94); }

/* ---- Two players sharing one phone ----
   Each player gets a slim strip at their own end — thumbstick on one side, a
   single row of buttons on the other — and the pitch is squeezed into the band
   between them, so nobody's controls sit on top of a goal. */
body.two-players { --pad-h: calc(min(23vw, 6rem) + 1.1rem); }
body.two-players .touch {
  height: auto; opacity: .95;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .55rem .6rem calc(.55rem + env(safe-area-inset-bottom, 0px));
}
body.two-players .touch2 {
  padding: calc(.55rem + env(safe-area-inset-top, 0px)) .6rem .55rem;
}
body.two-players .stick {
  /* relative, NOT static — the knob is absolutely positioned inside this, and
     with no positioned parent it sizes itself against the whole strip instead. */
  position: relative; left: auto; bottom: auto;
  width: min(23vw, 6rem); max-width: none; flex: none;
}
body.two-players .tbuttons {
  position: static; right: auto; bottom: auto;
  display: flex; flex-direction: row; align-items: center; gap: .4rem;
}
body.two-players .tbtn { width: min(15.5vw, 4rem); max-width: none; font-size: .52rem; }
/* Two slim strips sit off the pitch already, so those can stay solid. */
body.two-players .tbtn.move  { background: #9ec8ff; }
body.two-players .tbtn.slide { background: #9be8b4; }
body.two-players .tbtn.dash  { background: rgba(255, 255, 255, .78); }
body.two-players .tbtn.kick  { background: var(--gold); }
/* A couch match is one pig each — there is nobody to pass to. */
body.two-players .tbtn.pass { display: none; }
body.two-players .tbtn.move { font-size: .45rem; }
body.two-players .tbtn.kick { width: min(18vw, 4.7rem); max-width: none; font-size: .58rem; }
/* Keep the pitch out from under both strips. */
body.two-players #pitch {
  height: calc(100% - 2 * var(--pad-h) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  min-height: 42%;
}
/* Both top corners now belong to player 2, so the score and the Leave/sound
   buttons move to the halfway line where neither player's thumbs go. */
body.two-players .hud { justify-content: center; padding-left: 0; }
body.two-players .scoreboard { position: fixed; left: .4rem; top: 50%; transform: translateY(-50%); opacity: .85; }
body.two-players .target { display: none; }   /* just the two numbers — space is tight */
body.two-players .hud-quit { top: 50%; transform: translateY(-50%); right: .4rem; }
body.two-players .hud-sound { top: 50%; transform: translateY(-50%); right: 4rem; }

/* ---------------- Screens ---------------- */
.screens { position: fixed; inset: 0; z-index: 10; display: none; }
.screens.on { display: block; }
.screen {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  padding: 1rem; overflow-y: auto;
  background: rgba(4, 20, 11, .82);
  backdrop-filter: blur(3px);
}
.screen.active { display: flex; }

.panel {
  width: min(30rem, 100%);
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: 1.1rem;
  padding: 1.4rem 1.3rem 1.2rem;
  box-shadow: 0 1rem 2.4rem rgba(0, 0, 0, .45);
  margin: auto;
}
.panel.wide { width: min(38rem, 100%); }

.kicker { margin: 0 0 .2rem; font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.logo { margin: 0 0 .5rem; font-size: clamp(2rem, 8vw, 2.9rem); line-height: 1; letter-spacing: -.01em; }
.logo .ball { display: inline-block; animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
h2 { margin: 0 0 .35rem; font-size: 1.5rem; }
h3 { margin: 0 0 .4rem; font-size: .95rem; letter-spacing: .04em; }
.lede { margin: 0 0 1rem; color: var(--muted); font-size: .92rem; line-height: 1.45; }
.foot { margin: .9rem 0 0; text-align: center; font-size: .74rem; color: var(--muted); }
.tiny { font-size: .74rem; }

/* Fields */
.field { display: block; margin: 0 0 .5rem; }
.field.inline { flex: 1; margin: 0; }
.flabel { display: block; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .25rem; }
input[type="text"] {
  width: 100%; font: inherit; font-size: 1.05rem; font-weight: 700;
  padding: .6rem .7rem;
  color: var(--ink); background: rgba(255, 255, 255, .08);
  border: 2px solid var(--edge); border-radius: .7rem;
}
input[type="text"]:focus { outline: none; border-color: var(--gold); }
.hint { margin: 0 0 1rem; font-size: .78rem; color: var(--muted); line-height: 1.4; }
.hint.err { color: #ff9d9d; font-weight: 700; }
.hint.warn { color: #ffd75e; }

/* Colour picker */
.colors { display: flex; gap: .45rem; flex-wrap: wrap; margin: 0 0 1rem; }
.swatch {
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .25); cursor: pointer; padding: 0;
}
.swatch[aria-checked="true"] { border-color: #fff; transform: scale(1.12); }

/* Buttons */
.btn {
  display: block; width: 100%; margin: 0 0 .55rem;
  font: inherit; font-weight: 800; font-size: 1rem;
  padding: .75rem 1rem;
  color: var(--ink); background: rgba(255, 255, 255, .1);
  border: 2px solid var(--edge); border-radius: .8rem;
  cursor: pointer; text-align: center;
}
.btn:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .34); }
.btn.primary { background: linear-gradient(180deg, #33b558, #1b7a38); border-color: #6fe08f; }
.btn.primary:hover { background: linear-gradient(180deg, #3cc964, #22903f); }
.btn.big { font-size: 1.1rem; padding: .9rem 1rem; }
/* 🟢 The Boar Bots button, in lime, because that is the one you press most and
   it should be the one your eye lands on. Dark ink on it so it stays readable. */
.btn.lime {
  background: linear-gradient(180deg, #b6ff3c, #7fd400);
  border-color: #d6ff7a;
  color: #14260a;
  font-weight: 800;
  text-shadow: none;
}
.btn.lime:hover { background: linear-gradient(180deg, #c6ff62, #8ee800); border-color: #e6ffa8; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); font-size: .86rem; padding: .5rem; margin-top: .3rem; }
.btn.ghost:hover { color: var(--ink); background: rgba(255, 255, 255, .07); }
.btn.tiny-btn { font-size: .78rem; padding: .4rem .6rem; margin: .5rem 0 0; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.stack { margin-bottom: .4rem; }
.row { display: flex; gap: .5rem; }
.row .btn { margin-bottom: .55rem; }

/* Mode picker */
.modes { display: grid; gap: .5rem; margin: 0 0 1rem; }
.modes.small .mtitle { font-size: .92rem; }
.mode {
  display: block; width: 100%; text-align: left;
  font: inherit; cursor: pointer;
  padding: .7rem .8rem;
  background: rgba(255, 255, 255, .07);
  border: 2px solid var(--edge); border-radius: .8rem; color: var(--ink);
}
.mode[aria-checked="true"] { border-color: var(--gold); background: rgba(255, 215, 94, .16); }
.mtitle { display: block; font-weight: 800; font-size: 1.02rem; }
.msub { display: block; font-size: .78rem; color: var(--muted); margin-top: .1rem; }

/* 🎚️ Difficulty slider */
.difficulty {
  background: rgba(255, 255, 255, .06);
  border: 2px solid var(--edge); border-radius: .8rem;
  padding: .6rem .75rem .5rem; margin: 0 0 .8rem;
}
.drow { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .1rem; }
.dlabel { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.dname { font-weight: 800; font-size: 1rem; margin-left: auto; }
.dxp { font-size: .72rem; font-weight: 800; color: var(--gold); flex: none; }
.dslider {
  -webkit-appearance: none; appearance: none;
  width: 100%; margin: .35rem 0 .1rem; background: none; cursor: pointer;
  /* A finger, not a mouse pointer — give the track something to grab. */
  height: 1.9rem;
}
.dslider:focus { outline: none; }
.dslider::-webkit-slider-runnable-track {
  height: .55rem; border-radius: 999px;
  background: linear-gradient(90deg, #6fe08f, var(--gold) 55%, #ff8a5c);
}
.dslider::-moz-range-track {
  height: .55rem; border-radius: 999px;
  background: linear-gradient(90deg, #6fe08f, var(--gold) 55%, #ff8a5c);
}
.dslider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 1.65rem; height: 1.65rem; margin-top: -.55rem;
  border-radius: 50%; background: #fff; border: 3px solid #08240f;
  box-shadow: 0 .15rem .5rem rgba(0, 0, 0, .45);
}
.dslider::-moz-range-thumb {
  width: 1.4rem; height: 1.4rem;
  border-radius: 50%; background: #fff; border: 3px solid #08240f;
}
.dslider:focus-visible::-webkit-slider-thumb { border-color: var(--gold); }
.dticks { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); font-weight: 700; }
/* The team-size slider has five stops, so its track stays one flat colour —
   bigger teams are not "harder", just bigger. */
#dbl-sizebox .dslider::-webkit-slider-runnable-track { background: linear-gradient(90deg, #6fe08f, #8fd0ff); }
#dbl-sizebox .dslider::-moz-range-track { background: linear-gradient(90deg, #6fe08f, #8fd0ff); }
.dticks span.on { color: var(--ink); }
/* Sizes bigger than your squad are shown, but plainly out of reach. */
.dticks span.locked { color: rgba(226, 255, 232, .28); text-decoration: line-through; }
.dslider[disabled] { opacity: .55; cursor: not-allowed; }
.difficulty .hint { margin: .35rem 0 0; }

/* Career + upgrades */
.lvl { font-size: .78rem; color: var(--gold); font-weight: 800; }
.lvlbar { margin: 0 0 .8rem; }
.lvlrow { display: flex; justify-content: space-between; align-items: baseline; font-size: .86rem; margin-bottom: .3rem; }
.lvlrow b { font-size: 1.05rem; }
.lvlrow span { color: var(--muted); font-size: .78rem; }
.bar { height: .55rem; border-radius: 999px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.bar .fill { height: 100%; background: linear-gradient(90deg, #6fe08f, var(--gold)); width: 0; transition: width .3s; }
.upgrades { display: grid; gap: .45rem; margin: 0 0 .8rem; }
.upg {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .7rem; background: rgba(255, 255, 255, .06);
  border: 2px solid var(--edge); border-radius: .8rem;
}
.upg .uicon { font-size: 1.2rem; flex: none; }
.upg .ubody { flex: 1; min-width: 0; }
.upg .uname { font-weight: 800; font-size: .95rem; }
.upg .ublurb { display: block; font-size: .74rem; color: var(--muted); font-weight: 400; }
.upg .upips { display: flex; gap: .18rem; margin-left: auto; flex: none; }
.upg .pip { width: .5rem; height: 1rem; border-radius: .15rem; background: rgba(255, 255, 255, .16); }
.upg .pip.on { background: var(--gold); }
/* 🎽 Pips your position handed you, and specialty tracks nobody else can
   train, are green — so it is obvious what the shirt is paying for. */
.upg .upips.many { gap: .13rem; }
.upg .upips.many .pip { width: .36rem; }
.upg .pip.extra { background: rgba(111, 224, 143, .2); }
.upg .pip.extra.on { background: #6fe08f; }
.upg.spec { border-color: rgba(111, 224, 143, .5); background: rgba(111, 224, 143, .09); }
.upg.spec .uname { color: #9be8b4; }
.upghead { margin: .5rem 0 -.1rem; font-size: .78rem; font-weight: 800; color: #9be8b4; }
.upghead.dimhead { color: var(--muted); font-weight: 700; line-height: 1.4; }
.upg button {
  font: inherit; font-weight: 900; font-size: 1rem; cursor: pointer;
  width: 2rem; height: 2rem; border-radius: .5rem; margin-left: .5rem;
  color: #08240f; background: #6fe08f; border: 0;
}
.upg button[disabled] { background: rgba(255, 255, 255, .14); color: var(--muted); cursor: not-allowed; }
.upg.maxed { border-color: rgba(255, 215, 94, .5); }
.earned { margin: 0 0 .8rem; text-align: center; color: var(--gold); font-weight: 800; font-size: .95rem; }

/* 🌦️🎙️ Match extras — two chunky on/off tiles under the difficulty slider */
.toggles { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .45rem; margin: 0 0 .5rem; }
.tog {
  display: flex; align-items: center; gap: .4rem; cursor: pointer;
  font: inherit; text-align: left;
  padding: .55rem .6rem; border-radius: .8rem;
  background: rgba(255, 255, 255, .06); border: 2px solid var(--edge); color: inherit;
}
.tog .togicon { font-size: 1.2rem; flex: none; }
.tog .togname { font-weight: 800; font-size: .84rem; flex: 1; min-width: 0; }
.tog .togstate { font-weight: 900; font-size: .72rem; color: var(--muted); flex: none; }
.tog[aria-pressed="true"] { border-color: rgba(111, 224, 143, .55); background: rgba(111, 224, 143, .12); }
.tog[aria-pressed="true"] .togstate { color: #6fe08f; }
.tog[aria-pressed="false"] { opacity: .62; }

/* 🧠 The tactics board: pick how your team-mates play */
.tacboard { margin: 0 0 .6rem; }
.secttl { margin: .2rem 0 .45rem; font-size: .92rem; font-weight: 900; }
.tacs { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: .45rem; }
.tac {
  display: flex; align-items: flex-start; gap: .45rem; cursor: pointer;
  font: inherit; text-align: left;
  padding: .55rem .6rem; border-radius: .8rem;
  background: rgba(255, 255, 255, .06); border: 2px solid var(--edge); color: inherit;
}
.tac .tacicon { font-size: 1.2rem; flex: none; line-height: 1.2; }
.tac .tacbody { flex: 1; min-width: 0; }
.tac .tacname { display: block; font-weight: 800; font-size: .84rem; }
.tac .tacblurb { display: block; font-size: .72rem; color: var(--muted); line-height: 1.3; }
.tac .tackey { flex: none; font-weight: 900; font-size: .68rem; color: var(--muted);
  border: 1px solid var(--edge); border-radius: .35rem; padding: .05rem .28rem; }
.tac[aria-pressed="true"] { border-color: rgba(111, 224, 143, .55); background: rgba(111, 224, 143, .12); }
.tac[aria-pressed="true"] .tackey { color: #6fe08f; border-color: rgba(111, 224, 143, .55); }

/* 🥇 The penalty-shootout card, under the scoreboard */
.shootbar {
  position: absolute; left: 50%; top: 3.1rem; transform: translateX(-50%); z-index: 7;
  display: grid; gap: .18rem;
  padding: .35rem .6rem; border-radius: .7rem;
  background: rgba(8, 14, 10, .78); border: 2px solid rgba(255, 255, 255, .16);
  white-space: nowrap;
}
.shootrow { display: flex; align-items: center; gap: .45rem; }
.shootrow .sname { font-weight: 800; font-size: .72rem; width: 3rem; color: #eafff0; }
.shootrow .sdots { display: flex; gap: .16rem; }
.shootrow .sdots i { font-style: normal; font-size: .8rem; line-height: 1; }
.shootrow .sdots .sgoal { color: #6fe08f; }
.shootrow .sdots .smiss { color: #ff7b7b; }
.shootrow .sdots .stodo { color: rgba(255, 255, 255, .35); }
.shootrow .snum { font-weight: 900; font-size: .82rem; margin-left: .3rem; color: #ffd75e; }
@media (max-width: 700px) { .shootbar { top: 2.7rem; padding: .28rem .45rem; } }

/* 🧠 …and the chip that shows the orders during a match */
.tacchip {
  position: absolute; left: .55rem; top: 3.1rem; z-index: 7;
  display: flex; align-items: center; gap: .3rem; cursor: pointer;
  font: inherit; font-weight: 800; font-size: .78rem; color: #eafff0;
  padding: .28rem .55rem; border-radius: .7rem;
  background: rgba(8, 14, 10, .72); border: 2px solid rgba(255, 255, 255, .18);
}
.tacchip .tcicon { font-size: .95rem; }
@media (max-width: 700px) { .tacchip { top: 2.7rem; font-size: .7rem; } .tacchip .tcname { display: none; } }

/* 🎙️ The commentator's line, under the pitch */
.commentary {
  position: fixed; left: 50%; bottom: 6.5rem; transform: translateX(-50%);
  z-index: 6; pointer-events: none;
  max-width: min(92vw, 40rem); text-align: center;
  padding: .45rem .9rem; border-radius: .7rem;
  background: rgba(8, 14, 10, .78); border: 2px solid rgba(255, 255, 255, .16);
  color: #eafff0; font-weight: 700; font-size: .92rem; line-height: 1.35;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
.commentary::before { content: "🎙️ "; }
.commentary.pop { animation: commpop .28s ease-out; }
@keyframes commpop {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@media (max-width: 700px) { .commentary { bottom: 11.5rem; font-size: .82rem; } }
@media (prefers-reduced-motion: reduce) { .commentary.pop { animation: none; } }

/* 🎽 Position cards */
.posbox { display: grid; gap: .45rem; margin: 0 0 1rem; }
.pos {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .6rem .7rem;
  background: rgba(255, 255, 255, .06);
  border: 2px solid var(--edge); border-radius: .8rem;
}
.pos.picked { border-color: var(--gold); background: rgba(255, 215, 94, .14); }
.pos.dim { opacity: .42; }
.pos .picon { font-size: 1.7rem; line-height: 1; flex: none; }
.pos .pbody { flex: 1; min-width: 0; }
.pos .pname { display: block; font-weight: 800; font-size: 1rem; }
.pos .pblurb { display: block; font-size: .76rem; color: var(--muted); line-height: 1.35; margin-top: .1rem; }
.pos .pperks { display: block; font-size: .72rem; color: #9be8b4; font-weight: 700; margin-top: .28rem; }
.pos .pspec { display: block; font-size: .72rem; color: var(--gold); font-weight: 700; margin-top: .2rem; }
.pos .pextra { display: block; font-size: .72rem; color: #ffc9a3; font-weight: 700; margin-top: .2rem; }
.pos .pmove { display: block; margin-top: .35rem; font-size: .74rem; line-height: 1.35; }
.pos .pmove b { color: #9ec8ff; }
.pos .pmove i { display: block; color: var(--muted); font-style: normal; }
.ppick {
  flex: none; align-self: center;
  font: inherit; font-weight: 900; font-size: .82rem; cursor: pointer;
  padding: .5rem .75rem; border-radius: .6rem;
  color: #08240f; background: #6fe08f; border: 0;
}
.pos.picked .ppick { background: var(--gold); }
.posperks { margin: 0 0 .45rem; color: #9be8b4; font-weight: 700; font-size: .86rem; }
.posspec { margin: 0 0 .35rem; color: var(--gold); font-weight: 700; font-size: .86rem; line-height: 1.4; }
.posextra { margin: 0 0 .6rem; color: #ffc9a3; font-weight: 700; font-size: .86rem; line-height: 1.4; }
.posmove { margin: 0 0 .9rem; color: #9ec8ff; font-size: .88rem; line-height: 1.45; }

/* 🏆 The Boar Cup */
.cupnext {
  background: rgba(255, 215, 94, .12); border: 2px solid rgba(255, 215, 94, .45);
  border-radius: .8rem; padding: .6rem .75rem; margin: 0 0 .6rem;
}
.cupnext b { display: block; font-size: 1.05rem; }
.cupnext span { display: block; font-size: .8rem; color: var(--muted); margin-top: .15rem; line-height: 1.4; }
.cuptable {
  border: 2px solid var(--edge); border-radius: .8rem; overflow: hidden;
  margin: 0 0 .6rem; font-variant-numeric: tabular-nums;
}
.crow {
  display: grid; grid-template-columns: 1.6rem 1fr 1.5rem 1.5rem 1.5rem 1.5rem 2.1rem 2.2rem;
  align-items: center; gap: .1rem;
  padding: .38rem .5rem; font-size: .82rem;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.crow:first-child { border-top: 0; }
.crow span { text-align: center; }
.crow .cteam { text-align: left; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow .cpos { color: var(--muted); font-size: .72rem; }
.crow .cpts { font-weight: 900; }
.crow.chead { background: rgba(255, 255, 255, .08); color: var(--muted); font-size: .68rem;
  letter-spacing: .06em; text-transform: uppercase; }
.crow.chead .cteam { font-weight: 700; }
.crow.qual { background: rgba(111, 224, 143, .1); }
.crow.qual .cpos { color: #6fe08f; font-weight: 900; }
.crow.me { background: rgba(255, 215, 94, .16); }
.crow.me.qual { background: rgba(255, 215, 94, .2); }
.crow.me .cteam { color: var(--gold); }

/* 🤝 Squad */
.hint.tip {
  background: rgba(255, 215, 94, .12);
  border: 2px solid rgba(255, 215, 94, .35);
  border-radius: .7rem; padding: .5rem .65rem; margin: 0 0 .8rem;
}

.squad { display: grid; gap: .45rem; margin: 0 0 .6rem; }
.mate {
  display: flex; align-items: center; gap: .55rem; width: 100%;
  font: inherit; text-align: left; cursor: pointer;
  padding: .55rem .7rem;
  background: rgba(255, 255, 255, .06);
  border: 2px solid var(--edge); border-radius: .8rem; color: var(--ink);
}
.mate:hover { border-color: rgba(255, 255, 255, .34); }
.mate.playing { border-color: var(--gold); background: rgba(255, 215, 94, .14); }
.mate .mdot { width: 1.1rem; height: 1.1rem; border-radius: 50%; flex: none; border: 2px solid rgba(0,0,0,.35); }
.mate .micon { font-size: 1.25rem; flex: none; }
.mate .mbody { flex: 1; min-width: 0; }
.mate .mname { display: block; font-weight: 800; font-size: .95rem; }
.mate .mmeta { display: block; font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mate .mtag { flex: none; font-size: .64rem; font-weight: 900; letter-spacing: .1em; color: var(--muted); }
.mate.playing .mtag { color: var(--gold); }

.posrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin: 0 0 .6rem; }
.posbtn {
  font: inherit; cursor: pointer; padding: .45rem .2rem;
  background: rgba(255, 255, 255, .07);
  border: 2px solid var(--edge); border-radius: .7rem; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
}
.posbtn span { font-size: 1.15rem; line-height: 1; }
.posbtn i { font-style: normal; font-size: .64rem; font-weight: 800; color: var(--muted); }
.posbtn[aria-checked="true"] { border-color: var(--gold); background: rgba(255, 215, 94, .16); }
.posbtn[aria-checked="true"] i { color: var(--ink); }

/* Trophy cabinet */
.cabhead { margin: .2rem 0 .5rem; display: flex; align-items: baseline; gap: .5rem; }
.trophies { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .4rem; margin: 0 0 1rem; }
.trophy {
  display: flex; align-items: center; gap: .4rem;
  padding: .4rem .5rem; border-radius: .6rem;
  background: rgba(255, 255, 255, .05); border: 2px solid var(--edge);
  opacity: .55;
}
.trophy.got { opacity: 1; border-color: rgba(255, 215, 94, .55); background: rgba(255, 215, 94, .12); }
.trophy .ticon { font-size: 1.25rem; }
.trophy .tname2 { font-weight: 800; font-size: .74rem; line-height: 1.15; flex: 1; min-width: 0; }
.trophy .tneed { font-size: .62rem; color: var(--muted); white-space: nowrap; flex: none; }
.trophy.got .tneed { color: var(--gold); }

/* Server list */
.serverlist { display: grid; gap: .45rem; margin: 0 0 .8rem; max-height: 40vh; overflow-y: auto; }
.srv {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  font: inherit; text-align: left; cursor: pointer;
  padding: .6rem .7rem;
  background: rgba(255, 255, 255, .07);
  border: 2px solid var(--edge); border-radius: .8rem; color: var(--ink);
}
.srv:hover { border-color: var(--gold); }
.srv .sname { font-weight: 800; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv .smeta { font-size: .76rem; color: var(--muted); white-space: nowrap; }
.srv .lock { font-size: .95rem; }
.srv.full { opacity: .5; cursor: not-allowed; }
.empty { color: var(--muted); font-size: .88rem; text-align: center; padding: 1.2rem .5rem; }

.offline {
  background: rgba(255, 215, 94, .12);
  border: 2px solid rgba(255, 215, 94, .4);
  border-radius: .8rem; padding: .75rem .8rem; margin: 0 0 .9rem;
  font-size: .86rem; line-height: 1.45;
}
.offline.wrong { background: rgba(255, 143, 192, .14); border-color: rgba(255, 143, 192, .5); }
.offline p { margin: 0 0 .4rem; }
.offline p:last-child { margin: 0; }
code { background: rgba(0, 0, 0, .35); padding: .05rem .3rem; border-radius: .3rem; font-size: .9em; }

.joincode { display: flex; gap: .5rem; align-items: flex-end; margin: 0 0 .3rem; }
.joincode .btn { width: auto; margin: 0; padding: .6rem 1rem; }
#join-code { text-transform: uppercase; letter-spacing: .3em; text-align: center; }

.code-share {
  background: rgba(255, 255, 255, .08); border: 2px dashed var(--edge);
  border-radius: .7rem; padding: .5rem .7rem; margin: 0 0 .9rem;
  font-size: .86rem; text-align: center;
}
.code-share b { font-size: 1.3rem; letter-spacing: .3em; color: var(--gold); }

/* Lobby teams */
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: 0 0 .8rem; }
.teamcol {
  background: rgba(255, 255, 255, .06); border: 2px solid var(--edge);
  border-radius: .8rem; padding: .6rem .7rem;
}
.teamcol.pink { border-color: rgba(255, 143, 192, .45); }
.teamcol.brown { border-color: rgba(169, 113, 74, .5); }
.teamcol ul { list-style: none; margin: 0; padding: 0; min-height: 3.2rem; }
.teamcol li { font-size: .88rem; font-weight: 700; padding: .18rem 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.teamcol li .you { color: var(--gold); font-size: .7rem; letter-spacing: .1em; }
.teamcol li.bot { color: var(--muted); font-weight: 600; }

.bigscore { font-size: 3rem; font-weight: 900; margin: .2rem 0 .6rem; text-align: center; letter-spacing: .06em; }

.build {
  position: fixed; left: .6rem; bottom: .4rem; margin: 0; z-index: 12;
  font-size: .68rem; color: rgba(226, 255, 232, .38); pointer-events: none;
}

/* ---------------- Phone / short screens ---------------- */
@media (max-width: 30rem) {
  .panel { padding: 1.1rem 1rem 1rem; border-radius: .9rem; }
  .teams { grid-template-columns: 1fr; }
  /* On a phone the pigs already wear their names — keep the scoreboard tiny. */
  .tname { display: none; }
  .scoreboard { gap: .35rem; padding: .25rem .45rem; }
  .target { font-size: .58rem; }
  .hud { justify-content: flex-start; padding-left: .6rem; }
  .hud-quit { padding: .3rem .5rem; font-size: .7rem; }
  .hud-sound { right: 4.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .logo .ball { animation: none; }
  .banner span { animation: none; }
}


/* 👕 The club screen */
.clubtop { display: flex; justify-content: center; margin: .2rem 0 .6rem; }
#club-preview {
  width: min(90%, 19rem); height: auto;
  border-radius: .8rem;
  background: rgba(0, 0, 0, .25);
  border: 2px solid var(--edge);
}
.fieldlab { display: block; margin: .5rem 0 .25rem; font-size: .72rem; font-weight: 900; color: var(--muted); letter-spacing: .06em; }
#club-name {
  width: 100%; box-sizing: border-box;
  padding: .6rem .7rem; border-radius: .7rem;
  font: inherit; font-weight: 800; font-size: 1rem; color: inherit;
  background: rgba(255, 255, 255, .07); border: 2px solid var(--edge);
}
.pickrow-lab { margin: .5rem 0 .25rem; font-size: .72rem; font-weight: 800; color: var(--muted); letter-spacing: .05em; }
.pickrow { display: flex; flex-wrap: wrap; gap: .35rem; }
.pickrow button {
  cursor: pointer; font: inherit; font-weight: 800; font-size: .78rem; color: inherit;
  padding: .38rem .6rem; border-radius: .6rem;
  background: rgba(255, 255, 255, .06); border: 2px solid var(--edge);
}
.pickrow.icons button { font-size: 1.1rem; padding: .3rem .5rem; }
.pickrow button[aria-checked="true"] { border-color: rgba(111, 224, 143, .6); background: rgba(111, 224, 143, .14); }


/* 🎯 The training ground */
.drills { display: grid; gap: .5rem; margin: .5rem 0 .9rem; }
.drill {
  display: flex; align-items: flex-start; gap: .55rem; cursor: pointer;
  font: inherit; text-align: left; color: inherit;
  padding: .65rem .7rem; border-radius: .8rem;
  background: rgba(255, 255, 255, .06); border: 2px solid var(--edge);
}
.drill .dicon { font-size: 1.5rem; flex: none; line-height: 1.1; }
.drill .dbody { flex: 1; min-width: 0; }
.drill .dname { display: block; font-weight: 800; font-size: .95rem; }
.drill .dblurb { display: block; font-size: .78rem; color: var(--muted); line-height: 1.34; }
.drill .dneed { display: block; margin-top: .18rem; font-size: .72rem; font-weight: 800; color: #ffd75e; }
.drill .dmedal { flex: none; font-size: 1.4rem; }
.drill.gold { border-color: rgba(255, 215, 94, .65); background: rgba(255, 215, 94, .12); }
.drill.silver { border-color: rgba(210, 220, 235, .55); background: rgba(210, 220, 235, .09); }
.drill.bronze { border-color: rgba(205, 140, 90, .55); background: rgba(205, 140, 90, .1); }


/* 🌍 The online league table */
.leaguewrap { overflow-x: auto; margin: .3rem 0 .6rem; }
table.league { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.league th, table.league td { padding: .32rem .38rem; text-align: right; white-space: nowrap; }
table.league th { font-size: .68rem; color: var(--muted); letter-spacing: .05em; border-bottom: 2px solid var(--edge); }
table.league td.pos, table.league th.pos { width: 1.6rem; text-align: right; color: var(--muted); }
table.league td.club, table.league th.club { text-align: left; font-weight: 800; width: 99%; }
table.league td.pts { font-weight: 900; color: #ffd75e; }
table.league tbody tr:nth-child(even) { background: rgba(255, 255, 255, .04); }
table.league tbody tr.you { background: rgba(111, 224, 143, .14); outline: 2px solid rgba(111, 224, 143, .4); }
table.league tbody tr.you td.club::after { content: " — you"; font-weight: 700; color: #6fe08f; font-size: .74rem; }
.results { list-style: none; margin: .2rem 0 .6rem; padding: 0; font-size: .8rem; }
.results li { padding: .2rem 0; color: var(--muted); border-bottom: 1px solid rgba(255,255,255,.06); }
.results li b { color: #f2fff4; font-weight: 800; }


/* 🔁 The Pig Market */
.market { display: grid; gap: .4rem; margin: .35rem 0 .7rem; }
.market .empty { padding: .6rem; font-size: .82rem; color: var(--muted); text-align: center; }
.mkt {
  display: flex; align-items: center; gap: .5rem;
  padding: .55rem .6rem; border-radius: .8rem;
  background: rgba(255, 255, 255, .06); border: 2px solid var(--edge);
}
.mkt .mkdot { width: .9rem; height: .9rem; border-radius: 50%; flex: none; }
.mkt .mkicon { font-size: 1.15rem; flex: none; }
.mkt .mkbody { flex: 1; min-width: 0; }
.mkt .mkname { display: block; font-weight: 800; font-size: .88rem; }
.mkt .mkmeta { display: block; font-size: .72rem; color: var(--muted); line-height: 1.3; }
.mkt .mkstars { display: block; font-size: .74rem; color: #ffd75e; letter-spacing: .08em; }
.mkt .mkbtn {
  flex: none; cursor: pointer; font: inherit; font-weight: 800; font-size: .76rem;
  padding: .4rem .6rem; border-radius: .6rem; color: inherit;
  background: rgba(111, 224, 143, .16); border: 2px solid rgba(111, 224, 143, .5);
}
.mkt .mkbtn.sell { background: rgba(255, 158, 196, .14); border-color: rgba(255, 158, 196, .45); }
.mkt .mkbtn[disabled] { opacity: .4; cursor: not-allowed; }
.mkt.rich { border-color: rgba(255, 215, 94, .5); background: rgba(255, 215, 94, .09); }
