/* =====================================================================
   POP: loud and cheerful. Every game is a tile in its own colour; thick ink
   outlines and hard offset shadows make everything look pressable, and
   pressing pushes it into its shadow. Bricolage Grotesque, condensed and
   heavy for headlines, normal width for reading.
   --pop-accent is the raw colour of the current game (pink on the home
   screen), used for fills with ink on top. --primary-strong is the same hue
   pulled dark enough to read as text on cream.
   Spec: docs/themes/pop.md
   ===================================================================== */
:root[data-theme="pop"] {
  color-scheme: light;
  --ink: #111; --cream: #fdf3e1; --lemon: #ffd23f; --pink: #ff5c8a; --well: #f4e7cc;
  --pop-accent: var(--pink);
  --press: 4px 4px 0 var(--ink);
  --bg: var(--cream); --surface: #fff; --surface-2: #fff4d4;
  --text: var(--ink); --muted: #3e392f; --faint: #685f50; --border: var(--ink); --rule: var(--ink);
  --accent: var(--pop-accent);
  --primary: var(--pop-accent); --primary-contrast: var(--ink);
  --primary-strong: color-mix(in oklab, var(--pop-accent) 60%, var(--ink));
  --primary-soft: color-mix(in srgb, var(--pop-accent) 30%, #fff);
  --danger: #d3263a; --danger-soft: #ffd3d3; --success: #0d8246;
  --radius: 18px; --r-ctl: 12px; --r-ctl-in: 9px; --r-dialog: 22px; --r-menu: 18px; --r-board: 12px; --r-cell: 5px; --r-pill: 999px;
  --bw: 2.5px;
  --content-w: 1000px;
  --shadow: var(--press);
  --dialog-shadow: 8px 8px 0 var(--ink);
  --menu-shadow: 6px 6px 0 var(--ink);
  --overlay: rgba(17, 17, 17, .45);
  --font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --toast-bg: var(--ink); --toast-fg: var(--cream); --toast-action: var(--lemon);
  --record-bg: var(--lemon); --record-fg: var(--ink);
  /* 2048 */
  --g-board: #fff; --g-slot: var(--well);
  --t2: #fff; --t4: #fff4d4; --t8: var(--lemon); --t16: #ffa657; --t32: #ff7b72; --t64: var(--pink);
  --t128: #f78fb3; --t256: #d2a8ff; --t512: #9d7bff; --t1024: #5ad1ff; --t2048: #7ee787;
  --t-ink: var(--ink); --t-paper: var(--ink);
  /* memory grid */
  --flash: var(--ink); --tile: #fff;
  /* card table: solid mint felt framed like a game board */
  --table-bg: #37d399;
  --table-frame: 0 0 0 3px var(--ink), 5px 5px 0 3px var(--ink);
  --slot-line: rgba(17, 17, 17, .5);
  --card-paper: #fff; --card-r: .09;
  --card-shadow: 0 0 0 1.5px var(--ink), 2px 2px 0 1.5px var(--ink);
  --court-panel: var(--lemon); --court-rule: inset 0 0 0 1.5px var(--ink);
  --suit-red: #dc2a40; --suit-black: var(--ink);
  --card-back-art: radial-gradient(rgba(17, 17, 17, .24) 1.2px, transparent 1.5px) 0 0 / 6px 6px, var(--pink);
  --back-edge: #fff; --back-edge-w: .06; --back-shadow: 0 0 0 1.5px var(--ink), 2px 2px 0 1.5px var(--ink);
}
@supports (color: oklch(from red l c h)) {
  :root[data-theme="pop"] { --primary-strong: oklch(from var(--pop-accent) min(l, .52) c h); }
}
[data-theme="pop"] body { font-weight: 450; }
[data-theme="pop"] ::selection { background: var(--lemon); }
/* the backdrop: stickers that bob and get shoved by the pointer (js/backdrops/pop.js); faint over the content column */
[data-theme="pop"] .backdrop { --veil: .25; }
[data-theme="pop"] :is(button, a, input):focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* anything pressable sinks into its shadow */
[data-theme="pop"] :is(.icon-btn, .theme-btn, .btn, .keypad button) {
  box-shadow: var(--press);
  transition: transform .08s var(--ease), box-shadow .08s var(--ease), var(--fade);
}
[data-theme="pop"] :is(.icon-btn, .theme-btn, .btn, .keypad button):active:not(:disabled) { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }

/* ---------- chrome ---------- */
[data-theme="pop"] .topbar { background: var(--cream); -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom: 3px solid var(--ink); gap: 8px; }
[data-theme="pop"] .brand { font-size: 1.3rem; font-weight: 800; font-stretch: 80%; letter-spacing: 0; text-transform: uppercase; }
[data-theme="pop"] body[data-route="home"] .brand { visibility: hidden; }
[data-theme="pop"] .icon-btn { border: 2.5px solid var(--ink); background: #fff; }
[data-theme="pop"] :is(.icon-btn, .theme-btn):hover { background: var(--lemon); }
[data-theme="pop"] .main-nav a { color: var(--ink); font-weight: 700; border-radius: var(--r-pill); }
[data-theme="pop"] .main-nav a:hover { background: var(--lemon); }
[data-theme="pop"] .main-nav a[aria-current="true"] { background: var(--ink); color: var(--cream); }
[data-theme="pop"] .theme-btn { border: 2.5px solid var(--ink); background: #fff; font-weight: 700; }
[data-theme="pop"] .theme-btn .theme-swatch { border-width: 2px; }
[data-theme="pop"] .theme-btn .chev { color: var(--ink); }
[data-theme="pop"] .topbar .lang-toggle { padding: 3px; background: #fff; border: 2.5px solid var(--ink); box-shadow: var(--press); }
[data-theme="pop"] .topbar .lang-toggle button { color: var(--ink); font-weight: 800; border: 0; }
[data-theme="pop"] .topbar .lang-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
[data-theme="pop"] .theme-menu { border: 3px solid var(--ink); animation-duration: .1s; }
[data-theme="pop"] .theme-opt { border-radius: 12px; }
[data-theme="pop"] .theme-opt strong { font-weight: 800; }
[data-theme="pop"] .theme-opt .ico { color: var(--ink); }
[data-theme="pop"] .theme-opt:focus-visible { box-shadow: inset 0 0 0 2.5px var(--ink); }
[data-theme="pop"] .theme-opt .apps i { border: 2px solid var(--ink); border-radius: 999px; color: var(--ink); background: #fff; }

/* ---------- controls ---------- */
[data-theme="pop"] .btn {
  border: 3px solid var(--ink); border-radius: 14px;
  background: #fff;
  font-weight: 800; font-stretch: 85%; letter-spacing: .04em; text-transform: uppercase;
}
[data-theme="pop"] .btn:hover:not(:disabled) { background: var(--surface-2); transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
[data-theme="pop"] .btn-primary, [data-theme="pop"] .btn-primary:hover:not(:disabled) { background: var(--primary); border-color: var(--ink); color: var(--ink); }
[data-theme="pop"] .btn-danger, [data-theme="pop"] .btn-danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--ink); }
[data-theme="pop"] .btn:disabled { box-shadow: none; }
[data-theme="pop"] .segmented { padding: 4px; background: #fff; border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: var(--press); }
[data-theme="pop"] .segmented button { border: 2px solid transparent; color: var(--ink); font-weight: 700; }
[data-theme="pop"] .segmented button:hover { background: var(--surface-2); }
[data-theme="pop"] .segmented button[aria-pressed="true"] { background: var(--primary); color: var(--ink); border-color: var(--ink); box-shadow: none; }
[data-theme="pop"] .stat { border: 2.5px solid var(--ink); background: #fff; box-shadow: 3px 3px 0 var(--ink); }
[data-theme="pop"] .stat-label { color: var(--muted); font-weight: 700; }
[data-theme="pop"] .stat-value { font-weight: 800; }
[data-theme="pop"] .tool { color: var(--ink); font-weight: 700; }
[data-theme="pop"] .tool:hover:not(:disabled) { background: var(--surface-2); }
[data-theme="pop"] .tool[aria-pressed="true"] { background: var(--primary); color: var(--ink); box-shadow: inset 0 0 0 2.5px var(--ink); }
[data-theme="pop"] .tool .badge { background: var(--ink); color: var(--cream); font-weight: 800; }
[data-theme="pop"] .hint-text { color: var(--muted); font-weight: 600; }
[data-theme="pop"] .field label { color: var(--ink); font-weight: 800; }
[data-theme="pop"] .field input { border: 2.5px solid var(--ink); background: #fff; }
[data-theme="pop"] .switch { width: 52px; height: 30px; background: #fff; box-shadow: inset 0 0 0 2.5px var(--ink), 3px 3px 0 var(--ink); }
[data-theme="pop"] .switch::before { top: 6px; left: 6px; width: 18px; height: 18px; background: var(--ink); box-shadow: none; }
[data-theme="pop"] .switch[aria-checked="true"] { background: var(--primary); box-shadow: inset 0 0 0 2.5px var(--ink), 3px 3px 0 var(--ink); }
[data-theme="pop"] .switch[aria-checked="true"]::before { transform: translateX(22px); background: #fff; box-shadow: 0 0 0 2.5px var(--ink); }
[data-theme="pop"] :is(.check input, .range) { accent-color: var(--ink); }

/* ---------- surfaces, dialog, toast ---------- */
[data-theme="pop"] .box { border: 3px solid var(--ink); background: #fff; box-shadow: 6px 6px 0 var(--ink); }
[data-theme="pop"] .box > h3 { font-size: 1.3rem; font-weight: 800; font-stretch: 80%; text-transform: uppercase; letter-spacing: 0; }
[data-theme="pop"] .dialog { border: 3px solid var(--ink); padding: 26px 24px 24px; }
[data-theme="pop"] .dialog h2, [data-theme="pop"] .settings-title { font-size: 2rem; font-weight: 800; font-stretch: 78%; line-height: .95; letter-spacing: 0; text-transform: uppercase; }
[data-theme="pop"] .dialog p { color: var(--muted); font-weight: 500; }
[data-theme="pop"] .rules { padding-left: 0; list-style: none; color: var(--ink); font-weight: 500; }
[data-theme="pop"] .rules li { position: relative; padding-left: 22px; }
[data-theme="pop"] .rules li::before {
  content: ""; position: absolute; left: 1px; top: .45em;
  width: 10px; height: 10px;
  border: 2px solid var(--ink); border-radius: 3px;
  background: var(--primary);
  transform: rotate(45deg);
}
[data-theme="pop"] .record { border: 2.5px solid var(--ink); font-weight: 800; box-shadow: 3px 3px 0 var(--ink); transform: rotate(-2deg); }
[data-theme="pop"] #toast { font-weight: 700; box-shadow: 5px 5px 0 var(--lemon); }
[data-theme="pop"] #toast:not(.show) { box-shadow: none; }
[data-theme="pop"] .install-banner {
  margin: 0 0 30px; padding: 18px 20px;
  border: 3px solid var(--ink); border-radius: 6px;
  background: var(--lemon);
  box-shadow: 6px 6px 0 var(--ink);
  transform: rotate(.8deg);
}
[data-theme="pop"] .install-banner strong { font-weight: 800; }
[data-theme="pop"] .install-banner span { color: var(--ink); }
[data-theme="pop"] .offline-badge { color: var(--ink); font-weight: 600; }
[data-theme="pop"] .offline-badge i { width: 10px; height: 10px; border: 2px solid var(--ink); }
[data-theme="pop"] .drawer { border-left: 3px solid var(--ink); box-shadow: -6px 0 0 var(--ink); }
[data-theme="pop"] .setting { border-top: 2.5px dashed var(--ink); }
[data-theme="pop"] .setting-text strong { font-weight: 800; }
[data-theme="pop"] .setting-text small { color: var(--muted); font-weight: 500; }
[data-theme="pop"] .icon-tile { border: 2.5px solid var(--ink); background: #fff; color: var(--ink); font-weight: 700; box-shadow: 3px 3px 0 var(--ink); }
[data-theme="pop"] .icon-tile .ico { stroke-width: 2.3; }
[data-theme="pop"] .swatch-item i { box-shadow: 0 0 0 2px var(--ink); }

/* ---------- home: a big condensed title, then a wall of colour tiles ---------- */
[data-theme="pop"] .home-hero { display: flex; flex-direction: column; align-items: flex-start; margin: 26px 0 22px; }
[data-theme="pop"] .hero-title {
  display: block; order: 1;
  margin-bottom: 20px;
  font-size: clamp(3.1rem, 12vw, 7rem); font-weight: 800; font-stretch: 75%;
  line-height: .9; letter-spacing: -.01em; text-transform: uppercase;
}
[data-theme="pop"] .hero-title span { display: inline-block; }
[data-theme="pop"] .hero-title span + span {
  margin-top: .08em; padding: .04em .12em 0;
  border: 3px solid var(--ink); border-radius: 16px;
  background: var(--pink);
  box-shadow: 6px 6px 0 var(--ink);
  transform: rotate(-2deg);
}
[data-theme="pop"] .intro { order: 2; max-width: 50ch; margin: 6px 0 0; color: var(--muted); font-size: 1.08rem; font-weight: 500; }
[data-theme="pop"] .hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; order: 3; margin-top: 34px; }
[data-theme="pop"] .hero-meta .meta-date { display: none; }
[data-theme="pop"] .meta-count {
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--ink); color: var(--cream);
  font-size: .92rem; font-weight: 800; font-stretch: 85%; letter-spacing: .06em; text-transform: uppercase;
  transform: rotate(-1.5deg);
}
[data-theme="pop"] .meta-note { color: var(--muted); font-size: .92rem; font-weight: 600; }

/* section heads: an ink pill, slightly tilted, with the count in a lemon disc */
[data-theme="pop"] .section-head { align-items: center; gap: 8px 14px; margin: 0 0 18px; }
[data-theme="pop"] .section-title {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 16px; border-radius: 999px;
  background: var(--ink); color: var(--cream);
  font-size: .92rem; font-weight: 800; font-stretch: 85%; letter-spacing: .06em; text-transform: uppercase;
  transform: rotate(-1.5deg);
}
/* the count sits inside the right end of the section pill */
[data-theme="pop"] .home-section .section-title { padding-right: 46px; }
[data-theme="pop"] .section-count { display: grid; place-items: center; position: relative; z-index: 1; min-width: 26px; height: 26px; padding: 0 6px; margin-left: -50px; border-radius: 999px; background: var(--lemon); color: var(--ink); font-size: .8rem; font-weight: 800; transform: rotate(-1.5deg) translateY(-1px); }
[data-theme="pop"] .section-note { color: var(--muted); font-weight: 500; }
[data-theme="pop"] .home-section + .home-section { margin-top: 40px; }

[data-theme="pop"] .game-list { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }
[data-theme="pop"] .game-card {
  position: relative;
  flex-direction: column; align-items: flex-start; gap: 14px;
  min-height: 196px; padding: 18px 18px 16px;
  border: 3px solid var(--ink); border-radius: 18px;
  background: var(--pop); color: var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  transition: transform .08s var(--ease), box-shadow .08s var(--ease), var(--fade);
}
[data-theme="pop"] .game-card:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); border-color: var(--ink); }
[data-theme="pop"] .game-card:active { transform: translate(5px, 5px); box-shadow: 1px 1px 0 var(--ink); }
[data-theme="pop"] .game-card:focus-visible { outline-offset: 4px; }
[data-theme="pop"] .game-card .game-icon {
  width: 56px; height: 56px;
  border: 2.5px solid var(--ink); border-radius: 14px;
  background: #fff; color: #fff;
  box-shadow: none;
}
[data-theme="pop"] .game-icon svg { width: 42px; height: 42px; }
[data-theme="pop"] .game-icon svg [fill="#fff"] { fill: var(--ink); }
[data-theme="pop"] .game-icon svg [stroke="#fff"] { stroke: var(--ink); }
[data-theme="pop"] .kind-line .game-card .game-icon { width: 48px; height: 48px; color: var(--ink); }
[data-theme="pop"] .kind-line .game-card .game-icon svg { width: 26px; height: 26px; stroke-width: 2.3; }
[data-theme="pop"] .game-meta { display: flex; flex-direction: column; flex: 1; width: 100%; }
[data-theme="pop"] .game-num {
  display: block; position: absolute; top: 12px; right: 16px;
  font-size: 2.1rem; font-weight: 800; font-stretch: 75%; line-height: 1;
  color: transparent; -webkit-text-stroke: 1.5px var(--ink);
}
[data-theme="pop"] .game-meta h3 { margin: 0 0 6px; font-size: 1.42rem; font-weight: 800; font-stretch: 82%; line-height: 1.02; letter-spacing: 0; }
[data-theme="pop"] .game-meta p { margin: 0 0 12px; color: var(--ink); font-size: .92rem; font-weight: 500; line-height: 1.35; }
[data-theme="pop"] .game-status {
  align-self: flex-start; margin-top: auto;
  padding: 3px 10px;
  border: 2px solid var(--ink); border-radius: 999px;
  background: #fff; color: var(--ink);
  font-size: .78rem; font-weight: 700;
}
/* art panels: the art sits where a line symbol would, a white box top left */
[data-theme="pop"] .kind-art .game-card { padding: 18px 18px 16px; }
[data-theme="pop"] .kind-art .game-card .game-icon { width: 150px; height: 96px; aspect-ratio: auto; background: #fff; --art-scale: .58; }
[data-theme="pop"] .kind-art .game-card .game-meta { padding: 0; }
[data-theme="pop"] .home-footer { margin-top: 34px; }
[data-theme="pop"] .icon-list .game-card { min-height: 0; }
[data-theme="pop"] .icon-list .game-num { display: none; }

/* ---------- footer ---------- */
[data-theme="pop"] .site-footer { border-top: 3px solid var(--ink); color: var(--ink); font-weight: 500; }
[data-theme="pop"] .footer-brand { font-size: 1.3rem; font-weight: 800; font-stretch: 80%; text-transform: uppercase; }
[data-theme="pop"] .footer-links a { font-weight: 700; }
[data-theme="pop"] .footer-links a:hover { background: var(--lemon); text-decoration: none; }

/* ---------- game pieces ---------- */
[data-theme="pop"] .g2048-board { border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); }
[data-theme="pop"] .g2048-board > div { font-stretch: 80%; }
[data-theme="pop"] .g2048-board > div[class] { border: 2.5px solid var(--ink); }
[data-theme="pop"] .mem-grid i { border: 2.5px solid var(--ink); }
[data-theme="pop"] .keypad button { border: 2.5px solid var(--ink); background: #fff; font-weight: 800; }
[data-theme="pop"] .keypad button:hover { background: var(--surface-2); }
[data-theme="pop"] .keypad button.accent { background: var(--primary); color: var(--ink); border-color: var(--ink); }
[data-theme="pop"] .table { margin: 10px 15px 15px 10px; border-radius: 18px; }
[data-theme="pop"] .slot { box-shadow: none; outline: 2px dashed var(--slot-line); outline-offset: -2px; }
[data-theme="pop"] .idx b, [data-theme="pop"] .court .mid b { font-weight: 800; font-stretch: 80%; }
[data-theme="pop"] .card.sel .face { box-shadow: 0 0 0 2px var(--ink), 0 0 0 5px var(--lemon), 0 0 0 7px var(--ink); }

@media (max-width: 560px) {
  [data-theme="pop"] .game-card { min-height: 0; }
  [data-theme="pop"] .hero-title span + span { border-radius: 12px; box-shadow: 4px 4px 0 var(--ink); }
}
@media (prefers-reduced-motion: reduce) {
  [data-theme="pop"] :is(.btn, .icon-btn, .theme-btn, .keypad button, .game-card) { transition: none; }
}

/* ---------- hover: everything clickable has to visibly react ---------- */
[data-theme="pop"] :is(.switch, .range):hover, [data-theme="pop"] .check:hover input { outline: 2.5px solid var(--ink); }
[data-theme="pop"] :is(.segmented button:not([aria-pressed="true"]), .tool:not(:disabled, [aria-pressed="true"]), .keypad button, .theme-opt):hover { background: var(--lemon); }
