/* ============================================================
   重力迷宫 · 与小游戏柜主页同一套设计语言
   纸灰底 / 藏青墨 / 纸白卡托 / 2px 硬边 + 大圆角 + 轻硬阴影
   棋盘沿用主页迷宫卡的蓝绿调（#cfe1e5 底 / #214d64 深青墙）
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700;800;900&display=swap');

:root {
  --paper:      #eaf0f1;   /* 主页纸灰底 */
  --paper-deep: #dde7e9;
  --white:      #fbfcf9;   /* 卡片纸白 */
  --panel:      #fbfcf9;
  --ink:        #173246;   /* 主页藏青墨 */
  --muted:      #5d7481;
  --line:       rgba(23,50,70,.16);

  --red:        #e15d44;   /* 主页品牌橘红 */
  --red-deep:   #c24a33;
  --yellow:     #e3b44e;   /* 主页四格暖黄 */
  --blue:       #4078ab;   /* 主页四格蓝 */
  --blue-soft:  #5787af;
  --green:      #6b9679;

  --ice:        #cfe1e5;   /* 主页迷宫卡底：棋盘主色 */
  --ice-mid:    #88b4c0;   /* 主页迷宫内墙 */
  --ice-deep:   #214d64;   /* 主页迷宫深青：墙 */
  --ball-amber: #f5ba57;   /* 主页迷宫弹珠黄 */

  --font-sans: "Noto Sans SC", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;

  --shadow:      5px 5px 0 rgba(23,50,70,.13);
  --shadow-lg:   9px 9px 0 rgba(23,50,70,.12);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--ink);
  background-color: var(--paper);
  display: flex;
  justify-content: center;
  padding: 20px 14px 24px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* 主页同款细点纸纹 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .24;
  background-image: radial-gradient(#9ab1b6 .7px, transparent .7px);
  background-size: 13px 13px;
}

button { font: inherit; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 10; background: var(--white); padding: 10px; }

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  width: min(100%, 700px);
  margin: auto;
  padding: clamp(14px, 3vw, 22px) 6px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- 入场：错峰浮现 ---------- */
.topbar          { animation: rise .5s .02s ease-out both; }
.landing-copy    { animation: rise .5s .10s ease-out both; }
.landing-actions { animation: rise .5s .22s ease-out both; }
.screen-head     { animation: rise .5s .02s ease-out both; }
.screen-title    { animation: rise .5s .08s ease-out both; }
.subtle          { animation: rise .5s .12s ease-out both; }
.level-grid      { animation: rise .5s .18s ease-out both; }
.hud             { animation: rise .5s .06s ease-out both; }
.mission         { animation: rise .5s .12s ease-out both; }
.lesson-card     { animation: rise .5s .16s ease-out both; }
.board-frame     { animation: rise .55s .20s ease-out both; }
.gravity-readout { animation: rise .5s .26s ease-out both; }
.controls        { animation: rise .5s .30s ease-out both; }
.toast           { animation: rise .5s .34s ease-out both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 顶栏（品牌标识与主页一致） ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 14px;
  padding: 2px 2px 0;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  line-height: 1;
  text-decoration: none;
  color: var(--ink);
}
.logo-mark {
  width: 30px; height: 30px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 3px;
  transform: rotate(-11deg);
  transition: transform .2s ease;
  flex: none;
}
.logo:hover .logo-mark { transform: rotate(-11deg) scale(1.08); }
.logo-mark i { display: block; border-radius: 3px; background: var(--red); }
.logo-mark i:nth-child(2) { background: var(--yellow); }
.logo-mark i:nth-child(3) { background: var(--blue-soft); }
.logo-mark i:nth-child(4) { background: var(--green); }
.logo-zh { font-weight: 900; font-size: 23px; letter-spacing: -.01em; color: var(--ink); }
.logo-en {
  display: block;
  margin-top: 3px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 2.6px;
  color: var(--muted);
}
.header-note {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- 首页（landing） ---------- */
.landing {
  min-height: calc(100svh - 48px);
  justify-content: space-between;
  text-align: center;
}
.landing-copy { margin-top: clamp(5vh, 9vh, 12vh); }
.landing h1 {
  margin: 22px 0 14px;
  font-weight: 900;
  font-size: clamp(48px, 13vw, 78px);
  letter-spacing: -.05em;
  line-height: 1.05;
}
.landing p { margin: 0 auto; max-width: 300px; color: var(--muted); font-size: 14px; line-height: 1.8; }

/* 首页迷宫卡片艺术：纸白卡托 + 深青墙 + 暖黄弹珠 + 红目标 */
.hero-orbit {
  position: relative;
  width: min(62vw, 248px);
  aspect-ratio: 1;
  margin: 0 auto 6px;
  border: 2px solid var(--ink);
  border-radius: 24px;
  background: var(--white);
  box-shadow: var(--shadow-lg);
  transform: rotate(-4deg);
  animation: float 7s ease-in-out infinite;
}
.hero-orbit::before,
.hero-orbit::after {
  content: '';
  position: absolute;
  border-radius: 8px;
  background: var(--ice-deep);
}
.hero-orbit::before { left: 8%; top: 20%; width: 62%; height: 12px; transform: rotate(-4deg); }
.hero-orbit::after  { right: 10%; bottom: 22%; width: 48%; height: 12px; transform: rotate(6deg); }
.hero-goal {
  position: absolute;
  right: 15%; top: 12%;
  width: 21px; height: 21px;
  border-radius: 50%;
  border: 5px solid var(--red);
  box-shadow: 0 0 0 2px var(--white);
}
.hero-marble {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 54px; aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 31% 26%, #fff 0 8%, #f3e3c8 27%, var(--ball-amber) 74%, #c8931e 100%);
  box-shadow: inset 5px 6px 8px #ffffffaa, inset -6px -8px 11px #8a6a1a5e, 5px 6px 0 rgba(23,50,70,.28);
}
@keyframes float { 50% { transform: translateY(-8px) rotate(-1deg); } }

.landing-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(4vh, 7vh, 9vh);
}
.landing-actions .primary { min-width: 220px; }

/* ---------- 按钮（与弹弹棋同款） ---------- */
.primary {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 12px;
  cursor: pointer;
  padding: 14px 26px;
  background: var(--ink);
  color: var(--white);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .14em;
  text-align: center;
  box-shadow: 4px 4px 0 rgba(23,50,70,.2);
  transition: transform .09s, box-shadow .09s, background .13s, border-color .13s;
}
.primary:hover { background: var(--red); border-color: var(--red-deep); }
.primary:active { transform: translate(3px,3px); box-shadow: 1px 1px 0 rgba(23,50,70,.2); }
.primary:disabled { background: var(--paper-deep); border-color: var(--muted); color: var(--muted); box-shadow: none; cursor: default; }

.secondary {
  cursor: pointer;
  padding: 12px 22px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .1em;
  transition: background .13s, color .13s, transform .09s;
}
.secondary:hover { background: var(--ink); color: var(--white); }
.secondary:active { transform: translate(2px,2px); }

/* ---------- 顶部小标识（关卡页 / 游戏页 / 结算卡） ---------- */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  letter-spacing: .18em;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
}
.wordmark .mark {
  width: 19px; height: 19px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  transform: rotate(-11deg);
  flex: none;
  background:
    linear-gradient(135deg, #e15d44 0 25%, #e3b44e 25% 50%, #5787af 50% 75%, #6b9679 75% 100%);
}

/* ---------- 关卡选择页 ---------- */
.screen-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 34px;
}
.back {
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 6px 0;
  cursor: pointer;
  font-weight: 700;
}
.back:hover { color: var(--ink); }
.screen-title {
  margin: 34px 0 8px;
  font-size: clamp(32px, 9vw, 44px);
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1.1;
}
.subtle { color: var(--muted); font-size: 13px; margin: 0; }

.level-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
  margin: 26px 0;
}
.level-chip {
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  background: var(--white);
  border-radius: 15px;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  box-shadow: 3px 3px 0 rgba(23,50,70,.14);
  transition: transform .12s, box-shadow .12s, background .12s;
}
.level-chip:not(.locked):hover {
  transform: translateY(-2px);
  box-shadow: 5px 5px 0 rgba(23,50,70,.2);
}
.level-chip:not(.locked):active {
  transform: translate(2px,2px);
  box-shadow: 1px 1px 0 rgba(23,50,70,.2);
}
.level-chip.done { background: #e2eaec; }
.level-chip.current {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--red), 4px 4px 0 rgba(23,50,70,.14);
}
.level-chip.locked {
  color: #9db1ba;
  background: #eef2f3;
  cursor: not-allowed;
  box-shadow: none;
}
.stars {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: #c9962f;
  min-height: 12px;
}

/* ---------- 游戏页 ---------- */
.game-screen { width: 100%; }

/* 计分牌：纸白卡托（与弹弹棋计分牌同款） */
.hud {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin: 14px 0 14px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.hud-item {
  padding: 10px 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--muted);
  text-transform: uppercase;
}
.hud-item b {
  display: block;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  margin-top: 3px;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}
.hud-item:last-child { text-align: right; }
.stage-name {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
  padding: 10px 8px;
  color: var(--ink);
  white-space: nowrap;
}

/* 本关目标 */
.mission {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-height: 25px;
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}
.mission span, .lesson-card span {
  color: var(--red);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  white-space: nowrap;
}
.mission p { margin: 0; }

/* 新机制教学条 */
.lesson-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-left: 4px solid var(--red);
  border-radius: 0 12px 12px 0;
  background: #eef3f4;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.6;
}
.lesson-card p { margin: 0; }
.lesson-dismiss {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.lesson-dismiss:hover { color: var(--ink); }

/* 棋盘卡托：纸白 + 硬边（内部为主页迷宫蓝绿调） */
.board-frame {
  width: min(100%, 580px);
  margin: auto;
  padding: clamp(10px, 2.5vw, 15px);
  border: 2px solid var(--ink);
  border-radius: 22px;
  background: var(--white);
  box-shadow: var(--shadow-lg);
}
.board-rotor {
  aspect-ratio: 1;
  transition: transform 360ms cubic-bezier(.22,.84,.3,1.015);
  will-change: transform;
}
.board {
  width: 100%;
  height: 100%;
  position: relative;
  display: grid;
  overflow: hidden;
  border-radius: 15px;
  background: linear-gradient(180deg, #d9e7ea 0, #c6dbe0 55%, #bfd5da 100%);
  box-shadow: inset 0 0 0 1px #9fb9c0, inset 0 12px 24px #6d8f9630;
  touch-action: none;
}

/* 格子与机关：沿用机制辨识度，换主页色 */
.tile { position: relative; border: solid #a6c2c9; border-width: 0 1px 1px 0; }
.tile.ice { background: linear-gradient(135deg, #f2f8f9, #dce9ec); }
.tile.ice::after {
  content: '';
  position: absolute;
  inset: 18%;
  border-top: 1px solid #ffffffd9;
  transform: rotate(-32deg);
}
.tile.ice.cracked { background: var(--ink); box-shadow: inset 0 0 0 1px #0d2230; }
.tile.ice.cracked::after {
  content: '×';
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--paper);
  border: 0;
  transform: none;
  font: 700 17px var(--font-sans);
}
.wall {
  position: absolute;
  inset: 7%;
  border-radius: 6px;
  background: linear-gradient(145deg, #2d5f78, var(--ice-deep));
  box-shadow: inset 1.5px 1.5px 0 #ffffff2e, inset -2px -2px 0 #0000001f, 2px 3px 0 rgba(23,50,70,.25);
}
.exit {
  position: absolute;
  inset: 17%;
  border: 3px solid var(--ice-deep);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #fbfcf9 0 38%, #dce8ea 70%, #b9cfd4 100%);
  box-shadow: 0 0 0 2px #eaf0f1, inset 0 1px 3px #214d6433;
}
.exit::after {
  content: '';
  position: absolute;
  inset: 24%;
  border: 1.5px dashed #7fa0aa;
  border-radius: 50%;
  opacity: .5;
}
.exit.red { border-color: var(--red); box-shadow: 0 0 0 2px #eaf0f1, inset 0 1px 3px #c24a3333; }
.exit.blue { border-color: var(--blue); box-shadow: 0 0 0 2px #eaf0f1, inset 0 1px 3px #4078ab33; }
.portal {
  position: absolute;
  inset: 15%;
  border: 2.5px solid #c9962f;
  border-radius: 50%;
  background: radial-gradient(circle, #0000 56%, #e3b44e1f 62%, #0000 68%);
  box-shadow: inset 0 0 0 1px #fbfcf9, 0 0 11px #e3b44e66;
}
.portal::before {
  content: '';
  position: absolute;
  inset: -4.5px;
  border-radius: 50%;
  border: 2px dashed #d9b783;
  animation: portalSpin 7s linear infinite;
}
.portal.teal { border-color: #5f9aa0; box-shadow: inset 0 0 0 1px #f1f4ed, 0 0 11px #6e999066; }
.portal.teal::before { border-color: #9dc4bb; }
@keyframes portalSpin { to { transform: rotate(360deg); } }
.trap {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #3a4750, #15202a 58%, #0a1115 100%);
  box-shadow: inset 2px 3px 6px #000a, 0 1px 0 #ffffff66;
}
.oneway {
  position: absolute;
  inset: 16%;
  border: 1.5px solid var(--ice-deep);
  border-radius: 7px;
  background: var(--white);
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 #ffffffcc, 0 1px 2px #17324624;
}
.switch {
  position: absolute;
  inset: 23%;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #f6e5a8, var(--yellow) 70%, #c08f1e);
  box-shadow: inset 0 1px 1px #ffffff90, inset 0 -2px 3px #7a5f2470, 0 2px 3px #17324644;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.switch.active {
  background: radial-gradient(circle at 36% 30%, #b8c8a6, var(--green) 70%, #4c7357);
  box-shadow: inset 0 2px 4px #00000033, inset 0 -1px 0 #ffffff55;
  transform: translateY(1px);
}
.door {
  position: absolute;
  inset: 8%;
  background: repeating-linear-gradient(90deg, #4a6b7e 0 3.5px, #83a0ae 3.5px 7px);
  border-radius: 4px;
  opacity: .92;
  box-shadow: inset 0 1px 0 #ffffff60, 0 2px 3px #17324633;
  transition: opacity .18s;
}
.door.open { opacity: .16; }

/* 弹珠：玻璃质感（与主页弹珠同色系） */
.ball {
  position: absolute;
  z-index: 4;
  width: calc(100% / var(--cols) * .62);
  height: calc(100% / var(--rows) * .62);
  margin: calc(100% / var(--cols) * .19);
  border-radius: 50%;
  transition: left 110ms cubic-bezier(.25,.8,.35,1), top 110ms cubic-bezier(.25,.8,.35,1), transform 180ms ease, opacity 180ms ease;
}
.ball > span { position: absolute; display: block; border-radius: 50%; pointer-events: none; }
.ball-shadow {
  z-index: 0;
  left: 4%; right: 4%;
  top: auto; bottom: -6%;
  height: 34%;
  background: radial-gradient(ellipse at center, #1732464d 0, #17324622 52%, transparent 72%);
  filter: blur(.6px);
  transform: translateY(0) scaleX(1);
  transition: transform .12s ease, opacity .18s ease;
}
.ball.rolling .ball-shadow { transform: translateY(12%) scaleX(1.14); opacity: .82; }
.ball-spin {
  z-index: 1;
  inset: 0;
  overflow: hidden;
  transition: transform 112ms cubic-bezier(.3,.7,.38,1);
  background: radial-gradient(circle at 31% 26%, #fff 0 8%, #f3e3c8 27%, var(--ball-amber) 74%, #b9851c 100%);
  box-shadow: inset 0 0 0 1px #ffffff30, inset 5px 6px 8px #ffffffaa, inset -6px -8px 11px #8a6a1a5e, 0 0 0 1px #00000012;
}
.ball-spin::before {
  content: '';
  position: absolute;
  inset: -12%;
  background: conic-gradient(from 18deg at 62% 38%, transparent 0 16%, #ffffff26 21%, transparent 30%, #33392f1f 40%, transparent 52%, #ffffff30 61%, transparent 72%, #33392f14 84%, transparent 94%), radial-gradient(circle at 72% 66%, #0000001a 0 5%, transparent 17%), radial-gradient(circle at 26% 74%, #ffffff34 0 4%, transparent 15%);
}
.ball-spin::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset -8px -10px 13px #3e443d30;
}
.ball-shine {
  z-index: 2;
  inset: 0;
  background: radial-gradient(circle at 29% 21%, #fffffff5 0 8%, #ffffff80 15%, transparent 27%), radial-gradient(circle at 68% 82%, #ffffff20 0, transparent 42%);
}
.ball.red .ball-spin { background: radial-gradient(circle at 31% 26%, #fff 0 8%, #f4d5ce 27%, var(--red) 74%, #a83a24 100%); }
.ball.blue .ball-spin { background: radial-gradient(circle at 31% 26%, #fff 0 8%, #d3e2ee 27%, var(--blue-soft) 74%, #2f5d85 100%); }
.ball.entering { transform: scale(.35) !important; opacity: 0; }
.ball.failed { transform: scale(.58); opacity: .28; filter: grayscale(1); }
.ball.bump { animation: bump .24s cubic-bezier(.3,.7,.4,1); }
@keyframes bump {
  0%   { transform: translate(0,0) scale(1); }
  45%  { transform: translate(calc(var(--bx,0)*.7), calc(var(--by,0)*.7)) scale(.84); }
  100% { transform: translate(0,0) scale(1); }
}

/* 旋转反馈 */
.board { transition: filter .14s ease, box-shadow .14s ease; }
.board.impact { filter: brightness(.97); box-shadow: inset 0 0 0 2px var(--red), inset 0 12px 24px #6d8f9630; }
.board.portal-flash { filter: brightness(1.06) saturate(1.1); }
.board.switch-flash { box-shadow: inset 0 0 0 2px var(--green), inset 0 12px 24px #6d8f9630; }

/* 角度读数 */
.gravity-readout {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .26em;
  color: var(--muted);
  text-align: center;
  min-height: 22px;
  margin: 14px 0 10px;
}

/* 控制键：纸白硬边按键（与弹弹棋图标键同款） */
.controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: min(100%, 500px);
  margin: auto;
}
.icon-btn {
  min-height: 58px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  color: var(--ink);
  background: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(23,50,70,.16);
  transition: transform .08s, box-shadow .08s, background .12s, color .12s;
}
.icon-btn:hover:not(:disabled) { background: var(--ink); color: var(--white); }
.icon-btn:active:not(:disabled) { transform: translate(2px,2px); box-shadow: 1px 1px 0 rgba(23,50,70,.16); }
.icon-btn small {
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .08em;
}
.icon-btn:hover:not(:disabled) small { color: var(--paper); }
.icon-btn.main { background: var(--ink); color: var(--white); }
.icon-btn.main:hover:not(:disabled) { background: var(--red); border-color: var(--red-deep); }
.icon-btn.main small { color: var(--paper); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.controls .icon-btn[data-action="undo"] { background: #eef2f3; }
.controls .icon-btn[data-action="undo"]:hover:not(:disabled) { background: var(--ink); }

/* 状态提示 */
.toast {
  text-align: center;
  color: #b4543f;
  font-size: 12px;
  font-weight: 600;
  min-height: 20px;
  margin: 14px 0 0;
}

/* 结算弹窗 */
.result {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(23,50,70,.32);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  padding: 24px;
  animation: fade .22s ease;
}
.result-card {
  width: min(100%, 340px);
  background: linear-gradient(180deg, #fdfcf9 0, #f6f5f0 100%);
  padding: 30px;
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.result-card::before {
  content: '';
  display: block;
  height: 3px;
  margin: -30px -30px 20px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(90deg, #e3b44e00, #e3b44ecc, #e3b44e00);
}
.result-card h2 {
  font-size: 29px;
  font-weight: 900;
  letter-spacing: -.04em;
  margin: 6px 0;
}
.result-star {
  font-size: 24px;
  letter-spacing: 5px;
  color: #c9962f;
  margin: 16px 0;
}
.result-stats {
  display: flex;
  justify-content: center;
  gap: 28px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  margin: 22px 0;
}
.result-stats b {
  display: block;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.result-actions { display: grid; gap: 8px; }
.result-actions .primary { width: 100%; }

@keyframes fade { from { opacity: 0; } }

/* ---------- 焦点可见性（与主页一致） ---------- */
.logo:focus-visible,
button:focus-visible,
.level-chip:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

/* ---------- 移动端 ---------- */
@media (max-width: 560px) {
  body { padding: 12px 8px 16px; }
  .app-shell { padding-top: 10px; }
  .logo-zh { font-size: 20px; }
  .logo-mark { width: 26px; height: 26px; }
  .logo-en { font-size: 8.5px; letter-spacing: 2px; }
  .header-note { font-size: 10.5px; letter-spacing: .02em; }
  .hud-item { padding: 9px 11px; }
  .hud-item b { font-size: 14px; }
  .stage-name { font-size: 10.5px; letter-spacing: .06em; }
  .board-frame { padding: 9px; border-radius: 18px; }
  .board { border-radius: 12px; }
  .controls { gap: 7px; }
  .controls .icon-btn { min-height: 52px; border-radius: 12px; }
  .level-chip { font-size: 14px; }
  .hero-orbit { width: min(66vw, 220px); }
  .landing h1 { font-size: clamp(44px, 12vw, 64px); }
}

@media (max-height: 640px) {
  .landing-copy { margin-top: 3vh; }
  .landing-actions { margin-bottom: 3vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
