/* MalMonster — "Glow-in-the-Dark Dungeon", touch-first overhaul */
:root {
  --bg: #1b1b2f;
  --bg2: #232342;
  --panel: #2c2c52;
  --panel2: #353562;
  --line: #45457c;
  --text: #f4f1ff;
  --muted: #a8a5c9;
  --gold: #ffd166;
  --gold2: #ffb703;
  --good: #06d6a0;
  --bad: #ef476f;
  --info: #4cc9f0;
  --ember: #ff9f43;
  --r: 20px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  --keycap: 0 4px 0 rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 700px at 50% -10%, #2d2d55 0%, var(--bg) 60%) fixed;
  color: var(--text);
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
/* Bottom navbar gap lives on #app (NOT body): #app grows with overflowing
   screens, so the gap sits after the last content when a page scrolls.
   body has a fixed 100% height, so its padding would stay at the viewport
   bottom and scrolling content would slide past it. Standalone Android often
   reports env()=0 even when the bar overlays, hence the guaranteed minimum. */
#app { min-height: 100%; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
@media (display-mode: standalone) and (pointer: coarse) {
  /* 48px covers Android 3-button navbars that report env()=0; devices with
     correct insets use their real value via max() */
  #app { padding-bottom: max(env(safe-area-inset-bottom), 48px); }
}
/* browser chrome carries the design too */
::selection { background: var(--gold); color: var(--bg); }
input, textarea { caret-color: var(--gold); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 12px; }
* { scrollbar-width: thin; scrollbar-color: var(--panel2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--panel2); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

h1, h2, h3 { margin: .2em 0; }
button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; touch-action: manipulation; }
svg { display: block; }
.ico { display: inline-block; vertical-align: -0.15em; }
.menu-btn .ico { margin-bottom: 2px; }

.screen { flex: 1; display: flex; flex-direction: column; padding: max(12px, env(safe-area-inset-top)) 14px 14px; animation: fadein .28s cubic-bezier(.2, .8, .3, 1); max-width: 720px; margin: 0 auto; width: 100%; }
@keyframes fadein { from { opacity: 0; transform: translateY(10px) scale(.995); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 10px 22px; border-radius: 16px;
  font-size: 19px; font-weight: 700;
  background: linear-gradient(180deg, var(--gold), var(--gold2));
  color: #3a2c00; box-shadow: var(--shadow);
  transition: transform .06s ease, filter .15s;
}
.btn:active { transform: scale(.96); }
.btn.secondary { background: var(--panel2); color: var(--text); box-shadow: none; border: 2px solid var(--line); }
.btn.good { background: linear-gradient(180deg, #2ee6a8, var(--good)); color: #003b2b; }
.btn.danger { background: linear-gradient(180deg, #ff6b92, var(--bad)); color: #fff; }
.btn.big { min-height: 68px; font-size: 24px; border-radius: 20px; }
.btn:disabled { filter: grayscale(.7) brightness(.7); }
.btn-icon { width: 52px; min-height: 52px; padding: 0; border-radius: 14px; background: var(--panel2); border: 2px solid var(--line); font-size: 22px; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon:active { transform: scale(.94); }

/* ---------- top bar / hero ---------- */
.toprow { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.toprow .spacer { flex: 1; }
.title-lg { font-size: 26px; font-weight: 800; letter-spacing: .3px; }

.hero-bar { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); }
.hero-avatar { width: 74px; height: 74px; border-radius: 18px; background: var(--bg2); display: grid; place-items: center; flex: none; border: none; padding: 0; }
.hero-meta { flex: 1; min-width: 0; }
.hero-name { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--bg2); border: 1.5px solid var(--line); color: var(--text); border-radius: 999px; padding: 3px 10px; font-size: 14px; font-weight: 700; }
.chip.gold { color: var(--gold); border-color: var(--gold2); }
.chip.streak { color: var(--ember); border-color: var(--ember); }
.chip.level { color: var(--info); border-color: var(--info); }
.hero-title { color: var(--muted); font-size: 14px; margin-top: 2px; }
.xpbar { height: 12px; border-radius: 999px; background: var(--bg2); border: 1.5px solid var(--line); overflow: hidden; margin-top: 8px; }
.xpbar > div { height: 100%; background: linear-gradient(90deg, var(--info), #7bdff2); border-radius: 999px; transition: width .5s ease; }

.menu-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.menu-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 10px 4px; font-size: 13.5px; font-weight: 700; color: var(--text); }
.menu-btn:active { transform: scale(.95); }

/* ---------- quests ---------- */
.quest { background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; }
.quest .q-info { flex: 1; min-width: 0; }
.quest .q-label { font-size: 15px; font-weight: 700; }
.quest .q-reward { color: var(--gold); font-size: 14px; font-weight: 800; display: inline-flex; align-items: center; gap: 4px; }
.quest .q-bar { height: 10px; background: var(--bg2); border-radius: 999px; margin-top: 6px; overflow: hidden; border: 1px solid var(--line); }
.quest .q-bar > div { height: 100%; background: var(--good); transition: width .4s ease; }
.quest.done { border-color: var(--good); }

/* ---------- worlds ---------- */
.world-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 4px 0 20px; }
.world-card { position: relative; background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); padding: 14px 10px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: var(--shadow); transition: transform .08s; }
.world-card:active { transform: scale(.96); }
.world-card .w-name { font-weight: 800; font-size: 15px; text-align: center; line-height: 1.15; }
.world-card .w-table { font-size: 13px; color: var(--muted); font-weight: 700; }
.world-card.locked { filter: grayscale(.8) brightness(.55); }
.world-card.captured { border-color: rgba(255, 209, 102, .55); }
.world-card .lock { position: absolute; inset: 0; display: grid; place-items: center; }
.world-card .w-done { position: absolute; top: 8px; right: 8px; }
.w-mastery { width: 82%; height: 6px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); overflow: hidden; }
.w-mastery > div { height: 100%; border-radius: inherit; transition: width .5s ease; }
.section-title { font-size: 18px; font-weight: 800; margin: 14px 0 8px; color: var(--gold); }

/* world detail sheet */
.sheet { background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.monster-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 14px; }
.monster-hero .m-name { font-size: 24px; font-weight: 800; }
.monster-hero .m-sub { color: var(--muted); font-size: 14px; }
.facts-dots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 6px 0 14px; }
.fact-dot { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; border: 1.5px solid var(--line); background: var(--bg2); color: var(--muted); }
.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-row .btn { width: 100%; }

/* ---------- duel arena (signature) ---------- */
.arena {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 4px;
  min-height: min(320px, 38vh);
  border: 2px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  padding: 12px 8px 10px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(76, 201, 240, .12), transparent 55%),
    radial-gradient(150% 110% at 50% 118%, rgba(255, 209, 102, .10), transparent 52%),
    linear-gradient(180deg, #1f1f3d, #27274c);
  box-shadow: var(--shadow);
}
.arena::before {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 30px;
  background: linear-gradient(180deg, rgba(69, 69, 124, .35), rgba(27, 27, 47, .9));
  border-top: 2px solid rgba(69, 69, 124, .55);
}
.arena .crystal { position: absolute; bottom: 26px; z-index: 0; }
.arena .crystal.l { left: 10px; }
.arena .crystal.r { right: 10px; }
.arena .crystal svg { filter: drop-shadow(0 0 9px rgba(76, 201, 240, .55)); animation: crystalGlow 3.2s ease-in-out infinite; }
@keyframes crystalGlow { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }

.fighter { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; z-index: 1; min-width: 0; }
.f-top { height: 24px; display: flex; align-items: center; justify-content: center; }
.fighter .f-svg { width: min(36vw, 190px); height: min(36vw, 190px); }
.fighter.mon .f-svg { width: min(40vw, 215px); height: min(40vw, 215px); }
.fighter .f-svg svg { width: 100%; height: 100%; filter: drop-shadow(0 10px 10px rgba(0, 0, 0, .35)); }
.f-plate { font-size: 13.5px; font-weight: 800; background: rgba(27, 27, 47, .75); border: 1.5px solid var(--line); border-radius: 999px; padding: 2px 12px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fighter.hero .f-plate { color: #7bdff2; border-color: rgba(76, 201, 240, .5); }
.fighter.mon .f-plate { color: #ffb3c4; border-color: rgba(239, 71, 111, .45); }
.vs { align-self: center; margin-bottom: 40px; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 999px; background: var(--panel2); border: 2px solid var(--line); font-size: 15px; font-weight: 900; letter-spacing: 1px; color: var(--muted); z-index: 1; }
.pet-slot { position: absolute; bottom: 16px; left: 50%; margin-left: -58px; z-index: 2; filter: drop-shadow(0 3px 4px rgba(0,0,0,.4)); }

/* attack + victim reactions */
.fighter.atk .f-svg { animation: heroLunge .48s cubic-bezier(.2, .85, .3, 1.3); }
.fighter.mon.atk .f-svg { animation: monLunge .48s cubic-bezier(.2, .85, .3, 1.3); }
@keyframes heroLunge { 0% { transform: translateX(0); } 32% { transform: translateX(44%) scale(1.05) rotate(5deg); } 62% { transform: translateX(50%) rotate(3deg); } 100% { transform: translateX(0); } }
@keyframes monLunge { 0% { transform: translateX(0); } 32% { transform: translateX(-46%) scale(1.05) rotate(-5deg); } 62% { transform: translateX(-52%) rotate(-3deg); } 100% { transform: translateX(0); } }
.fighter.victim .f-svg { animation: victimShake .42s ease; }
@keyframes victimShake {
  0% { transform: translateX(0); filter: none; }
  18% { transform: translateX(-8px) rotate(-4deg); filter: brightness(2.3) saturate(.4) drop-shadow(0 0 14px #fff); }
  48% { transform: translateX(7px) rotate(3deg); filter: brightness(1.7) saturate(.7); }
  75% { transform: translateX(-4px); filter: none; }
  100% { transform: translateX(0); filter: none; }
}
.fighter.fainted .f-svg { filter: grayscale(1) brightness(.55); transform: rotate(9deg) translateY(12px); opacity: .55; transition: all .6s ease; }
.fighter.cheer .f-svg { animation: cheer .6s ease; }
@keyframes cheer { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(-16px) scale(1.05); } 60% { transform: translateY(-6px); } 80% { transform: translateY(-12px); } }

/* impact fx */
.impact { position: absolute; top: 8%; left: 50%; margin-left: -32px; z-index: 3; pointer-events: none; animation: impactPop .4s ease-out forwards; }
@keyframes impactPop { 0% { transform: scale(.3) rotate(-40deg); opacity: 0; } 35% { transform: scale(1.15) rotate(0deg); opacity: 1; } 100% { transform: scale(.72) rotate(14deg); opacity: 0; } }

.float-pts { position: absolute; top: 4%; left: 50%; transform: translateX(-50%); font-size: 28px; font-weight: 900; color: var(--good); animation: floatup .8s ease forwards; pointer-events: none; z-index: 3; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
@keyframes floatup { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -60px); } }

/* bars in the arena */
.hpbar { width: min(150px, 34vw); height: 14px; border-radius: 999px; background: var(--bg2); border: 2px solid var(--line); overflow: hidden; }
.hpbar > div { height: 100%; background: linear-gradient(90deg, var(--bad), #ff8fa3); transition: width .35s ease; }
.timerbar { width: min(150px, 34vw); height: 10px; border-radius: 999px; background: var(--bg2); border: 1.5px solid var(--line); overflow: hidden; }
.timerbar > div { height: 100%; background: linear-gradient(90deg, var(--ember), var(--bad)); border-radius: 999px; }
.timerbar.low > div { animation: chargePulse .45s ease-in-out infinite; }
@keyframes chargePulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.hearts { display: flex; gap: 4px; }
.hearts .off { filter: grayscale(1) brightness(.5); }
.heart-lost { animation: heartPop .55s ease forwards; }
@keyframes heartPop { 0% { transform: scale(1.7); opacity: 1; } 100% { transform: scale(.5); opacity: 0; } }

.battle-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.b-title { font-weight: 800; color: var(--muted); font-size: 15px; }
.battle-score { font-weight: 800; font-size: 20px; color: var(--gold); }
.streak { font-weight: 800; color: var(--ember); display: inline-flex; align-items: center; gap: 4px; }

/* ---------- question + inputs ---------- */
.question-card { background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); padding: 12px; text-align: center; box-shadow: var(--shadow); margin: 10px 0 8px; }
.question { font-size: clamp(40px, 11vw, 58px); font-weight: 900; letter-spacing: 2px; line-height: 1.1; }
.input-display { font-size: clamp(34px, 9vw, 44px); font-weight: 900; color: var(--gold); min-height: 1.3em; letter-spacing: 4px; }
.feedback { font-size: 20px; font-weight: 800; min-height: 1.4em; margin-top: 4px; }
.feedback.ok { color: var(--good); }
.feedback.no { color: var(--bad); }

.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 420px; width: 100%; margin: 4px auto 0; }
.numpad button { min-height: 64px; border-radius: 16px; background: var(--panel2); border: 2px solid var(--line); font-size: 30px; font-weight: 800; box-shadow: var(--keycap); }
.numpad button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.3); }
.numpad .key-ok { background: linear-gradient(180deg, #2ee6a8, var(--good)); color: #003b2b; border-color: transparent; }
.numpad .key-del { font-size: 24px; }
.numpad button:disabled { opacity: .45; box-shadow: none; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 480px; width: 100%; margin: 6px auto 0; }
.choices button { min-height: 74px; border-radius: 18px; background: var(--panel2); border: 2px solid var(--line); font-size: 32px; font-weight: 900; box-shadow: var(--keycap); }
.choices button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.3); }
.choices button.ok { background: var(--good); color: #003b2b; border-color: transparent; }
.choices button.no { background: var(--bad); color: #fff; border-color: transparent; }
.choices button:disabled { box-shadow: none; }

.progressline { text-align: center; color: var(--muted); font-weight: 800; margin-top: 8px; }

/* ---------- discover slides ---------- */
.slide-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.groups { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.group { background: rgba(255,255,255,.06); border: 2px dashed var(--line); border-radius: 18px; padding: 10px; display: grid; grid-template-columns: repeat(2, auto); gap: 6px; align-items: center; justify-items: center; }
.slide-math { font-size: clamp(24px, 7vw, 36px); font-weight: 900; color: var(--gold); text-align: center; }
.slide-sum { font-size: clamp(16px, 5vw, 22px); color: var(--muted); font-weight: 700; text-align: center; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 10, 22, .82); display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); z-index: 50; animation: fadein .2s ease; overflow-y: auto; }
.overlay .card { width: 100%; max-width: 440px; max-height: 92vh; overflow-y: auto; background: var(--panel); border: 2px solid var(--line); border-radius: 24px; padding: 22px; text-align: center; box-shadow: var(--shadow); animation: cardPop .32s cubic-bezier(.2, .85, .3, 1.25); position: relative; }
@keyframes cardPop { from { transform: scale(.85) translateY(16px); opacity: 0; } }
.overlay .card.win::before {
  content: "";
  position: absolute; inset: -70%;
  background: repeating-conic-gradient(rgba(255, 209, 102, .05) 0 7deg, transparent 7deg 22deg);
  animation: rays 30s linear infinite;
  pointer-events: none;
}
@keyframes rays { to { transform: rotate(1turn); } }
.overlay .card > * { position: relative; }
.stars { font-size: 42px; letter-spacing: 6px; margin: 4px 0 10px; display: flex; justify-content: center; }
.stars .dim { filter: grayscale(1) brightness(.45); }
.reward-row { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin: 8px 0; }
.reward { background: var(--bg2); border: 1.5px solid var(--line); border-radius: 14px; padding: 8px 16px; font-weight: 900; font-size: 20px; display: inline-flex; align-items: center; gap: 6px; }
.reward.xp { color: var(--info); }
.reward.coins { color: var(--gold); }
.card h2 { font-size: 30px; }
.levelup { background: linear-gradient(90deg, rgba(76,201,240,.2), rgba(123,223,242,.08)); border: 2px solid var(--info); border-radius: 14px; padding: 10px; margin: 10px 0; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.newchips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 8px 0; }
.newchips .chip { border-color: var(--gold); color: var(--gold); }
.capture-card { margin: 12px auto; padding: 12px; border: 3px solid var(--gold); border-radius: 18px; background: radial-gradient(circle at 50% 30%, rgba(255,209,102,.25), transparent 70%); animation: glowpulse 1.4s ease infinite; }
@keyframes glowpulse { 0%,100% { box-shadow: 0 0 12px rgba(255,209,102,.4); } 50% { box-shadow: 0 0 30px rgba(255,209,102,.8); } }
.capture-card .cap-label { color: var(--gold); font-weight: 900; font-size: 20px; margin-top: 4px; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.card .actions { display: grid; gap: 10px; margin-top: 14px; }
.confirm-text { font-size: 18px; font-weight: 700; color: var(--text); margin: 6px 0 4px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--panel); border: 2px solid var(--gold); color: var(--text); font-weight: 800; padding: 12px 22px; border-radius: 999px; box-shadow: var(--shadow); z-index: 90; max-width: 88vw; text-align: center; animation: toastIn .25s cubic-bezier(.2,.85,.3,1.2), toastOut .3s ease 2.25s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px) scale(.92); } }
@keyframes toastOut { to { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- shop / collection / hall ---------- */
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding-bottom: 20px; }
.item-card { background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.item-card.equipped { border-color: var(--good); }
.item-card .price { color: var(--gold); font-weight: 900; }
.item-card .state { font-size: 13px; color: var(--muted); font-weight: 700; }
.item-card button { min-height: 44px; border-radius: 12px; background: var(--gold2); color: #3a2c00; font-weight: 800; width: 100%; }
.item-card button.own { background: var(--panel2); color: var(--text); border: 2px solid var(--line); }

.coll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; padding-bottom: 20px; }
.coll-card { background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.coll-card .c-name { font-size: 13px; font-weight: 800; }
.coll-card.missed { filter: grayscale(1) brightness(.4); }
.coll-card.got { border-color: var(--gold); }

.tabs { display: flex; gap: 8px; margin: 8px 0 12px; }
.tabs button { flex: 1; min-height: 48px; border-radius: 14px; background: var(--panel); border: 2px solid var(--line); font-weight: 800; font-size: 16px; }
.tabs button.active { background: var(--gold2); color: #3a2c00; border-color: transparent; }
.hall-row { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; margin-bottom: 8px; }
.hall-row.me { border-color: var(--gold); }
.hall-row .rank { font-size: 22px; font-weight: 900; width: 40px; text-align: center; color: var(--muted); display: grid; place-items: center; }
.hall-row.top .rank { color: var(--gold); }
.hall-row .h-name { flex: 1; font-weight: 800; }
.hall-row .h-pts { font-weight: 900; color: var(--gold); display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-weight: 700; }

/* ---------- hero select / create ---------- */
.hero-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.hero-pick { background: var(--panel); border: 3px solid var(--line); border-radius: 18px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 800; }
.hero-pick.selected { border-color: var(--gold); background: var(--panel2); }
.hero-pick:active { transform: scale(.96); }
.text-input { width: 100%; min-height: 62px; border-radius: 16px; border: 2px solid var(--line); background: var(--bg2); color: var(--text); font-size: 24px; font-weight: 800; padding: 8px 16px; text-align: center; outline: none; }
.text-input:focus { border-color: var(--gold); }

/* ---------- parents / PIN ---------- */
.pin-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 12px 0 2px; min-height: 18px; }
.pin-dot { width: 16px; height: 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--bg2); transition: all .12s ease; }
.pin-dot.filled { background: var(--gold); border-color: var(--gold2); transform: scale(1.1); }
.pin-error { color: var(--bad); font-weight: 800; min-height: 1.5em; text-align: center; }
.pin-error.shake { animation: victimShake .4s ease; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(300px, 84vw); }
.pin-pad button { min-height: 62px; border-radius: 16px; background: var(--panel2); border: 2px solid var(--line); font-size: 26px; font-weight: 800; box-shadow: var(--keycap); }
.pin-pad button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.3); }
.pin-pad .key-ok { background: linear-gradient(180deg, #2ee6a8, var(--good)); color: #003b2b; border-color: transparent; font-size: 20px; }

.kid-row { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 10px 12px; margin-bottom: 10px; }
.kid-row .k-ava { width: 52px; height: 52px; flex: none; }
.kid-row .k-name { flex: 1; min-width: 0; font-weight: 800; }
.kid-row .k-sub { color: var(--muted); font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.kid-row .k-sub .k-gold { display: inline-flex; align-items: center; gap: 4px; }
.kid-row .trash { width: 48px; height: 48px; border-radius: 12px; background: var(--panel2); border: 2px solid var(--bad); color: var(--bad); display: grid; place-items: center; flex: none; }
.kid-row .trash:active { transform: scale(.92); }

/* achievements list */
.ach-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 20px; }
.ach-row { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.ach-row .em { display: grid; place-items: center; }
.ach-row .a-when { color: var(--muted); font-size: 12.5px; }

/* heatmap (parents) */
.heat-wrap { overflow-x: auto; padding-bottom: 20px; }
.heat-grid { display: grid; grid-template-columns: repeat(12, 30px); gap: 3px; }
.heat-cell { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #fff; background: var(--panel2); }
.legend { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; margin: 8px 0 14px; }
.legend .sw { width: 18px; height: 18px; border-radius: 5px; }

.center-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.logo { width: 140px; height: 140px; }
.subtitle { color: var(--muted); font-weight: 700; }
