/* Fredoka (SIL Open Font License), self-hosted so the app works offline */
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(fonts/fredoka-latin.woff2) format('woff2');
}

:root {
  --bg1: #2b1d4e;
  --bg2: #4a2c6e;
  --ink: #2a1840;
  --cream: #fff7e8;
  --accent: #ff6b81;
  --blue: #4d7cfe;
  --gold: #ffd23f;
  --green: #22c55e;
  --ink-2: #6b5a80;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: radial-gradient(120% 90% at 50% 0%, var(--bg2) 0%, var(--bg1) 60%, #1a1033 100%);
  background-color: var(--bg1);
  color: var(--cream);
  font-family: "Fredoka", ui-rounded, "Segoe UI", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
  touch-action: none;
}
body { position: fixed; inset: 0; }
button { touch-action: manipulation; font-family: inherit; cursor: pointer; }

#app {
  height: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: max(8px, env(safe-area-inset-top)) 12px max(8px, env(safe-area-inset-bottom));
  gap: 8px;
}

/* ---------- HUD ---------- */
#hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  transition: opacity .25s;
}
.at-home .play-only { display: none !important; }
body:not(.at-home) .home-only { display: none !important; }
.stat { display: flex; flex-direction: column; line-height: 1; }
.stat .label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; font-weight: 600; }
.stat .value { font-size: 30px; font-weight: 700; margin-top: 4px; }
.score .value { color: var(--gold); text-shadow: 0 3px 0 rgba(0,0,0,.25); transition: transform .12s; display: inline-block; transform-origin: left center; }
.score .value.bump { transform: scale(1.18); }
.next { align-items: center; }
#next {
  width: 52px; height: 52px; margin-top: 2px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.12);
}
.hud-right { grid-column: 3; display: flex; gap: 8px; justify-content: flex-end; align-items: center; }

.coin-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,.25);
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 17px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.08);
}
.coin-chip.big { font-size: 20px; padding: 7px 16px 7px 7px; }
.coin-chip.bump { animation: bump .35s; }
.coin {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6b0, #ffd23f 45%, #e0a100);
  color: transparent;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.18), 0 0 0 2px #b88300;
  font-size: 0;
  flex: none;
}
.icon-btn {
  width: 44px; height: 44px;
  border: 0; border-radius: 14px;
  background: rgba(255,255,255,.12);
  color: var(--cream);
  font-size: 18px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.2);
}
.icon-btn:active { transform: translateY(2px); box-shadow: none; }

/* ---------- Stage ---------- */
#stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#game {
  display: block;
  border-radius: 22px;
  touch-action: none;
  box-shadow: 0 18px 40px rgba(0,0,0,.35), 0 0 0 4px rgba(255,255,255,.08);
}

/* ---------- Dock ---------- */
#dock { display: flex; flex-direction: column; gap: 6px; }
#powerbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.at-home #powerbar { visibility: hidden; }
.pw {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 46px;
  border: 0; border-radius: 14px;
  background: rgba(255,255,255,.12);
  color: var(--cream);
  font-weight: 600; font-size: 15px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.22);
}
.pw:active { transform: translateY(2px); box-shadow: none; }
.pw.active { background: var(--gold); color: var(--ink); }
.pw .pi { font-size: 20px; }
.pw .pc {
  position: absolute; top: -6px; right: -4px;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-style: normal; font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
  box-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.pw .pc.ad { background: var(--green); }
.pw .pc.price { background: #3b2a66; }
#evo { display: block; width: 100%; height: 40px; }

/* ---------- Overlays ---------- */
.overlay {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 10, 40, .6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  border-radius: 22px;
  z-index: 5;
  overflow: hidden;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.overlay.home { background: linear-gradient(180deg, rgba(255,247,232,.6), rgba(255,247,232,.25)); backdrop-filter: none; -webkit-backdrop-filter: none; justify-content: space-between; }

.card {
  position: relative;
  width: min(340px, 100%);
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  background: var(--cream);
  color: var(--ink);
  border-radius: 26px;
  padding: 24px 20px 20px;
  text-align: center;
  box-shadow: 0 8px 0 #d9c6a8, 0 24px 50px rgba(0,0,0,.4);
  transform: translateY(16px) scale(.96);
  transition: transform .35s cubic-bezier(.2,1.6,.4,1);
  scrollbar-width: none;
}
.card::-webkit-scrollbar { display: none; }
.card.wide { width: min(380px, 100%); }
.overlay.show .card { transform: none; }
.card h2 { margin: 0 0 12px; font-size: 30px; }
.card h3 { margin: 18px 0 8px; font-size: 14px; text-align: left; opacity: .65; text-transform: uppercase; letter-spacing: .08em; }
.lead { margin: 4px 0 12px; font-size: 16px; line-height: 1.4; }
.hint { margin: 12px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.x-btn {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px;
  border: 0; border-radius: 12px;
  background: rgba(42,24,64,.08);
  color: var(--ink);
  font-size: 16px;
}

/* home */
.home .coin-chip, .home .icon-btn { background: var(--ink); color: #fff; }
.home-top { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.home-center { display: flex; flex-direction: column; align-items: center; width: min(320px, 100%); }
.title {
  margin: 0;
  display: flex; flex-direction: column; align-items: center;
  font-size: 64px; line-height: .9;
  letter-spacing: .01em;
  filter: drop-shadow(0 5px 0 rgba(42,24,64,.55));
}
.title span:first-child { color: var(--accent); -webkit-text-stroke: 2px #fff; paint-order: stroke fill; transform: rotate(-4deg); }
.title span:last-child { color: var(--blue); -webkit-text-stroke: 2px #fff; paint-order: stroke fill; transform: rotate(3deg); }
#hero { width: 100%; max-width: 280px; height: auto; aspect-ratio: 300 / 90; margin: 14px 0 6px; }
.home-best { margin: 0 0 6px; font-size: 16px; color: var(--ink); background: rgba(255,255,255,.75); padding: 4px 14px; border-radius: 999px; }
.home-nav { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.nav-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 4px 8px;
  border: 0; border-radius: 16px;
  background: var(--cream);
  color: var(--ink);
  font-weight: 600; font-size: 13px;
  box-shadow: 0 4px 0 #d9c6a8;
}
.nav-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #d9c6a8; }
.nav-btn .ni { font-size: 24px; }
.badge {
  position: absolute; top: -6px; right: -4px;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px;
  background: var(--accent); color: #fff;
  font-style: normal; font-size: 12px; font-weight: 700;
  display: none; place-items: center;
  animation: bob 1.2s ease-in-out infinite;
}
.badge.on { display: grid; }

/* buttons */
.big-btn, .ghost-btn, .link-btn {
  display: block;
  width: 100%;
  font-family: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 18px;
}
.big-btn {
  font-size: 22px;
  padding: 14px;
  color: #fff;
  background: linear-gradient(180deg, #ff8a9b, #ff5470);
  box-shadow: 0 6px 0 #c23651, 0 10px 18px rgba(255,84,112,.35);
  margin-top: 8px;
}
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #c23651; }
.big-btn.ad { background: linear-gradient(180deg, #4ade80, #16a34a); box-shadow: 0 6px 0 #11803a, 0 10px 18px rgba(34,197,94,.35); }
.big-btn.ad:active { box-shadow: 0 2px 0 #11803a; }
.big-btn.gold { background: linear-gradient(180deg, #ffe066, #f5b700); color: var(--ink); box-shadow: 0 6px 0 #b98a00, 0 10px 18px rgba(245,183,0,.35); }
.big-btn.gold:active { box-shadow: 0 2px 0 #b98a00; }
.big-btn:disabled { filter: grayscale(.8); opacity: .6; }
.big-btn.pulse { width: 220px; font-size: 28px; animation: pulse 1.6s ease-in-out infinite; }
.ghost-btn {
  font-size: 16px;
  padding: 12px;
  margin-top: 10px;
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 2px rgba(42,24,64,.2);
}
.ghost-btn.strong { box-shadow: inset 0 0 0 2px rgba(42,24,64,.55); }
.ghost-btn.as-link { text-decoration: none; margin-top: 16px; }
.link-btn { background: none; color: var(--ink-2); font-size: 15px; padding: 12px; margin-top: 4px; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; }
.link-btn.danger { color: #c4243f; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* game over */
.final { display: flex; flex-direction: column; margin: 0 0 4px; }
.final .label { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; opacity: .6; font-weight: 600; }
.final .value { font-size: 56px; font-weight: 700; color: #ff5470; line-height: 1.05; }
.best-line { margin: 3px 0; font-size: 15px; }
.best-line:empty { display: none; }
.best-line .new { color: #ff5470; font-weight: 700; }
.earned { display: inline-flex; align-items: center; gap: 6px; margin: 10px 0 2px; font-size: 20px; background: #fff0c2; padding: 6px 14px 6px 8px; border-radius: 999px; }

/* revive */
.timer-bar { height: 10px; border-radius: 99px; background: rgba(42,24,64,.12); overflow: hidden; margin: 6px 0; }
.timer-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff5470, #ffb347); border-radius: inherit; }

/* toggles */
.toggles { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
.toggles label {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(42,24,64,.06);
  padding: 10px 14px; border-radius: 14px;
  font-weight: 600; font-size: 17px;
  cursor: pointer;
}
.toggles.small { flex-direction: row; }
.toggles.small label { flex: 1; flex-direction: column; gap: 6px; font-size: 14px; padding: 10px 6px; }
.toggles input { display: none; }
.toggles i {
  position: relative; width: 46px; height: 28px; border-radius: 99px;
  background: #cbbfd8; transition: background .2s;
}
.toggles i::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2);
  transition: transform .2s cubic-bezier(.3,1.5,.5,1);
}
.toggles input:checked + i { background: var(--green); }
.toggles input:checked + i::after { transform: translateX(18px); }

/* daily */
.daily-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 8px; }
.day {
  border-radius: 14px; padding: 8px 2px 6px;
  background: rgba(42,24,64,.06);
  font-size: 12px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.day b { font-size: 15px; }
.day .coin { width: 18px; height: 18px; }
.day.got { opacity: .45; }
.day.today { background: #fff0c2; box-shadow: inset 0 0 0 2px var(--gold); }
.day.big { grid-column: span 2; }
#daily-done { display: none; }
.daily-claimed #daily-done { display: block; }
.daily-claimed #daily-actions { display: none; }

/* missions */
.mission-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.mission { background: rgba(42,24,64,.06); border-radius: 16px; padding: 12px; }
.mission .mt { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 15px; }
.mission .mr { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.mission .mr .coin { width: 16px; height: 16px; }
.mission .bar { height: 8px; background: rgba(42,24,64,.12); border-radius: 99px; margin: 8px 0 0; overflow: hidden; }
.mission .bar i { display: block; height: 100%; background: linear-gradient(90deg, #4ade80, #16a34a); border-radius: inherit; }
.mission .mp { font-size: 12px; opacity: .6; margin-top: 4px; }
.mission .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.mission .acts button { border: 0; border-radius: 12px; padding: 9px 4px; font-weight: 700; font-size: 14px; }
.mission .acts .claim { background: var(--ink); color: #fff; }
.mission .acts .claim2 { background: var(--green); color: #fff; }
.mission.claimed { opacity: .5; }

/* shop */
.free-coins {
  width: 100%;
  display: flex; justify-content: space-between; align-items: center;
  border: 0; border-radius: 16px; padding: 12px 14px;
  background: linear-gradient(180deg, #4ade80, #16a34a);
  color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 4px 0 #11803a;
}
.free-coins:disabled { filter: grayscale(1); opacity: .5; }
.fc-left { display: inline-flex; align-items: center; gap: 8px; }
.theme-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme {
  border: 0; border-radius: 16px; padding: 8px 8px 10px;
  background: rgba(42,24,64,.06);
  color: var(--ink);
  display: flex; flex-direction: column; gap: 6px; align-items: stretch;
  font-weight: 600; font-size: 14px;
}
.theme canvas { width: 100%; height: auto; aspect-ratio: 2 / 1; border-radius: 10px; }
.theme .tp { display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-size: 13px; padding: 5px; border-radius: 10px; background: var(--ink); color: #fff; }
.theme .tp .coin { width: 14px; height: 14px; }
.theme.using { box-shadow: inset 0 0 0 3px var(--green); }
.theme.using .tp { background: var(--green); }
.theme .tp.cant { background: #9a8fb0; }
.power-shop { display: flex; flex-direction: column; gap: 8px; }
.pshop {
  display: flex; align-items: center; gap: 10px;
  background: rgba(42,24,64,.06);
  border-radius: 14px; padding: 8px 10px;
  text-align: left;
}
.pshop .pi { font-size: 26px; }
.pshop .pd { flex: 1; font-size: 12px; line-height: 1.3; }
.pshop .pd b { font-size: 15px; display: block; }
.pshop button { border: 0; border-radius: 12px; padding: 8px 10px; font-weight: 700; background: var(--ink); color: #fff; display: inline-flex; align-items: center; gap: 4px; font-size: 14px; }
.pshop button .coin { width: 14px; height: 14px; }
.pshop button:disabled { opacity: .4; }
.noads {
  width: 100%; margin-top: 16px;
  border: 2px dashed rgba(42,24,64,.25); border-radius: 16px;
  background: none; color: var(--ink); padding: 12px;
  font-weight: 700; font-size: 15px; opacity: .6;
}
.noads small { display: block; font-weight: 500; font-size: 12px; }

/* how to */
.howto { text-align: left; padding-left: 22px; margin: 0 0 8px; line-height: 1.45; font-size: 15px; }
.howto li { margin-bottom: 6px; }

/* offer */
.offer-icon { font-size: 54px; line-height: 1; margin-bottom: 6px; }

/* in-game hints */
#tool-hint {
  position: absolute; left: 50%; top: 12%;
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 8px 8px 8px 16px; border-radius: 999px;
  font-weight: 600; font-size: 15px;
  display: none; align-items: center; gap: 10px;
  z-index: 4; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
#tool-hint.show { display: flex; }
#tool-hint button { border: 0; border-radius: 999px; padding: 6px 12px; background: rgba(255,255,255,.18); color: #fff; font-weight: 700; }

#toast {
  position: absolute;
  left: 50%; top: 22%;
  transform: translate(-50%, -10px) scale(.9);
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  font-size: 18px;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 0 #c99a10;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .3s cubic-bezier(.2,1.6,.4,1);
  white-space: nowrap;
  z-index: 6;
}
#toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ---------- Mock ad ---------- */
.ad-mock {
  position: fixed; inset: 0; z-index: 50;
  background: #0d0a18;
  display: grid; place-items: center;
  opacity: 0; transition: opacity .2s;
  padding: 24px;
}
.ad-mock.show { opacity: 1; }
.ad-box { width: min(360px, 100%); text-align: center; color: #fff; }
.ad-tag { display: inline-block; font-size: 12px; letter-spacing: .12em; background: #ffd23f; color: #000; padding: 3px 10px; border-radius: 6px; font-weight: 700; }
.ad-title { font-size: 30px; font-weight: 700; margin: 18px 0 4px; }
.ad-sub { opacity: .7; font-size: 14px; }
.ad-ring { width: 110px; height: 110px; margin: 28px auto; border-radius: 50%; border: 6px solid rgba(255,255,255,.15); border-top-color: #4ade80; animation: spin 1s linear infinite; display: grid; place-items: center; }
.ad-ring span { animation: spin 1s linear infinite reverse; font-size: 36px; font-weight: 700; }
.ad-note { opacity: .6; font-size: 13px; }
.ad-close { margin-top: 18px; width: 100%; border: 0; border-radius: 14px; padding: 14px; font-size: 18px; font-weight: 700; background: #4ade80; color: #0d0a18; }
.ad-close:disabled { background: rgba(255,255,255,.12); color: rgba(255,255,255,.6); }

/* ---------- Rotate hint ---------- */
#rotate {
  display: none;
  position: fixed; inset: 0;
  z-index: 60;
  background: var(--bg1);
  color: var(--cream);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
}
#rotate div { font-size: 56px; margin-bottom: 8px; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  #rotate { display: flex; }
}

/* ---------- Animations ---------- */
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Small screens ---------- */
@media (max-height: 680px) {
  .stat .value { font-size: 24px; }
  #next { width: 42px; height: 42px; }
  .icon-btn { width: 38px; height: 38px; font-size: 15px; }
  .pw { height: 40px; font-size: 13px; }
  #evo { height: 30px; }
  .title { font-size: 52px; }
  .card { padding: 18px 16px 16px; }
  .card h2 { font-size: 26px; margin-bottom: 8px; }
  .final .value { font-size: 44px; }
  .big-btn { font-size: 19px; padding: 11px; }
  .ghost-btn { padding: 10px; margin-top: 8px; }
}
@media (max-width: 360px) {
  #hud { gap: 6px; }
  .coin-chip { font-size: 15px; }
  .pw .pn { display: none; }
  .title { font-size: 48px; }
  .nav-btn { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .big-btn.pulse, .badge { animation: none; }
}


/* ===================== v1.1 UI pass (see docs/UX_AUDIT.md) ===================== */

/* Icons: one sprite, currentColor strokes + a soft accent fill */
.ic {
  width: 1.25em; height: 1.25em;
  flex: none;
  display: inline-block;
  vertical-align: middle;
  --acc: color-mix(in srgb, currentColor 22%, transparent);
}

/* HUD on the home screen shows best score, coins and settings */
.best-stat .value { display: inline-flex; align-items: center; gap: 6px; font-size: 26px; }
.best-stat .ic { color: var(--gold); --acc: rgba(255,210,63,.35); width: 24px; height: 24px; }
.icon-btn { display: grid; place-items: center; }
.icon-btn .ic { width: 22px; height: 22px; --acc: rgba(255,255,255,.25); }
#next { width: 56px; height: 56px; }

/* Home */
.home-center { margin-top: 6%; }
#hero { margin: 18px 0 22px; }
.big-btn, .ghost-btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.big-btn .ic { width: 1.05em; height: 1.05em; --acc: rgba(255,255,255,.3); }
.ghost-btn .ic { width: 20px; height: 20px; }
.nav-btn { gap: 6px; padding: 12px 4px 10px; min-height: 76px; }
.nav-btn .ni {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center;
  color: #fff;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
}
.nav-btn .ni .ic { width: 26px; height: 26px; --acc: rgba(255,255,255,.35); }
.t-pink .ni, .medal.t-pink, .mi.t-pink { background: linear-gradient(180deg, #ff8fa3, #ff5470); }
.t-orange .ni, .medal.t-orange, .mi.t-orange { background: linear-gradient(180deg, #ffb066, #ff8a1f); }
.t-blue .ni, .medal.t-blue, .mi.t-blue { background: linear-gradient(180deg, #6f9bff, #4d6dfe); }
.t-purple .ni, .medal.t-purple, .mi.t-purple { background: linear-gradient(180deg, #b08cff, #8e5cff); }
.t-green .ni, .medal.t-green, .mi.t-green { background: linear-gradient(180deg, #4ade80, #16a34a); }

/* Modal pieces */
.x-btn { width: 44px; height: 44px; top: 10px; right: 10px; display: grid; place-items: center; border-radius: 14px; }
.x-btn .ic { width: 20px; height: 20px; }
.sub { margin: -6px 0 14px; color: var(--ink-2); font-size: 14px; }
.medal {
  width: 76px; height: 76px; margin: 0 auto 10px;
  border-radius: 24px;
  display: grid; place-items: center;
  color: #fff;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.18), 0 8px 18px rgba(42,24,64,.18);
  transform: rotate(-4deg);
}
.medal .ic { width: 42px; height: 42px; --acc: rgba(255,255,255,.35); }

/* Ad language: green + video icon means "plays an ad" everywhere */
.big-btn.ad .ic { --acc: rgba(255,255,255,.35); }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 14px;
  padding: 10px 14px; min-height: 44px;
  font-weight: 700; font-size: 16px;
}
.chip-btn.ad { background: linear-gradient(180deg, #4ade80, #16a34a); color: #fff; box-shadow: 0 4px 0 #11803a; }
.chip-btn.ad:active { transform: translateY(3px); box-shadow: 0 1px 0 #11803a; }
.chip-btn.ad .ic { --acc: rgba(255,255,255,.35); }
.chip-btn:disabled { background: rgba(42,24,64,.08); color: var(--ink-2); box-shadow: none; }

/* Game over */
.best-line { display: flex; align-items: center; justify-content: center; gap: 6px; }
.best-line .ic { color: #f5b700; --acc: rgba(245,183,0,.3); }
.reward-box {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff0c2;
  border-radius: 18px;
  padding: 8px 8px 8px 14px;
  margin: 12px 0 6px;
}
.reward-box .earned { margin: 0; padding: 0; background: none; font-size: 24px; }
.reward-box .earned .coin { width: 26px; height: 26px; }

/* Power bar */
.pw .ic { width: 24px; height: 24px; --acc: rgba(255,255,255,.28); }
.pw.active .ic { --acc: rgba(42,24,64,.18); }
.pw .pc { background: var(--cream); color: var(--ink); top: -7px; right: -5px; }
.pw .pc.ad { background: var(--green); color: #fff; padding: 0 5px; }
.pw .pc .ic { width: 14px; height: 14px; --acc: rgba(255,255,255,.4); }

/* Toggles with icons */
.toggles label { gap: 10px; justify-content: flex-start; }
.toggles label span { flex: 1; text-align: left; }
.toggles label > .ic { width: 22px; height: 22px; color: var(--ink); }
.toggles.small label > .ic { width: 24px; height: 24px; }
.toggles.small label span { flex: none; text-align: center; }
.ghost-btn.as-link { display: flex; }

/* How to */
.howto { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.howto li { display: flex; gap: 10px; align-items: flex-start; margin: 0; }
.hn {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
}

/* Daily */
.day { position: relative; }
.day.got { opacity: 1; background: rgba(34,197,94,.1); color: var(--ink-2); }
.day.got .coin { filter: grayscale(.6); opacity: .6; }
.day .tick {
  position: absolute; top: -6px; right: -6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: grid; place-items: center;
}
.day .tick .ic { width: 14px; height: 14px; }

/* Missions */
.mission { display: grid; grid-template-columns: auto 1fr; gap: 0 12px; align-items: start; }
.mission .mi {
  grid-row: span 3;
  width: 40px; height: 40px; border-radius: 13px;
  display: grid; place-items: center; color: #fff;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.15);
}
.mission .mi .ic { width: 22px; height: 22px; --acc: rgba(255,255,255,.35); }
.mission .acts { grid-column: 2; }
.mission .bar { background: rgba(42,24,64,.14); }
.mission .mp { color: var(--ink-2); opacity: 1; }
.mission.claimed { opacity: 1; }
.mission.claimed .mt span:first-child { color: var(--ink-2); text-decoration: line-through; }
.mission .mt .ic { width: 18px; height: 18px; color: var(--green); }
.mission .acts .claim2 { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.mission .acts .claim2 .ic { width: 18px; height: 18px; --acc: rgba(255,255,255,.35); }
.mission .acts button { min-height: 44px; }

/* Shop */
.shop-coins { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 18px; margin: -4px 0 12px; background: #fff0c2; padding: 4px 14px 4px 6px; border-radius: 999px; }
.fc-left { gap: 10px; }
.fc-left .ic { width: 24px; height: 24px; --acc: rgba(255,255,255,.35); }
.fc-right { background: rgba(0,0,0,.18); padding: 3px 10px; border-radius: 999px; font-size: 14px; }
.free-coins { min-height: 52px; }
.theme .tp .ic { width: 14px; height: 14px; }
.pshop .pi { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(180deg, #6f9bff, #4d6dfe); }
.pshop .pi .ic { width: 26px; height: 26px; --acc: rgba(255,255,255,.35); }
.pshop button { min-height: 40px; }
.noads { display: flex; align-items: center; justify-content: center; gap: 10px; opacity: .75; color: var(--ink-2); }
.noads .ic { width: 26px; height: 26px; }
.noads span { text-align: left; }

/* Toast and tool hint */
#toast { top: 19%; display: flex; align-items: center; gap: 8px; font-size: 16px; padding: 8px 16px 8px 10px; }
#toast .ic { width: 22px; height: 22px; color: var(--ink); --acc: rgba(42,24,64,.18); }
#toast.plain { padding-left: 16px; }
.at-home #toast { top: auto; bottom: 21%; }
#tool-hint { gap: 8px; padding-left: 12px; }
#tool-hint .ic { width: 20px; height: 20px; color: var(--gold); --acc: rgba(255,210,63,.3); }
#tool-hint button { min-height: 36px; }

#rotate .ic { width: 72px; height: 72px; margin-bottom: 12px; color: var(--gold); --acc: rgba(255,210,63,.25); animation: tilt 1.8s ease-in-out infinite; }
@keyframes tilt { 0%, 30% { transform: rotate(-90deg); } 60%, 100% { transform: rotate(0); } }

@media (max-height: 680px) {
  .nav-btn { min-height: 64px; padding: 8px 4px; }
  .nav-btn .ni { width: 34px; height: 34px; border-radius: 11px; }
  .nav-btn .ni .ic { width: 22px; height: 22px; }
  .medal { width: 60px; height: 60px; border-radius: 18px; }
  .medal .ic { width: 32px; height: 32px; }
  #hero { margin: 10px 0 14px; }
}

/* ---------- v1.2 game modes ---------- */
.modes { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0 0 6px; }
.mode-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 2px 7px; min-height: 44px;
  border: 2px solid transparent; border-radius: 16px;
  background: rgba(255,255,255,.7);
  color: var(--ink); font: inherit; font-weight: 600; font-size: 13px;
  box-shadow: 0 3px 0 #d9c6a8;
  transition: transform .12s, background .15s;
}
.mode-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #d9c6a8; }
.mode-btn .ni { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.mode-btn .ni .ic { width: 22px; height: 22px; --acc: rgba(255,255,255,.35); }
.mode-btn .stars { display: flex; gap: 3px; }
.mode-btn .stars i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-2); opacity: .55; }
.mode-btn.on { background: #fff; border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.mode-btn.on .stars i { background: var(--accent); opacity: 1; }
.mode-btn .new {
  position: absolute; top: -8px; right: -4px;
  padding: 1px 6px; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .03em;
  box-shadow: 0 2px 0 rgba(0,0,0,.2);
}
.mode-desc { margin: 2px 0 14px; min-height: 2.6em; text-align: center; color: var(--ink-2); font-size: 14px; line-height: 1.3; max-width: 300px; }
.mode-tag { display: inline-flex; align-items: center; gap: 6px; margin: -4px auto 8px; padding: 4px 12px; border-radius: 999px; background: rgba(42,24,64,.08); color: var(--ink-2); font-size: 13px; font-weight: 600; }
.mode-tag .ic { width: 16px; height: 16px; }
#ov-over .card { text-align: center; }
@media (max-height: 680px) {
  #hero { display: none; }
  .home-center { margin-top: 2%; }
  .title { font-size: 44px; margin-bottom: 12px; }
  .mode-btn .ni { width: 28px; height: 28px; border-radius: 9px; }
  .mode-btn .ni .ic { width: 18px; height: 18px; }
  .mode-desc { margin-bottom: 10px; font-size: 13px; }
}
#hero { max-width: 230px; margin: 8px 0 12px; }
.home-center { margin-top: 3%; }
@media (max-height: 600px) {
  .title { font-size: 38px; margin-bottom: 8px; }
  .mode-desc { margin-bottom: 6px; min-height: 0; }
  #btn-play { padding-top: 10px; padding-bottom: 10px; font-size: 26px; }
}

/* ---------- launch intro ---------- */
#intro {
  position: fixed; inset: 0; z-index: 1000;
  background: #0b0727;
  transition: background-color .35s ease, opacity .35s ease;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}
#intro.game { background: var(--bg1); }
#intro.out { opacity: 0; pointer-events: none; }
.intro-card {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity .3s ease;
}
/* same size and spot as the Android 12+ splash icon, so the hand-off is seamless */
.lav-mark { width: 160px; height: auto; color: #fff; animation: lav-in .5s ease-out both; }
#intro.native .lav-mark { animation: none; }
.lav-spark { transform-box: fill-box; transform-origin: center; animation: lav-twinkle .9s .35s ease-in-out both; }
.lav-word {
  margin-top: 14px;
  font: 500 12px/1 ui-monospace, 'SFMono-Regular', Menlo, monospace;
  letter-spacing: .5em; text-indent: .5em; text-transform: uppercase;
  color: rgba(255, 255, 255, .62);
  animation: lav-word .6s .3s ease-out both;
}
.intro-game { opacity: 0; }
#intro.game .intro-lav { opacity: 0; }
#intro.game .intro-game { opacity: 1; }
#intro-cv { width: 260px; height: 170px; }
.intro-game .title { margin-top: -6px; opacity: 0; }
#intro.game .intro-game .title { animation: title-pop .5s .78s cubic-bezier(.3, 1.6, .5, 1) both; }
.intro-tag {
  margin: 14px 0 0; font-size: 17px; font-weight: 600; color: var(--cream);
  opacity: 0;
}
#intro.game .intro-tag { animation: rise-in .45s 1.1s ease-out both; }
.intro-skip {
  position: absolute; left: 0; right: 0; bottom: calc(28px + env(safe-area-inset-bottom));
  margin: 0; text-align: center; font-size: 13px; color: rgba(255, 255, 255, .45);
  opacity: 0; transition: opacity .4s ease;
}
#intro.can-skip .intro-skip { opacity: 1; }

@keyframes lav-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes lav-twinkle { 0%, 100% { transform: none; } 45% { transform: scale(1.45) rotate(45deg); } }
@keyframes lav-word { from { opacity: 0; letter-spacing: 1.1em; } to { opacity: 1; letter-spacing: .5em; } }
@keyframes title-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* home entrance right after the intro */
.home-enter #hud,
.home-enter .home-center > .title,
.home-enter #hero,
.home-enter #modes,
.home-enter #mode-desc,
.home-enter .home-nav { animation: rise-in .45s ease-out both; }
.home-enter #hero { animation-delay: .06s; }
.home-enter #modes { animation-delay: .12s; }
.home-enter #mode-desc { animation-delay: .16s; }
.home-enter .home-nav { animation-delay: .24s; }

@media (prefers-reduced-motion: reduce) {
  .lav-mark, .lav-spark, .lav-word, #intro.game .intro-game .title, #intro.game .intro-tag,
  .home-enter #hud, .home-enter .home-center > .title, .home-enter #hero, .home-enter #modes,
  .home-enter #mode-desc, .home-enter .home-nav { animation-duration: .01s; animation-delay: 0s; }
}
