/* =========================================================
   八零童乐园 · 怀旧像素闯关
   暖黄低饱和 · 胶片颗粒 · 移动端竖屏
   ========================================================= */

:root {
  --orange: #FF8A3D;
  --orange-deep: #D9631C;
  --orange-dark: #A84313;
  --cream: #FBF0DA;
  --paper: #F6E8CE;
  --paper-deep: #EDD9B7;
  --ink: #3B2A1F;
  --ink-2: #6B503A;
  --ink-3: #9A7C5E;
  --line: rgba(91, 58, 35, .16);
  --red: #C9573E;
  --green: #6C7C46;
  --gold: #E8A13A;
  --shadow-soft: 0 10px 26px rgba(104, 62, 33, .14);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #20130d;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button:focus-visible { outline: 3px solid #FFD08A; outline-offset: 2px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.app { min-height: 100dvh; min-height: 100vh; }
.screen { width: 100%; }

/* =========================================================
   首页：一张 390×844 成品底图 + 真实可点界面
   ========================================================= */

.home-screen {
  position: relative;
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #2a1710;
  isolation: isolate;
}

.home-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #d99a6e;
}
.home-art-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  user-select: none;
  -webkit-user-drag: none;
}
.home-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg,
      rgba(33, 16, 9, .60) 0%,
      rgba(33, 16, 9, .24) 15%,
      rgba(33, 16, 9, .02) 35%,
      rgba(33, 16, 9, 0) 52%,
      rgba(29, 15, 8, .32) 100%),
    radial-gradient(120% 58% at 50% 0%, rgba(255, 187, 108, .15), transparent 64%);
}
.home-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .15;
  mix-blend-mode: overlay;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,.20) 0 1px, transparent 1px 3px),
    radial-gradient(circle at 30% 20%, rgba(255,240,205,.35) 0 1px, transparent 1.4px);
  background-size: 100% 3px, 6px 6px;
}
.home-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  box-shadow: inset 0 0 90px rgba(27, 12, 6, .42);
}

/* 顶部玩家 / 星星 */
.home-top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 0;
}
.player-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  background: rgba(43, 26, 17, .54);
  border: 1px solid rgba(255, 232, 196, .28);
  box-shadow: 0 4px 14px rgba(38, 19, 10, .24);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-align: left;
  transition: transform .08s ease;
}
.player-chip:active { transform: scale(.97); }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #F8C678, #D96B2B);
  border: 2px solid rgba(255, 244, 219, .9);
  color: #4D2A12;
  font-weight: 800;
  font-size: 15px;
  flex: 0 0 auto;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.player-meta { display: flex; flex-direction: column; line-height: 1.12; }
.player-hello { font-size: 9px; color: rgba(255, 240, 214, .72); letter-spacing: .5px; }
.player-name { font-size: 13px; font-weight: 700; color: #FFF5E2; max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.star-pill {
  display: flex; align-items: center; gap: 4px;
  padding: 7px 12px 7px 9px;
  border-radius: 999px;
  background: rgba(255, 246, 223, .92);
  color: #8B4A16;
  border: 1px solid rgba(255, 255, 255, .58);
  box-shadow: 0 4px 14px rgba(38, 19, 10, .2);
  font-size: 13px;
  font-weight: 800;
}
.star-pill .mp-icon { font-size: 17px; width: 17px; height: 17px; color: var(--orange); }

/* 标题：压在底图的天空上 */
.home-hero {
  position: relative;
  z-index: 2;
  padding: 22px 20px 0;
  pointer-events: none;
}
.brand-row { display: flex; align-items: center; gap: 8px; }
.brand-stamp {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 5px;
  background: rgba(255, 138, 61, .94);
  color: #48220D;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1px;
  box-shadow: 0 2px 0 rgba(99, 42, 11, .38);
  transform: rotate(-1.2deg);
}
.brand-rule {
  flex: 0 0 30px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 215, 160, .6), transparent);
}
.brand-ghost {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(255, 235, 205, .6);
}
.game-logo {
  margin: 12px 0 0;
  font-size: clamp(38px, 11.6vw, 50px);
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: 3px;
  color: #FFF8E8;
  text-shadow:
    0 2px 0 #7E3A1A,
    0 4px 0 #5A2810,
    0 9px 22px rgba(24, 11, 5, .72);
}
.game-logo::after {
  content: "";
  display: block;
  width: 62px; height: 4px;
  margin-top: 10px;
  border-radius: 4px;
  background: linear-gradient(90deg, #FFD08A, #FF8A3D 62%, transparent);
}
.game-sub {
  margin: 10px 0 0;
  max-width: 300px;
  color: rgba(255, 243, 220, .94);
  font-size: 11.5px;
  letter-spacing: .4px;
  line-height: 1.6;
  text-shadow: 0 1px 8px rgba(31, 14, 7, .7);
}
.home-spacer { flex: 1 1 auto; min-height: 12px; }

/* 底部关卡板 */
.level-deck {
  position: relative;
  z-index: 4;
  margin: 0 10px calc(env(safe-area-inset-bottom, 0px) + 10px);
  padding: 13px 13px 11px;
  border-radius: 23px;
  background:
    radial-gradient(circle at 18% 0%, rgba(255,255,255,.72), transparent 42%),
    linear-gradient(180deg, #FBF1DC 0%, #F5E6CB 58%, #EFDCBC 100%);
  border: 1px solid rgba(255, 250, 238, .8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    inset 0 -2px 0 rgba(157, 106, 58, .12),
    0 2px 0 rgba(114, 68, 31, .22),
    0 20px 38px rgba(35, 17, 8, .36);
}
.level-deck::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 19px;
  border: 1px dashed rgba(150, 105, 61, .15);
  pointer-events: none;
}
.deck-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}
.deck-kicker {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #B76A2B;
}
.deck-heading h2 {
  margin: 2px 0 0;
  font-size: 16.5px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: .5px;
  color: #4A3120;
}
.deck-stat { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.chapter-tag {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid rgba(151, 106, 62, .28);
  border-radius: 5px;
  background: rgba(255, 249, 235, .66);
  color: #8E6438;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}
.deck-count { display: flex; align-items: baseline; gap: 2px; font-size: 11px; color: #8E6D4A; }
.deck-count b { font-size: 15px; color: #C9641E; font-weight: 800; font-family: var(--mono); }
.deck-count em { font-style: normal; color: #A98A66; }
.deck-pct { margin-left: 4px; font-size: 8.5px; color: #B79A76; }

.deck-progress {
  position: relative;
  z-index: 1;
  height: 5px;
  margin: 8px 0 9px;
  border-radius: 99px;
  background: rgba(117, 73, 37, .13);
  overflow: hidden;
  box-shadow: inset 0 1px 1px rgba(87, 52, 25, .13);
}
.deck-progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #FFB35C, #FF7A2F);
  box-shadow: 0 0 8px rgba(255, 138, 61, .6);
  transition: width .5s ease;
}

/* 15 个小关卡：同屏铺开 */
.level-map {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px 6px;
}
.level-row {
  --acc: #C0663F;
  --acc2: #D98A55;
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 3px 4px;
  border-radius: 12px;
  border: 1px solid rgba(117, 76, 40, .14);
  background: linear-gradient(180deg, rgba(255,255,255,.82), rgba(255,250,240,.32));
  box-shadow: 0 2px 0 rgba(117, 76, 40, .09), 0 3px 8px rgba(105, 62, 27, .05);
  transition: transform .08s ease, box-shadow .15s ease, border-color .15s ease;
  animation: nodeIn .38s ease both;
  animation-delay: var(--d, 0s);
  touch-action: manipulation;
}
.level-row:active {
  transform: scale(.94);
  box-shadow: 0 1px 0 rgba(117, 76, 40, .1);
}
.level-badge {
  position: relative;
  width: 100%;
  height: 33px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 9px;
  color: #FFF8E9;
  background: linear-gradient(145deg, var(--acc2), var(--acc));
  border: 1px solid rgba(255, 255, 255, .36);
  box-shadow: inset 0 1px 0 rgba(255,244,220,.42), 0 2px 0 rgba(73,39,20,.14);
  overflow: hidden;
}
.level-badge::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 45%;
  background: linear-gradient(180deg, transparent, rgba(53,25,11,.16));
  pointer-events: none;
}
.level-badge .mp-icon {
  position: relative;
  z-index: 1;
  width: 15px; height: 15px;
  color: #FFF7E5;
  filter: drop-shadow(0 1px 0 rgba(63,30,12,.28));
}
.level-num {
  position: relative;
  z-index: 1;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .2px;
  opacity: .92;
  text-shadow: 0 1px 0 rgba(62,29,12,.28);
}
.level-name {
  max-width: 100%;
  font-size: 8.5px;
  font-weight: 800;
  line-height: 1.2;
  color: #5A3D27;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.level-stars {
  position: absolute;
  top: 2px; right: 3px;
  z-index: 2;
  display: flex;
  gap: 0;
  height: 7px;
}
.level-stars .mp-icon {
  width: 6.5px; height: 6.5px;
  color: rgba(255, 248, 232, .28);
  filter: drop-shadow(0 1px 1px rgba(60,28,12,.25));
}
.level-stars .mp-icon.on { color: #FFD37A; filter: drop-shadow(0 1px 1px rgba(76,38,13,.35)); }
.level-lock {
  position: absolute;
  top: 3px; right: 3px;
  z-index: 2;
  width: 11px; height: 11px;
  display: grid; place-items: center;
  color: rgba(255, 248, 232, .86);
}
.level-lock .mp-icon { width: 11px; height: 11px; }

.level-row.is-next {
  border-color: rgba(255, 138, 61, .8);
  box-shadow: 0 0 0 2px rgba(255, 138, 61, .13), 0 3px 10px rgba(196, 92, 31, .17);
}
.level-row.is-next .level-badge {
  box-shadow:
    inset 0 1px 0 rgba(255,244,220,.5),
    0 0 0 1px rgba(255, 226, 180, .62),
    0 0 14px rgba(255, 138, 61, .5);
}
.level-row.is-next::after {
  content: "";
  position: absolute;
  top: -3px; right: -3px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #FF8A3D;
  border: 1.5px solid #FFF4DF;
  box-shadow: 0 0 0 2px rgba(255, 138, 61, .2);
  animation: nextPulse 1.6s ease-in-out infinite;
}
.level-row.locked {
  background: rgba(233, 219, 197, .55);
  border-color: rgba(117, 76, 40, .08);
  box-shadow: none;
  animation: none;
}
.level-row.locked .level-badge { filter: grayscale(.62) brightness(.93); opacity: .58; box-shadow: none; }
.level-row.locked .level-name { color: #A58A6C; }
.level-row.locked:active { transform: none; }

/* 开始按钮 */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border-radius: 15px;
  background: linear-gradient(180deg, #FFA258 0%, #FF8A3D 46%, #EE6F23 100%);
  border: 2px solid #B94C13;
  color: #FFF9EC;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 0 1px 0 rgba(130, 53, 12, .55);
  box-shadow:
    inset 0 1px 0 rgba(255, 231, 192, .55),
    0 5px 0 #A84313,
    0 11px 22px rgba(84, 36, 9, .35);
  transition: transform .07s ease, box-shadow .07s ease, filter .15s ease;
  touch-action: manipulation;
}
.btn-primary .mp-icon { width: 22px; height: 22px; color: #FFF7E5; filter: drop-shadow(0 1px 0 rgba(130,53,12,.5)); }
.btn-primary:active {
  transform: translateY(4px);
  box-shadow: inset 0 1px 0 rgba(255,231,192,.4), 0 1px 0 #A84313, 0 4px 10px rgba(84,36,9,.3);
}
.btn-primary:disabled { filter: grayscale(.4); opacity: .7; }

.deck-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.deck-actions .btn-primary {
  min-height: 47px;
  border-radius: 13px;
  font-size: 15.5px;
  letter-spacing: 2px;
  gap: 6px;
}
.deck-actions .btn-primary .mp-icon { width: 19px; height: 19px; }
.deck-tip {
  margin: 0;
  text-align: center;
  font-size: 9px;
  line-height: 1.35;
  color: #A98762;
  letter-spacing: .2px;
}

@keyframes nodeIn {
  from { opacity: 0; transform: translateY(7px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes nextPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255, 138, 61, .2); }
  50% { box-shadow: 0 0 0 4px rgba(255, 138, 61, .1); }
}

/* =========================================================
   游戏页
   ========================================================= */

.game-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  max-width: 580px;
  margin: 0 auto;
  background: #2b1a12;
  overflow: hidden;
  touch-action: none;
  box-shadow: 0 0 60px rgba(0, 0, 0, .6);
}
#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  touch-action: none;
}
.game-hud {
  position: absolute;
  z-index: 5;
  top: 0; left: 0; right: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.game-hud > *, .game-hud button { pointer-events: auto; }
.round-btn {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: rgba(36, 21, 13, .58);
  border: 1px solid rgba(255, 231, 198, .26);
  color: #FFF0D6;
  box-shadow: 0 2px 8px rgba(23, 11, 6, .25);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform .07s ease;
}
.round-btn:active { transform: scale(.92); }
.round-btn .mp-icon { width: 20px; height: 20px; }
.level-chip {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  padding: 5px 10px;
  border-radius: 10px;
  background: rgba(36, 21, 13, .40);
  border: 1px solid rgba(255, 231, 198, .13);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: #FFF3DC;
}
.level-chip .mono { font-size: 8px; letter-spacing: 1px; color: rgba(255, 226, 183, .68); }
.level-chip b { font-size: 12.5px; font-weight: 800; letter-spacing: .8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-side { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.hearts {
  display: flex; align-items: center; gap: 2px;
  padding: 6px 8px 6px 7px;
  border-radius: 10px;
  background: rgba(36, 21, 13, .40);
  border: 1px solid rgba(255, 231, 198, .13);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.hearts .mp-icon {
  width: 17px; height: 17px;
  color: #FF7A55;
  filter: drop-shadow(0 1px 0 rgba(90, 25, 10, .6));
  transition: transform .15s ease, opacity .2s ease;
}
.hearts .mp-icon.lost { color: #8A6B55; opacity: .38; filter: none; transform: scale(.85); }
.hearts .mp-icon.pop { animation: heartPop .3s ease; }
@keyframes heartPop { 0%{transform:scale(1);} 45%{transform:scale(1.35);} 100%{transform:scale(1);} }

.objective-chip {
  position: absolute;
  z-index: 4;
  top: calc(env(safe-area-inset-top, 0px) + 58px);
  left: 50%;
  transform: translateX(-50%);
  max-width: 86%;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(38, 22, 14, .42);
  border: 1px solid rgba(255, 233, 198, .15);
  color: rgba(255, 241, 218, .92);
  font-size: 10px;
  letter-spacing: .3px;
  white-space: nowrap;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  pointer-events: none;
}
.obj-dot { width: 5px; height: 5px; border-radius: 50%; background: #FFB15C; box-shadow: 0 0 6px #FF8A3D; flex: 0 0 auto; }
.obj-time { color: #FFD08A; font-weight: 800; }

.game-hint {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(38, 22, 14, .44);
  border: 1px solid rgba(255, 233, 198, .13);
  color: rgba(255, 240, 216, .78);
  font-size: 10px;
  letter-spacing: .5px;
  white-space: nowrap;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  pointer-events: none;
  transition: opacity .4s ease;
}
.game-hint.fade { opacity: 0; }

.toast {
  position: absolute;
  z-index: 8;
  top: 36%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.92);
  padding: 9px 17px;
  border-radius: 999px;
  background: rgba(36, 20, 12, .84);
  border: 1px solid rgba(255, 220, 170, .28);
  color: #FFE9C4;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* 遮罩 */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(28, 16, 10, .62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: overlayIn .2s ease;
}
@keyframes overlayIn { from{opacity:0;} to{opacity:1;} }

.tutorial-card {
  width: min(348px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  border-radius: 22px;
  background: var(--cream);
  border: 2px solid #5C3B26;
  box-shadow: 0 12px 0 rgba(22, 10, 4, .35), 0 30px 60px rgba(20, 9, 3, .4);
  animation: cardPop .28s cubic-bezier(.2, 1.35, .5, 1);
}
@keyframes cardPop { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }

.tutorial-scene {
  position: relative;
  height: 98px;
  overflow: hidden;
  background: linear-gradient(180deg, #E9A06E, #F7D7A2 62%, #D8A46C);
  border-bottom: 2px solid rgba(92, 59, 38, .2);
}
.scene-sun {
  position: absolute; right: 42px; top: 18px;
  width: 34px; height: 34px; border-radius: 50%;
  background: #FFF0C6; box-shadow: 0 0 26px rgba(255, 236, 184, .75);
}
.scene-hill {
  position: absolute; bottom: 0; border-radius: 50% 50% 0 0;
  background: #A8754F;
}
.scene-hill.h1 { left: -30px; width: 220px; height: 62px; background: #B07B58; }
.scene-hill.h2 { right: -50px; width: 260px; height: 46px; background: #96654A; }
.tutorial-icon {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 58px; height: 58px;
  display: grid; place-items: center;
  border-radius: 17px;
  background: rgba(255, 247, 229, .88);
  border: 2px solid rgba(92, 59, 38, .55);
  box-shadow: 0 5px 0 rgba(92, 59, 38, .25);
  color: #8E4C1E;
}
.tutorial-icon .mp-icon { width: 30px; height: 30px; }
.tutorial-body { padding: 16px 18px 18px; }
.eyebrow { display: block; font-size: 9px; font-weight: 800; letter-spacing: 2px; color: #B06B2C; }
.tutorial-body h2 { margin: 3px 0 0; font-size: 22px; font-weight: 900; letter-spacing: 1px; color: #412A1A; }
.tutorial-goal { margin: 4px 0 12px; font-size: 12px; color: #846345; line-height: 1.5; }
.tutorial-rows {
  border-top: 1px dashed rgba(125, 88, 55, .28);
  border-bottom: 1px dashed rgba(125, 88, 55, .28);
  padding: 9px 0;
  display: flex; flex-direction: column; gap: 7px;
  margin-bottom: 14px;
}
.tutorial-rows > div { display: flex; align-items: baseline; gap: 8px; font-size: 10.5px; line-height: 1.45; }
.tutorial-rows span { flex: 0 0 52px; color: #A28363; font-size: 9.5px; letter-spacing: .5px; }
.tutorial-rows b { flex: 1; color: #563C28; font-weight: 700; }
.btn-wide { min-height: 49px; font-size: 16px; letter-spacing: 5px; }

.modal-overlay { z-index: 40; }
.modal-card {
  width: min(336px, 100%);
  position: relative;
  padding: 22px 20px 18px;
  border-radius: 21px;
  background: var(--cream);
  border: 2px solid #5C3B26;
  box-shadow: 0 12px 0 rgba(22, 10, 4, .34), 0 28px 58px rgba(20, 9, 3, .42);
  text-align: center;
  animation: cardPop .28s cubic-bezier(.2, 1.35, .5, 1);
}
.modal-card::before {
  content: "";
  position: absolute; inset: 7px;
  border: 1px dashed rgba(123, 85, 51, .26);
  border-radius: 15px;
  pointer-events: none;
}
.modal-stamp {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 11px;
  border-radius: 4px;
  background: #E8A13A;
  box-shadow: 0 2px 0 #A45F12;
  color: #4B2A0C;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 2px;
  transform: rotate(-2deg);
}
.modal-title {
  margin: 0;
  font-size: 27px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #412A1A;
  line-height: 1.15;
}
.modal-sub { margin: 7px 0 0; font-size: 11.5px; line-height: 1.6; color: #86684B; }
.modal-stars {
  display: flex; justify-content: center; gap: 8px;
  margin: 15px 0 8px;
}
.modal-stars .mp-icon {
  width: 36px; height: 36px;
  color: #DCC7A7;
  transform: scale(.8);
  animation: starIn .45s cubic-bezier(.2, 1.6, .5, 1) both;
}
.modal-stars .mp-icon.on { color: #F2A63B; filter: drop-shadow(0 3px 0 rgba(155, 90, 15, .35)); }
.modal-stars .mp-icon:nth-child(2) { animation-delay: .09s; }
.modal-stars .mp-icon:nth-child(3) { animation-delay: .18s; }
@keyframes starIn { from { opacity: 0; transform: scale(.2) rotate(-30deg); } to { opacity: 1; transform: scale(1); } }
.modal-score {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 7px 0 15px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(222, 193, 152, .28);
  color: #7D5C3D;
  font-size: 11px;
}
.modal-score b { color: #4D3320; font-size: 13px; }
.modal-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 45px;
  border-radius: 13px;
  background: #F0DFC1;
  border: 2px solid #C7A77B;
  color: #5B3D27;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  box-shadow: 0 3px 0 #C7A77B;
  transition: transform .07s ease, box-shadow .07s ease;
}
.btn-ghost:active { transform: translateY(3px); box-shadow: 0 0 0 #C7A77B; }
.btn-ghost .mp-icon { width: 17px; height: 17px; color: #8F6239; }
.btn-text {
  width: 100%; min-height: 34px;
  color: #96795C;
  font-size: 11px;
  letter-spacing: 1px;
}
.btn-text:active { opacity: .6; }
.revive-note { margin: 0 0 2px; font-size: 9.5px; color: #B08863; letter-spacing: .3px; }
.modal-divider { height: 1px; background: rgba(123,85,51,.16); margin: 12px 0 10px; }
.modal-card.clear .modal-title { color: #9A4E13; }

@media (max-height: 720px) {
  .home-top { padding-top: calc(env(safe-area-inset-top, 0px) + 8px); }
  .home-hero { padding-top: 14px; }
  .game-logo { font-size: 34px; letter-spacing: 2px; }
  .game-sub { font-size: 10px; margin-top: 7px; }
  .brand-row { gap: 6px; }
  .brand-rule { flex-basis: 18px; }
  .brand-ghost { display: none; }
  .level-deck {
    margin: 0 8px calc(env(safe-area-inset-bottom, 0px) + 8px);
    padding: 10px 11px 9px;
    border-radius: 20px;
  }
  .deck-heading h2 { font-size: 15px; }
  .deck-kicker { font-size: 7.5px; }
  .deck-progress { margin: 6px 0 7px; }
  .level-map { gap: 5px; }
  .level-row { padding: 3px 2px; border-radius: 10px; }
  .level-badge { height: 29px; border-radius: 8px; }
  .level-badge .mp-icon { width: 13px; height: 13px; }
  .level-name { font-size: 8px; }
  .deck-actions { margin-top: 7px; gap: 4px; }
  .deck-actions .btn-primary {
    min-height: 42px;
    font-size: 14px;
    letter-spacing: 1.5px;
    border-width: 1.5px;
    box-shadow: inset 0 1px 0 rgba(255,231,192,.5), 0 3px 0 #A84313, 0 7px 14px rgba(84,36,9,.28);
  }
  .deck-tip { display: none; }
  .home-spacer { min-height: 4px; }
  .tutorial-scene { height: 78px; }
  .tutorial-rows { gap: 5px; }
}

@media (max-height: 600px) {
  .home-hero { padding-top: 8px; }
  .game-logo { font-size: 28px; margin-top: 8px; }
  .game-logo::after { margin-top: 6px; }
  .game-sub { display: none; }
  .brand-stamp { height: 19px; font-size: 8px; }
  .level-deck { padding: 8px 10px 8px; }
  .deck-heading h2 { font-size: 14px; }
  .level-row { padding: 2px; }
  .level-badge { height: 26px; }
  .level-name { font-size: 7.5px; }
  .deck-actions .btn-primary { min-height: 38px; font-size: 13px; }
}

@media (min-width: 521px) {
  body { background: #24150d; }
  .home-screen { box-shadow: 0 0 60px rgba(0,0,0,.35); }
}
