/* ========== 变量 ========== */
:root {
  --bg-page: #f5f0e1;
  --bg-card: #ffffff;
  --bg-grid: #faf8f5;
  --red: #c0392b;
  --yellow: #e6b422;
  --green: #27ae60;
  --wood: #8b5e3c;
  --text: #3e2723;
  --text-sub: #8d6e63;
  --border: #d4c5a9;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 48px;
  --tabbar-h: 50px;
  --text-min: 16px;
  --page-pad-x: 20px;
  --content-w: 880px;
  --grad-0: linear-gradient(135deg, #a8d8ea, #7ec8e3);
  --grad-1: linear-gradient(135deg, #c5e1a5, #8bc34a);
  --grad-2: linear-gradient(135deg, #d4a574, #a67c52);
  --grad-3: linear-gradient(135deg, #ffd4a8, #ffb870);
  --grad-4: linear-gradient(135deg, #e8b4f8, #ce93d8);
  --grad-5: linear-gradient(135deg, #fff3a0, #ffe082);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background: #fff;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: var(--text-min);
  background: #fff;
  color: var(--text);
  line-height: 1.6;
  height: 100dvh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--wood); text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.ico { width: 22px; height: 22px; display: block; flex-shrink: 0; }
.ico-sm { width: 18px; height: 18px; }

/* ========== 布局 ========== */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
}

.main-wrap {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-page);
  justify-content: center;
}

.main-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  width: 100%;
  max-width: 480px;
  position: relative;
}

/* ========== 顶部标题栏 ========== */
.top-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  height: var(--header-h);
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: var(--page-pad-x);
  padding-right: var(--page-pad-x);
  padding-bottom: 0;
  min-height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  background: #fff;
  border-bottom: 1px solid rgba(212, 197, 169, 0.4);
  flex-shrink: 0;
  z-index: 10;
}

.top-nav::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(0px - env(safe-area-inset-top, 0px));
  height: env(safe-area-inset-top, 0px);
  background: #fff;
  pointer-events: none;
}

.nav-back, .icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--text);
  border-radius: 8px;
  flex-shrink: 0;
}

.nav-title {
  flex: 1;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.icon-btn.is-muted { color: var(--text-sub); opacity: 0.72; }
.icon-btn .sound-off { display: none; }
.icon-btn.is-muted .sound-on { display: none; }
.icon-btn.is-muted .sound-off { display: block; }

/* ========== Tab 面板（互斥显示） ========== */
.game-screen,
.panel-screen {
  display: none;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  position: absolute;
  inset: 0;
  overflow: hidden;
  box-sizing: border-box;
  padding-left: var(--page-pad-x);
  padding-right: var(--page-pad-x);
}

.panel-screen[hidden] {
  display: none !important;
}

body[data-tab="game"] .game-screen {
  display: flex;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: 8px;
  padding-bottom: 8px;
}

body[data-tab="study"] #panelStudy,
body[data-tab="records"] #panelRecords {
  display: flex;
  overflow: hidden;
  padding-top: 8px;
  padding-bottom: 8px;
}

body[data-tab="vocab"] #panelVocab {
  display: flex;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: 8px;
  padding-bottom: 8px;
}

.panel-screen .panel-title,
.panel-screen .panel-desc,
.panel-screen .study-tabs,
.panel-screen .record-cards,
.panel-screen .record-curve-wrap,
.panel-screen .panel-subtitle,
.panel-screen .vocab-actions,
.panel-screen .bank-scroll-panel,
.panel-screen .panel-note {
  flex-shrink: 0;
}

.word-browse-list,
.history-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.level-bar {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.level-bar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.level-title { font-size: 16px; font-weight: 600; color: var(--text); }
.level-meta { font-size: 16px; color: var(--text-sub); white-space: nowrap; }
.level-meta b, .stat-chip b { color: var(--red); font-weight: 700; }

.progress-track {
  height: 6px;
  background: rgba(139, 94, 60, 0.12);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green), #2ecc71);
  border-radius: 3px;
  transition: width 0.35s ease;
}

/* ========== 棋盘 ========== */
.board-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.game-board {
  background: var(--bg-grid);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 8px;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1;
  flex-shrink: 0;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 5px;
  width: 100%;
  height: 100%;
}

.grid-cell {
  position: relative;
  min-height: 0;
}

.grid-cell.is-empty .word-card { visibility: hidden; pointer-events: none; }

.word-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  border: none;
  padding: 2px 3px;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
  min-height: 44px;
}

.word-card[hidden] { display: none !important; }

.word-card.grad-0 { background: var(--grad-0); }
.word-card.grad-1 { background: var(--grad-1); }
.word-card.grad-2 { background: var(--grad-2); }
.word-card.grad-3 { background: var(--grad-3); }
.word-card.grad-4 { background: var(--grad-4); }
.word-card.grad-5 { background: var(--grad-5); }

.wc-text {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  word-break: break-all;
  max-width: 100%;
  padding: 0 1px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wc-text.is-long {
  font-size: 9px;
  letter-spacing: -0.02em;
}

.wc-sub {
  display: none;
}

.word-card.is-selected {
  transform: scale(1.06);
  box-shadow: 0 0 0 2px var(--yellow), var(--shadow-sm);
  z-index: 2;
}

.word-card.is-match {
  animation: card-pop 0.4s ease forwards;
}

.word-card.is-shake {
  animation: card-shake 0.4s ease;
}

@keyframes card-pop {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.8; }
  100% { transform: scale(0); opacity: 0; }
}

@keyframes card-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* ========== 目标列表 ========== */
.target-panel {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
}

.target-label { font-size: 16px; color: var(--text-sub); margin-bottom: 6px; }

.target-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.target-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(139, 94, 60, 0.08);
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 16px;
}

.target-item.is-done { opacity: 0.4; text-decoration: line-through; }
.target-item[hidden] { display: none; }
.target-empty { font-size: 16px; color: var(--text-sub); }
.target-empty[hidden] { display: none; }

.ti-en { font-weight: 600; color: var(--text); }
.ti-cn { color: var(--text-sub); font-size: 16px; }

/* ========== 状态栏 ========== */
.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
  flex-shrink: 0;
}

.stat-chip {
  font-size: 16px;
  color: var(--text-sub);
  background: var(--bg-card);
  padding: 6px 12px;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}

.combo-flash {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--red);
  font-weight: 700;
  font-size: 18px;
  animation: combo-pop 0.8s ease forwards;
}

.combo-flash[hidden] { display: none; }

@keyframes combo-pop {
  0% { opacity: 0; transform: translateY(-50%) scale(0.6); }
  30% { opacity: 1; transform: translateY(-50%) scale(1.1); }
  100% { opacity: 0; transform: translateY(-80%) scale(1); }
}

/* ========== AI 记忆助手 ========== */
.ai-panel {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.ai-summary {
  padding: 12px 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.ai-summary::-webkit-details-marker { display: none; }

.ai-body { padding: 0 14px 14px; }

.curve-wrap { position: relative; margin-bottom: 10px; }

.curve-canvas {
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: rgba(245, 240, 225, 0.5);
}

.curve-labels {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.curve-tag {
  font-size: 16px;
  padding: 2px 8px;
  border-radius: 4px;
}

.curve-tag-threshold { background: rgba(192, 57, 43, 0.12); color: var(--red); }
.curve-tag-review { background: rgba(39, 174, 96, 0.12); color: var(--green); }

.ai-hint { font-size: 16px; color: var(--text-sub); margin-bottom: 8px; }

.forget-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.forget-word-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 12px;
  background: rgba(230, 180, 34, 0.15);
  border-radius: 8px;
  border: 1px solid rgba(230, 180, 34, 0.3);
  font-size: 16px;
}

.forget-word-btn[hidden] { display: none; }
.forget-empty { font-size: 16px; color: var(--text-sub); }
.forget-empty[hidden] { display: none; }

.fw-en { font-weight: 600; }
.fw-cn { font-size: 16px; color: var(--text-sub); }

/* ========== 按钮 ========== */
.action-row {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-action {
  flex: 1;
  height: 44px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}

.btn-action:hover, .btn-action:active { background: rgba(245, 240, 225, 0.8); border-color: var(--wood); }

.btn-primary {
  width: 100%;
  height: 44px;
  background: var(--wood);
  color: #fff;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  transition: background 0.15s;
}

.btn-primary:hover, .btn-primary:active { background: #6d4c33; }

.btn-speak {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  color: var(--text);
  background: #fff;
}

/* ========== 词库标签 ========== */
.bank-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 8px;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.bank-scroll::-webkit-scrollbar { display: none; }

.bank-tag {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 16px;
  color: var(--text-sub);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}

.bank-tag.active {
  background: rgba(192, 57, 43, 0.08);
  border-color: var(--red);
  color: var(--red);
  font-weight: 600;
}

.bt-emoji { font-size: 18px; line-height: 1; }

/* ========== 说明区块 ========== */
.info-block {
  padding: 16px 0 20px;
  border-top: 1px dashed rgba(212, 197, 169, 0.6);
  margin-top: 4px;
}

.info-block h1 { font-size: 20px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.info-block h2 { font-size: 18px; font-weight: 600; margin: 14px 0 8px; color: var(--text); }
.info-intro { font-size: 16px; color: var(--text-sub); line-height: 1.8; }
.tutorial-steps { padding-left: 20px; font-size: 16px; color: var(--text-sub); }
.tutorial-steps li { margin-bottom: 8px; }
.faq-list dt { font-weight: 600; margin-top: 10px; font-size: 16px; }
.faq-list dd { color: var(--text-sub); font-size: 16px; margin-left: 0; }

body:not([data-tab="game"]) .info-block { display: none; }

/* ========== 面板页 ========== */
.panel-title { font-size: 20px; font-weight: 600; padding-top: 8px; }
.panel-subtitle { font-size: 16px; font-weight: 600; margin-top: 12px; color: var(--text); }
.panel-desc { font-size: 16px; color: var(--text-sub); }
.panel-note { margin-top: 12px; font-size: 16px; color: var(--text-sub); }

.study-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.study-tab {
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 16px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-sub);
}

.study-tab.active {
  background: rgba(139, 94, 60, 0.1);
  border-color: var(--wood);
  color: var(--wood);
  font-weight: 600;
}

.word-browse-list, .history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 16px;
}

.word-list-item, .history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
  padding: 12px 14px;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  font-size: 16px;
  gap: 12px;
}

.word-list-item {
  cursor: pointer;
}

.wli-en { font-weight: 600; flex: 1 1 auto; min-width: 0; }
.wli-cn { color: var(--text-sub); flex-shrink: 0; text-align: right; }

.word-list-item[hidden], .history-item[hidden] { display: none; }
.word-list-empty, .history-empty { text-align: center; color: var(--text-sub); font-size: 16px; padding: 20px; }
.word-list-empty[hidden], .history-empty[hidden] { display: none; }

.record-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.record-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.rc-num { display: block; font-size: 28px; font-weight: 700; color: var(--red); }
.rc-label { font-size: 16px; color: var(--text-sub); }

.record-curve-wrap { margin: 12px 0; }

.vocab-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}

/* ========== 广告位 ========== */
.ad-slot {
  display: none;
  min-height: 60px;
  max-height: 60px;
  margin: 10px 0;
  color: #999;
  font-size: 16px;
  border-radius: 8px;
  border: 1px dashed #ccc;
  background: #fafafa;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  position: absolute;
  left: var(--page-pad-x);
  right: var(--page-pad-x);
  bottom: 0;
  z-index: 2;
}

body[data-tab="game"] .ad-slot:not(:empty) {
  display: flex;
  flex: 0 0 60px;
}

/* ========== TabBar ========== */
.tab-bar {
  display: flex;
  order: 999;
  flex-shrink: 0;
  position: relative;
  box-sizing: border-box;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff;
  border-top: 1px solid rgba(212, 197, 169, 0.45);
  box-shadow: 0 -2px 12px rgba(62, 39, 35, 0.04);
  z-index: 30;
}

.tab-bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: env(safe-area-inset-bottom, 0px);
  background: #fff;
  pointer-events: none;
}

.tab-btn {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 16px;
  color: var(--text-sub);
  padding: 4px 0 2px;
}

.tab-btn.active { color: var(--red); }
.tab-ico { width: 22px; height: 22px; }

/* ========== 页脚 ========== */
.site-footer {
  display: none;
  flex-shrink: 0;
  background: var(--text);
  color: #fff;
  text-align: center;
  padding: 16px;
  font-size: 16px;
  line-height: 1.7;
}

.site-footer a { color: #d4c5a9; }

.site-footer p { margin-bottom: 6px; }
.site-footer p:last-child { margin-bottom: 0; }

.page-footer-note {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(212, 197, 169, 0.6);
  font-size: 16px;
  color: var(--text-sub);
  line-height: 1.7;
}

.page-footer-note a { color: var(--wood); }

/* ========== 弹窗 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(62, 39, 35, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay[hidden] { display: none; }

.modal-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px 20px;
  width: 100%;
  max-width: 340px;
  box-shadow: var(--shadow);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 24px;
  color: var(--text-sub);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wm-en { font-size: 32px; font-weight: 700; color: var(--text); text-align: center; }
.wm-cn { font-size: 20px; color: var(--wood); text-align: center; margin-top: 4px; }
.wm-pos { font-size: 16px; color: var(--text-sub); text-align: center; margin-top: 4px; }
.wm-example { font-size: 16px; color: var(--text-sub); text-align: center; margin-top: 10px; font-style: italic; }
.wm-review-tip { font-size: 16px; color: var(--red); background: rgba(192,57,43,0.08); padding: 8px 12px; border-radius: 8px; margin-top: 12px; }
.wm-review-tip[hidden] { display: none; }
.wm-actions { display: flex; gap: 10px; margin-top: 18px; justify-content: center; }

.rm-title { font-size: 20px; font-weight: 600; text-align: center; }
.rm-text { font-size: 16px; color: var(--text-sub); text-align: center; margin-top: 10px; }
.rm-actions { display: flex; gap: 10px; margin-top: 18px; }
.rm-actions .btn-action, .rm-actions .btn-primary { flex: 1; }

.win-stars { font-size: 36px; color: var(--yellow); text-align: center; letter-spacing: 4px; }
.win-title { font-size: 24px; font-weight: 700; text-align: center; margin-top: 8px; color: var(--green); }
.win-score { font-size: 16px; text-align: center; color: var(--text-sub); margin-top: 6px; }
.win-bonus { font-size: 16px; text-align: center; color: var(--yellow); margin-top: 4px; }
.win-bonus[hidden] { display: none; }
.win-modal .btn-primary { margin-top: 18px; }

/* ========== Toast ========== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateX(-50%) translateY(20px);
  background: rgba(62, 39, 35, 0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 90;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ========== PC 侧栏 ========== */
.pc-sidebar { display: none; }

/* ========== PC 适配（主体 880px，顶栏/底栏/页脚通栏） ========== */
@media (min-width: 768px) {
  html {
    overflow: auto;
    background: var(--bg-page);
  }

  body {
    height: auto;
    overflow-y: auto;
    min-height: 100dvh;
    background:
      radial-gradient(ellipse 680px 680px at 88% 12%, rgba(212, 197, 169, 0.16), transparent),
      radial-gradient(ellipse 520px 520px at 8% 88%, rgba(141, 110, 99, 0.09), transparent),
      var(--bg-page);
  }

  .app-container {
    max-width: var(--content-w);
    width: 100%;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    margin: 0 auto;
    background: transparent;
    box-shadow: none;
  }

  .top-nav {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    padding-left: calc(50vw - 50% + var(--page-pad-x));
    padding-right: calc(50vw - 50% + var(--page-pad-x));
  }

  .main-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
    align-items: flex-start;
    gap: 24px;
    padding: 20px 24px 28px;
    background: transparent;
  }

  .main-content {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    overflow: visible;
    min-height: 480px;
  }

  .game-screen,
  .panel-screen {
    position: relative;
    inset: auto;
  }

  body[data-tab="game"] .game-screen {
    overflow-y: visible;
  }

  body[data-tab="study"] #panelStudy,
  body[data-tab="records"] #panelRecords,
  body[data-tab="vocab"] #panelVocab {
    overflow-y: visible;
    min-height: 420px;
  }

  .word-browse-list,
  .history-list {
    flex: none;
    overflow-y: visible;
  }

  .game-board {
    max-width: 480px;
    max-height: 480px;
    margin: 0 auto;
  }

  .wc-text { font-size: 16px; }
  .wc-sub { font-size: 12px; }

  body[data-tab="game"] .ai-panel { display: none; }

  .page-footer-note { display: none; }

  .pc-sidebar {
    display: flex;
    flex: 0 0 300px;
    width: 300px;
    padding: 0;
    min-height: 0;
    position: sticky;
    top: 16px;
    max-height: calc(100dvh - 120px);
    overflow-y: auto;
  }

  .pc-sidebar-inner {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(212, 197, 169, 0.45);
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .pc-side-title { font-size: 18px; font-weight: 600; }
  .pc-side-hint { font-size: 16px; color: var(--text-sub); }
  .pc-forget-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 16px;
    color: var(--text-sub);
    white-space: pre-line;
    line-height: 1.5;
  }

  body:not([data-tab="game"]) .pc-sidebar { display: none; }

  .tab-bar {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    padding-left: calc(50vw - 50%);
    padding-right: calc(50vw - 50%);
    max-width: none;
  }

  .site-footer {
    display: block;
    flex-shrink: 0;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    padding: 24px calc(50vw - 50% + 24px);
    margin-top: auto;
  }

  body[data-tab="game"] .ad-slot:not(:empty) {
    position: relative;
    left: auto;
    right: auto;
    margin: 16px 0 0;
  }

  .toast { bottom: 32px; }
}
