/* Tailgate Smash — mobile-first HUD. Warm, bold, cartoon. */
:root {
  --ink: #2a1a12;
  --cream: #fff6e9;
  --paper: #fffaf2;
  --orange: #ff8a3d;
  --red: #ef476f;
  --yellow: #ffd166;
  --green: #06d6a0;
  --blue: #118ab2;
  --purple: #9b5de5;
  --shadow: 0 4px 0 var(--ink);
  --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);
  --display: 'Lilita One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #ffc9a0;
  color: var(--ink);
  font-family: var(--body);
  /* No scrolling, zooming, pull-to-refresh, text selection or callouts. */
  position: fixed;
  inset: 0;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

#app { position: fixed; inset: 0; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#touch { position: absolute; inset: 0; z-index: 1; touch-action: none; }
#flash { position: absolute; inset: 0; z-index: 2; background: #fff; opacity: 0; pointer-events: none; }
#flash.on { animation: flash 0.35s ease-out; }
@keyframes flash { from { opacity: 0.55; } to { opacity: 0; } }

[hidden] { display: none !important; }
.hidden { opacity: 0; pointer-events: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- HUD ---------------------------------------------------------------- */
#hud {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  display: flex; flex-direction: column;
  padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) calc(14px + var(--safe-b)) calc(12px + var(--safe-l));
  max-width: 520px; margin: 0 auto;
}
#hud button { pointer-events: auto; }

.topbar { display: flex; align-items: center; gap: 6px; }
.topbar .pill { flex: 0 1 auto; min-width: 0; overflow: hidden; }
.spacer { flex: 1; }
.pill {
  display: flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 10px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 999px; box-shadow: var(--shadow);
  font-family: var(--display); font-size: 18px; letter-spacing: 0.3px; white-space: nowrap;
}
.pill small { font-family: var(--body); font-weight: 900; font-size: 10px; opacity: 0.7; }
.coin {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 35%, #fff3b0 0 25%, var(--yellow) 26% 60%, #f0a500 61%);
  border: 2px solid var(--ink);
}

.iconbtn {
  width: 48px; height: 48px; flex: none;
  display: grid; place-items: center; padding: 0;
  background: var(--paper); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow);
  cursor: pointer; touch-action: manipulation;
}
.iconbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.iconbtn svg { width: 26px; height: 26px; fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn .spk { fill: var(--ink); }
.iconbtn .x { display: none; }
.iconbtn.muted .wave { display: none; }
.iconbtn.muted .x { display: block; }

.subbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.place {
  font-weight: 900; font-size: 12px; letter-spacing: 0.4px; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; background: rgba(42, 26, 18, 0.72); color: var(--cream);
}
.combo {
  font-family: var(--display); font-size: 15px; padding: 3px 10px; border-radius: 999px;
  background: var(--red); color: #fff; border: 2px solid var(--ink);
}
.combo b { font-size: 18px; }
.combo span { font-size: 12px; opacity: 0.85; margin-left: 4px; }
.tag {
  font-weight: 900; font-size: 11px; padding: 4px 8px; border-radius: 8px;
  background: var(--ink); color: var(--yellow);
}

/* Chant bubble and big popups. */
.chant {
  align-self: center; margin-top: 14vh;
  font-family: var(--display); font-size: clamp(20px, 6vw, 28px); color: #fff;
  -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill;
  text-shadow: 0 3px 0 var(--ink); opacity: 0; transform: scale(0.8);
}
.chant.on { animation: chant 2.2s ease-out; }
@keyframes chant {
  0% { opacity: 0; transform: scale(0.6) rotate(-4deg); }
  12% { opacity: 1; transform: scale(1.08) rotate(2deg); }
  25% { transform: scale(1) rotate(-1deg); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.02) translateY(-14px); }
}

.popup {
  position: absolute; left: 0; right: 0; top: 34%;
  text-align: center; font-family: var(--display); font-size: clamp(44px, 14vw, 72px);
  color: var(--yellow); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--ink); opacity: 0; pointer-events: none;
}
.popup.perfect { color: var(--green); }
.popup.smash { color: var(--orange); font-size: clamp(52px, 17vw, 88px); }
.popup.miss { color: #fff; }
.popup.anim { animation: pop 1.05s cubic-bezier(.2, 1.4, .4, 1) forwards; }
@keyframes pop {
  0% { opacity: 0; transform: scale(0.3) rotate(-8deg); }
  18% { opacity: 1; transform: scale(1.12) rotate(3deg); }
  32% { transform: scale(1) rotate(-2deg); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: scale(1) translateY(-30px); }
}

/* ---- Bottom: meters and hints ------------------------------------------ */
.bottom { margin-top: auto; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.meter, .timing { transition: opacity 0.2s; }
.meter-label, .timing-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--display); font-size: 18px; color: #fff;
  -webkit-text-stroke: 1px var(--ink); paint-order: stroke fill; text-shadow: 0 2px 0 var(--ink);
  margin: 0 4px 4px;
}
.timing-label { justify-content: center; gap: 6px; }
.meter-tip { font-family: var(--body); font-weight: 900; font-size: 12px; -webkit-text-stroke: 0; text-shadow: none; color: var(--ink); background: var(--yellow); padding: 1px 8px; border-radius: 999px; }
.meter-track, .timing-track {
  position: relative; height: 34px; border-radius: 999px; overflow: hidden;
  background: var(--paper); border: 3px solid var(--ink); box-shadow: var(--shadow);
}
.meter-zone { position: absolute; top: 0; bottom: 0; background: rgba(6, 214, 160, 0.45); }
.meter-sweet { position: absolute; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: var(--green); }
.meter-fill {
  position: absolute; inset: 0; transform-origin: left center; transform: scaleX(0);
  background: linear-gradient(90deg, var(--yellow), var(--orange) 70%, var(--red));
  opacity: 0.85; mix-blend-mode: multiply;
}
.meter-needle { position: absolute; top: -2px; bottom: -2px; width: 6px; margin-left: -3px; background: var(--ink); border-radius: 3px; }
.meter.hot .meter-track { box-shadow: 0 4px 0 var(--ink), 0 0 0 4px rgba(6, 214, 160, 0.6); }

.timing-window { position: absolute; top: 0; bottom: 0; background: var(--green); }
.timing-window::after { content: ''; position: absolute; left: 32%; right: 32%; top: 0; bottom: 0; background: rgba(255, 255, 255, 0.45); }
.timing-cursor { position: absolute; top: -2px; bottom: -2px; width: 8px; margin-left: -4px; background: var(--ink); border-radius: 4px; }
.timing.perfect .timing-track { background: var(--green); }
.timing.good .timing-track { background: #a8f0d6; }
.timing.miss .timing-track { background: #ffc2cf; }

.hint {
  align-self: center; min-height: 48px; display: flex; align-items: center;
  font-weight: 900; font-size: 15px; color: var(--cream); background: rgba(42, 26, 18, 0.78);
  padding: 0 18px; border-radius: 999px; transition: opacity 0.2s;
}

/* ---- Sheets and overlays ------------------------------------------------ */
.sheet {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: flex-end; justify-content: center;
  padding: calc(12px + var(--safe-t)) calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l));
  background: linear-gradient(to top, rgba(42, 26, 18, 0.45), rgba(42, 26, 18, 0) 60%);
  transition: opacity 0.25s;
}
.sheet .card {
  width: 100%; max-width: 460px; max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 24px; box-shadow: 0 6px 0 var(--ink);
  padding: 16px 18px 18px; text-align: center;
  transform: translateY(0); transition: transform 0.3s cubic-bezier(.2, 1.3, .4, 1);
}
.sheet.hidden .card { transform: translateY(40px); }
/* The score card leaves the top of the screen tappable: the sound button
   (in the HUD underneath) works while the card is up. */
#result { pointer-events: none; }
#result:not(.hidden) .card { pointer-events: auto; }

.grade {
  display: inline-block; font-family: var(--display); font-size: 22px; letter-spacing: 1px; text-transform: uppercase;
  padding: 4px 16px; border-radius: 999px; border: 3px solid var(--ink); color: #fff; background: #8a817c;
}
.grade[data-grade="starter"] { background: var(--blue); }
.grade[data-grade="pro"] { background: var(--purple); }
.grade[data-grade="legend"] { background: linear-gradient(90deg, var(--orange), var(--red)); }
.grade[data-grade="fail"] { background: #8a817c; }
.score { font-family: var(--display); font-size: 56px; line-height: 1.05; margin-top: 6px; }
.newbest { display: inline-block; font-weight: 900; font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--yellow); border: 2px solid var(--ink); }
.reaction { margin: 6px 0 10px; font-weight: 900; font-size: 16px; }
.lines { list-style: none; margin: 0; padding: 0; text-align: left; font-size: 14px; }
.lines li { display: flex; justify-content: space-between; padding: 5px 4px; border-bottom: 2px dashed rgba(42, 26, 18, 0.15); }
.earned { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 10px; font-family: var(--display); font-size: 24px; }
.comboLine { margin: 4px 0 12px; font-size: 13px; font-weight: 700; opacity: 0.8; }
.actions { display: flex; gap: 10px; }

.bigbtn {
  flex: 1; min-height: 56px; padding: 0 20px;
  font-family: var(--display); font-size: 24px; letter-spacing: 0.5px; color: #fff;
  background: var(--orange); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 5px 0 var(--ink);
  cursor: pointer; touch-action: manipulation;
}
.bigbtn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.bigbtn.alt { background: var(--paper); color: var(--ink); }

.overlay {
  position: absolute; inset: 0; z-index: 6; display: grid; place-items: center;
  padding: calc(20px + var(--safe-t)) 20px calc(20px + var(--safe-b));
  background: radial-gradient(circle at 50% 40%, rgba(255, 209, 102, 0.55), rgba(239, 71, 111, 0.55));
  transition: opacity 0.35s;
}
.overlay.gone { opacity: 0; pointer-events: none; }
.title-card { text-align: center; width: 100%; max-width: 360px; }
.title-card h1 {
  margin: 0 0 12px; font-family: var(--display); font-weight: 400; font-size: clamp(56px, 18vw, 84px); line-height: 0.92;
  color: var(--yellow); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 7px 0 var(--ink);
  transform: rotate(-4deg);
}
.title-card h1 span { color: var(--orange); }
.title-card p { font-weight: 900; font-size: 17px; line-height: 1.4; margin: 0 0 22px; color: var(--ink); }
.title-card .bigbtn { width: 100%; }

/* ---- Nav, tricks, shop, daily, replay ----------------------------------- */
.iconbtn { position: relative; }
.iconbtn .star { fill: var(--yellow); stroke-width: 1.4; }
.iconbtn .dot { position: absolute; top: -5px; right: -5px; width: 14px; height: 14px; border-radius: 50%; background: var(--red); border: 2px solid var(--ink); }
#hud:not([data-phase="aim"]) .navbtn { opacity: 0.35; pointer-events: none; }

.tricks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; transition: opacity 0.2s; }
.tricks button {
  min-height: 48px; padding: 4px 2px; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--ink);
  background: var(--paper); color: var(--ink); font-family: var(--display); font-size: 14px; line-height: 1.05;
  cursor: pointer; touch-action: manipulation;
}
.tricks button small { display: block; font-family: var(--body); font-weight: 900; font-size: 10px; opacity: 0.7; }
.tricks button[aria-checked="true"] { background: var(--orange); color: #fff; }
.tricks button[aria-checked="true"] small { opacity: 0.95; }
.tricks button:disabled { background: #e7ddd2; color: #8a7d73; box-shadow: none; transform: translateY(3px); }

.sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sheet-head h2 { flex: 1; margin: 0; text-align: left; font-family: var(--display); font-weight: 400; font-size: 28px; }
.pill.small { height: 34px; font-size: 17px; padding: 0 10px; box-shadow: none; }
.card.tall { height: min(78vh, 640px); display: flex; flex-direction: column; }
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-bottom: 10px; }
.tabs button {
  min-height: 48px; border: 3px solid var(--ink); border-radius: 14px; background: var(--paper); color: var(--ink);
  font-family: var(--display); font-size: 15px; padding: 0 2px; cursor: pointer; touch-action: manipulation;
}
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--yellow); }
.shop-list {
  list-style: none; margin: 0; padding: 0 2px 4px; flex: 1; overflow-y: auto; overscroll-behavior: contain;
  touch-action: pan-y; -webkit-overflow-scrolling: touch; text-align: left;
}
.shop-list li { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 2px dashed rgba(42, 26, 18, 0.15); }
.shop-list .swatch { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 3px solid var(--ink); }
.shop-list .info { flex: 1; min-width: 0; }
.shop-list .info b { display: block; font-family: var(--display); font-weight: 400; font-size: 18px; }
.shop-list .info span { display: block; font-size: 12px; font-weight: 700; opacity: 0.75; }
.shop-list .info em { display: block; font-style: normal; font-size: 12px; font-weight: 900; color: var(--blue); }
.shop-list button {
  min-width: 92px; min-height: 48px; padding: 0 10px; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--ink);
  background: var(--orange); color: #fff; font-family: var(--display); font-size: 16px; cursor: pointer; touch-action: manipulation;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.shop-list button .coin { width: 14px; height: 14px; }
.shop-list button.owned { background: var(--paper); color: var(--ink); }
.shop-list button.equipped { background: var(--green); color: var(--ink); box-shadow: none; transform: translateY(3px); }
.shop-list button:disabled:not(.equipped) { background: #e7ddd2; color: #8a7d73; box-shadow: none; }

.daily-date { margin: 0 0 6px; font-weight: 900; font-size: 14px; text-align: left; opacity: 0.75; }
.daily-note { font-size: 13px; font-weight: 700; opacity: 0.75; margin: 10px 0 12px; text-align: left; }
.toast { margin: 0 0 10px; padding: 8px 12px; border-radius: 14px; background: var(--yellow); border: 3px solid var(--ink); font-weight: 900; }
.bigbtn.small { flex: 0 0 34%; font-size: 20px; }
/* Score card: Replay and Share share the space next to Go again. */
#result .actions { gap: 8px; }
#result .actions .bigbtn { white-space: nowrap; padding: 0 12px; }
#result .actions .bigbtn.small { flex: 0 0 auto; font-size: 18px; }
#btnAgain { font-size: 22px; }
.replay-banner {
  position: absolute; bottom: calc(28px + var(--safe-b)); left: 50%; transform: translateX(-50%); z-index: 4; white-space: nowrap;
  font-family: var(--display); font-size: 18px; color: #fff; background: rgba(42, 26, 18, 0.8);
  padding: 6px 14px; border-radius: 999px; display: flex; align-items: center; gap: 8px; pointer-events: none;
}
.replay-banner::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: blink 0.8s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
body.replaying #scene { filter: saturate(0.75) contrast(1.05); }
body.replaying .subbar { opacity: 0; }

/* ---- Drinks ------------------------------------------------------------- */
.hintrow { position: relative; display: flex; justify-content: center; align-items: center; min-height: 48px; }
.drinkbtn { position: absolute; right: 0; top: 0; transition: opacity 0.2s; }
.drinkbtn .can { fill: var(--yellow); }
.drinkbtn .count {
  position: absolute; top: -8px; right: -8px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px;
  background: var(--red); color: #fff; border: 2px solid var(--ink); font-family: var(--display); font-size: 13px; line-height: 18px;
}
.drinkbtn.empty .count { background: #8a817c; }
.drinkbtn.active { background: var(--green); }
.boost {
  font-family: var(--display); font-size: 15px; padding: 3px 10px; border-radius: 999px;
  border: 2px solid var(--ink); color: var(--ink); background: var(--boost, var(--yellow));
  animation: boostpulse 1.1s ease-in-out infinite;
}
@keyframes boostpulse { 50% { transform: scale(1.06); } }
.shop-list .count-note { color: var(--red); }
#flash.magma { background: radial-gradient(circle at 50% 45%, #ffd166, #ff5a1f 60%, #b5121b); }
#flash.magma.on { animation-duration: 0.6s; }
.popup.boostpop { color: var(--yellow); font-size: clamp(40px, 12vw, 64px); }
.popup.magmapop { color: #ffb02e; font-size: clamp(44px, 13vw, 70px); }
.shop-list button.added { background: var(--green); color: var(--ink); }

.fpsmeter {
  position: fixed; right: 8px; top: calc(118px + var(--safe-t)); z-index: 9; pointer-events: none; white-space: nowrap;
  font: 700 11px/1.3 ui-monospace, Menlo, Consolas, monospace; color: #fff; background: rgba(0, 0, 0, 0.6);
  padding: 2px 6px; border-radius: 6px; max-width: calc(100vw - 16px);
}

/* ---- Info page and first-launch notice --------------------------------- */
#info { z-index: 7; } /* above the title screen, which it can be opened from */
.info-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; text-align: left; padding-right: 4px; }
.info-body h3 { font-family: var(--display); font-weight: 400; font-size: 19px; margin: 14px 0 4px; }
.info-body h3:first-child { margin-top: 0; }
.info-body p { margin: 0 0 8px; font-size: 14px; line-height: 1.45; font-weight: 700; }
.info-body a { color: var(--blue); }
.license {
  white-space: pre-wrap; font: 11px/1.4 ui-monospace, Menlo, Consolas, monospace; background: #f3ece2;
  border: 2px solid rgba(42, 26, 18, 0.15); border-radius: 10px; padding: 8px; margin: 0 0 8px; -webkit-user-select: text; user-select: text;
}
.toggle { display: flex; align-items: center; gap: 10px; min-height: 48px; font-weight: 900; font-size: 15px; cursor: pointer; }
.slider { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 900; font-size: 15px; }
.slider span { flex: 0 0 120px; }
.slider input { flex: 1; min-width: 0; height: 32px; accent-color: var(--orange); touch-action: pan-x; }
.toggle input { width: 24px; height: 24px; accent-color: var(--orange); }
.linkbtn {
  min-height: 48px; min-width: 48px; padding: 0 12px; background: none; border: 0; color: var(--ink); cursor: pointer;
  font-family: var(--body); font-weight: 900; font-size: 14px; text-decoration: underline; text-underline-offset: 3px;
  touch-action: manipulation;
}
.title-card .linkbtn { margin-top: 8px; }
.linkbtn.foot { align-self: center; margin-top: 4px; }
.notice {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b));
  display: flex; align-items: center; gap: 2px; max-width: calc(100% - 24px); white-space: nowrap;
  padding: 0 4px 0 14px; border-radius: 999px; background: rgba(42, 26, 18, 0.82); color: var(--cream);
  font-weight: 900; font-size: 13px;
}
.notice .linkbtn { color: var(--yellow); padding: 0 6px; font-size: inherit; }
/* Two lines at most, even on a 320px phone: each line stays on one row and
   the text eases down a little on narrow screens. */
#notice { border-radius: 20px; padding: 4px 4px 6px 14px; white-space: normal; }
.notice-text { margin: 0; display: flex; flex-direction: column; align-items: flex-start; font-size: clamp(10.5px, 3.3vw, 13px); line-height: 1.2; }
.notice-line { display: flex; align-items: center; white-space: nowrap; }
.notice-safety { padding-bottom: 4px; font-weight: 800; color: var(--yellow); }
.noticeclose { width: 48px; height: 48px; border: 0; background: none; color: var(--cream); font-size: 22px; cursor: pointer; }

/* ---- Onboarding: parts of the HUD appear once they mean something ------- */
/* visibility (not display) keeps the top bar's layout steady as items unlock. */
body.lock-coins .topbar .coins, body.lock-coins .topbar .best { visibility: hidden; }
body.lock-shop #btnShop { visibility: hidden; }
body.lock-daily #btnDaily { visibility: hidden; }
body.lock-drinks #btnDrink { visibility: hidden; }
body.lock-place #placeName { display: none; }
.unlock-pop { animation: unlockpop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1); }
.unlock-glow { outline: 5px solid rgba(255, 209, 102, 0.95); outline-offset: 1px; }
@keyframes unlockpop { from { transform: scale(0.2); } }

/* New player's title: name at the top, the fan in the middle, Play at the bottom. */
#title.simple {
  place-items: stretch;
  background: linear-gradient(180deg, rgba(255, 209, 102, 0.5) 0%, rgba(255, 209, 102, 0) 30%, rgba(239, 71, 111, 0) 62%, rgba(239, 71, 111, 0.5) 100%);
}
#title.simple .title-card { height: 100%; margin: 0 auto; display: flex; flex-direction: column; justify-content: space-between; }
#title.simple .title-card h1 { margin-top: 34px; }
#title.simple .title-card p { margin-bottom: 14px; font-size: 19px; }
#title.simple .title-card .linkbtn { display: none; }
body.simple-title #hud { visibility: hidden; } /* nothing behind the corner link */
.corner-info {
  position: absolute; top: calc(10px + var(--safe-t)); right: 10px; z-index: 1;
  display: flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 12px 0 14px; border: 0; border-radius: 999px;
  background: rgba(42, 26, 18, 0.78); color: var(--cream); font: 900 13px var(--body); cursor: pointer; touch-action: manipulation;
}
.corner-info u { color: var(--yellow); text-underline-offset: 3px; }
.corner-info i {
  display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--yellow); color: var(--ink); font-style: normal; font-size: 13px;
}

/* Sheet headers: a long title must not squeeze the close button below 48px. */
.sheet-head .iconbtn { flex: 0 0 auto; }

/* Result card: points → coins on one line, first-time note, trick offer. */
.earned { gap: 8px; white-space: nowrap; }
.earned > * { flex-shrink: 0; } /* one line: big scores shrink the text instead of wrapping */
.earned .pts { opacity: 0.7; }
.earned .arrow { font-family: var(--body); font-weight: 900; opacity: 0.6; }
.coinNote { margin: 4px 0 2px; font-size: 14px; font-weight: 800; line-height: 1.35; opacity: 0.85; }
.bonusLine {
  display: flex; justify-content: center; align-items: center; gap: 8px; margin: 8px auto 2px; padding: 6px 14px; width: fit-content;
  border-radius: 999px; background: var(--yellow); border: 3px solid var(--ink); font-weight: 900; font-size: 16px;
}
.bonusLine b { font-family: var(--display); font-weight: 400; font-size: 19px; }
.bonusNote { margin: 2px 0 8px; font-size: 13px; font-weight: 800; opacity: 0.8; }

/* Tutorial coach: one instruction per step, under the top bar. */
.coach {
  align-self: center; margin-top: 10px; max-width: 340px; padding: 10px 16px 12px; text-align: center;
  background: rgba(255, 250, 242, 0.95); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 4px 0 var(--ink);
  animation: unlockpop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1); transition: opacity 0.2s;
}
.coach small { display: block; font-size: 12px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; color: var(--orange); }
.coach b { display: block; font-family: var(--display); font-weight: 400; font-size: 23px; line-height: 1.1; }
.coach span { display: block; margin-top: 3px; font-size: 14px; font-weight: 800; opacity: 0.8; }
.coach span:empty { display: none; }
.coach .coachbtn { display: block; width: 100%; margin-top: 10px; min-height: 52px; font-size: 22px; }
.coach .coachbtn[hidden] { display: none; }
#hud[data-phase="drink"] .coach, #hud[data-phase="impact"] .coach, #hud[data-phase="result"] .coach,
#hud[data-phase="replay"] .coach { opacity: 0; }
#hud[data-phase="air"] .coach:not(.keep-air) { opacity: 0; }
/* The tutorial uses the default trick, so the trick picker waits until it's over. */
body.tutorial #tricks { display: none !important; }

/* "New version ready. Tap to update" (above sheets, below the Info page). */
.update-banner {
  position: absolute; z-index: 6; top: calc(68px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  min-height: 48px; padding: 0 16px; max-width: calc(100% - 24px); white-space: nowrap;
  border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 4px 0 var(--ink); background: var(--yellow);
  color: var(--ink); font: 900 14px var(--body); cursor: pointer; touch-action: manipulation;
}
.update-banner[hidden] { display: none; }

/* Share sheet (above the score card). */
#share { z-index: 6; }
.share-status { margin: 0 0 10px; font-weight: 900; font-size: 15px; }
.share-preview { display: block; width: auto; max-width: 100%; height: min(36vh, 300px); margin: 0 auto 12px; border: 3px solid var(--ink); border-radius: 16px; background: #000; }
.share-preview[hidden] { display: none; }
.share-actions { display: flex; flex-direction: column; gap: 10px; }
.share-actions .bigbtn { width: 100%; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.share-actions [hidden] { display: none !important; }
.share-links { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.share-note { margin: 10px 0 0; font-size: 12px; font-weight: 800; opacity: 0.75; }

/* Guided shop: only the Lot Lager can be bought. */
.shop-tip { margin: 0 0 8px; padding: 8px 12px; border-radius: 14px; background: var(--yellow); border: 3px solid var(--ink); font-weight: 800; font-size: 14px; }
#shop.tutorial .tabs button:disabled:not([aria-selected="true"]) { opacity: 0.35; }
#shop.tutorial .shop-list li.dim { opacity: 0.35; filter: grayscale(0.6); }
#shop.tutorial .shop-list li.spot {
  border: 3px solid var(--ink); border-radius: 16px; background: #fff3cf; padding: 10px 8px; margin: 2px 0 6px;
  outline: 5px solid rgba(255, 209, 102, 0.95); outline-offset: 1px;
}
#shop.tutorial .shop-list li.spot button:not(:disabled) { animation: tutpulse 1.1s ease-in-out infinite; }
#shop.tutorial [data-close="shop"], #shop.tutorial .foot { opacity: 0.35; }
@keyframes tutpulse { 50% { box-shadow: 0 3px 0 var(--ink), 0 0 0 7px rgba(255, 138, 61, 0.55); } }

/* Finale card. */
.finale-title { margin: 4px 0 6px; font-family: var(--display); font-weight: 400; font-size: 36px; color: var(--orange);
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); }
.finale-text { margin: 0 0 12px; font-weight: 900; font-size: 18px; line-height: 1.35; }
.finale-goal { display: flex; align-items: center; gap: 12px; text-align: left; margin: 0 0 8px; padding: 10px 14px;
  border: 3px solid var(--ink); border-radius: 16px; background: #fff3cf; font-weight: 800; font-size: 16px; line-height: 1.35; }
.finale-goal b { font-weight: 900; }
.finale-goal .golden { flex: 0 0 46px; height: 30px; border-radius: 6px; border: 3px solid var(--ink);
  background: linear-gradient(135deg, #fff3a8, #ffcc33 45%, #d99a00); box-shadow: 0 6px 0 -2px var(--ink); }
.finale-note { margin: 0 0 10px; font-size: 13px; font-weight: 800; opacity: 0.8; }
/* Shop pointer: tab names styled like the shop's tabs, never split across lines. */
.finale-shop { margin: 0 0 14px; font-size: 15px; font-weight: 800; line-height: 1.9; }
.finale-shop .tabname {
  display: inline-block; white-space: nowrap; padding: 0 8px; line-height: 1.5; border: 2px solid var(--ink); border-radius: 10px;
  background: var(--paper); font-family: var(--display); font-weight: 400; font-size: 15px;
}

/* Coins flying from the result card to the counter the first time. */
.fly-coin {
  position: fixed; z-index: 30; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 35%, #fff6b0, #ffc533 55%, #d99a00); border: 2px solid var(--ink);
}

/* "Shop unlocked!" note under the shop button. */
.nudge {
  position: fixed; z-index: 5; padding: 8px 12px; border-radius: 14px; background: var(--yellow); border: 3px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink); font: 900 15px var(--body); color: var(--ink); white-space: nowrap; pointer-events: none;
  animation: unlockpop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.nudge::before {
  content: ''; position: absolute; top: -11px; left: var(--tip, 50%); width: 14px; height: 14px; background: var(--yellow);
  border-left: 3px solid var(--ink); border-top: 3px solid var(--ink); transform: translateX(-50%) rotate(45deg);
}
.nudge small { display: block; font-weight: 800; font-size: 13px; opacity: 0.85; }

@media (prefers-reduced-motion: reduce) {
  .popup.anim, .chant.on { animation-duration: 0.01s; }
  #flash.on { animation: none; }
  .unlock-pop, .nudge, .coach { animation: none; }
  #shop.tutorial .shop-list li.spot button { animation: none !important; }
}
