/* Pigball — a pinball table, so the canvas is PORTRAIT. Everything else on
   this shelf is landscape; this one is 480x720 and capped in width, because a
   tall thin table is the shape the game is. */

:root {
  --ink:   #f2eefb;
  --dim:   #a79ec0;
  --bg:    #140f1c;
  --panel: #211a2e;
  --line:  #3a2f4f;
  --hot:   #ffbe3d;
  --boar:  #c0392b;
  --pig:   #f2a0b6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 30;
  background: var(--hot); color: #241700; padding: .5rem .8rem; border-radius: 0 0 .5rem 0;
}
.skip-link:focus { left: 0; }

.bar {
  display: flex; align-items: center; gap: .9rem;
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--line);
  background: #150f1f70;
  position: sticky; top: 0; z-index: 8;
  backdrop-filter: blur(6px);
}
.bar h1 { font-size: 1.1rem; margin: 0; }
.bar .home { color: var(--dim); text-decoration: none; font-size: .9rem; }
.bar .home:hover { color: var(--ink); }
.bar .tag { margin: 0 0 0 auto; color: var(--dim); font-size: .78rem; }

main { padding: 1rem; max-width: 640px; margin: 0 auto; }

.screen { display: none; }
.screen.active { display: block; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.1rem 1.2rem;
}
.panel h2 { margin: 0 0 .4rem; }
.lede { color: var(--dim); margin: 0 0 1rem; }

.how { color: var(--dim); margin: 0; padding-left: 1.2rem; }
.how li { margin: .3rem 0; }
.how b { color: var(--ink); }
kbd {
  font: inherit; font-size: .85em; background: #30254a; color: var(--ink);
  border: 1px solid var(--line); border-radius: .35rem; padding: 0 .35rem;
}

.btn {
  font: inherit; color: var(--ink); cursor: pointer;
  background: #30254a; border: 1px solid var(--line);
  border-radius: .7rem; padding: .55rem .9rem;
}
.btn:hover:not(:disabled) { border-color: rgba(255,230,190,.5); }
.btn.big { background: var(--hot); color: #241700; font-weight: 800; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: .9rem; }

.hud { display: flex; gap: .5rem; align-items: center; margin-bottom: .6rem; flex-wrap: wrap; }
.pill {
  background: #2a2140; border: 1px solid var(--line);
  border-radius: 999px; padding: .25rem .7rem; font-weight: 800;
}
.pill.ghost { background: transparent; color: var(--dim); font-weight: 600; }
.hud .btn { margin-left: auto; }
/* 🔊 and ✕ sit together at the right end; only the first of them is pushed. */
.hud .btn + .btn { margin-left: 0; }
.how li.new::marker { color: var(--hot); }

/* ⚠️ A PORTRAIT CANVAS AT width:100% IS 1.5 SCREENS TALL ON A LAPTOP. The cap
   is what keeps the whole table visible without scrolling; the phone is the
   case that wants all the width it can get. */
canvas {
  display: block; margin: 0 auto;
  width: 100%; max-width: 400px; height: auto;
  background: #1b1428; border: 1px solid var(--line); border-radius: .8rem;
  touch-action: none;
}
.tip { color: var(--dim); font-size: .9rem; min-height: 1.5em; margin: .5rem 0 0; text-align: center; }

.facts { color: var(--dim); margin: .4rem 0 0; padding-left: 1.1rem; }
.facts li { margin: .15rem 0; }

.touchrow { display: flex; gap: .8rem; justify-content: center; margin-top: .7rem; }
.tbtn {
  font: inherit; font-size: 1.4rem; color: var(--ink); cursor: pointer;
  background: #30254a; border: 1px solid var(--line);
  border-radius: 999px; width: 4rem; height: 3.2rem;
  display: grid; place-items: center; user-select: none; touch-action: manipulation;
}
.tbtn.big { width: 6rem; background: var(--hot); color: #241700; border-color: transparent; }
.tbtn:active { transform: translateY(1px); }

@media (max-width: 560px) {
  main { padding: .6rem; }
  canvas { max-width: none; }
}

/* 🏆 the top ten — on the game-over screen and on its own from the title */
.board { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.board h3 { margin: 0 0 .4rem; font-size: 1rem; }
.lb-form p { margin: .2rem 0; color: var(--ink); }
.lb-form input {
  font: inherit; font-size: 1.3rem; font-weight: 800; letter-spacing: .3em; text-transform: uppercase;
  width: 6.2em; padding: .35rem .5rem; border-radius: .6rem;
  border: 2px solid var(--hot); background: #120c1a; color: var(--ink); text-align: center;
}
.lb-status { color: var(--dim); margin: .4rem 0; font-size: .9rem; }
.lb-status.bad { color: #ffb4a8; }
.lb-list { list-style: none; margin: .4rem 0 0; padding: 0; }
.lb-row, .lb-empty {
  display: grid; grid-template-columns: 2.2rem 3.4rem 1fr auto; gap: .5rem; align-items: center;
  padding: .3rem .5rem; border-radius: .5rem;
}
.lb-empty { display: block; color: var(--dim); }
.lb-row:nth-child(odd) { background: #ffffff08; }
.lb-row.top { background: #ffbe3d1f; }
.lb-row.mine { outline: 2px solid var(--hot); }
.lb-rank { text-align: center; color: var(--dim); font-weight: 700; }
.lb-who { font-weight: 800; letter-spacing: .12em; }
.lb-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.lb-note { color: var(--dim); font-size: .85rem; }

/* 🚀 THE TABLE PICKER (3 November 2026). Two big real buttons at the top of
   the title, where nobody can miss them; the picked one is lit. */
.tables { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin: .5rem 0 .4rem; }
.pick {
  position: relative; font: inherit; color: var(--ink); cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: .15rem;
  background: #2a1f3c; border: 2px solid var(--line); border-radius: .9rem; padding: .7rem .8rem;
}
.pick:hover { border-color: rgba(255,230,190,.5); }
.pick.on { border-color: var(--hot); box-shadow: 0 0 0 3px #ffbe3d33; background: #3a2a1f; }
.pick.space { background: linear-gradient(160deg, #0c1036, #2a0f4a); }
.pick.space.on { border-color: #7ff3ff; box-shadow: 0 0 0 3px #7ff3ff33, 0 0 18px #7ff3ff40; }
.pick-icon { font-size: 1.9rem; line-height: 1; }
.pick-name { font-weight: 900; font-size: 1.05rem; }
.pick-sub { color: var(--dim); font-size: .8rem; line-height: 1.3; }
.pick-best { font-weight: 800; font-size: .85rem; color: var(--hot); }
.pick.space .pick-best { color: #7ff3ff; }
.pick.haunt { background: linear-gradient(160deg, #0a0d1c, #12301c); }
.pick.haunt.on { border-color: #b6ff9a; box-shadow: 0 0 0 3px #b6ff9a33, 0 0 18px #b6ff9a40; }
.pick.haunt .pick-best { color: #b6ff9a; }
.pick.haunt .pick-new { background: #3fbf6a; }
body[data-table="haunt"] .btn.big#play { background: #b6ff9a; }
/* 🌋 four tables (v1.7): two rows of two below a tablet's width, so nothing is squeezed */
@media (max-width: 620px) {
  .tables { grid-template-columns: repeat(2, 1fr); }
}
/* a phone: two across still fits, with the small print left off */
@media (max-width: 480px) {
  .tables { gap: .4rem; }
  .pick { padding: .55rem .5rem; }
  .pick-sub { display: none; }
  .pick-name { font-size: .9rem; line-height: 1.15; }
  .pick-best { font-size: .75rem; }
}
.pick-new {
  position: absolute; top: -.55rem; right: .5rem;
  background: #ff4fd8; color: #fff; font-weight: 900; font-size: .72rem;
  padding: .05rem .45rem; border-radius: 999px; letter-spacing: .05em;
}
.pick-keys { color: var(--dim); font-size: .8rem; margin: 0 0 .7rem; }
body[data-table="space"] .btn.big#play { background: #7ff3ff; }

/* 🛟🫨🏆🎯 v1.6 (3 November 2026) ------------------------------------- */
.how-head { margin: .9rem 0 .2rem; font-size: 1rem; color: var(--hot); }
.how-new li::marker { color: #ff4fd8; }
.pill-mini {
  display: inline-block; margin-left: .3rem; padding: 0 .45rem; border-radius: 999px;
  background: #ffbe3d26; color: var(--hot); font-weight: 800; font-size: .8rem;
}
.btn.cab { border-color: #ffbe3d66; }
/* 🆕 the strip under the table picker */
.whatsnew {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin: 0 0 .8rem;
  padding: .55rem .7rem; border-radius: .8rem;
  background: linear-gradient(120deg, #3a1f3a, #2a1f3c 60%, #3a2a1f); border: 1px solid #ff4fd866;
}
.wn-tag { background: #ff4fd8; color: #fff; font-weight: 900; font-size: .72rem; padding: .05rem .5rem; border-radius: 999px; letter-spacing: .04em; }
.wn-text { font-size: .85rem; color: var(--ink); flex: 1 1 14rem; }
.whatsnew .btn.cab { background: #ffbe3d1a; }
/* 🫨 the nudge button: the same size as the flipper ones, painted like a warning */
.tbtn.nudge { background: #3b1f2a; border-color: #ff5a3c88; }
.tbtn { -webkit-touch-callout: none; -webkit-user-select: none; }

/* 🏅 the trophies won this game, on the game-over screen */
.over-trophies { margin-top: .8rem; padding: .6rem .8rem; border-radius: .8rem;
  background: linear-gradient(160deg, #3a2a1f, #2a1f3c); border: 1px solid #ffbe3d66; }
.over-trophies h3 { margin: 0 0 .3rem; font-size: 1rem; color: var(--hot); }
.over-trophy { margin: .15rem 0; }

/* 🏅 the cabinet: a shelf per table, a card per trophy */
.cabinet { display: flex; flex-direction: column; gap: .9rem; }
.shelf h3 { margin: 0 0 .4rem; font-size: 1rem; }
.shelf-farm h3 { color: var(--hot); }
.shelf-space h3 { color: #7ff3ff; }
.shelf-haunt h3 { color: #b6ff9a; }
.shelf-any h3 { color: #ff9be8; }
/* four a shelf: two rows of two, or one row of four where there is room — never three and an orphan */
.trophy-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
@media (min-width: 680px) { .trophy-grid { grid-template-columns: repeat(4, 1fr); } }
.trophy {
  display: flex; flex-direction: column; gap: .15rem; padding: .55rem .6rem; border-radius: .8rem;
  background: #1a1426; border: 1px dashed var(--line); color: var(--dim); min-height: 7.2rem;
}
.trophy .t-icon { font-size: 1.7rem; line-height: 1.1; filter: grayscale(1) opacity(.6); }
.trophy .t-name { color: var(--ink); font-size: .92rem; }
.trophy .t-what { font-size: .78rem; line-height: 1.3; }
.trophy .t-when { font-size: .74rem; margin-top: auto; }
.trophy.won {
  background: linear-gradient(160deg, #4a3414, #2a1f3c); border: 1px solid var(--hot);
  box-shadow: 0 0 0 2px #ffbe3d22, 0 0 14px #ffbe3d33; color: #f2e6cf;
}
.trophy.won .t-icon { filter: none; }
.trophy.won .t-when { color: var(--hot); font-weight: 800; }
.trophy .bar { display: block; height: 6px; border-radius: 99px; background: #2c2240; overflow: hidden; margin-top: auto; }
.trophy .bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffbe3d, #ff4fd8); }
@media (max-width: 480px) {
  .trophy-grid { gap: .4rem; }
  .trophy { min-height: 6.6rem; padding: .45rem .5rem; }
}

/* 🏅 the pop-up: slides down from the top of the screen, whatever screen it is */
.trophy-toast {
  position: fixed; left: 50%; top: .6rem; z-index: 40; transform: translate(-50%, -140%);
  display: flex; gap: .7rem; align-items: center; max-width: min(92vw, 420px);
  padding: .65rem .9rem; border-radius: 1rem;
  background: linear-gradient(160deg, #5a3c10, #2a1f3c); border: 2px solid var(--hot);
  box-shadow: 0 10px 30px #0009, 0 0 24px #ffbe3d55; color: var(--ink);
  transition: transform .35s cubic-bezier(.2, 1.4, .4, 1);
  pointer-events: none;
}
.trophy-toast.go { transform: translate(-50%, 0); }
.trophy-toast .tt-icon { font-size: 2.2rem; line-height: 1; }
.trophy-toast .tt-body { display: flex; flex-direction: column; gap: .1rem; font-size: .85rem; color: #f2e6cf; }
.trophy-toast .tt-body b { color: var(--hot); font-size: 1rem; }
.trophy-toast .tt-count { color: var(--dim); font-size: .75rem; }
@media (prefers-reduced-motion: reduce) { .trophy-toast { transition: none; } }
/* ⚠️ a class that sets display beats the hidden attribute, so say it out loud */
.trophy-toast[hidden], .over-trophies[hidden] { display: none !important; }

/* 🌋⬆️🧙👥🔥 v1.7 (7 November 2026) --------------------------------- */
.pick.volcano { background: linear-gradient(160deg, #2a0c06, #5a1a08); }
.pick.volcano.on { border-color: #ff9a3a; box-shadow: 0 0 0 3px #ff9a3a33, 0 0 18px #ff7a1a55; }
.pick.volcano .pick-best { color: #ffb02a; }
.pick.volcano .pick-new { background: #ff5a1a; }
body[data-table="volcano"] .btn.big#play { background: #ff9a3a; }
/* 👥 one player or two: two real buttons, the picked one lit */
.players { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 .5rem; }
.pl {
  position: relative; font: inherit; font-weight: 800; color: var(--ink); cursor: pointer;
  background: #2a1f3c; border: 2px solid var(--line); border-radius: .8rem; padding: .45rem .9rem;
}
.pl:hover { border-color: rgba(255,230,190,.5); }
.pl.on { border-color: var(--hot); background: #3a2a1f; box-shadow: 0 0 0 3px #ffbe3d33; }
.pl-new {
  position: absolute; top: -.6rem; right: .4rem;
  background: #ff4fd8; color: #fff; font-weight: 900; font-size: .65rem;
  padding: 0 .4rem; border-radius: 999px; letter-spacing: .05em;
}
.pl-keys { color: var(--dim); font-size: .8rem; }
/* 🧙 the picked table's mission lamps */
.wiz-lamps { margin: 0 0 .7rem; color: #ffb4ec; font-size: .9rem; font-weight: 700; }
.players-pill { color: #ffd84d; font-size: .85rem; }
.players-pill[hidden] { display: none !important; }
