/* ═══════════════════════════════════════════════════════════
   Screens (title / map / tester / codex), modals, buttons
   ═══════════════════════════════════════════════════════════ */
.screen {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; align-items: center;
  padding: clamp(14px, 3vh, 34px) clamp(12px, 3vw, 28px) 40px;
  animation: screen-in .4s ease both;
}
.screen-inner { width: min(960px, 100%); margin: auto 0; }

/* buttons */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 12px 26px; cursor: pointer;
  border: 4px solid var(--outline); border-radius: 20px;
  font-family: var(--round); font-size: 19px; font-weight: 900; letter-spacing: .04em; color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.3);
  background: linear-gradient(180deg, #ffb64a 0%, #ff8a2b 55%, #f06a1c 100%);
  box-shadow: 0 6px 0 #a8420f, 0 14px 22px rgba(0,0,0,.25), inset 0 3px 0 rgba(255,255,255,.55);
  transition: transform .12s ease, filter .12s ease;
}
.btn::after { content: ""; position: absolute; left: 10px; right: 10px; top: 5px; height: 36%; border-radius: 12px; background: linear-gradient(180deg, rgba(255,255,255,.5), transparent); pointer-events: none; }
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #a8420f, 0 6px 10px rgba(0,0,0,.2), inset 0 3px 0 rgba(255,255,255,.4); }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn--green { background: linear-gradient(180deg, #7be26a, #3fb54a 55%, #2a9a3d); box-shadow: 0 6px 0 #1a6a2a, 0 14px 22px rgba(0,0,0,.25), inset 0 3px 0 rgba(255,255,255,.55); }
.btn--blue { background: linear-gradient(180deg, #7cc6ff, #3d96f0 55%, #2a78d6); box-shadow: 0 6px 0 #1b4f95, 0 14px 22px rgba(0,0,0,.25), inset 0 3px 0 rgba(255,255,255,.55); }
.btn--ghost { color: var(--ink); text-shadow: none; background: linear-gradient(180deg, #fffdf3, #ffeec3); box-shadow: 0 5px 0 var(--frame-edge), 0 10px 16px rgba(0,0,0,.18), inset 0 3px 0 #fff; font-size: 15px; min-height: 44px; padding: 8px 18px; border-radius: 16px; }
.btn--small { font-size: 14px; min-height: 40px; padding: 6px 16px; border-radius: 14px; }
.btn--wide { width: 100%; }

/* ── Title ───────────────────────────────────────────────── */
.title-screen { justify-content: center; text-align: center; }
.title-logo { position: relative; margin-bottom: 4px; }
.title-logo .ribbon { display: inline-block; padding: 3px 18px; border: 3px solid var(--outline); border-radius: 999px; background: linear-gradient(180deg, #ff8fb5, #ff5f8f); color: #fff; font-family: var(--round); font-size: 13px; font-weight: 900; letter-spacing: .3em; text-shadow: 0 1px 0 rgba(0,0,0,.3); transform: rotate(-3deg); box-shadow: 0 3px 0 #9a2a55; }
.title-logo h1 {
  position: relative; margin: 4px 0 0; font-family: var(--round); font-size: clamp(60px, 15vw, 120px); font-weight: 900; line-height: 1.02; letter-spacing: -.02em;
  color: #ffd53a; -webkit-text-stroke: 12px var(--outline); paint-order: stroke fill;
  filter: drop-shadow(0 8px 0 var(--outline)) drop-shadow(0 18px 22px rgba(0,0,0,.28));
  animation: logo-bob 3.4s ease-in-out infinite;
}
.title-logo h1::after {
  content: attr(data-text); position: absolute; inset: 0; -webkit-text-stroke: 0;
  background: linear-gradient(180deg, #fffbb8 0%, #ffd53a 48%, #ff9a1f 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.title-sub { display: inline-block; margin: 14px 0 22px; padding: 5px 16px; border: 3px solid var(--outline); border-radius: 999px; background: rgba(255,255,255,.78); font-size: 13px; font-weight: 900; color: var(--ink); letter-spacing: .1em; box-shadow: 0 3px 0 var(--frame-edge); }
.title-moles { display: flex; justify-content: center; align-items: flex-end; gap: clamp(0px, 1vw, 10px); height: clamp(86px, 17vw, 130px); margin: 0 0 8px; }
.title-moles .tm { width: clamp(62px, 13vw, 100px); animation: tm-peek 2.6s ease-in-out infinite; animation-delay: var(--dl, 0s); filter: drop-shadow(0 6px 4px rgba(0,0,0,.3)); }
.title-moles .tm svg { width: 100%; height: auto; display: block; overflow: visible; }
.title-actions { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.title-actions .btn--big { font-size: 26px; min-height: 68px; padding: 14px 48px; border-radius: 26px; }
.title-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.title-foot { margin-top: 22px; font-size: 11px; font-weight: 700; color: rgba(255,255,255,.88); text-shadow: 0 1px 3px rgba(0,0,0,.5); }

/* ── Panels ──────────────────────────────────────────────── */
.panel {
  position: relative; padding: clamp(16px, 3vw, 26px);
  border: 4px solid var(--outline); border-radius: 28px;
  background: radial-gradient(circle at 10% 0%, #fff, transparent 36%), linear-gradient(170deg, var(--panel-1), var(--panel-2));
  box-shadow: 0 8px 0 var(--frame-edge), 0 24px 40px rgba(0,0,0,.28), inset 0 3px 0 #fff;
}
.screen-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.screen-head h2 { margin: 0; flex: 1; text-align: center; font-family: var(--round); font-size: clamp(22px, 5vw, 32px); font-weight: 900; color: #fff; -webkit-text-stroke: 6px var(--outline); paint-order: stroke fill; text-shadow: 0 4px 0 var(--outline); letter-spacing: .04em; }
.star-total { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 3px solid var(--outline); border-radius: 999px; background: linear-gradient(180deg, #fff7d0, #ffe08a); font-family: var(--round); font-weight: 900; color: #8a4a08; box-shadow: 0 3px 0 var(--frame-edge); }

/* ── Map ─────────────────────────────────────────────────── */
.world-tabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.world-tab { display: flex; align-items: center; gap: 6px; padding: 7px 14px; cursor: pointer; border: 3px solid var(--outline); border-radius: 999px; background: #fffdf2; font-family: var(--round); font-size: 13px; font-weight: 900; color: var(--ink); box-shadow: 0 3px 0 var(--frame-edge); }
.world-tab[aria-selected="true"] { background: var(--accent); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.3); }
.world-tab:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.6); }
.world-banner { text-align: center; margin: 0 0 12px; }
.world-banner b { font-family: var(--round); font-size: 20px; color: var(--ink); }
.world-banner span { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-top: 2px; }
.stage-path { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px 8px; padding: 8px 4px 4px; }
.stage-node { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer; }
.stage-node .dot {
  position: relative; display: grid; place-items: center; width: clamp(54px, 11vw, 78px); aspect-ratio: 1; border: 4px solid var(--outline); border-radius: 50%;
  background: linear-gradient(180deg, #ffd25a, #ff9f2a); box-shadow: 0 5px 0 #a8590f, inset 0 3px 0 rgba(255,255,255,.55);
  font-family: var(--round); font-size: clamp(18px, 4vw, 26px); font-weight: 900; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.35); transition: transform .12s ease;
}
.stage-node:hover .dot { transform: translateY(-3px) scale(1.04); }
.stage-node.is-cleared .dot { background: linear-gradient(180deg, #8bec7a, #3fb54a); box-shadow: 0 5px 0 #1d6e2a, inset 0 3px 0 rgba(255,255,255,.55); }
.stage-node.is-current .dot { animation: node-pulse 1.3s ease-in-out infinite; }
.stage-node.is-locked { cursor: not-allowed; }
.stage-node.is-locked .dot { background: linear-gradient(180deg, #cfcfd6, #9a9aa8); box-shadow: 0 5px 0 #5d5d6a, inset 0 3px 0 rgba(255,255,255,.4); color: #f4f4f8; }
.stage-node .mode-chip { font-size: 11px; font-weight: 900; color: var(--ink); white-space: nowrap; text-align: center; line-height: 1.2; }
.stage-node .stars { font-size: 13px; letter-spacing: 1px; color: #f2a516; text-shadow: 0 1px 0 rgba(0,0,0,.2); line-height: 1; }
.stage-node .badge-new { position: absolute; top: -8px; right: 2px; padding: 1px 6px; border: 2px solid var(--outline); border-radius: 999px; background: #ff4a6b; color: #fff; font-size: 9px; font-weight: 900; letter-spacing: .06em; transform: rotate(8deg); }
.stage-node .badge-boss { position: absolute; top: -10px; left: -2px; font-size: 20px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.3)); }

/* ── Modal overlay ───────────────────────────────────────── */
.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: clamp(12px, 3vw, 26px); overflow-y: auto; background: radial-gradient(circle at 50% 28%, rgba(255,237,184,.12), transparent 48%), rgba(20,28,44,.5); backdrop-filter: blur(6px); animation: overlay-in .24s ease both; }
.overlay-fx { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.modal {
  position: relative; z-index: 2; width: min(520px, 100%); max-height: calc(100svh - 24px); overflow-y: auto; padding: clamp(22px, 4vw, 32px) clamp(18px, 4vw, 30px) clamp(18px, 3.4vw, 26px);
  border: 4px solid var(--outline); border-radius: 30px; text-align: center;
  background: radial-gradient(circle at 12% 2%, #fff, transparent 32%), linear-gradient(170deg, var(--panel-1), var(--panel-2));
  box-shadow: 0 8px 0 var(--frame-edge), 0 36px 70px rgba(0,0,0,.4), inset 0 3px 0 #fff;
  animation: modal-in .4s cubic-bezier(.16,1.15,.3,1) both; scrollbar-width: thin;
}
.modal-kicker { margin: 0 0 6px; font-family: var(--round); font-size: 10px; font-weight: 900; letter-spacing: .24em; color: var(--accent); text-transform: uppercase; }
.modal h2 { margin: 0; font-family: var(--round); font-size: clamp(30px, 7vw, 42px); font-weight: 900; line-height: 1.08; color: var(--ink); }
.modal h2 em { color: var(--orange-deep); font-style: normal; }
.modal-sub { max-width: 380px; margin: 10px auto 0; font-size: 13px; font-weight: 700; line-height: 1.65; color: var(--ink-soft); }
.modal .btn { margin-top: 16px; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.modal-actions .btn { margin-top: 0; }
.modal-actions-row { display: flex; gap: 10px; }
.modal-actions-row .btn { flex: 1; }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; font-size: 11px; font-weight: 800; color: var(--ink-soft); }
.modal-foot strong { font-family: var(--round); font-size: 13px; color: var(--orange-deep); }

/* stage intro */
.intro-art { display: flex; justify-content: center; gap: 4px; height: 92px; margin: 2px 0 6px; }
.intro-art .tm { width: 82px; filter: drop-shadow(0 5px 3px rgba(0,0,0,.25)); }
.intro-art .tm svg { width: 100%; height: auto; overflow: visible; }
.intro-goal { display: flex; justify-content: center; gap: 8px; margin: 14px 0 2px; }
.intro-goal span { padding: 5px 10px; border: 2.5px solid var(--outline); border-radius: 12px; background: #fff8dc; font-family: var(--round); font-size: 12px; font-weight: 900; color: #8a4a08; }
.intro-tip { margin: 12px 0 0; padding: 8px 12px; border: 2.5px dashed var(--panel-edge); border-radius: 14px; background: rgba(255,255,255,.6); font-size: 12px; font-weight: 800; color: var(--ink); }

/* result */
.result-stars { display: flex; justify-content: center; gap: 4px; margin-bottom: 4px; }
.result-star { width: 62px; height: 62px; fill: #d9cdb4; stroke: var(--outline); stroke-width: 1.4; stroke-linejoin: round; filter: drop-shadow(0 4px 0 rgba(0,0,0,.18)); transition: fill .2s; }
.result-star:nth-child(2) { width: 78px; height: 78px; margin-top: -12px; }
.result-star.is-earned { fill: #ffc93c; animation: star-pop .5s cubic-bezier(.2,1.6,.4,1) both; }
.result-score { margin-top: 4px; font-family: var(--round); font-weight: 900; color: var(--orange-deep); line-height: 1; text-shadow: 0 3px 0 rgba(255,255,255,.9); }
.result-score span { font-size: clamp(54px, 13vw, 76px); }
.result-score small { margin-left: 4px; font-size: 20px; color: var(--ink-soft); }
.result-caption { margin: 6px 0 0; font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.new-record { margin-top: 10px; }
.new-record span { display: inline-block; padding: 3px 14px; border: 2.5px solid var(--outline); border-radius: 999px; background: linear-gradient(180deg, #ff8fb5, #ff5f8f); color: #fff; font-size: 12px; font-weight: 900; letter-spacing: .12em; animation: record-pop .4s cubic-bezier(.2,1.5,.4,1) both; }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.result-stat { padding: 9px 4px 8px; border: 2.5px solid rgba(140,100,50,.4); border-radius: 14px; background: rgba(255,255,255,.7); }
.result-stat b { display: block; font-family: var(--round); font-size: 21px; font-weight: 900; color: var(--ink); }
.result-stat span { display: block; margin-top: 1px; font-size: 10px; font-weight: 800; color: var(--ink-soft); }
.pause-badge { width: 74px; height: 74px; margin: 0 auto 10px; display: grid; place-items: center; border: 4px solid var(--outline); border-radius: 50%; background: linear-gradient(180deg, #7cc6ff, #3d96f0); box-shadow: 0 5px 0 #1b4f95, inset 0 3px 0 rgba(255,255,255,.5); }
.pause-badge svg { width: 36px; height: 36px; fill: #fff; stroke: var(--outline); stroke-width: 1.5; }

/* discovery (unlock) card */
.unlock-burst { position: relative; width: 130px; height: 130px; margin: 0 auto 6px; display: grid; place-items: center; }
.unlock-burst::before { content: ""; position: absolute; inset: -26px; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(255,221,100,.75) 0 12deg, transparent 12deg 30deg); -webkit-mask: radial-gradient(circle, #000 28%, transparent 70%); mask: radial-gradient(circle, #000 28%, transparent 70%); animation: spin 14s linear infinite; }
.unlock-burst .tm, .unlock-burst .emoji { position: relative; width: 108px; animation: unlock-pop .7s cubic-bezier(.2,1.7,.4,1) both; filter: drop-shadow(0 6px 4px rgba(0,0,0,.3)); }
.unlock-burst .emoji { font-size: 72px; text-align: center; line-height: 1; }
.unlock-burst .tm svg { width: 100%; height: auto; overflow: visible; }
.unlock-list { display: grid; gap: 10px; margin-top: 8px; }
.unlock-item h3 { margin: 4px 0 2px; font-family: var(--round); font-size: 24px; color: var(--orange-deep); }
.unlock-item p { margin: 0 auto; max-width: 340px; font-size: 13px; font-weight: 700; line-height: 1.6; color: var(--ink-soft); }
.unlock-tag { display: inline-block; padding: 2px 12px; border: 2.5px solid var(--outline); border-radius: 999px; background: #ff4a6b; color: #fff; font-size: 11px; font-weight: 900; letter-spacing: .14em; transform: rotate(-3deg); }

/* ── Tester select / codex ───────────────────────────────── */
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; text-align: left; }
.mode-card { padding: 12px 12px 11px; border: 3px solid var(--outline); border-radius: 20px; background: linear-gradient(180deg, #fffefa, #fff2cf); box-shadow: 0 4px 0 var(--frame-edge); }
.mode-card.is-locked { filter: grayscale(.85); opacity: .65; }
.mode-head { display: flex; align-items: center; gap: 10px; }
.mode-ico { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border: 2.5px solid var(--outline); border-radius: 13px; background: linear-gradient(145deg, #fff0c4, #ffd070); font-size: 23px; }
.mode-card h3 { margin: 0; font-size: 15.5px; font-weight: 900; color: var(--ink); }
.mode-card .mode-tag { font-size: 10px; font-weight: 900; color: var(--accent); letter-spacing: .08em; }
.mode-card p { margin: 8px 0 10px; font-size: 11.5px; font-weight: 600; line-height: 1.55; color: var(--ink-soft); min-height: 3.1em; }
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 6px; }
.tier-btn { padding: 6px 3px 5px; cursor: pointer; text-align: center; border: 2.5px solid rgba(140,100,50,.5); border-radius: 12px; background: #fffdf5; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.tier-btn:hover { transform: translateY(-2px); border-color: var(--accent); background: #fff6dc; }
.tier-btn b { display: block; font-size: 12px; font-weight: 900; color: #a24d12; }
.tier-btn .stars { display: block; font-size: 10px; letter-spacing: 1px; color: #f2a516; line-height: 1.5; }
.tier-btn small { display: block; font-size: 9px; font-weight: 700; color: var(--ink-soft); }
.tester-opts { display: flex; flex-wrap: wrap; gap: 10px 18px; justify-content: center; align-items: center; margin: 0 0 14px; padding: 8px 12px; border: 3px dashed var(--panel-edge); border-radius: 16px; background: rgba(255,255,255,.55); font-size: 12px; font-weight: 800; }
.tester-opts select { padding: 4px 8px; border: 2px solid var(--outline); border-radius: 10px; background: #fff; font: inherit; font-weight: 800; }
.tester-note { text-align: center; margin: 0 0 10px; font-size: 12px; font-weight: 800; color: var(--accent); }

.codex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.codex-card { padding: 10px 6px 8px; text-align: center; border: 3px solid var(--outline); border-radius: 18px; background: linear-gradient(180deg, #fffefa, #fff2cf); box-shadow: 0 4px 0 var(--frame-edge); }
.codex-card .tm { width: 80px; margin: 0 auto; height: 78px; overflow: hidden; }
.codex-card .tm svg { width: 100%; height: auto; overflow: visible; }
.codex-card.is-locked .tm { filter: brightness(0) opacity(.28); }
.codex-card b { display: block; font-family: var(--round); font-size: 14px; color: var(--ink); }
.codex-card span { display: block; font-size: 10px; font-weight: 700; color: var(--ink-soft); line-height: 1.3; margin-top: 2px; }
.codex-modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 8px; }
.codex-mode { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 2.5px solid rgba(140,100,50,.45); border-radius: 14px; background: rgba(255,255,255,.7); font-size: 12px; font-weight: 800; }
.codex-mode.is-locked { opacity: .45; filter: grayscale(1); }
.codex-mode .mode-ico { width: 32px; height: 32px; font-size: 17px; border-radius: 10px; }
.section-title { margin: 16px 0 8px; font-family: var(--round); font-size: 16px; font-weight: 900; color: var(--ink); text-align: left; }

@media (max-width: 720px) {
  .lab { left: 8px; bottom: 8px; width: 160px; }
  .mode-grid { grid-template-columns: 1fr; }
  .stage-path { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .hud { gap: 6px; }
  .hud-card { padding: 6px 10px 7px; border-radius: 16px; }
  .app { padding: 8px 8px 16px; }
  .modal { padding: 22px 16px 18px; border-radius: 26px; }
  .result-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) { .stage-path { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } .mole { transition: none; } }

.star-total:empty { display: none; }

.world-tab[data-locked] { opacity: .55; filter: grayscale(.7); }
.gate { margin: 10px auto 0; max-width: 460px; }
.gate-bar { height: 12px; border: 2.5px solid var(--outline); border-radius: 8px; background: rgba(120,80,30,.15); overflow: hidden; }
.gate-bar i { display: block; height: 100%; background: linear-gradient(90deg, #7bd45d, #ffc93c); }
.gate span { display: block; margin-top: 4px; font-size: 11.5px; font-weight: 800; color: var(--ink-soft); }
.lv-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); gap: 5px; }
.lv-quick .tier-btn { padding: 5px 2px; }
.lv-custom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; font-weight: 800; }
.lv-custom input { width: 58px; padding: 4px 6px; border: 2px solid var(--outline); border-radius: 10px; font: inherit; font-weight: 800; text-align: center; }
.stage-node .mode-chip { font-size: 10px; }

.intro-rules, .intro-gate { margin: 8px 0 0; padding: 7px 12px; border-radius: 14px; font-size: 11.5px; font-weight: 700; line-height: 1.55; text-align: start; }
.intro-rules { background: rgba(255, 236, 214, .8); border: 2px solid #f0b98a; color: #6a3b13; }
.intro-rules b { display: block; font-size: 11px; letter-spacing: .04em; color: #c2410c; }
.intro-gate { background: rgba(255, 247, 205, .9); border: 2px solid #f2cf63; color: #7a5a00; font-weight: 900; text-align: center; }
