:root {
  /* 明制汉服 · 清雅织金云锦色系（温润端庄、不压抑、同源雅致） */
  --song-celadon: #2D5466;       /* 主色：霁蓝 / 官窑青釉 */
  --song-celadon-deep: #203F4E;  /* 深霁蓝 */
  --song-celadon-soft: #E1EBEF;  /* 浅霁蓝云纹底 */

  --song-cinnabar: #A13A30;      /* 辅色一：珊瑚柿红 / 丹砂（温润华贵，不刺眼） */
  --song-cinnabar-soft: #F4E3E0; /* 浅珊瑚霞底 */

  --song-ochre: #AA7A2E;         /* 辅色二：赤金 / 缃叶织金 */
  --song-ochre-soft: #F4EAD8;    /* 浅织金底 */

  --song-bamboo: #3B6954;        /* 辅色三：竹青 / 松花官绿 */
  --song-bamboo-soft: #E1EDE7;   /* 浅官绿底 */

  /* 明制「交领云肩 · 织锦马面」温润浅色系色阶（彻底摒弃沉重黑褐块面） */
  --bg-page: #EAE2D5;            /* 全域底衬：暖杏胡粉底 */
  --surface: #FAF6EE;            /* 素绫卷册底色 */
  --surface-variant: #DFD5C3;    /* 檀香金丝槽底色 */
  --surface-warm: #F1EAE0;       /* 浅米锦次级块面 */
  --bone-cream: #FDFBF7;         /* 卜骨羊脂白玉 */

  /* 墨色与金石字色 */
  --text-primary: #2A241E;       /* 松烟浓墨 */
  --text-secondary: #5E5347;     /* 檀褐中墨 */
  --text-muted: #8A7D6F;         /* 暮云浅墨 */

  /* 温润漫射柔影 */
  --shadow-sm: 0 4px 16px rgba(42, 36, 30, 0.05);
  --shadow-md: 0 8px 24px rgba(42, 36, 30, 0.07);
  --shadow-lg: 0 20px 48px rgba(42, 36, 30, 0.16);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "PingFang SC", "Microsoft YaHei", serif;
  background-color: var(--bg-page);
  background-image:
    radial-gradient(circle at 12% 12%, rgba(161, 58, 48, 0.05) 0%, transparent 38%),
    radial-gradient(circle at 88% 15%, rgba(45, 84, 102, 0.06) 0%, transparent 38%),
    radial-gradient(circle at 80% 85%, rgba(59, 105, 84, 0.05) 0%, transparent 36%),
    radial-gradient(circle at 20% 82%, rgba(170, 122, 46, 0.06) 0%, transparent 36%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 宋韵色系文字与单色图标辅助类 */
.tone-primary, .icon-celadon { color: var(--song-celadon); }
.tone-cinnabar, .icon-cinnabar { color: var(--song-cinnabar); }
.tone-ochre, .icon-ochre { color: var(--song-ochre); }
.tone-bamboo, .icon-bamboo { color: var(--song-bamboo); }
.icon-muted { color: var(--text-muted); }

.mono-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mono-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.mono-icon-sm {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.mono-icon-lg {
  width: 48px;
  height: 48px;
  display: inline-block;
}

/* ==================== Top App Bar (明制牙白织金交领 · 温润通透不压抑) ==================== */
.top-bar {
  min-height: 58px;
  background: linear-gradient(90deg, #F5EFE3 0%, #FAF6EE 50%, #F5EFE3 100%);
  border: none;
  box-shadow: 0 2px 14px rgba(42, 36, 30, 0.06);
  padding: 8px clamp(20px, 3vw, 42px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.song-seal {
  background: linear-gradient(135deg, #A83E34 0%, #8C2E25 100%);
  color: #FAF5EB;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 4px 9px;
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(161, 58, 48, 0.22);
}

.logo-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 12px;
  white-space: nowrap;
}

.logo-sub {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1.5px;
  color: var(--song-ochre);
  background: transparent;
  padding: 0;
  white-space: nowrap;
}

/* Mode Switcher Chips (檀米织金切换槽) */
.mode-switcher {
  display: flex;
  background: rgba(170, 122, 46, 0.1);
  padding: 3px;
  border-radius: var(--radius-pill);
  gap: 2px;
  flex-shrink: 0;
}

.mode-chip {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  padding: 6px 15px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.22s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.mode-chip:hover {
  color: var(--text-primary);
}

.mode-chip.active {
  background: var(--song-celadon);
  color: #FAF6EE;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(45, 84, 102, 0.22);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pill-btn {
  border: none;
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.pill-btn:active {
  transform: scale(0.97);
}

.pill-btn.primary {
  background: linear-gradient(135deg, #A13A30 0%, #872D24 100%);
  color: #FAF5EB;
  box-shadow: 0 2px 8px rgba(161, 58, 48, 0.2);
}

.pill-btn.primary:hover {
  background: linear-gradient(135deg, #B24338 0%, #963329 100%);
}

.pill-btn.secondary {
  background: rgba(42, 36, 30, 0.055);
  color: var(--text-primary);
  border: none;
}

.pill-btn.secondary:hover {
  background: rgba(45, 84, 102, 0.1);
}

.badge-count {
  background: rgba(45, 84, 102, 0.1);
  color: var(--song-celadon);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(42, 36, 30, 0.055);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 15px;
  display: grid;
  place-items: center;
  transition: background 0.15s ease;
}

.icon-btn:hover {
  background: rgba(45, 84, 102, 0.12);
}

/* ==================== Full-Screen Unified Song Scroll Layout (一卷通景 · 消解块状感) ==================== */
@media (min-width: 1081px) {
  body {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
  }
}

.app-container {
  width: 100%;
  max-width: 100%;
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: clamp(6px, 1vh, 14px) clamp(16px, 2vw, 32px) clamp(10px, 1.4vh, 18px);
  display: grid;
  /* 侧栏与主内容黄金比例，中间列宽与一屏棋盘高度精准对齐，消除水平留白与纵向滚动条 */
  grid-template-columns: minmax(220px, 1fr) minmax(420px, min(45vw, calc(100vh - 156px))) minmax(220px, 1fr);
  gap: clamp(14px, 1.8vw, 28px);
  align-items: stretch;
}

/* 明制三栏同源丝绸层次：和谐统一于温润浅色系，同时以微色调区分功能区 */
.side-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: clamp(16px, 2vh, 24px);
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border-radius: 22px;
  padding: clamp(14px, 1.8vh, 24px) clamp(16px, 1.6vw, 24px);
  box-shadow: var(--shadow-sm);
}

/* 左栏：浅缃秋香绫（温润暖米金丝底） */
.left-panel {
  background: linear-gradient(180deg, rgba(246, 239, 226, 0.88) 0%, rgba(239, 230, 214, 0.88) 100%);
}

/* 右栏：浅月影素青纱（清润微青白绫底，与左栏同明度、和谐呼应） */
.right-panel {
  background: linear-gradient(180deg, rgba(242, 246, 245, 0.88) 0%, rgba(233, 240, 239, 0.88) 100%);
}

/* 栏目内部完全透明融为一体，以留白与色阶气韵自然分区 */
.m3-card {
  background: transparent;
  border-radius: 0;
  padding: 0;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

.stats-card {
  flex: 0 0 auto;
}

.tools-card {
  flex: 0 0 auto;
  padding-top: 4px;
}

.knowledge-card {
  flex: 0 0 auto;
}

.feed-card {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding-top: 8px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-muted);
}

/* Left Panel: 极简篇章题名与数字呈现（去盒子化） */
.level-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.level-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.level-header h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1.2px;
  line-height: 1.3;
  color: var(--text-primary);
  background: transparent;
  padding: 2px 0;
  border-radius: 0;
  border: none;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.level-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.mini-nav-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s ease;
}

.mini-nav-btn:hover {
  background: rgba(59, 91, 94, 0.12);
  color: var(--song-celadon);
}

.level-badge {
  background: transparent;
  color: var(--song-celadon);
  font-weight: 700;
  font-size: 12px;
  padding: 2px 6px;
  white-space: nowrap;
}

/* 计分区域：明制织金丝绦微底衬，数字沉稳醒目 */
.score-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: rgba(253, 251, 246, 0.55);
  border-radius: 14px;
}

.metric-box {
  background: transparent;
  border-radius: 0;
  padding: 4px 0;
  text-align: left;
  border: none;
  min-width: 0;
}

.metric-label {
  display: block;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
}

.progress-section {
  margin-bottom: 20px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.g-progress-bar {
  height: 4px;
  background: rgba(43, 39, 35, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.g-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--song-celadon) 0%, var(--song-bamboo) 55%, var(--song-ochre) 100%);
  border-radius: var(--radius-pill);
  transition: width 0.35s cubic-bezier(0.2, 0, 0, 1);
}

/* 宋式极简栏目标题（前缀朱砂小竖印，不加框线） */
.section-subtitle {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.section-subtitle::before {
  content: "";
  width: 3px;
  height: 11px;
  border-radius: 2px;
  background: var(--song-celadon);
  opacity: 0.7;
}

.goal-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.goal-chip {
  background: rgba(252, 250, 245, 0.65);
  border: none;
  border-radius: 12px;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 0;
}

.goal-chip:hover {
  background: rgba(252, 250, 245, 0.95);
  transform: translateY(-1px);
}

.goal-chip.completed {
  background: rgba(75, 110, 83, 0.12);
}

.goal-chip svg {
  width: 32px;
  height: 32px;
}

.goal-count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  background: transparent;
  padding: 0;
  white-space: nowrap;
}

.goal-chip.completed .goal-count {
  color: var(--song-bamboo);
}

/* Power-up Tools (极简无框雅具列表，悬停微晕染) */
.tools-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
}

.tool-btn:hover:not(:disabled) {
  background: rgba(252, 250, 245, 0.75);
  transform: translateX(2px);
}

.tool-btn.active-tool {
  background: var(--song-cinnabar-soft);
}

.tool-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.tool-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 16px;
}

.blue-bg { background: rgba(59, 91, 94, 0.1); }
.ochre-bg { background: rgba(154, 107, 46, 0.1); }
.red-bg { background: rgba(168, 66, 50, 0.1); }
.green-bg { background: rgba(75, 110, 83, 0.1); }

.tool-meta {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tool-name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--text-primary);
}

.tool-stock {
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  padding: 0 4px;
}

.tool-status-tip {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==================== Center Board Stage (明制玉堂素绫主栏 · 暖檀织金棋枰) ==================== */
.board-stage {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: clamp(8px, 1.2vh, 14px);
  min-width: 0;
  min-height: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(252, 249, 242, 0.94) 0%, rgba(246, 240, 229, 0.94) 100%);
  border-radius: 22px;
  padding: clamp(12px, 1.4vh, 18px) clamp(12px, 1.2vw, 18px);
  box-shadow: var(--shadow-md);
}

/* 卷首题跋行（珊瑚赤金印章配月白素绫） */
.search-omni-bar {
  width: 100%;
  background: rgba(170, 122, 46, 0.06);
  border-radius: 12px;
  padding: 6px 12px;
  border: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  flex-shrink: 0;
}

.search-g-icon {
  padding: 2px 8px;
  border-radius: 4px;
  background: linear-gradient(135deg, #A13A30 0%, #872D24 100%);
  color: #FAF5EB;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.omni-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.4px;
  line-height: 1.4;
}

.combo-pill {
  background: linear-gradient(135deg, #C69643 0%, #9E6E1E 100%);
  color: #FFFDF8;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  animation: pulsePop 0.35s ease;
}

.hidden {
  display: none !important;
}

/* 8x8 棋盘：温润金丝楠木/暖檀绫锦浅底，轻盈托举羊脂白玉甲骨，彻底告别沉重黑框 */
.board-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 0;
  max-width: 100%;
  max-height: calc(100vh - 190px);
  margin: 0 auto;
  background: linear-gradient(145deg, #E2D7C3 0%, #D7C9B1 100%);
  border-radius: clamp(16px, 1.6vw, 24px);
  padding: clamp(9px, 1.05vw, 15px);
  border: none;
  box-shadow:
    inset 0 2px 8px rgba(94, 75, 52, 0.1),
    0 4px 16px rgba(42, 36, 30, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-board {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: clamp(5px, 0.6vw, 9px);
  background: transparent;
  padding: 0;
  border-radius: 0;
}

/* Individual Oracle Tile (温润玉骨拓片 · 无边框线) */
.tile {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  min-width: 0;
  min-height: 0;
  border-radius: 11px;
  background: var(--bone-cream);
  border: none;
  box-shadow: 0 2px 5px rgba(43, 39, 35, 0.07);
  cursor: grab;
  touch-action: none;
  will-change: transform;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease, background 0.18s ease;
  overflow: hidden;
}

.tile.dragging {
  cursor: grabbing;
  z-index: 12;
  transition: none !important;
  box-shadow: 0 10px 24px rgba(43, 39, 35, 0.22);
}

.tile.drag-neighbor {
  z-index: 8;
  transition: transform 0.06s linear !important;
}

.tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(43, 39, 35, 0.12);
}

/* 明式四色云锦底纹（霁蓝、珊瑚、织金、官绿，皆温润沉稳不刺眼） */
.tile[data-color="blue"] {
  background: linear-gradient(145deg, #F5F9FB 0%, #E7EFF4 100%);
}
.tile[data-color="red"] {
  background: linear-gradient(145deg, #FCF5F4 0%, #F4E6E3 100%);
}
.tile[data-color="yellow"] {
  background: linear-gradient(145deg, #FDF9F0 0%, #F4EBDA 100%);
}
.tile[data-color="green"] {
  background: linear-gradient(145deg, #F4FAF7 0%, #E5F0EA 100%);
}

.tile.selected {
  background: #FFF9EB;
  box-shadow: 0 0 0 3px rgba(170, 122, 46, 0.55), 0 6px 14px rgba(42, 36, 30, 0.14);
  transform: scale(1.06);
  z-index: 4;
}

.tile.hint-glow {
  animation: hintPulse 1s infinite alternate ease-in-out;
}

/* Special Power-up Tile (4-match / 5-match) */
.tile.special-line::after {
  content: "✦";
  position: absolute;
  top: 2px;
  left: 5px;
  font-size: 11px;
  color: var(--song-celadon);
  font-weight: 900;
}

.tile.special-bomb {
  background: linear-gradient(135deg, #F7EFE0 0%, #EAD8B8 100%);
}

.tile.special-bomb::after {
  content: "★";
  position: absolute;
  top: 2px;
  left: 5px;
  font-size: 11px;
  color: var(--song-cinnabar);
}

.tile-svg-wrap {
  width: 74%;
  height: 74%;
  display: grid;
  place-items: center;
}

.tile-svg-wrap svg {
  width: 100%;
  height: 100%;
}

/* Evolution Mode: Modern Hanzi Primary Tile */
.tile.modern-variant .modern-primary-glyph {
  font-size: clamp(18px, 2.2vw, 32px);
  font-weight: 800;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  line-height: 1;
}

/* Tile Animations */
.tile.swapping {
  z-index: 10;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease !important;
  box-shadow: 0 8px 18px rgba(43, 39, 35, 0.18);
}

.tile.match-highlight {
  z-index: 5;
  background: #EFE6D5 !important;
  box-shadow: 0 0 0 3px rgba(154, 107, 46, 0.38), 0 6px 16px rgba(43, 39, 35, 0.16);
  transform: scale(1.08);
  transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.25s ease, background 0.25s ease;
}

.tile.matching {
  animation: matchClear 0.42s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.tile.dropping {
  animation: tileDrop 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.tile.invalid-shake {
  animation: shakeTile 0.4s ease;
}

@keyframes matchClear {
  0% { transform: scale(1.08); opacity: 1; }
  40% { transform: scale(1.18); background: var(--song-ochre-soft); opacity: 0.95; }
  100% { transform: scale(0.15); opacity: 0; }
}

@keyframes tileDrop {
  0% { transform: translateY(-38px) scale(0.94); opacity: 0.3; }
  75% { transform: translateY(2px) scale(1.01); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes shakeTile {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  45% { transform: translateX(6px); }
  70% { transform: translateX(-4px); }
  85% { transform: translateX(4px); }
}

@keyframes hintPulse {
  0% { box-shadow: 0 0 0 2px rgba(154, 107, 46, 0.22); background-color: #FAF6ED; }
  100% { box-shadow: 0 0 0 5px rgba(154, 107, 46, 0.48); background-color: #F2E8D5; }
}

@keyframes pulsePop {
  0% { transform: translateX(-50%) scale(0.7); opacity: 0; }
  70% { transform: translateX(-50%) scale(1.08); opacity: 1; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* 消除浮现的甲骨文玉印底卡（无边框线，温润玉白投影） */
.fx-layer {
  position: absolute;
  inset: 12px;
  pointer-events: none;
  overflow: hidden;
  z-index: 20;
}

.floating-toast {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  padding: 10px;
  display: grid;
  place-items: center;
  background: rgba(250, 247, 241, 0.97);
  border: none;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(43, 39, 35, 0.22);
  animation: floatUpFade 1.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.floating-toast svg {
  width: 100%;
  height: 100%;
}

@keyframes floatUpFade {
  0% { opacity: 0; transform: translate(-50%, -10%) scale(0.65); }
  22% { opacity: 1; transform: translate(-50%, -55%) scale(1.15); }
  75% { opacity: 1; transform: translate(-50%, -95%) scale(1.02); }
  100% { opacity: 0; transform: translate(-50%, -130%) scale(0.95); }
}

/* Bottom Legend Bar (无边框素笺签条) */
.quick-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.legend-pill {
  background: rgba(250, 247, 241, 0.5);
  border: none;
  box-shadow: none;
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
}

.legend-pill:hover {
  background: rgba(250, 247, 241, 0.92);
  color: var(--song-celadon);
  transform: translateY(-1px);
}

.legend-pill svg {
  width: 18px;
  height: 18px;
}

/* ==================== Right Panel: 极简字源与手札（消解套娃色块） ==================== */
.card-tag-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: nowrap;
  margin-bottom: 12px;
}

.g-pill-tag {
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 2px 0;
  border-radius: 0;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.g-pill-tag::before {
  content: "";
  width: 3px;
  height: 11px;
  border-radius: 2px;
  background: var(--song-cinnabar);
  opacity: 0.75;
}

.phonetic-badges {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  min-width: 0;
}

.pinyin-tag {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  padding: 3px 8px;
  border-radius: 8px;
  border: none;
  white-space: nowrap;
  width: 100%;
  justify-content: space-between;
  gap: 8px;
}

.pill-prefix {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pinyin-tag strong {
  font-weight: 800;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}

.archaic-pill {
  background: rgba(154, 107, 46, 0.08);
  color: var(--song-ochre);
}

.archaic-pill strong {
  color: #6E4919;
}

.modern-pill {
  background: rgba(59, 91, 94, 0.08);
  color: var(--song-celadon);
}

.modern-pill strong {
  color: var(--song-celadon-deep);
}

.pronounce-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: transform 0.12s ease, background 0.15s ease;
}

.pronounce-btn:hover {
  transform: translateX(-1px);
  background: rgba(252, 250, 245, 0.85);
}

.pronounce-btn:active {
  transform: scale(0.97);
}

/* 去除双层展示框，甲骨字形直接浮于温润圆印之上 */
.char-showcase {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 6px 0 12px;
  margin-bottom: 8px;
}

.oracle-glyph-box {
  width: 88px;
  height: 88px;
  background: radial-gradient(circle at 35% 30%, #FFFDF9 0%, #F2E8D5 100%);
  border-radius: 50%;
  border: none;
  box-shadow: 0 6px 18px rgba(36, 71, 91, 0.12), inset 0 0 0 3px rgba(196, 151, 70, 0.25);
  display: grid;
  place-items: center;
  padding: 16px;
}

.oracle-glyph-box svg {
  width: 100%;
  height: 100%;
}

.char-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.char-desc {
  font-size: 13px;
  line-height: 1.72;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.char-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px 0;
}

.mini-stat {
  background: transparent;
  padding: 2px 0;
  border-radius: 0;
  border: none;
}

.mini-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.mini-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Match Log Feed (极简手札条目 · 无背景块) */
.log-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px;
  border-radius: 8px;
  background: transparent;
  border: none;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.log-item:hover {
  background: rgba(252, 250, 245, 0.7);
}

.log-item-badge {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: transparent;
  border: none;
  display: grid;
  place-items: center;
  padding: 2px;
  flex-shrink: 0;
}

.log-item-badge svg {
  width: 100%;
  height: 100%;
}

.log-empty {
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 12px 4px;
  text-align: center;
}

/* ==================== Modals (宋式书院卷册弹窗 · 无边框) ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(43, 39, 35, 0.45);
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}

.m3-dialog {
  background: var(--surface);
  border-radius: 24px;
  padding: 26px;
  max-width: 920px;
  width: 100%;
  border: none;
  box-shadow: var(--shadow-lg);
  max-height: 88vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-header .icon-btn {
  flex-shrink: 0;
}

.archaeology-stats-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  background: var(--surface-warm);
  border: none;
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 16px;
}

.arch-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 3px;
}

.arch-num {
  font-size: 18px;
  font-weight: 800;
}

.arch-label {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.dict-controls-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.dict-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.search-input-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.search-input-icon {
  position: absolute;
  left: 14px;
  pointer-events: none;
}

.dict-search-input {
  width: 100%;
  padding: 10px 16px 10px 36px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--surface-warm);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

.dict-search-input:focus {
  background: var(--bone-cream);
  box-shadow: 0 0 0 2px rgba(59, 91, 94, 0.35);
}

.dict-tab {
  border: none;
  background: var(--surface-warm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.dict-tab:hover {
  background: var(--song-celadon-soft);
  color: var(--song-celadon);
}

.dict-tab.active {
  background: var(--song-celadon);
  color: #FAF7F1;
}

.dict-tab.active .mono-icon-sm {
  color: #FAF7F1;
}

.dict-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.dict-pagination {
  margin-top: 18px;
  padding-top: 14px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.dict-page-info {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.dict-item {
  background: var(--surface-warm);
  border: none;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.16s ease, background 0.16s ease;
}

.dict-item:hover {
  background: #EAE2D3;
  transform: translateY(-2px);
}

.dict-item-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dict-svg {
  width: 48px;
  height: 48px;
  background: var(--bone-cream);
  border-radius: 12px;
  padding: 6px;
  border: none;
}

.dict-svg svg {
  width: 100%;
  height: 100%;
}

.dict-hanzi {
  font-size: 24px;
  font-weight: 800;
}

.dict-pinyin {
  font-size: 12px;
  color: var(--text-secondary);
}

.dict-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Result Dialog */
.result-dialog {
  max-width: 420px;
  text-align: center;
}

.result-confetti {
  font-size: 52px;
  margin-bottom: 8px;
}

.result-dialog h2 {
  font-size: 26px;
  margin-bottom: 6px;
}

.result-dialog p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.res-box {
  background: var(--surface-warm);
  padding: 14px;
  border-radius: 16px;
}

.res-box span {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.res-box strong {
  font-size: 24px;
  color: var(--song-celadon);
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ==================== Multi-Device Responsive Breakpoints ==================== */

/* 1. Ultra-Wide / 2K / 4K Large PC Monitors (>= 1600px): Full-bleed 100vw × 100vh with Golden Ratio */
@media (min-width: 1600px) {
  .top-bar {
    padding: 10px 36px;
  }
  .logo-title {
    font-size: 24px;
  }
  .app-container {
    grid-template-columns: minmax(260px, 1fr) minmax(480px, min(45vw, calc(100vh - 156px))) minmax(260px, 1fr);
    padding: 12px 32px 16px;
    gap: 24px;
  }
  .board-frame {
    width: 100%;
  }
  .oracle-glyph-box {
    width: 104px;
    height: 104px;
  }
  .goal-chip svg {
    width: 42px;
    height: 42px;
  }
  .char-title {
    font-size: 20px;
  }
  .char-desc {
    font-size: 14.5px;
  }
  .floating-toast {
    width: 74px;
    height: 74px;
    padding: 12px;
  }
}

/* 2. Tablet & Medium Split-View (681px ~ 1080px): Full width, Board on top, 2-column panels below */
@media (max-width: 1080px) {
  .top-bar {
    padding: 10px 16px;
    justify-content: space-between;
  }
  .logo-sub {
    display: none;
  }
  .app-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    padding: 14px 16px 28px;
    gap: 16px;
  }
  .side-panel {
    height: auto;
  }
  .board-stage {
    grid-column: 1 / -1;
    order: -1;
    height: auto;
  }
  .board-frame {
    width: min(88vw, 540px);
    height: min(88vw, 540px);
  }
  .log-list {
    max-height: 220px;
  }
}

/* 3. Mobile Phones (<= 680px): Touch-optimized compact layout */
@media (max-width: 680px) {
  .top-bar {
    flex-wrap: wrap;
    justify-content: center;
    padding: 8px 10px;
    gap: 8px;
  }
  .brand {
    width: 100%;
    justify-content: center;
  }
  .logo-title {
    font-size: 18px;
  }
  .mode-switcher {
    padding: 3px;
  }
  .mode-chip {
    font-size: 12px;
    padding: 5px 12px;
  }
  .header-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
  }
  .pill-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  .icon-btn {
    width: 34px;
    height: 34px;
  }
  .app-container {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    padding: 10px 10px 24px;
    gap: 12px;
  }
  .board-stage {
    grid-column: 1;
    order: -1;
    gap: 10px;
  }
  .search-omni-bar {
    padding: 8px 12px;
    min-height: 40px;
    border-radius: 12px;
  }
  .omni-text {
    font-size: 12.5px;
  }
  .board-frame {
    width: min(94vw, 440px);
    height: min(94vw, 440px);
    padding: 8px;
    border-radius: 18px;
  }
  .game-board {
    gap: 4px;
    padding: 6px;
    border-radius: 14px;
  }
  .tile {
    border-radius: 8px;
  }
  .quick-legend {
    gap: 6px;
  }
  .legend-pill {
    padding: 4px 10px;
    font-size: 11.5px;
  }
  /* Make Tools a compact 3-column horizontal bar on mobile */
  .tools-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .tool-btn {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 6px;
    gap: 6px;
  }
  .tool-meta {
    flex-direction: column;
    gap: 4px;
  }
  .tool-name {
    font-size: 12px;
  }
  .m3-dialog {
    padding: 16px;
    border-radius: 18px;
    max-height: 92vh;
  }
  .dict-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }
}
