/* =========================================================
   昇趣 · 小小冒险棋 —— 样式
   ========================================================= */
:root {
  --cream: #FFF6E5;
  --card: #FFFDF6;
  --ink: #5A4636;
  --ink-soft: #8E7965;
  --line: #F0E3CC;
  --coral: #FF6B6B;
  --blue: #4D96FF;
  --yellow: #FFC93C;
  --teal: #2EC4B6;
  --purple: #9B5DE5;
  --green: #59C26B;
  --theme-a: #FFF6E5;
  --theme-b: #FFE7BF;
  --accent: #FF9F43;
  --deep: #5A4636;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; overscroll-behavior: none;
}
body {
  background: var(--cream);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  font-weight: 600;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  position: fixed; inset: 0;
}
button {
  font-family: inherit; font-weight: 800; color: var(--ink);
  border: none; background: none; cursor: pointer; outline: none;
  touch-action: manipulation;
}
img { -webkit-user-drag: none; }
.hidden { display: none !important; }

/* ---------- 屏幕 ---------- */
.screen {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.screen.active { display: flex; animation: screenIn .35s ease both; }
.screen-home { background: var(--cream); }
.screen-players, .screen-chars, .screen-maps {
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 210, 120, .30), transparent 38%),
    radial-gradient(circle at 90% 0%, rgba(255, 150, 170, .22), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(120, 220, 190, .25), transparent 55%),
    var(--cream);
}
.screen-game { background: linear-gradient(165deg, var(--theme-a), var(--theme-b)); flex-direction: row; }
.game-left { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.game-right {
  width: 116px; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
}
.game-right .hud-players { flex-direction: column; align-items: center; gap: 7px; flex: none; }
.game-right .pchip { width: 60px; }
.game-right .pchip-ava { width: 40px; height: 40px; font-size: 22px; }
.game-right .pchip-star { font-size: 11px; }
.game-right .turn-bar {
  flex-direction: column; align-items: center; gap: 2px;
  text-align: center; font-size: 11px; line-height: 1.2;
}
.game-right .turn-ava { font-size: 26px; }
.game-right .turn-text b { font-size: 14px; }
.game-right .roll-btn { flex-direction: column; gap: 4px; }
.game-right .roll-label { font-size: 11.5px; max-width: 72px; }
.game-right .die { width: 58px; height: 58px; padding: 7px; border-radius: 16px; }
.game-right .die .pip { width: 8px; height: 8px; }
.screen-end { background: linear-gradient(165deg, var(--theme-a), var(--theme-b)); }

/* ---------- 通用按钮 ---------- */
.big-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 62px;
  padding: 14px 22px;
  border-radius: 24px;
  font-size: 21px; font-weight: 900; color: #fff;
  background: linear-gradient(180deg, #FF9A6B, #FF6B6B);
  box-shadow: 0 6px 0 #D94F4F, 0 12px 24px rgba(217, 79, 79, .26);
  transition: transform .12s ease, box-shadow .12s ease, opacity .2s;
}
.big-btn:active { transform: translateY(5px); box-shadow: 0 2px 0 #D94F4F, 0 6px 12px rgba(217, 79, 79, .22); }
.big-btn:disabled { opacity: .45; box-shadow: 0 4px 0 #C9B8A8; background: linear-gradient(180deg, #CBBBA9, #B5A492); }
.pill-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 12px 26px;
  border-radius: 999px;
  font-size: 18px; font-weight: 900; color: #fff;
  background: linear-gradient(180deg, #FFA96B, #FF8A3D);
  box-shadow: 0 5px 0 #D96F27, 0 8px 18px rgba(217, 111, 39, .25);
  transition: transform .12s, box-shadow .12s;
}
.pill-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #D96F27; }
.pill-btn:disabled {
  opacity: .5;
  background: linear-gradient(180deg, #D8CFBE, #C2B59F);
  box-shadow: 0 4px 0 #A89B86;
  cursor: not-allowed;
}
.pill-btn.ghost {
  color: var(--ink); background: #FFF4DE;
  box-shadow: 0 4px 0 #E8D4B2;
}
.close-x {
  width: 38px; height: 38px; border-radius: 50%;
  background: #F4EAD9; color: #8E7965; font-size: 24px; line-height: 1;
}

/* ---------- 首页 ---------- */
.screen-home.active { display: flex; }
.home-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; align-items: center;
  padding: calc(16px + env(safe-area-inset-top)) 18px calc(12px + env(safe-area-inset-bottom));
  position: relative; z-index: 2;
}
.bg-deco { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.float-deco {
  position: absolute; opacity: .38; pointer-events: none;
  animation: floatDeco 9s ease-in-out infinite alternate;
  will-change: transform;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  margin: 8px 0 2px;
}
.brand-icon {
  width: 64px; height: 64px; border-radius: 19px;
  box-shadow: 0 5px 12px rgba(120, 70, 30, .22);
  border: 2px solid rgba(255, 255, 255, .85);
}
.brand-title { font-size: 27px; font-weight: 900; letter-spacing: 1px; color: #4C3828; }
.brand-sub { font-size: 11.5px; color: #A08A75; font-weight: 700; letter-spacing: .5px; margin-top: 2px; }
.home-stage {
  width: 100%; max-width: 430px;
  display: flex; flex-direction: column; align-items: center;
  margin-top: 14px;
}
.mascot-row { display: flex; align-items: flex-end; gap: 4px; margin: 4px 0 22px; }
.mascot {
  display: flex; align-items: center; justify-content: center;
  background: #FFFDF6; border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 6px 0 rgba(160, 120, 80, .14), 0 10px 20px rgba(160, 120, 80, .16);
}
.m1 { width: 62px; height: 62px; font-size: 36px; animation: bob 2.4s ease-in-out infinite; }
.m2 { width: 82px; height: 82px; font-size: 47px; animation: bob 2.4s .25s ease-in-out infinite; }
.m3 { width: 62px; height: 62px; font-size: 36px; animation: bob 2.4s .5s ease-in-out infinite; }
.start-btn { max-width: 340px; height: 74px; font-size: 24px; border-radius: 28px; }
.start-icon { font-size: 28px; animation: spinWiggle 3s ease-in-out infinite; display: inline-block; }
.start-text { letter-spacing: 2px; }

.home-tools {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  width: 100%; max-width: 380px; margin-top: 20px;
}
.tool-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 2px 8px;
  border-radius: 18px;
  background: rgba(255, 253, 246, .86);
  border: 2px solid #F2E4CD;
  box-shadow: 0 4px 0 #EBD9BB;
  font-size: 10.5px; font-weight: 800; color: #7A6451;
  transition: transform .1s;
}
.tool-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #EBD9BB; }
.tool-icon { font-size: 23px; line-height: 1; }
.home-stats { display: flex; gap: 16px; margin-top: 22px; font-size: 12.5px; color: #8E7965; font-weight: 700; }
.home-stats b { font-size: 15px; color: #5A4636; }
.home-badges { margin-top: 12px; text-align: center; min-height: 20px; }
.home-badge-title { font-size: 10.5px; color: #A08A75; margin-bottom: 4px; }
.home-badge-row { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }
.mini-badge {
  width: 27px; height: 27px; display: flex; align-items: center; justify-content: center;
  background: #FFF8E7; border: 2px solid #FFE3A8; border-radius: 50%;
  font-size: 14px;
}
.home-badge-tip { font-size: 11px; color: #B09A83; }
.home-foot { margin-top: auto; padding-top: 26px; font-size: 10.5px; color: #B09A83; letter-spacing: .3px; }

/* ---------- 设置类页面 ---------- */
.setup-shell {
  flex: 1; min-height: 0;
  width: 100%; max-width: 520px;
  margin: 0 auto;
  display: flex; flex-direction: column;
  padding: calc(10px + env(safe-area-inset-top)) 14px 0;
}
.setup-head {
  height: 56px; flex-shrink: 0;
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
}
.round-back {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255, 253, 246, .9);
  border: 2px solid #F1E2C9;
  box-shadow: 0 3px 0 #E7D5B6;
  font-size: 20px; color: #7A6451;
  display: flex; align-items: center; justify-content: center;
}
.round-back:active { transform: translateY(2px); box-shadow: none; }
.setup-title { text-align: center; font-size: 21px; font-weight: 900; color: #4C3828; letter-spacing: .5px; }
.setup-hint { text-align: center; font-size: 12.5px; color: #A08A75; margin: 8px 0 4px; }
.setup-foot { text-align: center; font-size: 11.5px; color: #A08A75; padding: 14px 0 calc(12px + env(safe-area-inset-bottom)); margin-top: auto; }

/* 人数 */
.count-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 18px 4px 0;
}
.count-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 138px;
  border-radius: 26px;
  background: #FFFDF6;
  border: 3px solid var(--cc);
  box-shadow: 0 6px 0 rgba(120, 90, 60, .13), 0 10px 20px rgba(120, 90, 60, .10);
  transition: transform .1s, box-shadow .1s;
  animation: cardIn .45s ease both;
}
.count-card:active { transform: translateY(4px) scale(.98); box-shadow: 0 2px 0 rgba(120, 90, 60, .13); }
.cc-emojis { font-size: 27px; letter-spacing: -5px; line-height: 1.1; }
.cc-num { font-size: 24px; font-weight: 900; color: var(--cc); letter-spacing: 1px; }
.cc-sub { font-size: 11px; color: #A08A75; font-weight: 700; }

/* 角色 */
.chars-shell { padding-left: 12px; padding-right: 12px; }
.pick-slots { display: flex; justify-content: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.slot {
  width: 58px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.slot-ava {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #FFFDF6; border: 2.5px dashed #DCCBB4;
  font-size: 25px; color: #B7A18A;
  transition: border-color .2s, box-shadow .2s;
}
.slot.filled .slot-ava { border-style: solid; border-color: var(--pc); box-shadow: 0 3px 0 rgba(120, 90, 60, .13); }
.slot.current .slot-ava { border-color: #FF9F43; animation: slotPulse 1.2s ease-in-out infinite; }
.slot-label { font-size: 9.5px; color: #8E7965; max-width: 58px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.char-hint { text-align: center; font-size: 12.5px; color: #A08A75; margin: 7px 0 5px; }
.char-tabs {
  display: flex; gap: 4px;
  margin: 0 0 7px; padding: 2px 0 4px;
  flex-shrink: 0;
}
.char-tab {
  flex: 1 1 0; min-width: 0;
  display: flex; align-items: center; justify-content: center; gap: 2px;
  padding: 6px 2px; border-radius: 999px;
  background: rgba(255, 253, 246, .85);
  border: 2px solid #F0E0C7;
  font-size: 10px; color: #8E7965; white-space: nowrap;
}
.char-tab.active {
  background: #FFE9C7; border-color: #FFC97A; color: #A9642A;
  box-shadow: 0 3px 0 #F0D2A4;
}
.char-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 6px;
}
.char-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.char-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  min-height: 108px; padding: 10px 4px 8px;
  border-radius: 22px;
  background: linear-gradient(165deg, #FFFFFF 0%, var(--cb, #FFF6E5) 100%);
  border: 2px solid var(--cr, #F0E3CC);
  box-shadow: 0 4px 0 rgba(150, 120, 90, .14), 0 7px 14px rgba(150, 120, 90, .08);
  animation: cardIn .38s ease both;
  transition: transform .1s, box-shadow .15s, opacity .2s;
  overflow: hidden;
}
.char-move {
  position: absolute; top: 5px; right: 5px;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 1px 3px rgba(120, 95, 70, .22);
  opacity: .92; pointer-events: none; z-index: 2;
}
.char-card::before {
  content: ''; position: absolute; left: 10%; right: 10%; top: 2px; height: 42%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 72%);
  pointer-events: none;
}
.char-card::after {
  content: ''; position: absolute; top: -12%; bottom: -12%; left: -46%; width: 34%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: translateX(0) skewX(-16deg);
  animation: cardShine 4.6s ease-in-out infinite;
  pointer-events: none; z-index: 2;
}
.char-card:nth-child(3n)::after { animation-delay: 1.4s; }
.char-card:nth-child(3n+2)::after { animation-delay: 2.6s; }
@keyframes cardShine {
  0%, 58% { transform: translateX(0) skewX(-16deg); opacity: 0; }
  62% { opacity: 1; }
  88%, 100% { transform: translateX(460%) skewX(-16deg); opacity: 0; }
}
.char-card:active { transform: translateY(4px) scale(.97); box-shadow: 0 1px 0 rgba(150, 120, 90, .14); }
.char-orb {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 32% 24%, #FFFFFF 10%, var(--cb, #FFF6E5) 62%, var(--cr, #F0E3CC) 128%);
  border: 2px solid #FFFFFF;
  box-shadow:
    0 0 0 2.5px var(--cc, #D9C6A8),
    inset 0 -4px 6px rgba(0, 0, 0, .07),
    0 4px 8px rgba(120, 90, 60, .18);
  position: relative; z-index: 1;
}
/* 球面高光 + 底部投影，立体感 */
.char-orb::before {
  content: ''; position: absolute; left: 15%; top: 7%; width: 46%; height: 30%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 72%);
  pointer-events: none;
}
.char-orb::after {
  content: ''; position: absolute; left: 14%; right: 14%; bottom: 5%; height: 13%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(70, 45, 25, .13), transparent);
  pointer-events: none;
}
.char-emoji {
  font-size: 31px; line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(90, 60, 30, .22));
  animation: charBob 3.6s ease-in-out infinite;
}
.char-card:nth-child(2n) .char-emoji { animation-delay: .6s; }
.char-card:nth-child(3n) .char-emoji { animation-delay: 1.2s; }
@keyframes charBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.5px); } }
.char-name {
  font-size: 11.5px; color: #5A4636; font-weight: 800;
  margin-top: 7px; position: relative; z-index: 1;
  white-space: nowrap;
}
.char-en {
  font-size: 8.5px; color: var(--cc, #8E7965); font-weight: 800;
  opacity: .9; letter-spacing: .2px; margin-top: 1px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  position: relative; z-index: 1;
}
.char-card.taken { opacity: .5; }
.char-card.taken::after { display: none; }
.char-card.taken .char-emoji { animation: none; filter: grayscale(.3) drop-shadow(0 1px 1px rgba(90, 60, 30, .18)); }
.char-card.taken .char-orb { border-color: #FFFFFF; box-shadow: 0 0 0 3px var(--pc), 0 3px 6px rgba(120, 90, 60, .14); }
.char-check {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--pc); color: #fff; font-size: 12px; line-height: 19px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .18);
}
.next-btn {
  height: 56px; font-size: 18px; margin: 8px 4px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #4FD8C8, #2EC4B6);
  box-shadow: 0 5px 0 #189E92, 0 10px 20px rgba(24, 158, 146, .24);
  flex-shrink: 0;
}

/* 地图 */
.maps-shell { padding-left: 14px; padding-right: 14px; }
.map-team { display: flex; justify-content: center; gap: 5px; height: 32px; align-items: center; }
.team-ava {
  width: 29px; height: 29px; border-radius: 50%;
  background: #FFFDF6; border: 2px solid var(--pc);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; box-shadow: 0 2px 0 rgba(120, 90, 60, .12);
}
.map-list {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 10px;
  padding: 5px 2px calc(14px + env(safe-area-inset-bottom));
}
.map-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 22px;
  background: linear-gradient(135deg, var(--ma), var(--mb));
  border: 3px solid rgba(255, 255, 255, .9);
  box-shadow: 0 5px 0 rgba(120, 90, 60, .14), 0 8px 16px rgba(120, 90, 60, .10);
  text-align: left;
  animation: cardIn .4s ease both;
  transition: transform .1s;
}
.map-card:active { transform: translateY(4px) scale(.99); box-shadow: 0 1px 0 rgba(120, 90, 60, .14); }
.map-art {
  position: relative; width: 96px; height: 66px; flex-shrink: 0;
  border-radius: 16px; overflow: hidden;
  background:
    radial-gradient(circle at 20% 16%, rgba(255, 255, 255, .5), transparent 46%),
    radial-gradient(circle at 84% 90%, rgba(255, 255, 255, .3), transparent 40%),
    linear-gradient(150deg, var(--ma), var(--mb));
  border: 2.5px solid rgba(255, 255, 255, .85);
  box-shadow: inset 0 -7px 10px rgba(90, 60, 30, .10), 0 2px 6px rgba(120, 90, 60, .12);
}
.map-art-road { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; }
.mar-edge { fill: none; stroke: rgba(255, 255, 255, .92); stroke-width: 11; stroke-linecap: round; }
.mar-dash {
  fill: none; stroke: rgba(255, 255, 255, .6); stroke-width: 2.4; stroke-linecap: round;
  stroke-dasharray: 4 6;
  animation: roadFlow 2.2s linear infinite;
}
.map-art-e {
  position: absolute; line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(60, 40, 20, .28));
  animation: artFloat 3.4s ease-in-out infinite;
}
.map-art-e.e1 { left: 7%; bottom: 5%; font-size: 21px; }
.map-art-e.e2 { right: 7%; top: 7%; font-size: 30px; animation-delay: .7s; }
.map-art-e.e3 { right: 34%; bottom: 4%; font-size: 17px; opacity: .92; animation-delay: 1.4s; }
@keyframes artFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.map-info { flex: 1; min-width: 0; color: var(--mk, #4C3828); }
.map-name { font-size: 17px; font-weight: 900; letter-spacing: .4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-tag { font-size: 10.5px; opacity: .72; font-weight: 700; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-go {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 50%; background: rgba(255, 255, 255, .8);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--mk, #4C3828);
}

/* ---------- 游戏页 ---------- */
.game-deco { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.game-float { opacity: .26; }
.hud {
  position: relative; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(4px + env(safe-area-inset-top)) 10px 1px;
  flex-shrink: 0;
}
.hud-btn {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255, 253, 246, .78);
  border: 2px solid rgba(255, 255, 255, .8);
  box-shadow: 0 3px 0 rgba(120, 90, 60, .13);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}
.hud-btn:active { transform: translateY(2px); box-shadow: none; }
.hud-players { flex: 1; display: flex; justify-content: center; align-items: flex-end; gap: 6px; min-width: 0; }
.pchip {
  width: 52px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  transition: transform .25s ease;
  position: relative;
}
.pchip-ava {
  width: 33px; height: 33px; border-radius: 50%;
  background: #FFFDF6; border: 2.5px solid var(--pc);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 3px 0 rgba(120, 90, 60, .14);
  transition: box-shadow .25s, transform .25s;
}
.pchip-star { font-size: 9.5px; color: #7A6451; font-weight: 800; white-space: nowrap; }
.pchip.active { transform: translateY(-2px); }
.pchip.active .pchip-ava {
  transform: scale(1.1);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .9), 0 5px 10px rgba(90, 60, 40, .22);
}
.pchip.active .pchip-star { color: #4C3828; }
.map-ribbon {
  position: relative; z-index: 5;
  align-self: center; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 11px 3px;
  border-radius: 999px;
  background: rgba(255, 253, 246, .62);
  border: 1.5px solid rgba(255, 255, 255, .8);
  font-size: 11px; font-weight: 800; color: var(--deep);
  margin-bottom: 1px;
}
.board-wrap {
  position: relative; z-index: 2;
  flex: 1; min-height: 0;
  display: flex; align-items: stretch; justify-content: center;
  /* 底部多留一截：棋盘投影 + 圆角不再被屏幕下边缘切掉 */
  padding: 2px 6px calc(9px + env(safe-area-inset-bottom));
}
.board-frame {
  position: relative;
  width: 100%; max-width: 620px;
  height: 100%;
  flex-shrink: 1;
  padding: 6px;
  border-radius: 26px;
  background: linear-gradient(145deg, var(--theme-a), var(--theme-b));
  border: 3px solid rgba(255, 255, 255, .9);
  box-shadow: 0 10px 24px rgba(80, 55, 35, .18), inset 0 0 0 2px rgba(255, 255, 255, .28);
}
/* 边缘暗角 + 顶部高光，让棋盘像一幅小画 */
.board-frame::before {
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  border-radius: 26px;
  pointer-events: none; z-index: 3;
  box-shadow: inset 0 0 30px rgba(70, 45, 25, .13);
}
.board-frame::after {
  content: ''; position: absolute; left: 6%; right: 6%; top: 2px; height: 32%;
  border-radius: 20px;
  pointer-events: none; z-index: 3;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, .30), transparent 72%);
}
.board {
  position: relative; width: 100%; height: 100%;
}
.board-road {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0; overflow: visible;
  pointer-events: none;
}
.road-edge, .road-base, .road-dash {
  stroke-linecap: round; stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.road-edge { stroke: rgba(255, 255, 255, .92); stroke-width: calc(var(--tile, 44px) * 1.18); }
.road-base { stroke: #F1E0C0; stroke-width: calc(var(--tile, 44px) * 0.96); }
.road-dash {
  stroke: rgba(255, 255, 255, .9);
  stroke-width: calc(var(--tile, 44px) * 0.10);
  stroke-dasharray: 7 10;
  animation: roadFlow 2.4s linear infinite;
}
@keyframes roadFlow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -17; } }
.board-scenery {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  z-index: 1; pointer-events: none; overflow: hidden;
}
.scenery-item {
  position: absolute; line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(70, 50, 30, .28));
}
.scenery-item.scenery-back { opacity: .24; }
.scenery-item.scenery-front { opacity: .48; }
.tile {
  position: absolute;
  transform: translate(-50%, -50%);
  width: var(--tile, 44px);
  height: var(--tile, 44px);
  padding: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #FFFFFF 4%, var(--tb, #FFF6E5) 74%);
  border: 2px solid rgba(255, 255, 255, .95);
  box-shadow: 0 3px 0 rgba(120, 90, 60, .18), 0 6px 10px rgba(120, 90, 60, .15), inset 0 -3px 5px rgba(0, 0, 0, .05);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  /* ⚠️ 这里的入场动画必须带上 translate(-50%,-50%)：
     棋格是靠 transform 居中的，如果动画只写 scale()，
     动画结束后（fill: both）会把居中偏移覆盖掉，
     整副棋盘会向右下偏移半格，最下面一排就被屏幕边缘切掉了。 */
  animation: tilePop .55s ease both;
  z-index: 2;
}
.tile::after {
  content: ''; position: absolute; left: 9%; right: 9%; top: 9%; bottom: 9%;
  border-radius: 50%;
  border: 1.5px solid var(--tr, #E9D7B8);
  opacity: .5;
  pointer-events: none;
}
.tile-icon {
  font-size: calc(var(--tile, 44px) * 0.52);
  line-height: 1; display: block;
  position: relative; z-index: 1;
}
.tile-start {
  background: radial-gradient(circle at 32% 26%, #FFFFFF 6%, #B9EDC6 76%);
  box-shadow: 0 0 0 3px rgba(46, 196, 182, .3), 0 4px 0 rgba(46, 150, 140, .25), 0 6px 12px rgba(46, 150, 140, .2);
}
.tile-finish {
  background: radial-gradient(circle at 32% 26%, #FFFFFF 6%, #FFD06B 76%);
  box-shadow: 0 0 0 3px rgba(255, 193, 60, .45), 0 4px 0 rgba(200, 140, 20, .25), 0 0 18px rgba(255, 193, 60, .55);
}
.tile-finish .tile-icon { font-size: calc(var(--tile, 40px) * 0.54); animation: trophyShine 2.2s ease-in-out infinite; }
.tile-mini::after { border-style: dashed; opacity: .7; }
.token-layer { position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; z-index: 4; }
.token {
  position: absolute;
  transform: translate(-50%, -50%);
  transition: left .56s cubic-bezier(.34, .9, .4, 1), top .56s cubic-bezier(.34, .9, .4, 1);
  display: flex; align-items: center; justify-content: center;
  z-index: 5;
  will-change: left, top;
}
.board.no-anim .token { transition: none; }
.token-ava {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: #FFFDF6;
  border: 4px solid var(--pc);
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  box-shadow: 0 4px 9px rgba(80, 55, 35, .3);
  font-size: inherit;
}
/* ---------- 三种移动方式：蹦跳 / 开车 / 飞行 ---------- */
.token.hop .token-ava,
.token.mv-hop .token-ava { animation: tokenHop .52s ease; }

/* 开车：起步抬头 → 途中车身微侧 → 到站轻轻点头刹车 */
.token.mv-drive .token-ava { animation: tokenDrive .5s cubic-bezier(.3, .8, .4, 1); }
@keyframes tokenDrive {
  0%   { transform: translateX(-16%) rotate(-10deg) scale(1.05); }
  28%  { transform: translateX(-2%) rotate(6deg)  scale(1.03); }
  62%  { transform: translateX(1%)  rotate(-3deg) scale(1.01); }
  88%  { transform: translateX(0)   rotate(3deg)  scale(.99); }
  100% { transform: translateX(0)   rotate(0deg)  scale(1); }
}

/* 飞行：高高飞起来，画一道大弧线再落回棋格 */
.token.mv-fly .token-ava { animation: tokenFly .56s cubic-bezier(.32, .1, .38, 1); }
@keyframes tokenFly {
  0%   { transform: translateY(0)      scale(1)    rotate(0deg); }
  20%  { transform: translateY(-110%)  scale(1.13) rotate(-9deg); }
  52%  { transform: translateY(-165%)  scale(1.18) rotate(5deg); }
  80%  { transform: translateY(-100%)  scale(1.10) rotate(-4deg); }
  100% { transform: translateY(0)      scale(1)    rotate(0deg); }
}

/* 飞行时留在地面上的小影子：飞得越高影子越小越淡 */
.token::before {
  content: ''; position: absolute; left: 50%; bottom: -4%;
  width: 64%; height: 16%;
  border-radius: 50%;
  background: rgba(70, 50, 30, .3);
  transform: translateX(-50%) scale(.5);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.token.mv-fly::before { animation: tokenShadow .56s cubic-bezier(.32, .1, .38, 1); }
@keyframes tokenShadow {
  0%   { opacity: .5;  transform: translateX(-50%) scale(1); }
  52%  { opacity: .22; transform: translateX(-50%) scale(.62); }
  100% { opacity: .5;  transform: translateX(-50%) scale(1); }
}

.token-in .token-ava { animation: tokenIn .5s cubic-bezier(.2, 1.4, .4, 1) both; }

.control-panel {
  position: relative; z-index: 5;
  flex-shrink: 0;
  display: flex; flex-direction: row; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
  background: rgba(255, 253, 246, .92);
  box-shadow: 0 -4px 18px rgba(90, 70, 50, .13);
}
.turn-bar {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; color: #7A6451; font-weight: 700;
  min-height: 24px; min-width: 0;
}
.turn-text { white-space: nowrap; }
.turn-ava { font-size: 22px; }
.turn-text b { font-size: 16px; color: var(--pc); font-weight: 900; }
.roll-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 0; margin: 0 0 2px;
  background: none; border: none; flex-shrink: 0;
  transition: opacity .2s, transform .1s;
}
.roll-btn:active { transform: scale(.97); }
.roll-btn:disabled { opacity: .55; }
.roll-label { font-size: 13.5px; font-weight: 900; color: #6B5442; max-width: 92px; line-height: 1.25; }
.die {
  width: 72px; height: 72px;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  padding: 9px; gap: 1px;
  border-radius: 20px;
  background: linear-gradient(160deg, #FFFDF6, #FFF3DC);
  border: 3px solid #EBDCC2;
  box-shadow: 0 6px 0 #D9C6A8, 0 10px 16px rgba(90, 70, 50, .18);
}
.die .pip { width: 11px; height: 11px; border-radius: 50%; background: #4A3B32; opacity: 0; justify-self: center; align-self: center; transition: opacity .1s; }
.die .pip.on { opacity: 1; }
.die.rolling { animation: diceRoll .55s ease-in-out; }
.die.settle { animation: diceSettle .3s ease; }
.roll-btn.nudge .die { animation: diceNudge 1.1s ease-in-out infinite; }
.roll-btn.nudge .roll-label { color: #D96F27; }

/* 深色太空主题 */
.map-space .hud-btn { background: rgba(255, 255, 255, .16); color: #FFF6E5; border-color: rgba(255, 255, 255, .25); }
.map-space .pchip-star { color: #FFF6E5; }
.map-space .pchip.active { background: rgba(255, 255, 255, .13); border-radius: 14px; }
.map-space .map-ribbon { background: rgba(255, 255, 255, .16); color: #FFF6E5; border-color: rgba(255, 255, 255, .25); }
.map-space .control-panel { background: rgba(40, 33, 74, .9); }
.map-space .turn-text { color: #FFF6E5; }
.map-space .roll-label { color: #FFF6E5; }
.map-space .board-frame { border-color: rgba(255, 255, 255, .45); }

/* 每张地图的氛围光效叠加（阳光/水光/星云/雪雾……） */
.map-forest .game-deco {
  background:
    radial-gradient(ellipse at 18% 0%, rgba(255, 255, 190, .30), transparent 42%),
    radial-gradient(ellipse at 88% 8%, rgba(180, 255, 190, .22), transparent 40%);
}
.map-build .game-deco {
  background: repeating-linear-gradient(-45deg, rgba(255, 200, 90, .10) 0 22px, transparent 22px 44px);
}
.map-ocean .game-deco {
  background:
    linear-gradient(105deg, transparent 12%, rgba(255, 255, 255, .13) 18%, transparent 26%,
      transparent 44%, rgba(255, 255, 255, .10) 52%, transparent 62%,
      transparent 78%, rgba(255, 255, 255, .12) 86%, transparent 92%),
    radial-gradient(ellipse at 50% 118%, rgba(0, 120, 180, .25), transparent 55%);
}
.map-candy .game-deco {
  background:
    radial-gradient(circle at 14% 90%, rgba(255, 180, 215, .30), transparent 40%),
    radial-gradient(circle at 86% 12%, rgba(255, 220, 240, .35), transparent 42%);
}
.map-jungle .game-deco {
  background:
    radial-gradient(ellipse at 80% 0%, rgba(210, 255, 150, .26), transparent 44%),
    radial-gradient(ellipse at 8% 96%, rgba(120, 220, 120, .20), transparent 40%);
}
.map-desert .game-deco {
  background:
    radial-gradient(ellipse at 50% -8%, rgba(255, 220, 130, .38), transparent 46%),
    radial-gradient(ellipse at 90% 96%, rgba(230, 170, 80, .18), transparent 40%);
}
.map-snow .game-deco {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 255, 255, .42), transparent 44%),
    radial-gradient(ellipse at 10% 100%, rgba(190, 230, 255, .28), transparent 46%);
}
.map-space .game-deco {
  background:
    radial-gradient(ellipse at 22% 24%, rgba(160, 120, 255, .22), transparent 42%),
    radial-gradient(ellipse at 82% 70%, rgba(90, 60, 200, .25), transparent 45%),
    radial-gradient(circle at 68% 18%, rgba(255, 255, 255, .20), transparent 12%);
}

/* 每张地图的“路”颜色 + 主题氛围 */

/* === 森林：土路 + 落叶斑 === */
.map-forest .road-edge { stroke: rgba(255, 255, 255, .88); }
.map-forest .road-base { stroke: #D7C093; }
.map-forest .road-dash { stroke: rgba(255, 240, 210, .95); }
.map-forest .board-frame {
  background:
    radial-gradient(circle at 12% 20%, rgba(160, 210, 120, .32), transparent 30%),
    radial-gradient(circle at 82% 85%, rgba(120, 180, 100, .28), transparent 32%),
    linear-gradient(145deg, var(--theme-a), var(--theme-b));
}
.map-forest .tile::after {
  border-style: dashed;
}

/* === 工地：木板路 + 警示条纹 === */
.map-build .road-edge { stroke: rgba(255, 248, 230, .92); }
.map-build .road-base { stroke: #E9C98A; }
.map-build .road-dash { stroke: #FFE16A; stroke-dasharray: 12 7; }
.map-build .board-frame {
  background:
    repeating-linear-gradient(45deg, rgba(255,220,120,.18) 0 10px, transparent 10px 22px),
    linear-gradient(145deg, var(--theme-a), var(--theme-b));
}
.map-build .tile::after {
  border-style: dashed;
  border-color: #C97A1B;
}

/* === 海洋：波浪路 + 气泡 === */
.map-ocean .road-edge { stroke: rgba(230, 248, 255, .95); }
.map-ocean .road-base { stroke: #7EC9E8; }
.map-ocean .road-dash { stroke: #E3F4FB; stroke-dasharray: 10 14; }
.map-ocean .board-frame {
  background:
    radial-gradient(circle at 20% 80%, rgba(160, 230, 255, .5), transparent 28%),
    radial-gradient(circle at 85% 20%, rgba(120, 200, 240, .45), transparent 26%),
    linear-gradient(160deg, var(--theme-a), var(--theme-b));
}
.map-ocean .tile::after {
  border-style: double;
  border-width: 2px;
}

/* === 糖果：粉糖路 + 斑点 === */
.map-candy .road-edge { stroke: rgba(255, 230, 240, .95); }
.map-candy .road-base { stroke: #FFA0C8; }
.map-candy .road-dash { stroke: #FFE5F2; stroke-dasharray: 9 10; }
.map-candy .board-frame {
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 200, 230, .5), transparent 26%),
    radial-gradient(circle at 75% 70%, rgba(255, 220, 240, .55), transparent 24%),
    linear-gradient(145deg, var(--theme-a), var(--theme-b));
}
.map-candy .tile::after {
  border-style: dotted;
  border-width: 3px;
  border-color: #E85D9E;
}

/* === 丛林：藤萝路 + 蕨叶 === */
.map-jungle .road-edge { stroke: rgba(250, 255, 240, .92); }
.map-jungle .road-base { stroke: #B8D38A; }
.map-jungle .road-dash { stroke: rgba(230, 250, 200, .95); }
.map-jungle .board-frame {
  background:
    radial-gradient(circle at 15% 15%, rgba(80, 180, 100, .35), transparent 28%),
    radial-gradient(circle at 88% 85%, rgba(60, 160, 80, .32), transparent 28%),
    linear-gradient(145deg, var(--theme-a), var(--theme-b));
}
.map-jungle .tile::after {
  border-style: dashed;
  border-color: #3E9E4C;
}

/* === 沙漠：沙路 + 波纹 === */
.map-desert .road-edge { stroke: rgba(255, 248, 230, .92); }
.map-desert .road-base { stroke: #F3C976; }
.map-desert .road-dash { stroke: rgba(255, 235, 180, .95); stroke-dasharray: 14 8; }
.map-desert .board-frame {
  background:
    radial-gradient(ellipse at 50% 100%, rgba(220, 170, 80, .45), transparent 35%),
    radial-gradient(ellipse at 10% 10%, rgba(255, 220, 120, .35), transparent 30%),
    linear-gradient(160deg, var(--theme-a), var(--theme-b));
}
.map-desert .tile::after {
  border-color: #C58A22;
  border-width: 2px;
}

/* === 冰雪：冰面路 + 雪花 === */
.map-snow .road-edge { stroke: rgba(230, 248, 255, .95); }
.map-snow .road-base { stroke: #B0D9EE; }
.map-snow .road-dash { stroke: #FFFFFF; stroke-dasharray: 10 10; }
.map-snow .board-frame {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .45), transparent 45%),
    linear-gradient(160deg, var(--theme-a), var(--theme-b));
}
.map-snow .tile::after {
  border-style: dotted;
  border-width: 3px;
  border-color: #2C7DA0;
}

/* === 太空：霓虹路 + 星点 === */
.map-space .board-frame {
  background:
    radial-gradient(circle at 20% 20%, rgba(200, 180, 255, .18), transparent 30%),
    radial-gradient(circle at 85% 75%, rgba(140, 130, 220, .25), transparent 28%),
    linear-gradient(160deg, var(--theme-a), var(--theme-b));
}
.map-space .tile::after {
  border-style: double;
  border-color: rgba(255, 255, 255, .55);
}
.map-space .scenery-item { opacity: .6; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 150;
  display: flex; align-items: center; justify-content: center;
  padding: 14px;
  background: rgba(58, 40, 30, .45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .52s ease;
}
.modal.show { opacity: 1; }
.modal-card {
  width: min(92vw, 460px);
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto; overscroll-behavior: contain;
  background: #FFFDF6;
  border: 3px solid #fff;
  border-radius: 30px;
  padding: 20px;
  box-shadow: 0 18px 50px rgba(50, 30, 15, .3);
  transform: scale(.84);
  transition: transform .66s cubic-bezier(.2, 1.25, .4, 1);
}
.modal.show .modal-card { transform: scale(1); }
.modal-title { text-align: center; font-size: 23px; font-weight: 900; color: #4C3828; }
.modal-sub { text-align: center; font-size: 14px; color: #8E7965; font-weight: 600; margin-top: 6px; line-height: 1.5; }

.event-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.event-icon {
  width: 88px; height: 88px; border-radius: 50%;
  background: #FFF6E5;
  border: 4px solid var(--ec, #FFC93C);
  display: flex; align-items: center; justify-content: center;
  font-size: 46px;
  box-shadow: 0 6px 0 rgba(150, 110, 70, .12);
  animation: eventPop 1.05s cubic-bezier(.2, 1.45, .4, 1) both;
}
.event-title { font-size: 23px; font-weight: 900; color: #4C3828; margin-top: 12px; }
.event-sub { font-size: 14.5px; color: #8E7965; font-weight: 600; line-height: 1.5; margin: 6px 0 16px; }

.word-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.word-badge {
  padding: 5px 14px; border-radius: 999px;
  background: #E8F8EC; color: #2E9C58;
  font-size: 11.5px; font-weight: 800;
  border: 1.5px solid #B9E8C6;
}
.word-emoji {
  font-size: 82px; line-height: 1.15; margin: 8px 0 2px;
  filter: drop-shadow(0 6px 8px rgba(90, 60, 30, .16));
  animation: wordFloat 2.2s ease-in-out infinite;
}
.word-emoji.pop { animation: wordPop .45s cubic-bezier(.2, 1.5, .4, 1); }
.word-en {
  font-size: clamp(27px, 8.5vw, 37px);
  font-weight: 900; color: #3C2C1E; letter-spacing: .5px;
  line-height: 1.15; word-break: break-word; max-width: 100%;
}
.word-zh { font-size: 17px; color: #8E7965; font-weight: 700; margin-top: 2px; }
.speak-btn {
  margin: 12px 0 6px;
  padding: 9px 18px; border-radius: 999px;
  background: #FFF1D9; border: 2px solid #F2D9AE;
  color: #A9642A; font-size: 13.5px; font-weight: 800;
}
.speak-btn:active { transform: scale(.96); }
.word-count { font-size: 10.5px; color: #B09A83; margin-top: 10px; }

.gift-title { text-align: center; font-size: 22px; font-weight: 900; color: #4C3828; }
.gift-row { display: flex; justify-content: center; gap: 9px; margin: 16px 0 6px; }
.gift-box {
  width: 92px; min-height: 108px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-radius: 20px;
  background: linear-gradient(160deg, #FFE7F1, #FFC8DF);
  border: 3px solid #fff;
  box-shadow: 0 5px 0 #EDA3C1, 0 8px 14px rgba(180, 90, 130, .18);
  transition: transform .18s, opacity .2s;
}
.gift-box:active { transform: scale(.95); }
.gift-top { font-size: 36px; line-height: 1.2; }
.gift-label { font-size: 10.5px; color: #9C3E68; font-weight: 800; }
.gift-box.open {
  background: linear-gradient(160deg, #FFF6D9, #FFE199);
  box-shadow: 0 0 0 4px rgba(255, 201, 60, .45), 0 5px 0 #E8B84A;
  animation: giftOpen .45s cubic-bezier(.2, 1.5, .4, 1);
}
.gift-box.dim { opacity: .35; }
.gift-tip { text-align: center; font-size: 12.5px; color: #8E7965; margin: 4px 0 12px; }

.confirm-icon { text-align: center; font-size: 50px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }

/* 单词本 / 徽章 / 设置 / 玩法 */
.wordbook-card { display: flex; flex-direction: column; padding: 16px; height: min(86vh, 720px); height: min(86dvh, 720px); }
.badges-card, .settings-card, .howto-card { height: auto; max-height: 86vh; max-height: 86dvh; }
.wb-head { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.wb-title { font-size: 20px; font-weight: 900; color: #4C3828; }
.wb-progress { font-size: 11.5px; color: #8E7965; margin: 4px 0 6px; font-weight: 700; flex-shrink: 0; }
.wb-progress b { color: #E86A2E; font-size: 14px; }
.wb-tabs { display: flex; gap: 6px; overflow-x: auto; flex-shrink: 0; padding: 2px 1px 8px; }
.wb-tab {
  flex-shrink: 0; padding: 7px 11px; border-radius: 999px;
  background: #FFF4DE; border: 2px solid #F1DFC1;
  font-size: 10.5px; color: #8E7965;
}
.wb-tab.active { background: #FFE9C7; border-color: #FFC97A; color: #A9642A; }
.wb-tab b { color: #E86A2E; margin-left: 2px; }
.wb-grid {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px;
  padding: 2px 1px 10px;
}
.word-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 8px; border-radius: 15px;
  background: #FFFDF6; border: 2px solid #F0E3CC;
  text-align: left; min-height: 56px;
}
.word-chip.got { box-shadow: 0 2px 0 #EAD9BE; }
.word-chip.got:active { transform: translateY(2px); box-shadow: none; }
.word-chip.locked { opacity: .5; background: #F7F1E6; }
.wc-emoji { font-size: 25px; line-height: 1; width: 30px; text-align: center; flex-shrink: 0; }
.wc-en { display: block; font-size: 13px; font-weight: 900; color: #3C2C1E; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wc-zh { display: block; font-size: 9.5px; color: #A08A75; font-weight: 700; }
.word-chip > span:last-child { min-width: 0; }
.word-chip { overflow: hidden; }
.wordbook-card .pill-btn { flex-shrink: 0; width: 100%; margin-top: 4px; }

.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 8px 0 12px; overflow-y: auto; }
.badge-card {
  border-radius: 17px; padding: 10px 8px; text-align: center;
  background: #FFF8E7; border: 2px solid #F2E2C4;
}
.badge-card.locked { opacity: .55; background: #F5EFE4; }
.badge-icon { font-size: 30px; line-height: 1.1; }
.badge-name { font-size: 12px; font-weight: 900; color: #4C3828; margin-top: 2px; }
.badge-desc { font-size: 9px; color: #A08A75; margin-top: 2px; line-height: 1.35; font-weight: 600; }

.set-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 14px; }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 13px; border-radius: 17px;
  background: #FFF8EA; border: 2px solid #F3E3C7;
}
.set-info b { display: block; font-size: 14px; color: #4C3828; }
.set-info span { display: block; font-size: 9.5px; color: #A08A75; font-weight: 600; margin-top: 1px; }
.switch {
  width: 52px; height: 30px; flex-shrink: 0;
  border-radius: 999px; background: #DED2C0;
  position: relative; transition: background .2s;
}
.switch i {
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .2);
  transition: transform .2s;
}
.switch.on { background: #59C26B; }
.switch.on i { transform: translateX(22px); }
.about {
  text-align: center; font-size: 10px; line-height: 1.7;
  color: #A08A75; font-weight: 600; margin: 10px 0 12px;
}
.about b { color: #7A6451; }

.how-list { display: flex; flex-direction: column; gap: 9px; margin: 8px 0 10px; }
.how-step {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: 17px;
  background: #FFF8EA; border: 2px solid #F3E3C7;
}
.how-icon { font-size: 22px; line-height: 1.2; }
.how-step b { display: block; font-size: 13.5px; color: #4C3828; }
.how-step span { display: block; font-size: 10.5px; color: #8E7965; line-height: 1.5; margin-top: 2px; font-weight: 600; }
.how-tip {
  font-size: 10.5px; color: #A9642A; line-height: 1.55;
  background: #FFF3DD; border-radius: 14px; padding: 9px 12px;
  border: 1.5px dashed #F0D2A4; margin-bottom: 4px;
}

.pause-card { display: flex; flex-direction: column; gap: 8px; padding: 18px; }
.pause-title { text-align: center; font-size: 22px; font-weight: 900; color: #4C3828; margin-bottom: 4px; }
.menu-btn {
  width: 100%; min-height: 50px; border-radius: 17px;
  background: #FFF8EA; border: 2px solid #F3E3C7;
  box-shadow: 0 3px 0 #EAD6B6;
  font-size: 15px; color: #5A4636;
  display: flex; align-items: center; justify-content: center;
}
.menu-btn:active { transform: translateY(3px); box-shadow: none; }
.menu-btn.danger { color: #C9524B; background: #FFF1EF; border-color: #F6D3CF; box-shadow: 0 3px 0 #EFC2BD; }

/* ---------- 星星换奖励（回合内兑换） ---------- */
.star-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; }
.star-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.star-title { font-size: 20px; font-weight: 900; color: #4C3828; }
.star-balance {
  flex-shrink: 0;
  font-size: 12.5px; font-weight: 700; color: #8E7965;
  background: #FFF8EA; border: 2px solid #FFE3A8; border-radius: 999px;
  padding: 4px 12px; white-space: nowrap;
}
.star-balance b { color: #E8931B; font-size: 14px; }
.star-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.star-opt {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 92px; padding: 10px 6px;
  border-radius: 18px;
  background: #FFF8EA; border: 2px solid #F3E3C7;
  box-shadow: 0 3px 0 #EAD6B6;
  transition: transform .1s, box-shadow .1s;
}
.star-opt:active { transform: translateY(3px); box-shadow: none; }
.star-opt.off { opacity: .42; box-shadow: none; background: #F7F1E4; }
.so-icon { font-size: 28px; line-height: 1.1; }
.so-name { font-size: 13px; font-weight: 900; color: #4C3828; }
.so-sub { font-size: 11px; font-weight: 700; color: #A9642A; }
.so-cost {
  font-size: 12px; font-weight: 900; color: #E8931B;
  background: #FFF3DD; border-radius: 999px; padding: 2px 9px;
}
.star-tip {
  text-align: center; font-size: 10.5px; font-weight: 700; color: #A9642A;
  background: #FFF3DD; border: 1.5px dashed #F0D2A4; border-radius: 14px;
  padding: 8px 12px;
}

/* TV：兑换按钮更大，遥控器好点 */
.screen-tv .star-title { font-size: 28px; }
.screen-tv .star-balance { font-size: 17px; padding: 7px 18px; }
.screen-tv .star-balance b { font-size: 20px; }
.screen-tv .star-grid { gap: 14px; }
.screen-tv .star-opt { min-height: 152px; border-radius: 24px; gap: 4px; }
.screen-tv .so-icon { font-size: 46px; }
.screen-tv .so-name { font-size: 20px; }
.screen-tv .so-cost { font-size: 17px; padding: 4px 14px; }
.screen-tv .star-tip { font-size: 15px; padding: 12px 18px; }


/* ---------- 小游戏 ---------- */
.mini-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
  background: rgba(45, 30, 20, .58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .24s ease;
}
.mini-overlay.show { opacity: 1; }
.mini-card {
  width: min(94vw, 460px); height: min(88vh, 660px); height: min(88dvh, 660px);
  display: flex; flex-direction: column;
  background: #FFFDF6;
  border: 3px solid #fff;
  border-radius: 30px;
  padding: 15px 15px 14px;
  box-shadow: 0 20px 50px rgba(40, 25, 15, .35);
  transform: scale(.9);
  transition: transform .28s cubic-bezier(.2, 1.35, .4, 1);
}
.mini-overlay.show .mini-card { transform: scale(1); }
.mini-head { flex-shrink: 0; display: flex; align-items: center; gap: 9px; padding-bottom: 6px; }
.mini-title {
  font-size: 19px; font-weight: 900; color: #4C3828;
  background: #FFF3DD; border: 2px solid var(--mc, #FFC93C);
  border-radius: 999px; padding: 5px 12px;
}
.mini-sub { font-size: 10.5px; color: #A08A75; font-weight: 600; line-height: 1.3; }
.mini-body { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

.bubble-hud { display: flex; justify-content: space-between; font-size: 16px; font-weight: 900; color: #4C3828; padding: 2px 4px; flex-shrink: 0; }
.bubble-bar { height: 9px; background: #F1E4CE; border-radius: 999px; overflow: hidden; flex-shrink: 0; margin: 3px 0 6px; }
.bubble-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #2EC4B6, #7DE3D6); border-radius: 999px; transition: width .1s linear; }
.bubble-stage { flex: 1; min-height: 0; position: relative; overflow: hidden; border-radius: 20px; background: #F5FDFC; }
.bubble {
  position: absolute; width: 58px; height: 58px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .9);
  box-shadow: 0 4px 8px rgba(70, 130, 130, .16), inset 0 -4px 8px rgba(0, 0, 0, .05);
  display: flex; align-items: center; justify-content: center;
  font-size: 27px;
  animation: bubbleBob 3s ease-in-out infinite alternate;
  transition: transform .2s;
}
.bubble:active { transform: scale(.9); }
.bubble.popped { animation: bubblePop .26s ease forwards; pointer-events: none; }

.mini-progress { display: flex; gap: 6px; justify-content: center; padding: 4px 0 6px; flex-shrink: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #E9DCC7; }
.dot.now { background: #FF9F43; transform: scale(1.2); }
.dot.done { background: #59C26B; }
.mini-prompt { text-align: center; font-size: 17px; font-weight: 900; color: #4C3828; margin: 4px 0 8px; flex-shrink: 0; }
.silhouette {
  width: 140px; height: 140px; flex-shrink: 0;
  margin: 4px auto 2px;
  border-radius: 30px;
  background: #F2ECFF;
  border: 3px solid #E2D5FF;
  display: flex; align-items: center; justify-content: center;
  font-size: 96px;
  line-height: 1;
}
.silhouette span { filter: brightness(0) opacity(.82); }
.shadow-options { display: flex; justify-content: center; gap: 14px; margin-top: auto; padding: 8px 0 14px; }
.opt-btn {
  width: 78px; height: 78px; border-radius: 22px;
  background: #FFFDF6; border: 3px solid #F0E3CC;
  box-shadow: 0 5px 0 #EAD9BE;
  font-size: 40px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s, border-color .2s, box-shadow .2s;
}
.opt-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #EAD9BE; }
.opt-btn.correct { border-color: #59C26B; background: #EBFAEF; box-shadow: 0 0 0 4px rgba(89, 194, 107, .25), 0 5px 0 #4CAF5B; animation: correctPop .45s ease; }
.opt-btn.wrong { border-color: #FF8A8A; animation: shake .4s ease; }

.count-stage {
  flex: 1; min-height: 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 6px 12px; padding: 8px 12px;
  background: #F6FAFF; border-radius: 20px;
  margin: 4px 0 10px;
  overflow: hidden;
}
.count-item { font-size: 36px; transform: rotate(var(--rot, 0deg)); display: inline-block; line-height: 1.2; }
.count-item.cheer { animation: countCheer .6s ease; }
.count-options { display: flex; justify-content: center; gap: 7px; flex-shrink: 0; padding-bottom: 6px; }
.num-btn {
  width: 52px; height: 56px; border-radius: 16px;
  background: #FFFDF6; border: 3px solid #F0E3CC;
  box-shadow: 0 4px 0 #EAD9BE;
  font-size: 24px; font-weight: 900; color: #4C3828;
  transition: transform .1s;
}
.num-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #EAD9BE; }
.num-btn.correct { background: #EBFAEF; border-color: #59C26B; box-shadow: 0 0 0 4px rgba(89, 194, 107, .22), 0 4px 0 #4CAF5B; }
.num-btn.wrong { border-color: #FF8A8A; animation: shake .4s ease; }

/* 算一算（10以内加减法） */
.math-eq {
  text-align: center; font-size: 42px; font-weight: 900; color: #3B2A1A;
  letter-spacing: 2px; margin: 4px 0 2px; flex-shrink: 0;
}
.math-eq b { color: #FF8A3D; }
.math-pic {
  flex: 1; min-height: 0; display: flex; flex-wrap: wrap;
  align-items: center; justify-content: center; gap: 2px;
  padding: 6px 10px; margin: 4px 0 8px;
  background: #F0FBF4; border-radius: 20px; overflow: hidden;
  font-size: 28px; line-height: 1.3;
}
.math-op { margin: 0 10px; font-weight: 900; color: #10AC84; font-size: 30px; }
.math-out { opacity: .3; filter: grayscale(.7); position: relative; display: inline-block; }
.math-out::after {
  content: ''; position: absolute; left: -2px; right: -2px; top: 50%;
  border-top: 3px solid #E06565; border-radius: 2px; transform: rotate(-14deg);
}

.listen-speaker {
  align-self: center;
  padding: 10px 22px; border-radius: 999px;
  background: #FFF1D9; border: 2px solid #F2D9AE;
  color: #A9642A; font-size: 14px; font-weight: 900;
}
.listen-speaker:active { transform: scale(.96); }
.listen-word {
  text-align: center; font-size: 26px; font-weight: 900; color: #3C2C1E;
  margin: 10px 0 2px; min-height: 34px;
  opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s;
}
.listen-word.show { opacity: 1; transform: none; }
.listen-options { display: flex; justify-content: center; gap: 12px; margin: auto 0 14px; }
.listen-options .opt-btn { width: 84px; height: 84px; font-size: 44px; }

.mini-result {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 6px; padding: 6px;
}
.mini-result-icon { font-size: 54px; animation: bob 1.5s ease-in-out infinite; }
.mini-star-row { font-size: 28px; letter-spacing: 3px; min-height: 36px; animation: cardIn .40s ease both; }
.mini-result-title { font-size: 19px; font-weight: 900; color: #4C3828; margin: 4px 0 10px; }

/* ---------- 结算 ---------- */
.end-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: calc(16px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: center;
}
.end-body {
  width: min(92vw, 440px);
  background: rgba(255, 253, 246, .96);
  border: 3px solid #fff;
  border-radius: 32px;
  padding: 20px 18px 16px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(70, 45, 25, .25);
  animation: endIn .5s cubic-bezier(.2, 1.2, .4, 1) both;
}
.end-crown { font-size: 38px; line-height: 1; animation: bob 1.8s ease-in-out infinite; }
.end-ava {
  width: 92px; height: 92px; margin: 4px auto 6px;
  border-radius: 50%;
  background: #FFFDF6; border: 4px solid var(--pc);
  display: flex; align-items: center; justify-content: center;
  font-size: 50px;
  box-shadow: 0 6px 0 rgba(120, 90, 60, .14), 0 10px 22px rgba(120, 90, 60, .16);
}
.end-title { font-size: 27px; font-weight: 900; color: #4C3828; margin: 4px 0 2px; }
.end-sub { font-size: 11.5px; color: #A08A75; font-weight: 700; }
.end-medal { font-size: 22px; margin: 8px 0 10px; color: #A9642A; font-weight: 900; }
.end-medal span { font-size: 14px; }
.end-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 12px; }
.stat-card {
  padding: 8px 2px; border-radius: 15px;
  background: #FFF8E9; border: 2px solid #F3E3C7;
}
.stat-card b { display: block; font-size: 21px; color: #E86A2E; line-height: 1.1; }
.stat-card span { display: block; font-size: 9px; color: #A08A75; font-weight: 700; }
.end-rank { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.rank-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 13px;
  background: #FFF8E9; border: 1.5px solid #F3E3C7;
}
.rank-no { font-size: 15px; width: 24px; }
.rank-ava {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--pc); background: #FFFDF6;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.rank-name { flex: 1; text-align: left; font-size: 12.5px; font-weight: 800; color: #5A4636; }
.rank-star { font-size: 11px; color: #A9642A; font-weight: 800; }
.end-actions { display: flex; flex-direction: column; gap: 8px; }
.end-actions .pill-btn { width: 100%; }
.end-foot { font-size: 9px; color: #C0AB94; margin-top: 12px; letter-spacing: 1px; }

/* ---------- 转场 / 提示 / 粒子 ---------- */
.trans-layer {
  position: fixed; inset: 0; z-index: 180;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--theme-a), var(--theme-b));
  opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.trans-layer.show { opacity: 1; pointer-events: all; }
.trans-inner { text-align: center; animation: transIn .5s cubic-bezier(.2, 1.3, .4, 1) both; }
.trans-art { font-size: 46px; letter-spacing: -6px; }
.trans-art span:nth-child(2) { font-size: 60px; }
.trans-name { font-size: 28px; font-weight: 900; color: var(--deep); margin-top: 4px; letter-spacing: 2px; }
.trans-sub { font-size: 13px; color: var(--deep); opacity: .6; font-weight: 700; margin-top: 4px; }

#fx-canvas { position: fixed; inset: 0; z-index: 240; pointer-events: none; }

.toast {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 50%;
  z-index: 260;
  transform: translate(-50%, -140%);
  display: flex; align-items: center; gap: 9px;
  max-width: 92vw;
  padding: 9px 15px;
  border-radius: 18px;
  background: #FFFDF6;
  border: 2px solid #fff;
  box-shadow: 0 8px 24px rgba(60, 40, 20, .22);
  transition: transform .3s cubic-bezier(.2, 1.4, .4, 1);
}
.toast.show { transform: translate(-50%, 0); }
.toast-icon { font-size: 24px; }
.toast-body b { display: block; font-size: 12.5px; color: #4C3828; }
.toast-body span { display: block; font-size: 10px; color: #A08A75; font-weight: 600; }

/* ---------- 动画 ---------- */
@keyframes screenIn { from { opacity: .2; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes floatDeco { from { transform: translateY(0) rotate(-6deg); } to { transform: translateY(-22px) rotate(7deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes spinWiggle { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(12deg); } }
@keyframes slotPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 159, 67, .45); } 50% { box-shadow: 0 0 0 6px rgba(255, 159, 67, .12); } }
@keyframes tileIn { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }
/* 棋格专用：保留居中偏移 */
@keyframes tilePop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.7); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes tokenIn { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
@keyframes tokenHop { 0% { transform: translateY(0) scale(1); } 45% { transform: translateY(-32%) scale(1.12); } 100% { transform: translateY(0) scale(1); } }
@keyframes trophyShine { 0%, 100% { transform: scale(1) rotate(-3deg); } 50% { transform: scale(1.08) rotate(3deg); } }
@keyframes diceRoll { 0% { transform: rotate(0) scale(1); } 30% { transform: rotate(-18deg) scale(1.06); } 60% { transform: rotate(16deg) scale(.96); } 100% { transform: rotate(0) scale(1); } }
@keyframes diceSettle { 0% { transform: scale(1.14); } 60% { transform: scale(.95); } 100% { transform: scale(1); } }
@keyframes diceNudge { 0%, 100% { transform: rotate(0) scale(1); } 25% { transform: rotate(-8deg) scale(1.03); } 75% { transform: rotate(8deg) scale(1.03); } }
@keyframes eventPop { from { opacity: 0; transform: scale(.4) rotate(-12deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes wordFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes wordPop { 0% { transform: scale(1); } 40% { transform: scale(1.18) rotate(-5deg); } 100% { transform: scale(1); } }
@keyframes giftOpen { 0% { transform: scale(1); } 45% { transform: scale(1.1) rotate(3deg); } 100% { transform: scale(1); } }
@keyframes bubbleBob { from { transform: translateY(2px); } to { transform: translateY(-9px); } }
@keyframes bubblePop { 0% { transform: scale(1); opacity: 1; } 60% { transform: scale(1.25); opacity: .8; } 100% { transform: scale(0); opacity: 0; } }
@keyframes correctPop { 0% { transform: scale(1); } 50% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px) rotate(-2deg); } 40% { transform: translateX(6px) rotate(2deg); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@keyframes countCheer { 0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); } 45% { transform: translateY(-12px) rotate(var(--rot, 0deg)) scale(1.15); } }
@keyframes transIn { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: scale(1); } }
@keyframes endIn { from { opacity: 0; transform: translateY(18px) scale(.95); } to { opacity: 1; transform: none; } }

/* ---------- 小屏适配 ---------- */
@media (max-height: 680px) {
  .control-panel { padding-top: 5px; gap: 3px; }
  .die { width: 62px; height: 62px; padding: 7px; border-radius: 17px; }
  .die .pip { width: 9px; height: 9px; }
  .roll-label { font-size: 13.5px; }
  .turn-bar { font-size: 12.5px; }
  .mascot-row { margin-bottom: 14px; }
  .home-stage { margin-top: 6px; }
  .start-btn { height: 66px; font-size: 22px; }
  .home-tools { margin-top: 14px; }
  .mini-card { height: 90vh; height: 90dvh; }
  .silhouette { width: 120px; height: 120px; font-size: 82px; }
  .opt-btn { width: 68px; height: 68px; font-size: 35px; }
}
@media (min-width: 420px) {
  .wb-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-height: 580px) {
  .screen-players .count-card { min-height: 112px; }
  .cc-emojis { font-size: 22px; }
  .cc-num { font-size: 20px; }
  .brand-icon { width: 54px; height: 54px; }
  .brand-title { font-size: 23px; }
  .mascot-row { margin-bottom: 10px; }
  .mascot { transform: scale(.9); }
}

/* =========================================================
   TV 横屏适配 —— .screen-tv（由 tv.js 根据 isTv 自动加 body）
   ========================================================= */

/* --- 焦点环：遥控器当前选中元素 --- */
.tv-focus {
  outline: none !important;
  position: relative;
  /* box-shadow 做外发光 + 圆角环 */
  box-shadow:
    0 0 0 4px #FFF6E5,
    0 0 0 8px #FF9F43,
    0 0 28px 8px rgba(255, 159, 67, .65) !important;
  border-radius: 18px !important;
  transform: scale(1.04);
  transition: transform .18s cubic-bezier(.2, 1.4, .4, 1), box-shadow .18s ease;
  z-index: 3;
}
.tv-focus:active { transform: scale(1.04); }

/* 某些元素有特殊圆角，让焦点环适配 */
.tv-focus.hud-btn, .tv-focus.round-back, .tv-focus.switch,
.tv-focus.speak-btn, .tv-focus.wb-tab, .tv-focus.dot,
.tv-focus.roll-btn, .tv-focus.num-btn { border-radius: 999px !important; }
.tv-focus.opt-btn { border-radius: 26px !important; }
.tv-focus.word-chip, .tv-focus.badge-card, .tv-focus.how-step,
.tv-focus.set-row, .tv-focus.rank-row { border-radius: 20px !important; }
.tv-focus.big-btn { border-radius: 28px !important; }
.tv-focus.char-card { border-radius: 26px !important; }
.tv-focus.tile, .tv-focus.token { box-shadow: none !important; } /* tile/token 不是可聚焦元素，兜底 */

/* 焦点音效：通过 transform 抖动一下增强 TV 反馈 */
.tv-focus::after {
  content: ''; position: absolute; inset: -4px;
  border-radius: inherit;
  animation: tvFocusPulse 1.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes tvFocusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 159, 67, 0); }
  50%      { box-shadow: 0 0 0 12px rgba(255, 159, 67, .10); }
}

/* --- TV 基础放大：比手机大 10~15% --- */
.screen-tv {
  /* 整体放大约 10% —— MainActivity textZoom=110 也会再放大 */
  font-size: 10px; /* 基础 rem 单位 */
}
.screen-tv .big-btn { min-height: 72px; font-size: 25px; border-radius: 28px; }
.screen-tv .pill-btn { min-height: 58px; font-size: 20px; padding: 14px 30px; }
.screen-tv .round-back { width: 52px; height: 52px; font-size: 30px; }
.screen-tv .setup-title { font-size: 26px; }
.screen-tv .brand-title { font-size: 34px; }
.screen-tv .brand-sub { font-size: 15px; }
.screen-tv .tool-btn { min-height: 76px; font-size: 14px; padding: 10px 14px; border-radius: 20px; }
.screen-tv .tool-icon { font-size: 30px; }

/* --- 首页：TV 横屏下更宽的布局 --- */
.screen-tv .home-scroll {
  max-width: none;
  padding: calc(24px + env(safe-area-inset-top)) 36px calc(28px + env(safe-area-inset-bottom));
  flex-direction: row;
  gap: 28px;
  align-items: center;
}
.screen-tv .brand {
  flex-direction: column;
  text-align: center;
  margin-bottom: 0;
  min-width: 200px;
}
.screen-tv .brand-icon { width: 96px; height: 96px; }
.screen-tv .home-stage { flex: 1; max-width: 900px; }
.screen-tv .home-tools {
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 22px;
}
.screen-tv .mascot-row { margin-bottom: 18px; }
.screen-tv .mascot { font-size: 56px; }

/* --- setup 页面（players / chars / maps）：居中更宽 --- */
.screen-tv .setup-shell {
  max-width: 900px;
  margin: 16px auto;
  padding: 22px 28px;
}
.screen-tv .count-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 18px;
}
.screen-tv .count-card {
  min-height: 200px;
  padding: 22px 14px;
  border-radius: 28px;
}
.screen-tv .cc-emojis { font-size: 44px; }
.screen-tv .cc-num { font-size: 26px; }
.screen-tv .cc-sub { font-size: 14px; }

/* --- 选角色 --- */
.screen-tv .char-grid { grid-template-columns: repeat(6, 1fr); gap: 14px; }
.screen-tv .char-card { border-radius: 22px; min-height: 138px; }
.screen-tv .char-ava { font-size: 52px; }
.screen-tv .char-name { font-size: 16px; }
.screen-tv .char-hint { font-size: 18px; }

/* --- 选地图 --- */
.screen-tv .map-list {
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 18px;
}
.screen-tv .map-card { border-radius: 26px; padding: 14px; }
.screen-tv .map-thumb { height: 140px; border-radius: 20px; }
.screen-tv .map-name { font-size: 18px; }
.screen-tv .map-desc { font-size: 12px; }
.screen-tv .map-team { font-size: 15px; margin-top: 4px; }

/* --- 游戏主界面：横屏横向布局 --- */
.screen-tv .screen-game {
  padding: 14px 24px 20px;
}
.screen-tv .hud {
  padding: 6px 10px 10px;
}
.screen-tv .hud-btn { width: 60px; height: 60px; font-size: 28px; border-radius: 18px; }
.screen-tv .map-ribbon {
  font-size: 22px;
  padding: 10px 24px;
  margin: 4px 0 10px;
}
.screen-tv .game-right {
  width: 200px;
  gap: 16px;
  padding: 16px 12px;
}
.screen-tv .game-right .hud-players { gap: 12px; }
.screen-tv .game-right .pchip { width: 110px; }
.screen-tv .game-right .pchip-ava { width: 72px; height: 72px; font-size: 40px; }
.screen-tv .game-right .pchip-star { font-size: 16px; }
.screen-tv .game-right .turn-bar { font-size: 18px; min-height: 72px; border-radius: 22px; padding: 0 18px; }
.screen-tv .game-right .turn-ava { font-size: 40px; }
.screen-tv .game-right .turn-text b { font-size: 22px; }
.screen-tv .game-right .roll-btn { min-height: 120px; font-size: 28px; border-radius: 32px; gap: 16px; padding: 20px; }
.screen-tv .game-right .roll-label { font-size: 22px; max-width: none; }
.screen-tv .game-right .die { width: 92px; height: 92px; padding: 12px; border-radius: 26px; }
.screen-tv .game-right .die .pip { width: 14px; height: 14px; }

/* 棋盘居中放大；控制栏在右侧（与 DOM 结构一致） */
.screen-tv .board-wrap {
  flex: 1; min-height: 0;
  display: flex; gap: 22px;
  align-items: stretch;
  justify-content: center;
}
.screen-tv .board-wrap .board-frame {
  flex: 1;
  max-width: 920px;
  max-height: none;
}

/* --- 弹窗：TV 更大 --- */
.screen-tv .modal-card {
  width: min(80vw, 680px);
  max-height: 86vh;
  padding: 26px 28px;
  border-radius: 36px;
}
.screen-tv .modal-title { font-size: 30px; }
.screen-tv .modal-sub { font-size: 17px; }
.screen-tv .event-icon { width: 110px; height: 110px; font-size: 60px; }
.screen-tv .event-title { font-size: 30px; }
.screen-tv .word-emoji { font-size: 110px; }
.screen-tv .word-en { font-size: 44px; }
.screen-tv .word-zh { font-size: 22px; }
.screen-tv .speak-btn { min-height: 64px; font-size: 17px; }
.screen-tv .menu-btn { min-height: 72px; font-size: 20px; }
.screen-tv .gift-box { width: 130px; min-height: 152px; }

/* --- 小游戏：更大按钮 --- */
.screen-tv .mini-card {
  width: min(92vw, 820px);
  height: min(84vh, 680px);
  padding: 22px 24px;
  border-radius: 36px;
}
.screen-tv .mini-title { font-size: 24px; padding: 8px 18px; }
.screen-tv .silhouette { width: 180px; height: 180px; font-size: 120px; }
.screen-tv .opt-btn { width: 100px; height: 100px; font-size: 54px; }
.screen-tv .num-btn { width: 72px; height: 76px; font-size: 32px; }
.screen-tv .listen-options .opt-btn { width: 110px; height: 110px; font-size: 58px; }
.screen-tv .math-eq { font-size: 58px; }
.screen-tv .math-pic { font-size: 38px; }
.screen-tv .math-op { font-size: 40px; }

/* --- 结算 --- */
.screen-tv .end-body { width: min(80vw, 560px); padding: 28px 26px 22px; }
.screen-tv .end-crown { font-size: 52px; }
.screen-tv .end-ava { width: 120px; height: 120px; font-size: 66px; }
.screen-tv .end-title { font-size: 34px; }
.screen-tv .end-medal { font-size: 30px; }
.screen-tv .stat-card b { font-size: 28px; }

/* --- 设置 / 单词本 / 徽章 / 玩法 --- */
.screen-tv .wb-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
.screen-tv .word-chip { min-height: 78px; padding: 12px; border-radius: 20px; }
.screen-tv .wc-en { font-size: 17px; }
.screen-tv .badge-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
.screen-tv .badge-icon { font-size: 40px; }
.screen-tv .badge-name { font-size: 16px; }
.screen-tv .set-row { padding: 16px 20px; border-radius: 22px; min-height: 72px; }
.screen-tv .set-info b { font-size: 18px; }
.screen-tv .set-info span { font-size: 13px; }
.screen-tv .how-step { padding: 14px 18px; border-radius: 22px; gap: 14px; }
.screen-tv .how-icon { font-size: 32px; }
.screen-tv .how-step b { font-size: 18px; }
.screen-tv .how-step span { font-size: 14px; }

/* --- Toast --- */
.screen-tv .toast { padding: 14px 22px; border-radius: 22px; }
.screen-tv .toast-icon { font-size: 32px; }
.screen-tv .toast-body b { font-size: 17px; }
.screen-tv .toast-body span { font-size: 13px; }

/* --- TV：地图卡片改为竖排网格，迷你场景更大 --- */
.screen-tv .map-card { position: relative; flex-direction: column; align-items: stretch; text-align: center; padding: 10px 12px 12px; gap: 0; }
.screen-tv .map-art { width: 100%; height: 82px; border-radius: 20px; }
.screen-tv .map-art-e.e1 { font-size: 27px; }
.screen-tv .map-art-e.e2 { font-size: 41px; }
.screen-tv .map-art-e.e3 { font-size: 22px; }
.screen-tv .map-info { margin-top: 10px; }
.screen-tv .map-name { font-size: 21px; }
.screen-tv .map-go { position: absolute; top: 20px; right: 20px; }
.screen-tv .char-card { min-height: 142px; border-radius: 26px; }
.screen-tv .char-orb { width: 76px; height: 76px; }
.screen-tv .char-emoji { font-size: 44px; }
.screen-tv .char-name { font-size: 15px; margin-top: 9px; }
.screen-tv .char-en { font-size: 11px; }
.screen-tv .board-frame { border-radius: 32px; }
.screen-tv .board-frame::before { border-radius: 32px; }

/* --- 小视口横屏兜底：手机横屏装 TV 版 / 720p 电视投影（视口 ≤ 920dp） ---
   1080p 电视典型视口 960×540 不受影响，维持大字号大棋盘。 */
@media (max-width: 920px) and (orientation: landscape) {
  .screen-tv { font-size: 9px; }
  .screen-tv .big-btn { min-height: 54px; font-size: 19px; border-radius: 22px; }
  .screen-tv .round-back { width: 44px; height: 44px; font-size: 24px; }
  .screen-tv .setup-title { font-size: 20px; }
  .screen-tv .setup-shell { max-width: none; margin: 8px auto; padding: 12px 18px; border-radius: 24px; }
  .screen-tv .brand-title { font-size: 24px; }
  .screen-tv .brand-sub { font-size: 12px; }
  .screen-tv .tool-btn { min-height: 58px; font-size: 12px; padding: 8px 10px; border-radius: 16px; }
  .screen-tv .tool-icon { font-size: 24px; }
  .screen-tv .home-scroll { gap: 18px; padding: 14px 22px calc(16px + env(safe-area-inset-bottom)); }
  .screen-tv .brand { min-width: 150px; }
  .screen-tv .brand-icon { width: 64px; height: 64px; }
  .screen-tv .mascot { font-size: 40px; }
  .screen-tv .mascot-row { margin-bottom: 12px; }
  .screen-tv .home-tools { gap: 10px; margin-top: 14px; }

  .screen-tv .count-grid { gap: 10px; margin-top: 10px; }
  .screen-tv .count-card { min-height: 118px; padding: 12px 8px; border-radius: 20px; }
  .screen-tv .cc-emojis { font-size: 26px; }
  .screen-tv .cc-num { font-size: 17px; }
  .screen-tv .cc-sub { font-size: 10.5px; }

  .screen-tv .char-grid { gap: 9px; }
  .screen-tv .char-card { min-height: 108px; border-radius: 18px; padding: 8px 4px 7px; }
  .screen-tv .char-orb { width: 50px; height: 50px; }
  .screen-tv .char-emoji { font-size: 29px; }
  .screen-tv .char-name { font-size: 12px; margin-top: 6px; }
  .screen-tv .char-en { font-size: 9.5px; }
  .screen-tv .char-hint { font-size: 13px; margin: 4px 0 3px; }
  .screen-tv .next-btn { height: 48px; font-size: 15px; margin: 6px 4px calc(8px + env(safe-area-inset-bottom)); }

  .screen-tv .map-list { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 10px; }
  .screen-tv .map-card { padding: 10px; }
  .screen-tv .map-art { height: 72px; border-radius: 14px; }
  .screen-tv .map-art-e.e1 { font-size: 20px; }
  .screen-tv .map-art-e.e2 { font-size: 30px; }
  .screen-tv .map-art-e.e3 { font-size: 16px; }
  .screen-tv .map-name { font-size: 16px; }
  .screen-tv .map-tag { font-size: 10px; }
  .screen-tv .map-go { top: 16px; right: 16px; }

  .screen-tv .screen-game { padding: 8px 14px 12px; }
  .screen-tv .hud { padding: 4px 8px 6px; }
  .screen-tv .hud-btn { width: 46px; height: 46px; font-size: 21px; border-radius: 14px; }
  .screen-tv .map-ribbon { font-size: 15px; padding: 6px 16px; margin: 2px 0 6px; }
  .screen-tv .board-wrap { gap: 14px; }
  .screen-tv .board-frame { max-width: 760px; border-radius: 24px; }
  .screen-tv .game-right { width: 160px; padding: 8px 10px; gap: 10px; }
  .screen-tv .game-right .pchip { width: 90px; }
  .screen-tv .game-right .pchip-ava { width: 58px; height: 58px; font-size: 32px; }
  .screen-tv .game-right .pchip-star { font-size: 13px; }
  .screen-tv .game-right .turn-bar { min-height: 50px; font-size: 13px; padding: 0 12px; border-radius: 16px; }
  .screen-tv .game-right .turn-ava { font-size: 27px; }
  .screen-tv .game-right .turn-text b { font-size: 16px; }
  .screen-tv .game-right .roll-btn { min-height: 72px; font-size: 19px; border-radius: 24px; padding: 10px; gap: 12px; }
  .screen-tv .game-right .roll-label { font-size: 14px; max-width: 110px; }
  .screen-tv .game-right .die { width: 56px; height: 56px; padding: 7px; border-radius: 16px; }
  .screen-tv .game-right .die .pip { width: 9px; height: 9px; }

  .screen-tv .modal-card { width: min(92vw, 560px); max-height: 88vh; padding: 18px 20px; border-radius: 28px; }
  .screen-tv .modal-title { font-size: 22px; }
  .screen-tv .event-icon { width: 84px; height: 84px; font-size: 46px; }
  .screen-tv .event-title { font-size: 22px; }
  .screen-tv .word-emoji { font-size: 82px; }
  .screen-tv .word-en { font-size: 33px; }
  .screen-tv .word-zh { font-size: 17px; }
  .screen-tv .speak-btn { min-height: 52px; font-size: 14px; }
  .screen-tv .menu-btn { min-height: 56px; font-size: 16px; }
  .screen-tv .gift-box { width: 100px; min-height: 120px; }
  .screen-tv .mini-card { width: min(94vw, 660px); height: min(88vh, 520px); padding: 16px 18px; border-radius: 28px; }
  .screen-tv .mini-title { font-size: 19px; padding: 6px 14px; }
  .screen-tv .silhouette { width: 128px; height: 128px; font-size: 84px; }
  .screen-tv .opt-btn { width: 74px; height: 74px; font-size: 39px; }
  .screen-tv .num-btn { width: 56px; height: 60px; font-size: 26px; }
  .screen-tv .listen-options .opt-btn { width: 82px; height: 82px; font-size: 42px; }
  .screen-tv .end-body { width: min(88vw, 460px); padding: 20px 20px 16px; }
  .screen-tv .end-ava { width: 88px; height: 88px; font-size: 48px; }
  .screen-tv .end-title { font-size: 26px; }
}

/* =========================================================
   手机 / iOS 横版适配（非 TV 设备）
   横屏下游戏页 = 左棋盘 + 右控制栏；其余页面压扁留白、拉开列数，
   避免小朋友在横屏里反复上下滚动。
   ========================================================= */
@media (orientation: landscape) {
  /* ---------- 游戏页：双栏 ---------- */
  body:not(.screen-tv) .screen-game.active {
    padding: calc(2px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right))
             calc(4px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left));
  }
  body:not(.screen-tv) .game-left { min-width: 0; }
  body:not(.screen-tv) .screen-game .hud {
    padding: 0 2px 2px;
    gap: 6px;
  }
  body:not(.screen-tv) .screen-game .hud-btn {
    width: 32px; height: 32px; font-size: 16px;
  }
  body:not(.screen-tv) .screen-game .map-ribbon {
    justify-self: center;
    margin: 1px 0 3px;
    padding: 1px 10px 2px;
    font-size: 10.5px;
  }
  body:not(.screen-tv) .screen-game .board-wrap {
    padding: 1px 5px calc(10px + env(safe-area-inset-bottom));
    min-height: 0;
  }
  body:not(.screen-tv) .screen-game .board-frame {
    max-width: none;
    padding: 5px;
    border-radius: 18px;
  }
  body:not(.screen-tv) .screen-game .board-frame::before { border-radius: 18px; }
  body:not(.screen-tv) .game-right {
    width: clamp(96px, 15vw, 148px);
    gap: 8px;
    padding: 8px 5px;
  }
  body:not(.screen-tv) .game-right .hud-players { gap: 6px; }
  body:not(.screen-tv) .game-right .pchip { width: 54px; }
  body:not(.screen-tv) .game-right .pchip-ava { width: 36px; height: 36px; font-size: 20px; }
  body:not(.screen-tv) .game-right .pchip-star { font-size: 10.5px; }
  body:not(.screen-tv) .game-right .turn-bar {
    flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; text-align: center; min-height: 0;
  }
  body:not(.screen-tv) .game-right .turn-ava { font-size: 24px; line-height: 1.1; }
  body:not(.screen-tv) .game-right .turn-text {
    white-space: normal; font-size: 12.5px; line-height: 1.25;
  }
  body:not(.screen-tv) .game-right .roll-btn {
    flex-direction: column;
    gap: 6px; align-items: center; justify-content: center;
    width: 100%; margin: 0;
  }
  body:not(.screen-tv) .game-right .die {
    width: clamp(50px, 13vh, 68px); height: clamp(50px, 13vh, 68px);
    padding: 7px; border-radius: 16px;
    border-width: 2.5px;
  }
  body:not(.screen-tv) .game-right .die .pip { width: 8px; height: 8px; }
  body:not(.screen-tv) .game-right .roll-label {
    font-size: 12px; line-height: 1.25; max-width: none; text-align: center;
  }

  /* ---------- 首页：左右分栏 ---------- */
  body:not(.screen-tv) .home-scroll {
    flex-direction: row;
    align-items: center; justify-content: center;
    gap: clamp(14px, 3vw, 32px);
    padding: calc(8px + env(safe-area-inset-top)) clamp(16px, 4vw, 40px)
             calc(8px + env(safe-area-inset-bottom));
  }
  body:not(.screen-tv) .brand {
    flex-direction: column; text-align: center;
    margin: 0; min-width: clamp(140px, 18vw, 190px); gap: 8px;
  }
  body:not(.screen-tv) .brand-icon { width: clamp(48px, 13vh, 64px); height: clamp(48px, 13vh, 64px); }
  body:not(.screen-tv) .brand-title { font-size: clamp(20px, 5.4vh, 27px); }
  body:not(.screen-tv) .home-stage { flex: 1; max-width: 460px; margin-top: 0; }
  body:not(.screen-tv) .mascot-row { margin: 0 0 8px; }
  body:not(.screen-tv) .m1, body:not(.screen-tv) .m3 { width: 46px; height: 46px; font-size: 26px; }
  body:not(.screen-tv) .m2 { width: 60px; height: 60px; font-size: 34px; }
  body:not(.screen-tv) .start-btn { height: clamp(54px, 13vh, 68px); font-size: 21px; border-radius: 24px; }
  body:not(.screen-tv) .home-tools { margin-top: 10px; gap: 7px; }
  body:not(.screen-tv) .tool-btn { padding: 6px 2px 5px; border-radius: 15px; }
  body:not(.screen-tv) .tool-icon { font-size: 20px; }
  body:not(.screen-tv) .home-stats { margin-top: 10px; }
  body:not(.screen-tv) .home-badges { margin-top: 6px; min-height: 0; }
  body:not(.screen-tv) .home-foot { display: none; }

  /* ---------- 设置页：压缩头部、拉宽内容 ---------- */
  body:not(.screen-tv) .setup-shell {
    max-width: min(86vw, 760px);
    padding: calc(2px + env(safe-area-inset-top)) 14px 0;
  }
  body:not(.screen-tv) .setup-head { height: 42px; }
  body:not(.screen-tv) .round-back { width: 36px; height: 36px; font-size: 18px; }
  body:not(.screen-tv) .setup-title { font-size: 18px; }
  body:not(.screen-tv) .setup-hint { font-size: 11px; margin: 2px 0 0; }
  body:not(.screen-tv) .setup-foot {
    padding: 4px 0 calc(2px + env(safe-area-inset-bottom));
  }

  /* 人数：四列排开 */
  body:not(.screen-tv) .count-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 9px;
    padding: 8px 2px 0;
  }
  body:not(.screen-tv) .count-card {
    min-height: clamp(92px, 25vh, 132px);
    border-radius: 20px;
    border-width: 2.5px;
  }
  body:not(.screen-tv) .cc-emojis { font-size: 24px; }
  body:not(.screen-tv) .cc-num { font-size: 19px; }
  body:not(.screen-tv) .cc-sub { font-size: 10px; }

  /* 角色：五列 + 更矮的卡片 */
  body:not(.screen-tv) .pick-slots { gap: 5px; margin-top: 0; }
  body:not(.screen-tv) .slot { width: 50px; }
  body:not(.screen-tv) .slot-ava { width: 40px; height: 40px; font-size: 21px; }
  body:not(.screen-tv) .char-hint { font-size: 11px; margin: 3px 0 2px; }
  body:not(.screen-tv) .char-tabs { padding: 1px 0 3px; margin-bottom: 4px; }
  body:not(.screen-tv) .char-tab { padding: 4px 2px; font-size: 9.5px; }
  body:not(.screen-tv) .char-grid { grid-template-columns: repeat(5, 1fr); gap: 7px; }
  body:not(.screen-tv) .char-card {
    min-height: clamp(84px, 22vh, 108px);
    padding: 6px 3px 5px; border-radius: 18px;
  }
  body:not(.screen-tv) .char-orb { width: 44px; height: 44px; }
  body:not(.screen-tv) .char-emoji { font-size: 25px; }
  body:not(.screen-tv) .char-name { font-size: 10.5px; margin-top: 4px; }
  body:not(.screen-tv) .char-en { font-size: 8.5px; }
  body:not(.screen-tv) .next-btn {
    height: 44px; font-size: 15px;
    margin: 5px 4px calc(4px + env(safe-area-inset-bottom));
  }

  /* 地图：两列网格 */
  body:not(.screen-tv) .map-team { height: 24px; }
  body:not(.screen-tv) .map-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: min-content;
    align-content: start;
    gap: 8px;
    padding: 2px 2px calc(8px + env(safe-area-inset-bottom));
  }
  body:not(.screen-tv) .map-card { padding: 6px; gap: 8px; border-radius: 18px; }
  body:not(.screen-tv) .map-art { width: 78px; height: 54px; border-radius: 13px; }
  body:not(.screen-tv) .map-name { font-size: 15px; }
  body:not(.screen-tv) .map-tag { font-size: 9.5px; }

  /* ---------- 结算 ---------- */
  body:not(.screen-tv) .end-scroll {
    padding: calc(8px + env(safe-area-inset-top)) 12px calc(10px + env(safe-area-inset-bottom));
  }
  body:not(.screen-tv) .end-body {
    width: min(80vw, 560px);
    padding: 14px 16px 12px;
    border-radius: 26px;
  }

  /* ---------- 弹窗 / 小游戏：横屏放宽 ---------- */
  body:not(.screen-tv) .modal-card {
    width: min(88vw, 560px);
    max-height: 94vh; max-height: 94dvh;
    padding: 14px 18px;
    border-radius: 24px;
  }
  body:not(.screen-tv) .mini-card {
    width: min(90vw, 640px);
    height: min(92vh, 560px); height: min(92dvh, 560px);
    padding: 12px 18px;
  }
  body:not(.screen-tv) .mini-title { padding: 4px 14px; }
  body:not(.screen-tv) .silhouette { width: clamp(110px, 30vh, 150px); height: clamp(110px, 30vh, 150px); font-size: 76px; }
  body:not(.screen-tv) .opt-btn { width: clamp(58px, 16vh, 76px); height: clamp(58px, 16vh, 76px); font-size: 32px; }
  body:not(.screen-tv) .listen-options .opt-btn { width: clamp(62px, 17vh, 82px); height: clamp(62px, 17vh, 82px); font-size: 34px; }
  body:not(.screen-tv) .word-emoji { font-size: clamp(58px, 16vh, 84px); }
  body:not(.screen-tv) .wordbook-card { width: min(92vw, 720px); }
  body:not(.screen-tv) .wb-grid { grid-template-columns: repeat(4, 1fr); }

  /* 星星兑换：横屏压缩，四个奖励一屏放得下 */
  body:not(.screen-tv) .star-card { padding: 10px 14px; gap: 6px; }
  body:not(.screen-tv) .star-title { font-size: 17px; }
  body:not(.screen-tv) .star-balance { font-size: 11px; padding: 3px 10px; }
  body:not(.screen-tv) .star-balance b { font-size: 12.5px; }
  body:not(.screen-tv) .star-grid { gap: 5px; }
  body:not(.screen-tv) .star-opt { min-height: 72px; padding: 6px 4px; border-radius: 14px; }
  body:not(.screen-tv) .so-icon { font-size: 20px; }
  body:not(.screen-tv) .so-name { font-size: 11.5px; }
  body:not(.screen-tv) .so-cost { font-size: 10.5px; padding: 1px 7px; }
  body:not(.screen-tv) .star-tip { font-size: 9.5px; padding: 5px 10px; }
}

/* 横屏但高度很矮（常见于手机横屏 320~380dp）时再压一档 */
@media (orientation: landscape) and (max-height: 400px) {
  body:not(.screen-tv) .mascot-row { display: none; }
  body:not(.screen-tv) .home-tools { margin-top: 8px; }
  body:not(.screen-tv) .home-badges { display: none; }
  body:not(.screen-tv) .setup-hint { display: none; }
  body:not(.screen-tv) .char-hint { display: none; }
  body:not(.screen-tv) .map-art { width: 66px; height: 46px; }
  body:not(.screen-tv) .game-right { gap: 5px; padding: 5px 6px; }
  body:not(.screen-tv) .game-right .roll-label { font-size: 11px; }
}
