/* =========================================================
   SLAP CITY — STYLES (V2, mobile-first)
   Street-poster look: asphalt black, graffiti yellow, sticker
   buttons with hard shadows. Portrait phone is the base layout;
   landscape / desktop layer on top.
   ========================================================= */
:root {
  color-scheme: dark;
  --ink: #0b0a0f;
  --ink-2: #16131f;
  --ink-3: #221d30;
  --paper: #fff8e7;
  --muted: #b9b0c9;
  --yellow: #ffd23f;
  --orange: #ff8a00;
  --red: #ff3b3b;
  --green: #35ff6b;
  --blue: #2f8bff;
  --purple: #b34dff;
  --display: "Bangers", "Impact", "Arial Black", sans-serif;
  --ui: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--ink); color: var(--paper);
  font-family: var(--ui);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  touch-action: none;
}
#app { position: fixed; inset: 0; overflow: hidden; background: var(--ink); }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
[hidden] { display: none !important; }

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--display);
  font-size: clamp(17px, 2.4vmin + 8px, 24px);
  letter-spacing: 0.06em;
  padding: 0.5em 1em 0.4em;
  min-height: 48px;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid #000;
  border-radius: 8px;
  box-shadow: 4px 4px 0 #000;
  transform: skew(-6deg);
  transition: transform 0.09s ease, box-shadow 0.09s ease, background 0.12s;
  white-space: nowrap;
}
@media (hover: hover) { .btn:hover { background: #fff; transform: skew(-6deg) translate(-1px, -2px); box-shadow: 5px 6px 0 #000; } }
.btn:active { transform: skew(-6deg) translate(3px, 3px) scale(0.98); box-shadow: 1px 1px 0 #000; }
.btn-play {
  background: var(--yellow);
  font-size: clamp(28px, 5vmin + 12px, 46px);
  padding: 0.28em 1.4em 0.18em;
  box-shadow: 6px 6px 0 #000;
  animation: breathe 2.4s ease-in-out infinite;
}
@media (hover: hover) { .btn-play:hover { background: #ffe07a; } }
@keyframes breathe { 0%, 100% { transform: skew(-6deg) scale(1); } 50% { transform: skew(-6deg) scale(1.035); } }
.btn-go { background: var(--yellow); }
.btn-small { font-size: 16px; min-height: 40px; padding: 0.35em 0.8em 0.25em; background: var(--ink-3); color: var(--muted); }
@media (hover: hover) { .btn-small:hover { background: #3a2f4f; color: var(--paper); } }
.btn-small.armed { background: var(--red); color: #fff; }
.link-btn { background: none; border: 0; color: var(--muted); font-weight: 800; letter-spacing: 0.12em; font-size: 15px; padding: 8px 4px; text-decoration: underline; text-underline-offset: 4px; }

.icon-btn {
  font-family: var(--ui); font-weight: 800; font-size: 14px; letter-spacing: 0.08em;
  background: rgba(11,10,15,0.65); border: 2px solid rgba(255,255,255,0.3); color: var(--paper);
  border-radius: 999px; padding: 6px 12px; min-width: 40px; min-height: 36px;
}

/* ---------- screens & transitions ---------- */
.screen {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: calc(12px + var(--safe-t)) calc(16px + var(--safe-r)) calc(12px + var(--safe-b)) calc(16px + var(--safe-l));
}
.screen.enter { animation: screenIn 0.28s cubic-bezier(.2,1.2,.4,1) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- loading ---------- */
#screen-loading { z-index: 60; background: radial-gradient(ellipse at 50% 40%, #2a1d44 0%, var(--ink) 70%); }
.load-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; width: min(420px, 100%); text-align: center; }
.load-title { font-family: var(--display); font-size: 26px; letter-spacing: 0.08em; color: var(--yellow); text-shadow: 3px 3px 0 #000; }
.load-bar { width: 100%; height: 18px; border: 3px solid #000; border-radius: 999px; background: #1a1624; box-shadow: 4px 4px 0 #000; overflow: hidden; }
#load-fill { height: 100%; width: 0%; background: repeating-linear-gradient(-45deg, var(--yellow) 0 12px, var(--orange) 12px 24px); transition: width 0.2s ease; animation: barslide 0.8s linear infinite; background-size: 34px 100%; }
@keyframes barslide { to { background-position: 34px 0; } }
.load-msg { font-weight: 800; letter-spacing: 0.14em; font-size: 15px; color: var(--muted); min-height: 1.3em; }

/* ---------- logo ---------- */
.logo { position: relative; line-height: 0.82; transform: rotate(-4deg); margin-top: 0.35em; text-align: center; }
.logo .crown { position: absolute; width: 22%; left: 38%; top: -20%; filter: drop-shadow(3px 3px 0 #000); animation: crownbob 2.6s ease-in-out infinite; }
@keyframes crownbob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5px) rotate(3deg); } }
.logo-slap, .logo-city {
  font-family: var(--display);
  font-size: clamp(64px, 21vw, 150px);
  letter-spacing: 0.02em;
  -webkit-text-stroke: 0.06em #000;
  paint-order: stroke fill;
  text-shadow: 0.06em 0.07em 0 #000, 0 0 30px rgba(255,138,0,0.35);
}
.logo-slap { background: linear-gradient(180deg, #ffe86b 0%, #ffb000 55%, #ff6a00 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.logo-city { margin-left: 0.4em; background: linear-gradient(180deg, #ffffff 0%, #c9c9d1 60%, #8a8a99 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.logo-sm .logo-slap, .logo-sm .logo-city { font-size: clamp(56px, 16vw, 110px); }

/* ---------- start (portrait-first) ---------- */
#screen-start {
  align-items: stretch;
  background: linear-gradient(180deg, rgba(11,10,15,0.55) 0%, rgba(11,10,15,0.05) 38%, rgba(11,10,15,0.2) 55%, rgba(11,10,15,0.94) 78%);
}
.start-wrap {
  width: 100%; max-width: 560px; margin: 0 auto; padding-top: clamp(24px, 5vh, 56px);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 10px;
}
.tagline { display: flex; flex-direction: column; align-items: center; font-family: var(--display); font-size: clamp(17px, 4.6vw, 28px); letter-spacing: 0.05em; line-height: 1.05; text-shadow: 2px 2px 0 #000, 0 0 12px rgba(0,0,0,0.6); }
.tagline .y { color: var(--yellow); }
.menu { display: flex; flex-direction: column; gap: 12px; align-items: stretch; width: 100%; }
.menu .btn-play { align-self: stretch; }
.pick-chip {
  align-self: center;
  font-weight: 800; letter-spacing: 0.12em; font-size: 14px;
  background: #000; color: var(--yellow); padding: 5px 12px; border-radius: 4px;
  border-left: 4px solid var(--red);
}
.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.menu-grid .btn { width: 100%; }
.start-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.best-line { font-weight: 800; letter-spacing: 0.14em; color: var(--muted); font-size: 15px; }
.best-line span { color: var(--yellow); font-variant-numeric: tabular-nums; }

@media (min-aspect-ratio: 1/1) {
  #screen-start { align-items: center; justify-content: flex-start; background: linear-gradient(90deg, rgba(11,10,15,0.92) 0%, rgba(11,10,15,0.72) 38%, rgba(11,10,15,0) 70%); }
  .start-wrap { margin: 0; align-items: flex-start; justify-content: center; padding-left: clamp(0px, 3vw, 48px); padding-top: 0; gap: clamp(8px, 2vmin, 16px); max-width: 520px; }
  .logo { text-align: left; }
  .logo-slap, .logo-city { font-size: clamp(56px, 17vmin, 150px); }
  .tagline { align-items: flex-start; font-size: clamp(16px, 3.6vmin, 28px); }
  .pick-chip { align-self: flex-start; }
}

/* ---------- panels ---------- */
.panel-screen { background: rgba(8,6,14,0.8); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.panel {
  width: min(1040px, 100%); max-height: 100%;
  display: flex; flex-direction: column;
  background: linear-gradient(160deg, var(--ink-2), var(--ink));
  border: 3px solid #000; border-radius: 12px;
  box-shadow: 8px 8px 0 #000, 0 0 0 2px rgba(255,210,63,0.25) inset;
  overflow: hidden;
}
.panel-head {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 3px solid #000;
  background: repeating-linear-gradient(-45deg, #1d1828 0 14px, #19151f 14px 28px);
}
.panel-head h2 {
  margin: 0; font-family: var(--display); font-weight: 400;
  font-size: clamp(20px, 3.6vmin + 8px, 40px); letter-spacing: 0.05em; color: var(--yellow);
  text-shadow: 3px 3px 0 #000; text-align: center; text-wrap: balance; line-height: 1;
}
.panel-head .btn { font-size: 16px; min-height: 42px; padding: 0.4em 0.7em 0.3em; }
.panel-body { padding: 14px; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.sub-head { font-family: var(--display); font-weight: 400; letter-spacing: 0.06em; font-size: 24px; margin: 20px 0 10px; color: var(--paper); }
.sub-head small { font-family: var(--ui); font-size: 13px; letter-spacing: 0.12em; color: var(--muted); margin-left: 8px; text-transform: uppercase; }
.note { color: var(--muted); font-size: 15px; font-weight: 500; line-height: 1.4; max-width: 70ch; }

/* ---------- character showcase ---------- */
.showcase {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: center; gap: 12px;
  border: 3px solid #000; border-radius: 10px; margin-bottom: 14px; overflow: hidden;
  background: radial-gradient(ellipse at 30% 60%, rgba(255,255,255,0.08), transparent 60%), var(--ink-3);
  box-shadow: 4px 4px 0 #000;
}
#showcase-canvas { width: 100%; aspect-ratio: 1 / 1.1; display: block; max-width: 100%; }
.showcase-info { padding: 10px 12px 10px 0; display: flex; flex-direction: column; gap: 4px; }
.showcase-city { font-weight: 800; letter-spacing: 0.18em; font-size: 14px; color: var(--muted); }
.showcase-name { font-family: var(--display); font-size: clamp(40px, 11vw, 72px); line-height: 0.9; letter-spacing: 0.03em; text-shadow: 4px 4px 0 #000; }
.showcase-tag { font-size: 17px; font-weight: 700; color: var(--paper); line-height: 1.25; }
.badge-free { align-self: flex-start; margin-top: 6px; font-weight: 800; letter-spacing: 0.16em; font-size: 14px; padding: 4px 12px; border: 2px solid #000; border-radius: 4px; background: #1f9d45; color: #fff; }

/* cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 12px; }
.card {
  position: relative; display: flex; flex-direction: column; align-items: stretch;
  border: 3px solid #000; border-radius: 10px; overflow: hidden;
  background: var(--ink-3); box-shadow: 4px 4px 0 #000; text-align: center;
  transition: transform 0.12s ease;
  padding: 0;
}
@media (hover: hover) { .card:hover { transform: translateY(-3px) rotate(-0.6deg); } }
.card:active { transform: scale(0.97); }
.card canvas, .card .city-art { width: 100%; aspect-ratio: 1 / 1; display: block; max-width: 100%; }
.card .card-name { font-family: var(--display); font-size: 26px; letter-spacing: 0.04em; line-height: 1; padding: 8px 6px 0; text-shadow: 2px 2px 0 #000; }
.card .card-city { font-weight: 800; font-size: 13px; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; padding: 2px 6px 0; }
.card .card-tag { font-size: 14px; color: var(--paper); padding: 4px 8px 0; min-height: 2.6em; line-height: 1.25; font-weight: 500; }
.card .badge {
  margin: 8px 10px 10px; font-weight: 800; letter-spacing: 0.14em; font-size: 14px;
  padding: 5px 0; border-radius: 4px; background: #1f9d45; color: #fff; border: 2px solid #000;
}
.card.selected { outline: 4px solid var(--yellow); outline-offset: 0; }
.card.selected .badge { background: var(--yellow); color: #000; }
.card.selected::after {
  content: "SELECTED"; position: absolute; top: 9px; right: -30px; transform: rotate(35deg);
  background: var(--yellow); color: #000; font-weight: 800; font-size: 11px; letter-spacing: 0.14em; padding: 2px 34px;
  border-top: 2px solid #000; border-bottom: 2px solid #000;
}
.card.locked { background: #120f19; }
.card.locked .card-name { font-size: 19px; color: var(--muted); }
.card .buy {
  margin: 8px 10px 10px; font-family: var(--ui); font-weight: 800; font-size: 13px; letter-spacing: 0.06em;
  padding: 6px 4px; border-radius: 4px; border: 2px solid #000; background: var(--orange); color: #000;
}
.card .lock-icon { position: absolute; top: 36%; left: 50%; transform: translate(-50%, -50%); font-size: 34px; filter: drop-shadow(2px 2px 0 #000); }
.city-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.city-art { position: relative; overflow: hidden; }
.city-art .city-emoji { position: absolute; left: 10px; top: 8px; font-size: 26px; }
.city-art .city-skyline { position: absolute; left: 0; right: 0; bottom: 0; height: 60%; width: 100%; }
.card.soon { filter: grayscale(0.85); opacity: 0.8; }
.card.soon .badge { background: #3a3448; color: var(--muted); }

/* leaderboard */
.table-wrap { overflow-x: auto; border: 3px solid #000; border-radius: 8px; touch-action: pan-x pan-y; }
.lb { width: 100%; border-collapse: collapse; font-size: 17px; font-weight: 700; min-width: 520px; }
.lb th { text-align: left; font-weight: 800; font-size: 13px; letter-spacing: 0.14em; color: var(--muted); background: #000; padding: 8px 10px; }
.lb td { padding: 9px 10px; border-top: 1px solid #2a2438; }
.lb .num { text-align: right; font-variant-numeric: tabular-nums; }
.lb tr:nth-child(1) td { color: var(--yellow); font-size: 20px; }
.lb tr:nth-child(2) td, .lb tr:nth-child(3) td { color: #fff; }
.lb tr.me td { background: rgba(255,210,63,0.12); }
.lb .rank { font-family: var(--display); font-size: 22px; font-weight: 400; width: 40px; }
.lb .empty { text-align: center; color: var(--muted); padding: 26px; font-weight: 600; }

/* settings */
.settings { display: flex; flex-direction: column; gap: 10px; }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, 160px) auto; align-items: center; gap: 12px; padding: 10px 12px; background: var(--ink-3); border: 2px solid #000; border-radius: 8px; }
.set-block { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--ink-3); border: 2px solid #000; border-radius: 8px; }
.set-label { display: flex; flex-direction: column; }
.set-label b { font-family: var(--display); font-weight: 400; font-size: 22px; letter-spacing: 0.05em; }
.set-label small { color: var(--muted); font-size: 14px; font-weight: 600; }
.switch { position: relative; width: 58px; height: 32px; border-radius: 999px; border: 3px solid #000; background: #3a3448; padding: 0; transition: background 0.15s; }
.switch i { position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 2px 2px 0 #000; transition: transform 0.15s cubic-bezier(.3,1.6,.5,1); }
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"] i { transform: translateX(26px); }
input[type=range] { width: 100%; accent-color: var(--yellow); height: 28px; touch-action: pan-x; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 3px solid #000; border-radius: 8px; overflow: hidden; }
.seg button { background: #1a1624; color: var(--muted); border: 0; border-right: 2px solid #000; padding: 10px 4px; min-height: 44px; font-weight: 800; letter-spacing: 0.06em; font-size: 15px; }
.seg button:last-child { border-right: 0; }
.seg button[aria-checked="true"] { background: var(--yellow); color: #000; }
.set-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.version { font-size: 13px; }

/* how to */
.howto-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.how { background: var(--ink-3); border: 3px solid #000; border-radius: 8px; padding: 12px 14px; box-shadow: 4px 4px 0 #000; }
.how h4 { margin: 0 0 6px; font-family: var(--display); font-weight: 400; font-size: 28px; letter-spacing: 0.05em; color: var(--yellow); }
.how p { margin: 0 0 8px; line-height: 1.35; font-size: 16px; font-weight: 500; }
.how .keys { color: var(--muted); }
.g { color: var(--green); } .y { color: var(--yellow); }
kbd { font-family: var(--ui); font-weight: 800; background: #000; border: 1px solid #555; border-bottom-width: 3px; border-radius: 4px; padding: 0 6px; color: var(--paper); font-size: 14px; }
.hearts-demo { font-size: 22px; }

/* modals */
#screen-pause, #screen-over { background: rgba(8,6,14,0.55); }
.modal {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: linear-gradient(160deg, var(--ink-2), var(--ink));
  border: 3px solid #000; border-radius: 12px; box-shadow: 8px 8px 0 #000;
  padding: 18px 20px; max-height: 100%; overflow-y: auto; width: min(560px, 100%);
  touch-action: pan-y;
}
.modal h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(38px, 9vmin, 60px); letter-spacing: 0.04em; color: var(--yellow); text-shadow: 4px 4px 0 #000; }
#screen-pause .modal .btn { width: 100%; max-width: 300px; }
.over-left, .over-right { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.over-title { color: var(--red) !important; transform: rotate(-3deg); }
.new-best { font-family: var(--display); font-size: 24px; letter-spacing: 0.08em; color: #000; background: var(--yellow); padding: 2px 14px; border: 2px solid #000; animation: wobble 0.6s ease-in-out infinite alternate; }
@keyframes wobble { from { transform: rotate(-2deg) scale(1); } to { transform: rotate(2deg) scale(1.08); } }
.total { text-align: center; }
.total-label { font-weight: 800; letter-spacing: 0.18em; font-size: 13px; color: var(--muted); }
.total-num { font-family: var(--display); font-size: clamp(50px, 12vmin, 80px); line-height: 1; color: #fff; text-shadow: 4px 4px 0 #000; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; width: 100%; }
.stats > div { background: var(--ink-3); border: 2px solid #000; border-radius: 6px; padding: 6px 4px; text-align: center; }
.stats dt { font-weight: 800; font-size: 11px; letter-spacing: 0.12em; color: var(--muted); }
.stats dd { margin: 0; font-family: var(--display); font-size: 26px; font-variant-numeric: tabular-nums; }
.name-row { width: 100%; display: flex; flex-direction: column; gap: 4px; }
.name-row label { font-weight: 800; font-size: 12px; letter-spacing: 0.16em; color: var(--muted); }
.name-input { display: flex; gap: 8px; align-items: center; }
.name-input input {
  flex: 1; min-width: 0; font-family: var(--display); font-size: 24px; letter-spacing: 0.06em; text-transform: uppercase;
  background: #000; color: var(--yellow); border: 2px solid #3a3448; border-radius: 6px; padding: 6px 10px;
  -webkit-user-select: text; user-select: text; touch-action: manipulation;
}
.rank-badge { font-weight: 800; letter-spacing: 0.1em; font-size: 14px; color: var(--green); white-space: nowrap; }
.over-buttons { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.over-buttons .btn-play { width: 100%; max-width: 360px; }
.over-buttons .menu-grid { width: 100%; }
.over-buttons .menu-grid .btn { font-size: 16px; white-space: normal; line-height: 1.05; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- HUD ---------- */
#hud {
  position: absolute; left: 0; right: 0; top: 0; z-index: 10; pointer-events: none;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start;
  padding: calc(8px + var(--safe-t)) calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l));
  font-family: var(--display); letter-spacing: 0.05em;
  background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0));
}
.hud-left { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hud-center { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.hud-right { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; transform-origin: right top; }
.hud-label { font-family: var(--ui); font-weight: 800; font-size: 12px; letter-spacing: 0.2em; color: var(--muted); text-shadow: 1px 1px 0 #000; }
.hearts { font-size: clamp(20px, 3.6vmin + 6px, 32px); line-height: 1; letter-spacing: 1px; filter: drop-shadow(2px 2px 0 #000); display: flex; }
.hearts span { display: inline-block; }
.hearts .gone { filter: grayscale(1) brightness(0.4); opacity: 0.55; }
.hearts .lost { animation: heartlost 0.6s ease; }
.hearts.low span:not(.gone) { animation: heartbeat 0.8s ease-in-out infinite; }
@keyframes heartlost { 0% { transform: scale(1.9) rotate(-15deg); filter: none; } 100% { transform: scale(1); } }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 20% { transform: scale(1.25); } 40% { transform: scale(1); } }
.pause-btn { pointer-events: auto; font-size: 13px; padding: 4px 10px; min-height: 32px; }
.hud-score { font-size: clamp(30px, 6vmin + 10px, 50px); color: #fff; -webkit-text-stroke: 6px #000; paint-order: stroke fill; font-variant-numeric: tabular-nums; }
.hud-score.bump { animation: scorebump 0.25s ease; }
@keyframes scorebump { 0% { transform: scale(1.25); color: var(--yellow); } 100% { transform: scale(1); } }
.hud-dist { font-family: var(--ui); font-weight: 800; font-size: 14px; letter-spacing: 0.12em; color: var(--paper); text-shadow: 1px 1px 0 #000, 0 0 6px #000; margin-top: 2px; font-variant-numeric: tabular-nums; }
.hud-mult { font-size: clamp(30px, 6vmin + 10px, 50px); color: var(--yellow); -webkit-text-stroke: 6px #000; paint-order: stroke fill; }
.pips { display: flex; gap: 3px; margin-top: 4px; }
.pips i { width: 12px; height: 7px; border-radius: 2px; background: rgba(255,255,255,0.18); border: 1px solid #000; }
.pips i.on { background: var(--yellow); }
.hud-right.fire .pips i.on { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.hud-right.pulse { animation: combopulse 0.35s ease; }
.hud-right.fire .hud-mult { color: var(--orange); animation: firepulse 0.5s ease-in-out infinite alternate; }
@keyframes combopulse { 0% { transform: scale(1.5) rotate(4deg); } 100% { transform: scale(1); } }
@keyframes firepulse { from { transform: scale(1); text-shadow: 0 0 8px #ff5a00; } to { transform: scale(1.12); text-shadow: 0 0 22px #ffd23f; } }

#pop {
  position: absolute; left: 50%; top: 27%; z-index: 11; pointer-events: none;
  transform: translate(-50%, -50%); opacity: 0;
  font-family: var(--display); font-size: clamp(34px, 9vmin, 76px); letter-spacing: 0.04em; white-space: nowrap;
  color: #fff; -webkit-text-stroke: 7px #000; paint-order: stroke fill;
  text-shadow: 5px 5px 0 #000;
}
#pop.show { animation: pop 0.72s cubic-bezier(.2,1.6,.4,1) forwards; }
#pop.slap { color: var(--yellow); }
#pop.perfect { color: var(--green); font-size: clamp(34px, 9vmin, 80px); }
#pop.count { color: #fff; font-size: clamp(70px, 20vmin, 150px); animation-duration: 0.7s; }
#pop.go { color: var(--yellow); }
#pop.over { color: var(--red); font-size: clamp(54px, 14vmin, 120px); animation: popstay 1.4s cubic-bezier(.2,1.6,.4,1) forwards; }
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(-8deg); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(3deg); }
  32% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); }
  78% { opacity: 1; transform: translate(-50%, -58%) scale(1) rotate(-2deg); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(0.9) rotate(-2deg); }
}
@keyframes popstay {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(-8deg); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(-4deg); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-4deg); }
}

#banner {
  position: absolute; left: 50%; top: calc(88px + var(--safe-t)); z-index: 11; pointer-events: none;
  transform: translate(-50%, -140%); opacity: 0;
  font-family: var(--display); font-size: clamp(20px, 5vmin, 40px); letter-spacing: 0.05em; white-space: nowrap;
  padding: 4px 18px 2px; border: 3px solid #000; border-radius: 6px; box-shadow: 4px 4px 0 #000;
  background: var(--yellow); color: #000;
}
#banner.show { animation: banner 1.5s ease forwards; }
#banner.fire { background: linear-gradient(90deg, #ff3b00, #ffb000, #ff3b00); background-size: 200% 100%; color: #fff; -webkit-text-stroke: 4px #000; paint-order: stroke fill; }
#banner.fire.show { animation: banner 2.2s ease forwards, fireslide 0.6s linear infinite; }
#banner.lost { background: #3a3448; color: #fff; }
#banner.level { background: var(--blue); color: #fff; -webkit-text-stroke: 4px #000; paint-order: stroke fill; }
@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -60%) scale(0.7); }
  12% { opacity: 1; transform: translate(-50%, 0) scale(1.08); }
  20% { transform: translate(-50%, 0) scale(1); }
  82% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -60%); }
}
@keyframes fireslide { from { background-position: 0 0; } to { background-position: 200% 0; } }

/* tutorial hint */
#hint {
  position: absolute; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%); z-index: 12; pointer-events: none;
  font-family: var(--display); font-size: clamp(24px, 6vmin, 40px); letter-spacing: 0.05em; white-space: nowrap;
  background: #000; color: var(--green); border: 3px solid var(--green); border-radius: 10px; padding: 6px 18px 4px;
  box-shadow: 0 0 24px rgba(53,255,107,0.35); animation: hintpulse 0.8s ease-in-out infinite alternate;
}
#hint.warn { color: var(--yellow); border-color: var(--yellow); box-shadow: 0 0 24px rgba(255,210,63,0.35); }
@keyframes hintpulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.07); } }

/* ---------- touch controls (portrait: one row across the bottom) ---------- */
#controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 12; pointer-events: none;
  display: grid; grid-template-columns: 1fr 1.7fr 1fr; gap: 10px; align-items: end;
  padding: 0 calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l));
}
.ctrl-btn {
  pointer-events: auto; touch-action: none;
  height: clamp(76px, 12vh, 104px);
  border-radius: 22px; border: 3px solid rgba(0,0,0,0.9);
  background: rgba(255,248,231,0.18); color: #fff;
  font-size: clamp(26px, 7vw, 38px); box-shadow: 3px 4px 0 rgba(0,0,0,0.7);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  transition: transform 0.05s, background 0.05s;
}
.ctrl-btn span { pointer-events: none; }
.ctrl-btn.down { background: rgba(255,248,231,0.45); transform: scale(0.94); }
.slap-btn {
  height: clamp(92px, 14vh, 124px);
  background: radial-gradient(circle at 35% 30%, #ffe680, var(--yellow) 45%, var(--orange));
  color: #000; font-family: var(--display); font-size: clamp(34px, 9vw, 48px); letter-spacing: 0.04em;
  border: 4px solid #000; box-shadow: 5px 5px 0 #000; border-radius: 26px;
}
.slap-btn.down { background: radial-gradient(circle at 50% 50%, #fff, var(--yellow)); transform: scale(0.93) rotate(-3deg); }
#controls.swipe-only .ctrl-btn { display: none; }

/* landscape phones & desktop touch: arrows bottom-left, SLAP bottom-right */
@media (min-aspect-ratio: 1/1) {
  #controls { grid-template-columns: auto auto 1fr auto; }
  #btn-left { grid-column: 1; }
  #btn-right { grid-column: 2; grid-row: 1; }
  #btn-slap { grid-column: 4; grid-row: 1; }
  .ctrl-btn { width: clamp(70px, 17vmin, 104px); height: clamp(70px, 17vmin, 104px); border-radius: 50%; }
  .slap-btn { width: clamp(110px, 29vmin, 170px); height: clamp(110px, 29vmin, 170px); border-radius: 50%; }
  #hint { bottom: calc(40px + var(--safe-b)); }
}

#toast {
  position: absolute; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 20px); z-index: 70;
  background: #000; color: var(--yellow); border: 2px solid var(--yellow); border-radius: 6px;
  padding: 8px 14px; font-weight: 800; letter-spacing: 0.08em; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- small / short screens ---------- */
@media (max-width: 360px) {
  .btn { font-size: 16px; padding: 0.45em 0.6em 0.35em; }
  .menu-grid { gap: 10px; }
  .panel-head { grid-template-columns: auto 1fr; }
  .panel-head .btn-go { display: none; }
  .hud-score, .hud-mult { font-size: 30px; }
  .set-row { grid-template-columns: minmax(0, 1fr) auto; }
  .set-row input[type=range] { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  .panel-head { padding: 6px 10px; }
  .panel-body { padding: 10px; }
  .card .card-tag { display: none; }
  .card-grid { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
  .card .card-name { font-size: 21px; }
  .showcase { grid-template-columns: 180px 1fr; }
  #showcase-canvas { aspect-ratio: 1 / 1; }
  .modal { padding: 10px 16px; gap: 8px; }
  .modal.over { width: min(820px, 100%); display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 16px; }
  .over-left, .over-right { gap: 8px; }
  .modal.over h2 { font-size: 40px; }
  .new-best { font-size: 16px; }
  .total-num { font-size: 44px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .stats > div { padding: 3px 4px; }
  .stats dd { font-size: 20px; }
  .name-input input { font-size: 18px; padding: 4px 8px; }
  .over-buttons .btn-play { font-size: 26px; }
  .over-buttons .menu-grid .btn { font-size: 14px; padding: 0.45em 0.4em 0.35em; min-height: 40px; }
  .btn { min-height: 40px; }
  .hud-score, .hud-mult { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .new-best, .hud-right.fire .hud-mult, .btn-play, .logo .crown, #hint { animation: none; }
  .screen.enter { animation: none; }
}

/* =========================================================
   V3 — progression, shop, daily, box, ads, SLAP MODE
   ========================================================= */
/* --- shared bits --- */
.xpbar { display: block; position: relative; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.12); border: 2px solid #000; overflow: hidden; }
.xpbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--green), #b8ff3b); transition: width 0.4s ease; }
.xpbar.big { height: 14px; }
.xpbar.coinbar i { background: linear-gradient(90deg, #ffb000, var(--yellow)); }
.chip { font-family: var(--ui); font-weight: 800; letter-spacing: 0.08em; font-size: 15px; background: rgba(0,0,0,0.72); color: var(--paper); border: 2px solid #000; border-radius: 999px; padding: 5px 12px; min-height: 36px; box-shadow: 2px 2px 0 #000; white-space: nowrap; font-variant-numeric: tabular-nums; }
.coin-chip { color: var(--yellow); }
.chip.static { cursor: default; }
.badge-n { font-family: var(--ui); font-weight: 800; font-size: 12px; background: var(--red); color: #fff; border-radius: 999px; padding: 1px 6px; margin-left: 4px; vertical-align: middle; letter-spacing: 0.04em; transform: skew(6deg); display: inline-block; }
.badge-n:empty { display: none; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; touch-action: pan-x; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; font-family: var(--ui); font-weight: 800; letter-spacing: 0.1em; font-size: 14px; background: var(--ink-3); color: var(--muted); border: 2px solid #000; border-radius: 6px; padding: 7px 12px; min-height: 38px; }
.tab[aria-selected="true"] { background: var(--yellow); color: #000; box-shadow: 2px 2px 0 #000; }
.shake { animation: shakeX 0.35s ease; }
@keyframes shakeX { 20% { transform: skew(-6deg) translateX(-6px); } 40% { transform: skew(-6deg) translateX(6px); } 60% { transform: skew(-6deg) translateX(-4px); } 80% { transform: skew(-6deg) translateX(3px); } }

/* --- start top bar --- */
#screen-start { flex-direction: column; }
.topbar { position: absolute; left: 0; right: 0; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l)); }
.topbar-right { display: flex; gap: 6px; }
.lvl-chip { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.72); border: 2px solid #000; border-radius: 999px; padding: 4px 12px 4px 10px; min-height: 36px; box-shadow: 2px 2px 0 #000; font-family: var(--display); letter-spacing: 0.06em; font-size: 17px; color: var(--green); }
.lvl-chip .xpbar { width: clamp(48px, 16vw, 90px); }
.streak-chip { color: var(--orange); }
.streak-chip.pulse { animation: chippulse 1s ease-in-out infinite alternate; border-color: var(--orange); }
@keyframes chippulse { from { transform: scale(1); } to { transform: scale(1.08); box-shadow: 0 0 14px rgba(255,138,0,0.7); } }
.start-wrap { padding-top: calc(clamp(24px, 5vh, 56px) + 34px); }
.menu-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.menu-grid-3 .btn { font-size: clamp(15px, 1.6vmin + 9px, 21px); padding: 0.5em 0.3em 0.4em; white-space: normal; line-height: 1.05; }
.btn-shop { background: var(--green); }
.box-cta { font-family: var(--display); font-size: 20px; letter-spacing: 0.06em; background: linear-gradient(90deg, var(--purple), #ff4fd8); color: #fff; border: 3px solid #000; border-radius: 8px; box-shadow: 4px 4px 0 #000; padding: 6px 12px 4px; min-height: 44px; -webkit-text-stroke: 3px #000; paint-order: stroke fill; animation: boxcta 1.2s ease-in-out infinite alternate; }
.box-cta.small { font-size: 16px; min-height: 38px; }
@keyframes boxcta { from { transform: rotate(-1deg); } to { transform: rotate(1deg) scale(1.03); } }

/* --- HUD: streak meter, SLAP MODE, callout --- */
.meter { position: relative; width: clamp(84px, 24vw, 130px); height: 12px; margin-top: 6px; border: 2px solid #000; border-radius: 999px; background: rgba(0,0,0,0.55); overflow: hidden; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--blue), var(--purple)); transition: width 0.18s ease; }
.meter span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--ui); font-weight: 800; font-size: 9px; letter-spacing: 0.18em; color: #fff; text-shadow: 1px 1px 0 #000; }
.meter.slapmode { border-color: var(--yellow); box-shadow: 0 0 12px rgba(255,210,63,0.8); }
.meter.slapmode i { background: linear-gradient(90deg, #ffb000, var(--yellow), #fff3a0); transition: width 0.1s linear; }
body.slapmode .hud-mult { color: var(--yellow); animation: firepulse 0.35s ease-in-out infinite alternate; }
#banner.slapmode { background: linear-gradient(90deg, #ffb000, var(--yellow), #ffb000); background-size: 200% 100%; color: #000; font-size: clamp(26px, 7vmin, 52px); }
#banner.slapmode.show { animation: banner 2s ease forwards, fireslide 0.5s linear infinite; }
#banner.almost { background: var(--orange); color: #fff; -webkit-text-stroke: 4px #000; paint-order: stroke fill; }
#banner.best { background: linear-gradient(90deg, var(--yellow), #fff, var(--yellow)); color: #000; font-size: clamp(24px, 6.5vmin, 48px); }
#banner.combo { background: var(--green); }
#callout {
  position: absolute; left: calc(12px + var(--safe-l)); bottom: calc(210px + var(--safe-b)); z-index: 11; pointer-events: none; opacity: 0;
  font-family: var(--display); font-size: clamp(20px, 5vmin, 34px); letter-spacing: 0.04em; white-space: nowrap;
  background: #fff; color: #000; border: 3px solid #000; border-radius: 14px 14px 14px 2px; padding: 4px 14px 2px;
  box-shadow: 4px 4px 0 var(--cc, #ffd23f), 4px 4px 0 2px #000; transform-origin: left bottom;
}
#callout.show { animation: callout 1.3s cubic-bezier(.2,1.5,.4,1) forwards; }
@keyframes callout { 0% { opacity: 0; transform: scale(0.4) rotate(-6deg); } 14% { opacity: 1; transform: scale(1.08) rotate(-3deg); } 24% { transform: scale(1) rotate(-3deg); } 82% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px) rotate(-3deg); } }
@media (min-aspect-ratio: 1/1) { #callout { bottom: calc(120px + var(--safe-b)); } }

/* --- results --- */
.modal.over { gap: 10px; padding-bottom: calc(18px + var(--safe-b)); }
.res-head { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.stats-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.stats-6 dd { font-size: 22px; }
@media (min-width: 560px) { .stats-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.rewards { width: 100%; display: flex; flex-direction: column; gap: 8px; background: rgba(0,0,0,0.35); border: 2px solid #000; border-radius: 10px; padding: 10px; }
.rw-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rw { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.rw-num { font-family: var(--display); font-size: 32px; color: var(--green); text-shadow: 3px 3px 0 #000; font-variant-numeric: tabular-nums; }
.rw-num.coin { color: var(--yellow); }
.rw-lbl { font-weight: 800; font-size: 11px; letter-spacing: 0.14em; color: var(--muted); margin-top: 2px; }
.lvlbar { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 10px; }
.lvlbar b { font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--green); letter-spacing: 0.05em; }
.lvlbar small { grid-column: 2; font-weight: 800; font-size: 11px; letter-spacing: 0.1em; color: var(--muted); text-align: right; }
.lvlpop { animation: lvlpop 0.6s cubic-bezier(.2,1.6,.4,1); display: inline-block; }
@keyframes lvlpop { 0% { transform: scale(2); color: #fff; } 100% { transform: scale(1); } }
.rw-events { display: flex; flex-direction: column; gap: 5px; }
.rw-events:empty { display: none; }
.rw-ev { font-weight: 800; letter-spacing: 0.05em; font-size: 14px; padding: 5px 8px; border-radius: 6px; background: var(--ink-3); border-left: 4px solid var(--green); text-align: left; animation: evin 0.4s ease both; }
.rw-ev:nth-child(2) { animation-delay: 0.15s; } .rw-ev:nth-child(3) { animation-delay: 0.3s; } .rw-ev:nth-child(4) { animation-delay: 0.45s; }
.rw-ev b { color: var(--yellow); }
.rw-ev.ev-lvl { border-color: var(--green); color: var(--green); }
.rw-ev.ev-ach { border-color: var(--yellow); }
.rw-ev.ev-box { border: 2px solid #000; border-left: 4px solid var(--purple); background: linear-gradient(90deg, #3b1f5e, var(--ink-3)); color: #fff; width: 100%; min-height: 40px; }
@keyframes evin { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
.next-unlock { display: flex; flex-direction: column; gap: 4px; }
.nu-text { font-weight: 800; font-size: 13px; letter-spacing: 0.08em; color: var(--muted); }
.nu-text b { color: var(--yellow); }
.btn-runback { font-size: clamp(30px, 6vmin + 12px, 46px); }
.btn-continue { width: 100%; max-width: 360px; font-size: 17px; background: var(--ink-3); color: var(--paper); white-space: normal; }
.btn-continue:disabled { opacity: 0.5; }

/* --- ad slots (only visible with real IDs or ?adsdebug=1) --- */
.ad-spacer { height: 24px; flex: 0 0 auto; }
.ad-slot { width: 100%; max-width: 728px; margin: 0 auto; text-align: center; pointer-events: auto; }
.ad-label { font-family: system-ui, sans-serif; font-size: 10px; letter-spacing: 0.12em; color: #8d86a0; text-transform: uppercase; margin-bottom: 3px; }
.ad-placeholder { font-family: system-ui, sans-serif; font-size: 12px; color: #8d86a0; min-height: 90px; display: flex; align-items: center; justify-content: center; border: 1px dashed #5a5270; border-radius: 4px; background: rgba(255,255,255,0.03); }
.menu .ad-slot { margin-top: 18px; }
.panel-body > .ad-slot { margin-top: 24px; }

/* --- shop --- */
.shop-top { display: grid; grid-template-columns: minmax(120px, 42%) 1fr; gap: 12px; align-items: center; margin-bottom: 10px; }
#shop-canvas { width: 100%; aspect-ratio: 3 / 4; border: 3px solid #000; border-radius: 10px; box-shadow: 4px 4px 0 #000; display: block; }
.shop-info { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 0; }
.shop-item-name { font-family: var(--display); font-size: clamp(24px, 6vw, 38px); letter-spacing: 0.04em; line-height: 1; text-shadow: 3px 3px 0 #000; }
.shop-item-rarity { font-weight: 800; letter-spacing: 0.12em; font-size: 13px; color: var(--muted); }
.shop-info .btn-go { min-width: 60%; }
.shop-info .btn-go:disabled { background: var(--ink-3); color: var(--green); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.item-card { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 0 0 6px; background: var(--ink-3); border: 2px solid #000; border-top: 4px solid var(--rar, #9aa0a6); border-radius: 8px; box-shadow: 3px 3px 0 #000; text-align: center; overflow: hidden; }
.item-card canvas { width: 100%; aspect-ratio: 1 / 1; display: block; }
.item-card.sel { outline: 3px solid var(--yellow); outline-offset: 1px; }
.item-card.equipped::after { content: '✓'; position: absolute; top: 4px; right: 6px; font-weight: 800; color: #000; background: var(--green); border-radius: 999px; width: 20px; height: 20px; line-height: 20px; font-size: 13px; }
.it-name { font-family: var(--display); font-size: 16px; letter-spacing: 0.03em; line-height: 1; padding: 4px 4px 0; }
.it-rar { font-weight: 800; font-size: 10px; letter-spacing: 0.12em; color: var(--rar, var(--muted)); padding: 0 4px; }
.it-price { font-weight: 800; font-size: 13px; color: var(--yellow); font-variant-numeric: tabular-nums; }
.it-price.short { color: var(--muted); }
.item-card.owned .it-price { color: var(--green); }
.item-card.premium { opacity: 0.8; cursor: default; padding-top: 10px; border-top-color: var(--purple); }
.item-card.premium .it-price { color: var(--muted); font-size: 11px; }
.item-card.premium .it-rar { color: var(--muted); text-transform: none; letter-spacing: 0.02em; font-size: 11px; }
.prem-icon { font-size: 30px; }
.sub-head small { font-family: var(--ui); font-size: 13px; color: var(--muted); letter-spacing: 0.1em; }

/* --- challenges / achievements / streak --- */
.reset-note { font-weight: 800; letter-spacing: 0.14em; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.ch-list { display: flex; flex-direction: column; gap: 10px; }
.ch { background: var(--ink-3); border: 2px solid #000; border-radius: 8px; padding: 10px; box-shadow: 3px 3px 0 #000; }
.ch.done { border-color: var(--green); }
.ch-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 6px; }
.ch-text { font-family: var(--display); font-size: 20px; letter-spacing: 0.03em; }
.ch-rw { font-weight: 800; color: var(--yellow); white-space: nowrap; }
.ch-prog { font-weight: 800; font-size: 12px; color: var(--muted); text-align: right; margin-top: 3px; font-variant-numeric: tabular-nums; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.ach { background: var(--ink-3); border: 2px solid #000; border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 4px; opacity: 0.8; }
.ach.got { opacity: 1; border-color: var(--yellow); box-shadow: 0 0 10px rgba(255,210,63,0.25); }
.ach-icon { font-size: 24px; }
.ach-name { font-family: var(--display); font-size: 18px; letter-spacing: 0.03em; line-height: 1; }
.ach-desc { font-size: 13px; color: var(--muted); }
.ach-rw { font-weight: 800; font-size: 12px; color: var(--yellow); letter-spacing: 0.06em; }
.streak-track { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; }
.sday { background: var(--ink-3); border: 2px solid #000; border-radius: 8px; padding: 6px 4px; text-align: center; display: flex; flex-direction: column; gap: 2px; align-items: center; }
.sday.big { grid-column: span 2; border-color: var(--purple); }
.sday.claimed { opacity: 0.55; }
.sday.claimed .sday-icon::after { content: ' ✓'; color: var(--green); font-size: 16px; }
.sday.today { border-color: var(--yellow); background: #3a2f1a; box-shadow: 0 0 14px rgba(255,210,63,0.45); animation: chippulse 0.9s ease-in-out infinite alternate; }
.sday-n { font-weight: 800; font-size: 11px; letter-spacing: 0.12em; color: var(--muted); }
.sday-icon { font-size: 22px; }
.sday-rw { font-weight: 800; font-size: 12px; line-height: 1.1; }
#screen-streak, #screen-box { background: rgba(8,6,14,0.72); z-index: 40; }
.streak-modal .btn-play { width: 100%; max-width: 320px; }
.streak-sub { font-weight: 800; letter-spacing: 0.12em; color: var(--muted); text-align: center; font-size: 14px; }

/* --- slap box --- */
.box-modal { text-align: center; }
.gift { font-size: clamp(90px, 30vw, 150px); line-height: 1; background: none; border: 0; padding: 10px; filter: drop-shadow(6px 6px 0 #000); animation: giftbob 1.2s ease-in-out infinite; }
.gift.shaking { animation: giftshake 0.12s linear infinite; }
@keyframes giftbob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
@keyframes giftshake { 0% { transform: rotate(-8deg) scale(1.05); } 50% { transform: rotate(8deg) scale(1.1); } 100% { transform: rotate(-8deg) scale(1.05); } }
.box-hint { font-weight: 800; letter-spacing: 0.16em; color: var(--muted); }
.box-reward { display: flex; flex-direction: column; align-items: center; gap: 4px; animation: boxreveal 0.6s cubic-bezier(.2,1.6,.4,1) both; }
#box-canvas { width: min(200px, 56vw); aspect-ratio: 1 / 1; border: 3px solid var(--rar, #000); border-radius: 12px; box-shadow: 0 0 30px var(--rar, transparent), 4px 4px 0 #000; }
.box-rarity { font-weight: 800; letter-spacing: 0.2em; font-size: 14px; }
.box-name { font-family: var(--display); font-size: clamp(26px, 7vw, 40px); letter-spacing: 0.04em; text-shadow: 3px 3px 0 #000; }
.box-buttons { display: flex; gap: 12px; justify-content: center; }
@keyframes boxreveal { 0% { opacity: 0; transform: scale(0.3) rotate(-10deg); } 100% { opacity: 1; transform: none; } }

/* --- small / landscape adjustments --- */
@media (max-width: 360px) {
  .chip { font-size: 13px; padding: 4px 8px; }
  .lvl-chip { font-size: 15px; padding: 3px 8px; }
  .lvl-chip .xpbar { width: 40px; }
  .menu-grid-3 .btn { font-size: 14px; }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .streak-track { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sday.big { grid-column: span 3; }
  .rw-num { font-size: 26px; }
}
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  .modal.over { display: flex; width: min(720px, 100%); }
  .start-wrap { padding-top: 40px; }
  .shop-top { grid-template-columns: 140px 1fr; }
  #shop-canvas { aspect-ratio: 1 / 1; }
  .gift { font-size: 80px; }
}
@media (min-aspect-ratio: 1/1) {
  .start-wrap { padding-top: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .box-cta, .gift, .streak-chip.pulse, .sday.today, #callout.show, .rw-ev { animation: none; }
  #callout.show { opacity: 1; }
}
.plain-link { color: var(--muted); }
@media (max-width: 360px) {
  #screen-shop .panel-head { grid-template-columns: auto 1fr auto; }
  #screen-shop .panel-head h2 { font-size: 26px; }
}
@media (max-height: 640px) and (max-aspect-ratio: 1/1) {
  .start-wrap { padding-top: 46px; gap: 6px; }
  .logo-slap, .logo-city { font-size: clamp(54px, 17vw, 90px); }
  .logo .crown { top: -14%; }
  .tagline { font-size: 16px; }
  .menu { gap: 8px; }
  .menu-grid-3 { gap: 8px; }
  .menu-grid-3 .btn { min-height: 42px; }
}
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  .start-wrap { padding-top: 40px; gap: 6px; justify-content: flex-start; }
  .logo-slap, .logo-city { font-size: clamp(40px, 13vmin, 70px); }
  .tagline { display: none; }
  .menu { gap: 6px; }
  .menu .btn-play { font-size: 26px; min-height: 44px; }
  .menu-grid-3 { gap: 6px 8px; }
  .menu-grid-3 .btn { min-height: 36px; font-size: 14px; padding: 0.35em 0.3em 0.25em; }
  .start-foot .link-btn, .best-line { font-size: 13px; padding-top: 2px; padding-bottom: 2px; }
}
