﻿/* =========================================================
   涓€灞忓竷灞€瑕嗙洊灞?   鐩爣锛氫换浣曢〉闈㈤兘涓嶅嚭鐜扮旱鍚戞粴鍔紱鍐呭澶氭椂鐢ㄦí鍚戝垎椤?鏍囩銆?   ========================================================= */

html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  min-height: 0;
}

.app {
  width: min(1240px, 100%);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: 8px 12px max(8px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.topbar {
  position: static;
  top: auto;
  flex: 0 0 auto;
  margin: 0;
  min-height: 56px;
}

.screens {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  padding: 0;
}

.screen.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  animation: screenIn .22s ease both;
}

.bottom-nav {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  flex: 0 0 auto;
  width: min(560px, 100%);
  margin: 0 auto;
}

body.focus-mode .app {
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

body.focus-mode .screens {
  flex: 1 1 auto;
}

.screen.focus {
  max-width: none;
}

/* 闅愯棌鎵€鏈夌旱鍚戞粴鍔ㄦ潯锛屼絾淇濈暀妯悜婊戝姩 */
.map-pager,
.mini-unit-row,
.palette {
  scrollbar-width: none;
}
.map-pager::-webkit-scrollbar,
.mini-unit-row::-webkit-scrollbar,
.palette::-webkit-scrollbar {
  display: none;
}

/* ---------------- 棣栭〉 ---------------- */
.home-shell {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: 8px;
}

.hero {
  min-width: 0;
  min-height: 0;
  height: 100%;
  border-radius: 22px;
}

.hero-content {
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-width: 640px;
  padding: clamp(14px, 2.2vh, 32px) clamp(16px, 3vw, 36px);
  justify-content: center;
}

.hero h1 {
  font-size: clamp(30px, 5.2vh, 58px);
  margin: 4px 0 10px;
}

.hero-desc {
  max-width: 480px;
  margin-bottom: 13px;
  font-size: clamp(11px, 1.55vh, 14px);
  line-height: 1.55;
}

.hero-actions {
  min-width: 0;
  gap: 8px;
  flex-wrap: nowrap;
}

.hero-actions .btn {
  min-width: 0;
  min-height: 42px;
  padding: 0 14px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-badges {
  gap: 6px;
  margin-top: 12px;
}

.hero-badges span {
  padding: 4px 8px;
  font-size: 9px;
}

.hero-guide {
  right: 12px;
  bottom: 10px;
  max-width: 46%;
  gap: 5px;
}

.hero-guide .bubble {
  margin-bottom: 4px;
  padding: 7px 9px;
  font-size: 10px;
  line-height: 1.45;
}

.guide-avatar,
.guide-avatar svg,
.guide-avatar img {
  width: 64px;
  height: 86px;
}

.home-dock {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.daily,
.home-units-card {
  min-width: 0;
}

.stat-strip {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 5px 3px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .75);
  box-shadow: 0 3px 0 rgba(44, 69, 50, .06);
}

.stat-chip span { font-size: 13px; line-height: 1.2; }
.stat-chip b { font-size: 15px; line-height: 1.2; }
.stat-chip small { font-size: 8px; color: var(--muted); }

.daily {
  flex: 0 0 auto;
  padding: 9px 11px;
}

.daily h2 {
  font-size: clamp(16px, 2.4vh, 21px);
  margin-top: 1px;
}

.daily-head {
  gap: 8px;
}

.ring {
  width: 46px;
  height: 46px;
}

.ring span { font-size: 10px; }
.ring::after { inset: 6px; }

.daily-progress {
  height: 7px;
  margin: 7px 0 5px;
}

.daily .muted {
  font-size: 10px;
  line-height: 1.4;
  margin-bottom: 4px;
}

.daily .text-btn { font-size: 10px; }

.home-units-card {
  flex: 1 1 auto;
  min-height: 0;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.home-units-card .section-head {
  margin-bottom: 5px;
}

.home-units-card h3 {
  margin: 0;
  font-size: 12px;
}

.home-units-card .text-btn { font-size: 10px; }

.mini-unit-row {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.mini-unit {
  flex: 0 0 132px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.mini-unit .mini-icon { font-size: 17px; line-height: 1.1; }
.mini-unit b {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-unit small { font-size: 9px; color: var(--muted); }
.mini-unit .mini-stars { color: #e0b34c; font-size: 9px; letter-spacing: .5px; }

@media (min-width: 760px) and (max-width: 1039px) {
  .home-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1.42fr) minmax(0, .58fr);
  }
  .home-dock {
    display: grid;
    grid-template-columns: minmax(0, .8fr) minmax(0, 1.1fr) minmax(0, 1.2fr);
    grid-template-rows: 1fr;
    gap: 8px;
  }
  .stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    align-content: stretch;
  }
  .daily { height: 100%; }
  .home-units-card { height: 100%; }
  .mini-unit-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 5px;
    height: 100%;
    overflow: hidden;
  }
  .mini-unit {
    flex: none;
    width: auto;
    min-height: 0;
    padding: 5px 6px;
  }
  .mini-unit .mini-icon { font-size: 15px; }
  .mini-unit b { font-size: 10px; }
}

@media (min-width: 1040px) {
  .home-shell {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-rows: 1fr;
  }
  .hero-content { padding: 24px 30px; }
  .home-dock { gap: 8px; }
  .home-units-card { flex: 0 0 auto; height: 190px; }
  .mini-unit-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 5px;
    height: 100%;
    overflow: hidden;
  }
  .mini-unit {
    flex: none;
    width: auto;
    min-height: 0;
    padding: 5px 6px;
  }
  .mini-unit .mini-icon { font-size: 15px; }
  .mini-unit b { font-size: 10px; }
}

@media (max-height: 720px) {
  .hero-desc,
  .hero-badges { display: none; }
  .hero h1 { font-size: clamp(26px, 5.6vh, 40px); }
  .home-shell { grid-template-rows: minmax(0, 1.2fr) minmax(0, .8fr); }
  .home-units-card { display: none; }
  .daily .muted { display: none; }
  .chart-note { display: none; }
}

@media (max-height: 620px) {
  .topbar { min-height: 48px; }
  .brand-text small { display: none; }
  .hero-actions .btn { min-height: 38px; }
  .stat-chip small { display: none; }
  .stat-chip { padding: 3px; }
  .stat-chip span { display: none; }
  .daily h2 { font-size: 15px; }
  .ring { width: 40px; height: 40px; }
}

/* ---------------- 鐭ヨ瘑缇ゅ矝 ---------------- */
#screen-map { gap: 6px; }

.map-head {
  flex: 0 0 auto;
  margin: 0 0 4px;
  align-items: center;
}

.map-head h1 {
  font-size: clamp(24px, 4.2vh, 36px);
  margin: 2px 0;
}

.map-head p {
  font-size: 10.5px;
  line-height: 1.4;
  margin: 0;
}

.map-head .head-progress {
  min-width: 92px;
  padding: 8px 12px;
}

.map-head .head-progress b { font-size: 18px; }
.map-head .head-progress small { font-size: 9px; }

.map-pager-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.map-pager {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  border-radius: 16px;
}

.map-page {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 2px;
  scroll-snap-align: start;
}

.map-page .unit-card {
  height: 100%;
  min-height: 0;
  padding: 9px 10px;
  overflow: hidden;
  border-radius: 16px;
}

.map-page .unit-icon {
  width: 42px;
  height: 38px;
  border-radius: 11px;
  font-size: 19px;
  box-shadow: 0 4px 0 var(--unit-dark);
}

.map-page .unit-card h3 {
  margin: 7px 0 1px;
  font-size: 15px;
}

.map-page .island-name {
  margin-bottom: 3px;
  font-size: 9px;
}

.map-page .unit-card p { display: none; }

.map-page .grade-pill {
  padding: 3px 6px;
  font-size: 8.5px;
}

.map-page .unit-stars { font-size: 10px; }
.map-page .unit-bottom { margin-top: auto; }
.map-page .state { font-size: 9px; }
.map-page .unit-go {
  padding: 5px 9px;
  font-size: 9px;
}

.pager-foot {
  flex: 0 0 auto;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pager-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.pager-btn:active { transform: translateY(1px); }

.pager-dots { display: flex; align-items: center; gap: 5px; }

.pager-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #c9d7c2;
  cursor: pointer;
  transition: width .2s, background .2s;
}

.pager-dot.active {
  width: 16px;
  border-radius: 4px;
  background: var(--green-deep);
}

.pager-label {
  font-size: 9px;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------------- 鏍囩椤甸€氱敤 ---------------- */
.tab-group {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.tab-bar {
  flex: 0 0 auto;
  display: flex;
  gap: 3px;
  padding: 3px;
  margin-bottom: 7px;
  border: 1px solid #dce8d4;
  border-radius: 11px;
  background: #edf5e7;
}

.tab-bar button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 34px;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.tab-bar button.active {
  background: #fff;
  color: var(--green-dark);
  box-shadow: 0 2px 6px rgba(44, 69, 50, .1);
}

.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  margin-left: 2px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ffe8b8;
  color: #7b5c12;
  font-size: 9px;
  vertical-align: 1px;
}

.tab-body {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

.tab-panel {
  display: none;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.tab-panel.active {
  display: block;
  animation: screenIn .2s ease both;
}

/* ---------------- 鐭ヨ瘑鍗?---------------- */
#screen-learn { gap: 4px; }

.learn-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.concept {
  min-height: 0;
  height: 100%;
  padding: 11px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.learn-tabs {
  min-height: 0;
  overflow: hidden;
}

.learn-tabs .tab-body {
  overflow: hidden;
}

.learn-tabs .tab-bar { margin-bottom: 6px; }

#concept-card {
  min-height: 0;
  overflow: hidden;
}

#concept-card .tab-panel {
  overflow: hidden;
}

#concept-card .tab-panel[data-tab-panel="formula"].active,
#concept-card .tab-panel[data-tab-panel="example"].active {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.concept-hero {
  gap: 9px;
  margin-bottom: 8px;
}

.concept-avatar,
.concept-avatar svg,
.concept-avatar img {
  width: 42px;
  height: 56px;
}

.concept-hero .bubble {
  padding: 7px 10px;
  font-size: 10.5px;
  line-height: 1.45;
}

#concept-card h1 {
  font-size: clamp(22px, 3.4vh, 32px);
  margin: 1px 0;
}

#concept-card .island-name {
  font-size: 10px;
  margin-bottom: 8px;
}

.concept-lead {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 9px;
  font-size: 11px;
  line-height: 1.5;
}

.point-list {
  gap: 5px;
  margin-bottom: 7px;
}

.point-list li {
  gap: 7px;
  padding: 7px 8px;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.4;
}

.point-list .num {
  width: 19px;
  height: 19px;
  border-radius: 6px;
  font-size: 9px;
}

.formula-card {
  padding: 10px 12px;
  border-radius: 13px;
  margin-bottom: 6px;
}

.formula-card small { font-size: 8.5px; margin-bottom: 3px; }
.formula { font-size: clamp(16px, 2.6vh, 22px); line-height: 1.35; }

.example-card {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 10.5px;
  line-height: 1.5;
}

#start-quiz-btn {
  flex: 0 0 auto;
  min-height: 40px;
  margin-top: 7px;
  font-size: 12px;
}

.learn-side { display: none; }

.learn-note {
  padding: 10px 12px;
  font-size: 10px;
  line-height: 1.5;
  color: var(--muted);
}
.learn-note b { display: block; color: var(--ink-soft); font-size: 11px; margin-bottom: 3px; }
.learn-note p { margin: 0; }

@media (min-width: 760px) {
  .learn-grid {
    grid-template-columns: minmax(0, 1fr) 252px;
  }
  .learn-side {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-height: 0;
  }
  .mission {
    flex: 0 0 auto;
    padding: 11px;
  }
  .mission h3 { font-size: 14px; margin: 2px 0 7px; }
  .mission-list { gap: 5px; margin-bottom: 8px; }
  .mission-list li { font-size: 9.5px; line-height: 1.35; }
  .mission-reward { font-size: 9.5px; padding: 5px 7px; }
}

/* ---------------- 绛旈 ---------------- */
#screen-quiz { overflow: hidden; }

.quiz-shell {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.quiz-top {
  flex: 0 0 auto;
  margin-bottom: 7px;
}

.quiz-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px;
  overflow: hidden;
}

.quiz-guide {
  flex: 0 0 auto;
  margin-bottom: 6px;
}

.quiz-avatar,
.quiz-avatar svg,
.quiz-avatar img {
  width: 38px;
  height: 50px;
}

.quiz-guide .bubble {
  padding: 6px 9px;
  font-size: 10px;
  line-height: 1.4;
}

.quiz-meta {
  flex: 0 0 auto;
  margin-bottom: 4px;
}

.quiz-card h2 {
  flex: 0 0 auto;
  margin-bottom: 8px;
  font-size: clamp(18px, 3.1vh, 23px);
  line-height: 1.4;
}

.answer-area {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.choice-grid { gap: 7px; }

.option-btn {
  min-height: clamp(42px, 6.8vh, 60px);
  padding: 7px 10px;
  font-size: 12.5px;
  border-radius: 12px;
}

.option-btn .letter {
  width: 26px;
  height: 26px;
  font-size: 10px;
  border-radius: 7px;
}

.number-wrap { gap: 7px; }

.answer-display {
  min-height: 50px;
  padding: 6px 12px;
}

.answer-display .value { font-size: 24px; }
.answer-display .unit { font-size: 13px; }
.answer-display .caret { height: 24px; }

.keypad {
  max-width: 340px;
  gap: 5px;
}

.keypad button {
  min-height: clamp(38px, 6vh, 48px);
  font-size: 17px;
  border-radius: 10px;
}

.keypad .key-submit { font-size: 12px; }

#feedback-panel {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

#feedback-panel[hidden],
#answer-area[hidden],
#quiz-tools[hidden] { display: none; }

.feedback-head > span { font-size: 20px; }
.feedback-head b { font-size: 13px; }
.feedback-head p { font-size: 11px; }

.feedback-explain {
  margin: 7px 0 9px;
  font-size: 11px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feedback .btn { min-height: 38px; }

.quiz-tools {
  flex: 0 0 auto;
  margin-top: 7px;
  padding-top: 7px;
}

.hint-btn { padding: 6px 10px; font-size: 10px; }
.hint-text { font-size: 10.5px; line-height: 1.45; padding-top: 3px; }

@media (max-height: 700px) {
  .quiz-guide { display: none; }
  .quiz-card { padding: 9px; }
  .quiz-card h2 { margin-bottom: 5px; font-size: 17px; }
  .option-btn { min-height: 40px; }
  .keypad button { min-height: 36px; }
  .answer-display { min-height: 42px; }
  .feedback-explain { -webkit-line-clamp: 3; }
}

/* ---------------- 缁撶畻 ---------------- */
.result-shell {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
}

.result-tabs {
  flex: 1 1 auto;
  min-height: 0;
}

.result-tabs .tab-body { flex: 1 1 auto; }

.result-tabs .tab-panel {
  height: 100%;
  overflow: hidden;
}

.result-card {
  height: 100%;
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.result-stars {
  min-height: 0;
  margin-bottom: 3px;
}
.result-stars span { font-size: clamp(30px, 5.5vh, 46px); }

.result-card h1 {
  margin: 3px 0 3px;
  font-size: clamp(22px, 3.8vh, 32px);
}

.result-card .muted {
  max-width: 520px;
  font-size: 10.5px;
  line-height: 1.45;
  margin-bottom: 4px;
}

.reward-big {
  margin: 7px 0 8px;
  padding: 5px 13px;
}
.reward-big b { font-size: 21px; }
.reward-big .reward-cube { font-size: 17px; }
.reward-big span:last-child { font-size: 10px; }

.result-stats {
  max-width: 410px;
  gap: 6px;
  margin-bottom: 9px;
}
.result-stats > div { padding: 6px 5px; }
.result-stats b { font-size: 16px; }
.result-stats small { font-size: 9px; }

.result-actions { gap: 5px; }
.result-actions .btn {
  min-height: 36px;
  padding: 0 11px;
  font-size: 10.5px;
}

.review {
  height: 100%;
  min-height: 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.review h3 { flex: 0 0 auto; margin: 0 0 6px; font-size: 14px; }
.review-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: grid;
  gap: 5px;
  align-content: start;
}

.review-item { padding: 6px 8px; border-radius: 9px; }
.review-item .q { font-size: 10.5px; line-height: 1.4; margin-bottom: 2px; }
.review-item .a { font-size: 9.5px; }
.review-item .e {
  margin: 2px 0 0;
  font-size: 9px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state { padding: 12px 8px; font-size: 10.5px; }

/* ---------------- 瀹跺洯 ---------------- */
.build-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.build-head {
  flex: 0 0 auto;
  margin: 0;
  align-items: center;
}

.build-head h1 {
  font-size: clamp(21px, 3.4vh, 30px);
  margin: 1px 0;
}

.build-desc { display: none; }

.build-currency {
  padding: 6px 10px;
  gap: 7px;
}
.build-currency > span { font-size: 18px; }
.build-currency b { font-size: 16px; }
.build-currency small { font-size: 9px; }
.build-currency .text-btn { display: none; }

.build-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, .95fr) minmax(0, 1.05fr);
  gap: 7px;
  align-items: stretch;
}

.build-stage {
  min-height: 0;
  height: 100%;
  max-height: none;
  border-radius: 18px;
}

.build-panel {
  min-height: 0;
  height: 100%;
  padding: 7px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.build-tools {
  flex: 0 0 auto;
  gap: 4px;
  margin-bottom: 4px;
}
.tool-btn { min-height: 32px; font-size: 9px; padding: 4px 2px; }

.build-subbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 4px;
}

.build-tab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 26px;
  padding: 2px 4px;
  border: 1px solid #dfe9d7;
  border-radius: 8px;
  background: #f7fbf3;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 800;
  cursor: pointer;
}
.build-tab.active {
  background: var(--green-soft);
  border-color: #b7dfa1;
  color: var(--green-dark);
}
.build-tab .tab-count {
  min-width: 14px;
  height: 14px;
  font-size: 8px;
  vertical-align: 0;
}

.day-night-btn {
  flex: 0 0 30px;
  width: 30px;
  height: 26px;
  padding: 0;
  border: 1px solid #dfe9d7;
  border-radius: 8px;
  background: #fff9e8;
  font-size: 12px;
  cursor: pointer;
}

.build-pane {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.build-pane.active { display: flex; flex-direction: column; }

.palette {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 4px;
  min-height: 0;
}

.block-swatch {
  min-height: 44px;
  padding: 2px;
  gap: 1px;
  font-size: 7.5px;
  border-radius: 7px;
}
.swatch-cube { width: 19px; height: 19px; border-radius: 5px; }
.block-swatch.deco { background: #fffaf0; }

.collection-hint {
  flex: 0 0 auto;
  padding: 2px 0;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  text-align: center;
}

.build-orders {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.order-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px;
  border: 1px solid #e5edde;
  border-radius: 8px;
  background: #fbfdf8;
}
.order-row.ready { border-color: #b8e19e; background: #f2ffe7; }
.order-row.claimed { opacity: .55; }
.order-main { flex: 1 1 auto; min-width: 0; }
.order-main b {
  display: block;
  font-size: 9px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.order-main small { font-size: 7.5px; color: var(--muted); }
.order-bar {
  height: 3px;
  margin: 2px 0 1px;
  border-radius: 999px;
  background: #eaf2e4;
  overflow: hidden;
}
.order-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #9ce86f, #55bd35);
}
.order-claim {
  flex: 0 0 34px;
  height: 27px;
  padding: 0;
  border: 1px solid #d7e7cb;
  border-radius: 7px;
  background: #f1f7ec;
  color: #9aaa95;
  font-size: 8px;
  font-weight: 900;
  cursor: pointer;
}
.order-claim.ready {
  border-color: #6fc54d;
  background: var(--green);
  color: #153a0b;
  box-shadow: 0 2px 0 var(--green-deep);
}
.order-claim[disabled] { cursor: default; }

.collection-list {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.collection-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border: 1px solid #e7eee1;
  border-radius: 8px;
  background: #fbfdf8;
  color: var(--muted);
  font-size: 8px;
}
.collection-row.done { border-color: #c9e7b6; background: #f4ffea; color: var(--green-dark); }
.collection-icon {
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  background: #edf4e8;
  font-size: 8px;
  font-weight: 900;
}
.collection-row.done .collection-icon { background: var(--green); color: #173a0e; }
.collection-row b { flex: 1 1 auto; font-size: 8.5px; }
.collection-row small { font-size: 7px; }

#clear-build { flex: 0 0 auto; font-size: 8.5px; padding: 2px 0; }

/* 鐧藉ぉ / 澶滄櫄 */
.build-stage.night {
  background: linear-gradient(180deg, #162044 0%, #263a63 52%, #1f3b36 100%);
}
.build-stage.night .build-scene svg {
  filter: brightness(.78) saturate(.9);
}
.build-stage.night .build-hint {
  background: rgba(8, 18, 38, .76);
}
.build-stage.night .build-level {
  background: rgba(22, 32, 64, .82);
  color: #f2f7ff;
  border-color: rgba(255, 255, 255, .25);
}
.night-stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s;
  background-image:
    radial-gradient(circle, #fff 1px, transparent 1.8px),
    radial-gradient(circle, #ffe9a0 1px, transparent 1.8px),
    radial-gradient(circle, #b9e5ff 1px, transparent 1.8px);
  background-size: 73px 61px, 131px 97px, 191px 149px;
  background-position: 0 0, 25px 15px, 60px 40px;
}
.build-stage.night .night-stars { opacity: .8; }
.night-stars::after {
  content: "";
  position: absolute;
  top: 8%;
  right: 12%;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #fff6c4;
  box-shadow: 0 0 38px rgba(255, 242, 168, .55);
  opacity: .9;
}
.fireflies { display: none; position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.build-stage.night .fireflies { display: block; }
.fireflies i {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffe36a;
  box-shadow: 0 0 10px 4px rgba(255, 227, 106, .55);
  animation: fireflyFloat 5s ease-in-out infinite;
}
.fireflies i:nth-child(1) { left: 18%; top: 58%; animation-delay: 0s; }
.fireflies i:nth-child(2) { left: 34%; top: 72%; animation-delay: -1.2s; }
.fireflies i:nth-child(3) { left: 58%; top: 62%; animation-delay: -2.1s; }
.fireflies i:nth-child(4) { left: 72%; top: 78%; animation-delay: -.7s; }
.fireflies i:nth-child(5) { left: 46%; top: 42%; animation-delay: -3s; }
.fireflies i:nth-child(6) { left: 82%; top: 48%; animation-delay: -1.8s; }

@keyframes fireflyFloat {
  0%, 100% { transform: translate(0, 0); opacity: .35; }
  50% { transform: translate(9px, -14px); opacity: 1; }
}

@media (max-width: 759px) {
  .palette {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 4px;
    height: auto;
    overflow: hidden;
  }
  .block-swatch {
    min-height: 44px;
    padding: 2px 1px;
  }
  .swatch-cube { width: 18px; height: 18px; }
}

@media (min-width: 380px) and (max-width: 759px) {
  .order-row { padding: 6px 6px; }
  .order-main b { font-size: 10px; }
  .order-main small { font-size: 8px; }
  .order-claim { flex-basis: 38px; height: 30px; font-size: 9px; }
}

@media (min-width: 760px) {
  .build-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-rows: 1fr;
  }
  .build-panel { padding: 10px; }
  .block-swatch { min-height: 50px; font-size: 8px; }
  .build-tab { min-height: 28px; font-size: 9px; }
  .order-row { padding: 5px 6px; }
  .order-main b { font-size: 9px; }
  .order-main small { font-size: 8px; }
}

@media (max-width: 760px) {
  .build-quests { display: none; }
}

@media (min-width: 760px) {
  .map-page .unit-card p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 6px;
    font-size: 10px;
    line-height: 1.45;
  }
}

@media (max-height: 700px) {
  .build-quests { display: none; }
  .block-swatch { min-height: 44px; }
  .report-note { display: none; }
}

@media (max-height: 700px) and (max-width: 759px) {
  .build-layout { grid-template-rows: minmax(0, .85fr) minmax(0, 1.15fr); }
  .order-row { padding: 3px 5px; }
  .order-main b { font-size: 8px; }
  .order-main small { font-size: 7px; }
  .order-bar { height: 2px; }
  .order-claim { flex-basis: 31px; height: 24px; font-size: 7.5px; }
}

/* ---------------- 瀹堕暱鎶ュ憡 ---------------- */
.parent-head {
  flex: 0 0 auto;
  margin: 0 0 5px;
  align-items: center;
}

.parent-head h1 {
  font-size: clamp(22px, 3.6vh, 30px);
  margin: 1px 0;
}

.parent-head .head-progress { padding: 7px 11px; min-width: 92px; }
.parent-head .head-progress b { font-size: 18px; }

.parent-tabs {
  flex: 1 1 auto;
  min-height: 0;
}

.parent-tabs .tab-body { flex: 1 1 auto; }

.parent-tabs .tab-panel {
  height: 100%;
  overflow: hidden;
}

.parent-tabs .tab-panel[data-tab-panel="overview"] {
  display: none;
  flex-direction: column;
  gap: 7px;
}

.parent-tabs .tab-panel[data-tab-panel="overview"].active {
  display: flex;
}

.report-hero {
  height: auto;
  flex: 1 1 auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.report-note { flex: 0 0 auto; }

.report-hero h2 { font-size: 20px; margin: 4px 0; }
.report-hero p { font-size: 10.5px; line-height: 1.5; }

.report-metrics { gap: 6px; }
.report-metrics > div { padding: 8px 6px; }
.report-metrics b { font-size: 19px; }
.report-metrics small { font-size: 9px; }

.report-note {
  margin-top: 7px;
  padding: 9px 11px;
  font-size: 10px;
  line-height: 1.45;
  color: var(--muted);
}
.report-note b { display: block; color: var(--ink-soft); font-size: 11px; margin-bottom: 2px; }
.report-note p { margin: 0; }

.mastery-list {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px 14px;
  align-content: start;
  overflow: hidden;
}

.mastery-row {
  gap: 2px 8px;
}
.mastery-row .name { font-size: 10px; }
.mastery-row .val { font-size: 9px; }
.mastery-bar { height: 5px; }

.mistake-list {
  height: calc(100% - 32px);
  display: grid;
  gap: 5px;
  align-content: start;
  overflow: hidden;
}

.mistake-item { padding: 6px 8px; border-radius: 9px; }
.mistake-item .q { font-size: 10px; line-height: 1.4; }
.mistake-item .meta { font-size: 9px; margin-top: 2px; }
.mistake-list .empty-state { padding: 12px 8px; font-size: 10px; }

.mini-pager {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.report-actions {
  height: 100%;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.report-actions h3 { margin: 0 0 4px; font-size: 16px; }
.report-actions p { font-size: 10.5px; line-height: 1.5; }
.parent-actions { gap: 6px; margin: 9px 0; }
.parent-actions .btn { min-height: 36px; padding: 0 11px; font-size: 10px; }

@media (min-width: 760px) {
  .mastery-list { grid-template-columns: 1fr 1fr; }
  .report-hero { flex-direction: row; align-items: center; justify-content: space-between; }
  .report-hero > div:first-child { flex: 1; }
  .report-metrics { min-width: 250px; }
}

/* ---------------- 璁剧疆寮圭獥 ---------------- */
.modal-root[hidden] { display: none; }

.modal {
  width: min(560px, 100%);
  height: min(620px, 88dvh);
  max-height: 88dvh;
  padding: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal h2 { margin: 0 0 5px; font-size: 20px; }
.modal > .muted { flex: 0 0 auto; font-size: 10.5px; line-height: 1.45; }

.modal .tab-group {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 7px;
}

.modal .tab-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.modal .tab-panel {
  height: 100%;
  overflow: hidden;
}

.modal .tab-bar { margin-bottom: 6px; }
.modal .tab-bar button { min-height: 32px; font-size: 10.5px; }

.modal-section { margin: 0; }
.modal-section h3 { margin: 0 0 6px; font-size: 12px; }

.setting-row { padding: 8px 0; }
.setting-row .label { font-size: 11px; }
.setting-row .desc { font-size: 9px; }

.char-options { gap: 8px; }
.char-option { padding: 7px; }
.char-option svg,
.char-option img { width: 38px; height: 50px; }
.char-option b { font-size: 11px; }
.char-option small { font-size: 8px; }

.asset-status {
  font-size: 9.5px;
  line-height: 1.45;
  padding: 7px 8px;
}
.asset-actions { gap: 4px; margin-top: 6px; }
.asset-actions .btn { min-height: 32px; padding: 0 8px; font-size: 9px; border-radius: 8px; }
.modal .tiny { font-size: 9px; }

.modal-actions { gap: 6px; margin-top: 8px; }
.modal-actions .btn { min-height: 36px; padding: 0 12px; font-size: 10.5px; }

/* 鏅€氱‘璁ゅ脊绐楀唴瀹规洿鐭紝鑷姩楂樺害 */
.modal.confirm-modal { height: auto; min-height: 0; }
.modal.confirm-modal .modal-actions { margin-top: 14px; }

/* 鎵嬫満妯睆澶煯鏃讹紝鎻愮ず绔栧睆浣跨敤锛涘钩鏉挎í灞忎笉鍙楀奖鍝?*/
.rotate-hint { display: none; }

@media (orientation: landscape) and (max-height: 620px) and (max-width: 1100px) {
  .rotate-hint {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
      radial-gradient(circle at 50% 20%, rgba(255, 255, 255, .9), transparent 55%),
      linear-gradient(180deg, #c9f4ff, #efffdc);
  }
  .rotate-hint-card {
    max-width: 360px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 24px;
    background: rgba(255, 253, 247, .94);
    box-shadow: 0 18px 50px rgba(47, 81, 60, .18);
    text-align: center;
  }
  .rotate-hint-card > span { display: block; font-size: 44px; margin-bottom: 6px; }
  .rotate-hint-card b { display: block; font-size: 20px; margin-bottom: 6px; }
  .rotate-hint-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
}

/* ---------------- 灏忓睆缁嗚妭 ---------------- */
@media (max-width: 480px) {
  .btn-unit { display: none; }
}

@media (max-width: 420px) {
  .app { padding: 5px 8px max(5px, env(safe-area-inset-bottom)); gap: 6px; }
  .topbar { min-height: 50px; padding: 6px 8px; border-radius: 17px; }
  .brand-text b { font-size: 13px; }
  .brand-cube { width: 34px; height: 34px; }
  .icon-btn { width: 36px; height: 36px; border-radius: 11px; }
  .player-chip { padding: 3px; }
  .player-avatar { width: 28px; height: 28px; }
  .bottom-nav { padding: 5px; border-radius: 18px; }
  .bottom-nav button { padding: 5px 2px; }
  .bottom-nav button span { font-size: 17px; }
  .bottom-nav button small { font-size: 9px; }

  .hero h1 { font-size: clamp(28px, 5.4vh, 40px); }
  .hero-content { padding: 12px; }
  .hero-guide { display: none; }
  .hero-actions .btn { flex: 1 1 auto; }

  .map-page { gap: 5px; }
  .map-page .unit-card { padding: 7px 8px; border-radius: 14px; }
  .map-page .unit-icon { width: 36px; height: 33px; font-size: 17px; }
  .map-page .unit-card h3 { font-size: 13px; margin-top: 5px; }
  .map-page .unit-go { padding: 4px 7px; font-size: 8px; }
  .map-page .state { font-size: 8px; }

  .concept { padding: 8px; }
  .point-list li { font-size: 10.5px; padding: 6px 7px; }
  .formula { font-size: 15px; }
  .example-card { font-size: 9.5px; }

  .quiz-card { padding: 9px; }
  .option-btn { font-size: 11.5px; }
  .feedback-explain { font-size: 10.5px; }

  .report-hero h2 { font-size: 18px; }
  .mastery-list { gap: 3px; }
}

@media (max-height: 700px) and (max-width: 760px) {
  .hero-guide { display: none; }
  .hero h1 { font-size: clamp(25px, 5.2vh, 36px); }
  .hero-actions .btn { min-height: 36px; }
}

/* =========================================================
   瀹跺洯鍏ㄥ睆寤洪€犳ā寮?   ========================================================= */
body.build-mode .topbar,
body.build-mode .bottom-nav {
  display: none;
}

body.build-mode .app {
  width: 100%;
  max-width: none;
  padding: 0;
  gap: 0;
}

body.build-mode .screens {
  flex: 1 1 auto;
}

.build-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.build-shell {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.build-canvas {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #bdefff;
}

.build-screen .build-stage {
  position: absolute;
  inset: 0;
  height: 100%;
  min-height: 0;
  max-height: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.build-screen .build-scene {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.build-screen .build-hint {
  position: absolute;
  top: max(66px, calc(env(safe-area-inset-top) + 58px));
  left: 10px;
  bottom: auto;
  z-index: 5;
  max-width: min(70%, 380px);
  padding: 6px 10px;
  background: rgba(20, 48, 32, .72);
  color: #fff;
  font-size: 10px;
}

.build-topbar {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}

.build-topbar > * {
  pointer-events: auto;
}

.build-back {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 12px;
  background: rgba(255, 253, 247, .9);
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(34, 72, 48, .14);
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.build-heading {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 400px;
  margin-right: auto;
  padding: 5px 11px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 12px;
  background: rgba(255, 253, 247, .86);
  box-shadow: 0 4px 12px rgba(34, 72, 48, .12);
  backdrop-filter: blur(8px);
}
.build-heading b {
  display: block;
  font-size: 17px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.build-heading small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.25;
}

.build-top-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
}

.build-top-actions .build-currency {
  padding: 5px 8px;
  border-radius: 12px;
  background: rgba(255, 253, 247, .9);
  box-shadow: 0 4px 12px rgba(34, 72, 48, .12);
  backdrop-filter: blur(8px);
}
.build-top-actions .build-currency > span { font-size: 16px; }
.build-top-actions .build-currency b { font-size: 15px; }
.build-top-actions .build-currency small { font-size: 8px; }

.build-top-actions .day-night-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 249, 232, .94);
  box-shadow: 0 4px 12px rgba(34, 72, 48, .12);
}

.build-dock {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 6;
  max-height: 55%;
  padding: 7px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(255, 253, 247, .94);
  box-shadow: 0 10px 30px rgba(28, 66, 43, .22);
  backdrop-filter: blur(12px);
}

.build-dock .build-tools { margin-bottom: 4px; }
.build-dock .build-subbar { margin-bottom: 4px; }
.build-dock .build-pane { flex: 1 1 auto; min-height: 0; }
.build-dock #clear-build { margin-top: 2px; }

@media (max-width: 759px) {
  .build-dock {
    max-height: 52%;
    padding: 6px;
  }
  .build-top-actions .build-currency small { display: none; }
  .build-top-actions .build-currency { padding: 4px 7px; }
  .build-heading { padding: 4px 9px; }
  .build-heading b { font-size: 15px; }
}

@media (min-width: 760px) {
  .build-dock {
    max-height: 48%;
    padding: 7px;
  }
  .build-dock .palette {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: 1fr;
    gap: 4px;
  }
  .build-dock .block-swatch {
    min-height: 46px;
    font-size: 8px;
  }
  .build-dock .swatch-cube {
    width: 20px;
    height: 20px;
  }
  .build-screen .build-hint {
    top: 66px;
    left: 12px;
  }
}

/* 妯睆骞虫澘锛氭帶鍒跺彴鍋滈潬鍙充晶锛屽矝闈㈠悜宸﹁浣嶏紝閬垮厤鎸′綇鍓嶆帓鏍煎瓙 */
@media (min-width: 1000px) and (orientation: landscape) {
  .build-dock {
    left: auto;
    right: 10px;
    bottom: 10px;
    width: 330px;
    max-height: calc(100% - 80px);
  }
  .build-dock .palette {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
  }
  .build-screen .build-scene svg {
    transform: translateX(-14.5%);
  }
}

/* 绌哄湴涓婄殑灏忓姩鐗?*/
.ambient-animal { pointer-events: none; }
.animal-walk {
  animation: animalWander 5.2s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center bottom;
}
@keyframes animalWander {
  0%, 100% { transform: translate(0, 0); }
  45% { transform: translate(var(--dx, 8px), var(--dy, -3px)); }
  55% { transform: translate(var(--dx, 8px), var(--dy, -3px)); }
}

/* 棣栨浣跨敤 / 璐﹀彿 */
.onboarding-modal {
  height: auto;
  min-height: 0;
  max-height: 88dvh;
}
.onboarding h2 { margin: 4px 0 8px; font-size: 23px; }
.onboarding > .muted { font-size: 11.5px; line-height: 1.65; margin-bottom: 10px; }
.field-label {
  display: block;
  margin: 10px 0 4px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
}
.text-input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 2px solid #dce8d4;
  border-radius: 12px;
  background: #fbfff7;
  font-size: 16px;
  font-weight: 800;
  outline: none;
}
.text-input:focus { border-color: var(--green-deep); }
.form-error {
  min-height: 18px;
  margin: 7px 0 4px;
  color: #b23a35;
  font-size: 10.5px;
  line-height: 1.4;
}
.onboarding .btn { margin-top: 8px; }
.onboarding .text-btn { display: block; margin: 10px auto 4px; }
.onboarding .tiny { text-align: center; margin: 8px 0 0; }
.account-big-id {
  margin: 8px 0;
  padding: 10px;
  border-radius: 14px;
  background: #efffe4;
  border: 1px solid #c9eab6;
  color: var(--green-dark);
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 8px;
  text-align: center;
}
.account-box { padding: 4px 0; }
.account-id-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f3f9ed;
  font-size: 11px;
  color: var(--muted);
}
.account-id-line b { font-size: 24px; letter-spacing: 4px; color: var(--green-dark); }
.account-name-line { margin: 8px 0 4px; font-size: 12px; color: var(--ink-soft); }

/* 鎵嬫満涓婁篃璁╂樀绉板彲瑙?*/
@media (max-width: 559px) {
  #player-name {
    display: inline;
    max-width: 54px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    line-height: 1.1;
  }
  .player-chip { gap: 4px; padding: 3px 5px 3px 3px; }
}

/* 鏂瑰潡鑳屽寘锛氱湡姝ｇ殑涓夋柟鍧楀皬绔嬫柟浣?*/
.swatch-cube {
  position: relative;
  display: block;
  background: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.swatch-cube i {
  position: absolute;
  inset: 0;
  display: block;
  background-color: var(--top);
  background-image: var(--tex);
  background-size: cover;
  background-position: center;
  pointer-events: none;
}
.swatch-cube .sw-top {
  clip-path: polygon(50% 0, 100% 25%, 50% 50%, 0 25%);
  background-color: var(--top);
}
.swatch-cube .sw-left {
  clip-path: polygon(0 25%, 50% 50%, 50% 100%, 0 75%);
  background-color: var(--left);
  filter: brightness(.92);
}
.swatch-cube .sw-right {
  clip-path: polygon(50% 50%, 100% 25%, 100% 75%, 50% 100%);
  background-color: var(--right);
  filter: brightness(.82);
}

.asset-divider {
  height: 1px;
  margin: 8px 0 7px;
  background: #e1ead9;
}

/* 骞寸骇閫夋嫨 */
.grade-chooser h2 { margin-bottom: 6px; }
.grade-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 8px 0;
  padding: 10px;
  border: 2px solid #dfe9d7;
  border-radius: 14px;
  background: #fbfff7;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.grade-choice:hover,
.grade-choice.active {
  border-color: var(--green-deep);
  background: #efffe4;
}
.grade-num {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #d8f5c2;
  color: var(--green-dark);
  font-size: 24px;
  font-weight: 900;
}
.grade-choice span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; }
.grade-choice b { font-size: 15px; }
.grade-choice small { color: var(--muted); font-size: 9.5px; }
.grade-choice i { margin-left: auto; color: var(--green-deep); font-style: normal; font-weight: 900; }

/* Phone landscape: use the width, hide the old "rotate to portrait" blocker. */
@media (orientation: landscape) and (max-height: 560px) and (max-width: 1000px) {
  .rotate-hint { display: none !important; }
  .app { padding: 4px 8px max(4px, env(safe-area-inset-bottom)); gap: 4px; }
  .topbar { min-height: 40px; padding: 4px 8px; border-radius: 14px; }
  .brand-cube { width: 30px; height: 30px; }
  .brand-text b { font-size: 12px; }
  .brand-text small { display: none; }
  .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
  .player-chip { padding: 3px; }
  .player-avatar { width: 26px; height: 26px; }
  .bottom-nav { min-height: 46px; padding: 3px; border-radius: 14px; }
  .bottom-nav button { padding: 3px 2px; }
  .bottom-nav button span { font-size: 15px; }
  .bottom-nav button small { font-size: 8px; }
  .screens { min-height: 0; }
  .screen { padding: 2px 0; }

  .home-shell {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    grid-template-rows: 1fr;
    gap: 6px;
  }
  .hero { border-radius: 16px; }
  .hero-content { padding: 8px 12px; }
  .hero .eyebrow { font-size: 8px; }
  .hero h1 { font-size: clamp(20px, 4.4vh, 28px); line-height: 1.05; }
  .hero-desc { display: none; }
  .hero-actions { gap: 5px; margin-top: 5px; }
  .hero-actions .btn { min-height: 30px; font-size: 9.5px; padding: 4px 8px; }
  .hero-badges { display: none; }
  .hero-guide { display: none; }
  .home-dock { gap: 4px; }
  .stat-strip { gap: 4px; }
  .stat-chip { min-height: 34px; padding: 3px 5px; border-radius: 10px; }
  .stat-chip span { font-size: 12px; }
  .stat-chip b { font-size: 13px; }
  .stat-chip small { display: none; }
  .daily { padding: 6px 8px; border-radius: 12px; }
  .daily-head h2 { font-size: 14px; }
  .daily .eyebrow { font-size: 8px; }
  .daily .muted { display: none; }
  .ring { width: 34px; height: 34px; }
  .ring span { font-size: 9px; }
  .daily-progress { margin: 4px 0 2px; }
  .daily .text-btn { font-size: 8px; }
  .home-units-card { display: none; }

  .screen-head { min-height: 40px; padding: 2px 2px 4px; }
  .screen-head h1 { font-size: 19px; }
  .screen-head p { display: none; }
  .head-progress { min-width: 90px; padding: 4px 7px; }
  .head-progress b { font-size: 16px; }
  .map-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .unit-card { padding: 6px 7px; border-radius: 12px; }
  .unit-card h3 { font-size: 12px; }
  .unit-card p, .island-name { display: none; }
  .unit-icon { width: 28px; height: 28px; font-size: 17px; }
  .unit-stars { display: none; }
  .unit-bottom { margin-top: 3px; font-size: 8px; }
  .unit-go { font-size: 8px; }
  .map-foot { min-height: 30px; }

  .learn-grid { grid-template-columns: 1.2fr .8fr; gap: 6px; }
  .concept-hero { display: none; }
  .concept-card, .mission-card { padding: 8px; border-radius: 14px; }
  .concept-card h2 { font-size: 16px; }
  .concept-card li { font-size: 9px; line-height: 1.4; }
  .formula-box { padding: 6px; font-size: 11px; }
  .example-box { font-size: 9px; line-height: 1.4; }

  .quiz-screen .screen-head { display: none; }
  .quiz-card { padding: 6px; border-radius: 14px; }
  .quiz-guide { display: none; }
  .quiz-meta { padding: 2px 0; }
  .quiz-card h2 { font-size: 15px; margin: 4px 0; }
  .number-wrap { gap: 4px; }
  .answer-display { min-height: 34px; }
  .keypad { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
  .keypad button { min-height: 30px; font-size: 12px; }
  .question-actions { gap: 4px; }
  .question-actions .btn { min-height: 30px; font-size: 9px; }

  .modal { max-height: calc(100dvh - 12px); height: auto; }
  .modal .tab-body { max-height: calc(100dvh - 150px); }
}

/* phone landscape: dock must stack, not use the 3-column tablet rule */
@media (orientation: landscape) and (max-height: 560px) and (max-width: 1000px) {
  .home-dock {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
  }
  .home-dock .stat-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: 1fr;
    gap: 3px;
    flex: 0 0 auto;
  }
  .home-dock .daily {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
  }
  .home-units-card { display: none !important; }
  .mini-unit-row { display: none; }
}

/* phone landscape: hard one-screen constraints */
@media (orientation: landscape) and (max-height: 560px) and (max-width: 1000px) {
  html, body { height: 100dvh; overflow: hidden; }
  .app { height: 100dvh; min-height: 0; overflow: hidden; }
  .screens { flex: 1 1 auto; min-height: 0; height: auto; overflow: hidden; }
  .screen { height: 100%; min-height: 0; overflow: hidden; }
  .home-shell { height: 100%; min-height: 0; overflow: hidden; }
  .home-dock { height: 100%; min-height: 0; overflow: hidden; }
  .daily { overflow: hidden; }
}

/* phone landscape: build dock on the right, scene on the left */
@media (orientation: landscape) and (max-height: 560px) and (max-width: 1000px) {
  .build-dock {
    left: auto;
    right: 8px;
    bottom: 8px;
    width: 280px;
    max-height: calc(100% - 70px);
  }
  .build-dock .palette {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 3px;
  }
  .build-dock .block-swatch { min-height: 38px; font-size: 7px; }
  .build-dock .swatch-cube { width: 18px; height: 18px; }
  .build-screen .build-scene svg { transform: translateX(-15%); }
}

/* phone landscape: keep stat labels readable */
@media (orientation: landscape) and (max-height: 560px) and (max-width: 1000px) {
  .home-dock .stat-strip {
    flex: 0 0 44px;
    height: 44px;
    align-items: stretch;
  }
  .home-dock .stat-chip {
    min-height: 0;
    padding: 2px 3px;
    gap: 0;
    justify-content: center;
  }
  .home-dock .stat-chip span { font-size: 10px; line-height: 1; }
  .home-dock .stat-chip b { font-size: 12px; line-height: 1.1; }
  .home-dock .stat-chip small { display: block; font-size: 7px; line-height: 1.1; }
}

/* Never block phone landscape. */
.rotate-hint { display: none !important; }

