/* ========== 变量 ========== */
:root {
  --bg-page: #f5f0e1;
  --bg-tg: #2c2416;
  --bg-paper: #faf3e0;
  --gold: #e6b422;
  --gold-deep: #a9791a;
  --text: #3e2723;
  --text-sub: #8d6e63;
  --border: #d4c5a9;
  --bubble-recv: #e8e0d5;
  --bubble-send: #f0e6c8;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 48px;
  --tabbar-h: 56px;
  --text-min: 16px;
  --content-w: 880px;
  --mono: "Courier New", "DejaVu Sans Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  /* black-translucent 穿透模式下，html 背景延伸到刘海区，需与顶部 header 同色 */
  background: #2c2416;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: var(--text-min);
  /* body 背景同 html，确保 Safari 安全区填色一致 */
  background: #2c2416;
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

/* app-container 内部恢复页面背景色，避免深棕溢出到内容区 */
a { color: var(--gold-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font: inherit; cursor: pointer; border: none; background: none; }

/* ========== 布局容器 ========== */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  max-width: 100%;
  margin: 0 auto;
  background: var(--bg-page);
}

.main-wrap {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-page);
}

.main-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 0 16px;
}

/* ========== 顶部标题栏 ========== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: var(--safe-top) 12px 0;
  min-height: calc(var(--header-h) + var(--safe-top));
  background: var(--bg-tg);
  border-bottom: 1px solid rgba(230, 180, 34, 0.25);
  flex-shrink: 0;
  z-index: 10;
}

.app-title {
  flex: 1;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.08em;
}

.header-actions { display: flex; align-items: center; flex-shrink: 0; }

.brand-mark { display: flex; align-items: center; flex-shrink: 0; border-radius: 8px; }
.brand-mark:active { opacity: 0.85; }

.ico, .tab-ico, .ico-sm { display: block; flex-shrink: 0; }
.ico { width: 22px; height: 22px; }
.tab-ico { width: 22px; height: 22px; }
.ico-sm { width: 16px; height: 16px; }

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  border-radius: 10px;
  flex-shrink: 0;
}
.icon-btn:active { background: rgba(255, 255, 255, 0.08); }
.icon-btn.is-muted { opacity: 0.6; }

.icon-btn .sound-off,
.pc-nav-sound .sound-off { display: none; }
.icon-btn.is-muted .sound-on,
.pc-nav-sound.is-muted .sound-on { display: none; }
.icon-btn.is-muted .sound-off,
.pc-nav-sound.is-muted .sound-off { display: block; }

.pc-nav { display: none; }

/* ========== 屏幕切换 ========== */
.screen {
  display: none;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 14px;
  padding-top: 10px;
  padding-bottom: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.screen::-webkit-scrollbar { display: none; }

body[data-tab="learn"] .screen-learn,
body[data-tab="telegraph"] .screen-telegraph { display: flex; }

/* 电报页：禁止外层滚动，内部聊天区自适应收缩，避免小屏重叠 */
body[data-tab="telegraph"] .screen-telegraph {
  overflow: hidden;
  gap: 6px;
  padding-top: 6px;
  padding-bottom: 6px;
}

body[data-tab="telegraph"] .telegraph-card {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

body[data-tab="telegraph"] .tg-chat {
  min-height: 0;
  flex: 1 1 auto;
}

body[data-tab="telegraph"] .tg-keyzone,
body[data-tab="telegraph"] .tg-input-row,
body[data-tab="telegraph"] .tg-statusbar {
  flex-shrink: 0;
}

.article-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 0;
  display: none;
  scrollbar-width: none;
}
.article-content::-webkit-scrollbar { display: none; }

body[data-tab="alphabet"] .article-alphabet,
body[data-tab="tutorial"] .article-tutorial { display: block; }

.page-lead { text-align: center; padding: 0 4px; flex-shrink: 0; }
.page-lead h1 { font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.35; }
.page-lead-sub { font-size: 16px; color: var(--text-sub); margin-top: 4px; }

/* ========== 学习卡片 ========== */
.learn-card {
  background: var(--bg-paper);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border: 1px solid rgba(212, 197, 169, 0.6);
}

.convert-block { display: flex; flex-direction: column; gap: 10px; }

.convert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.convert-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-sub);
}
.convert-label-right { text-align: right; }

.dir-btn {
  width: 40px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-deep);
  background: rgba(230, 180, 34, 0.14);
  border: 1px solid rgba(230, 180, 34, 0.4);
  border-radius: 8px;
  flex-shrink: 0;
}
.dir-btn:active { background: rgba(230, 180, 34, 0.28); }

.text-input {
  width: 100%;
  font-size: 18px;
  font-family: inherit;
  color: var(--text);
  background: #fffdf6;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  resize: none;
  outline: none;
  line-height: 1.5;
}
.text-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(230, 180, 34, 0.22);
}
.text-input.mode-morse { font-family: var(--mono); letter-spacing: 0.08em; }

.morse-output {
  min-height: 64px;
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.12em;
  color: var(--gold-deep);
  background: #fffdf6;
  border: 1px dashed rgba(212, 197, 169, 0.8);
  border-radius: 12px;
  padding: 14px;
  word-break: break-word;
  line-height: 1.7;
}
.morse-output.mode-text {
  font-family: inherit;
  letter-spacing: 0;
  color: var(--text);
  font-size: 18px;
}
.morse-placeholder { color: var(--text-sub); font-family: inherit; font-size: 16px; letter-spacing: 0; }

.convert-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.convert-btn {
  height: 38px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--gold-deep);
  font-size: 15px;
}
.convert-btn:active { background: rgba(230, 180, 34, 0.12); }
.convert-btn-primary {
  color: #2c2416;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 600;
}
.convert-btn-primary:active { background: var(--gold-deep); }

/* ========== 播放按钮 ========== */
.play-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0 4px;
}

.play-btn-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-btn {
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2c2416;
  background: radial-gradient(circle at 35% 30%, #f4cf52, var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 4px 14px rgba(169, 121, 26, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.45);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.play-btn:active:not(.is-playing) { transform: scale(0.95); }

.play-btn .play-ico { display: block; flex-shrink: 0; }
.play-btn .ico-play { width: 30px; height: 30px; margin-left: 3px; }
.play-btn .ico-pause { width: 24px; height: 24px; display: none; }

.play-block.is-playing .play-btn {
  color: #fffdf6;
  background: radial-gradient(circle at 35% 28%, #ffe566, #f0b820 52%, #c88a10);
  animation: play-btn-glow 0.45s ease-in-out infinite alternate;
}
.play-block.is-playing .play-btn .ico-play { display: none; }
.play-block.is-playing .play-btn .ico-pause { display: block; }

.play-block.is-playing .play-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 3px solid rgba(230, 180, 34, 0.75);
  animation: play-ring-spin 1.2s linear infinite;
}

.play-block.is-playing .play-btn::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.35);
  animation: play-inner-flash 0.35s ease-in-out infinite alternate;
}

@keyframes play-btn-glow {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(230, 180, 34, 0.55), 0 4px 16px rgba(169, 121, 26, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.45);
  }
  100% {
    transform: scale(1.08);
    box-shadow: 0 0 0 10px rgba(230, 180, 34, 0.12), 0 6px 22px rgba(230, 180, 34, 0.55), inset 0 2px 6px rgba(255, 255, 255, 0.55);
  }
}

@keyframes play-ring-spin {
  from { transform: rotate(0deg); opacity: 0.95; }
  to { transform: rotate(360deg); opacity: 0.55; }
}

@keyframes play-inner-flash {
  from { opacity: 0.35; }
  to { opacity: 1; }
}

.play-eq {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  height: 28px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

.play-eq span {
  display: block;
  width: 5px;
  height: 8px;
  border-radius: 3px;
  background: var(--gold-deep);
}

.play-block.is-playing .play-eq {
  opacity: 1;
  transform: translateY(0);
}

.play-block.is-playing .play-eq span:nth-child(1) { animation: eq-bar 0.42s ease-in-out infinite alternate; }
.play-block.is-playing .play-eq span:nth-child(2) { animation: eq-bar 0.38s ease-in-out infinite alternate 0.08s; }
.play-block.is-playing .play-eq span:nth-child(3) { animation: eq-bar 0.5s ease-in-out infinite alternate 0.04s; }
.play-block.is-playing .play-eq span:nth-child(4) { animation: eq-bar 0.36s ease-in-out infinite alternate 0.12s; }
.play-block.is-playing .play-eq span:nth-child(5) { animation: eq-bar 0.44s ease-in-out infinite alternate 0.06s; }

@keyframes eq-bar {
  0% { height: 6px; background: var(--gold-deep); }
  100% { height: 26px; background: var(--gold); }
}

.play-tip {
  font-size: 16px;
  color: var(--text-sub);
  transition: color 0.2s;
}

.play-block.is-playing .play-tip {
  color: var(--gold-deep);
  font-weight: 600;
  animation: play-tip-glow 0.8s ease-in-out infinite;
}

@keyframes play-tip-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ========== 字母表参考 ========== */
.ref-fold {
  border: 1px solid rgba(212, 197, 169, 0.7);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  overflow: hidden;
}
.ref-fold summary {
  padding: 12px 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--gold-deep);
  cursor: pointer;
  list-style: none;
}
.ref-fold summary::-webkit-details-marker { display: none; }

.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
  padding: 0 14px 14px;
}
.ref-grid-full { padding: 12px 0 4px; }

.ref-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  background: #fffdf6;
  border: 1px solid rgba(212, 197, 169, 0.6);
  border-radius: 8px;
  text-align: center;
}
.ref-cell:active { background: rgba(230, 180, 34, 0.18); }
.ref-cell-char { font-size: 18px; font-weight: 700; color: var(--text); }
.ref-cell-code { font-family: var(--mono); font-size: 16px; color: var(--gold-deep); letter-spacing: 0.06em; }

/* ========== 电报模拟卡片 ========== */
.telegraph-card {
  background: var(--bg-tg);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid rgba(230, 180, 34, 0.18);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(230, 180, 34, 0.06), transparent 40%),
    radial-gradient(circle at 88% 92%, rgba(230, 180, 34, 0.05), transparent 40%);
}

.tg-statusbar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: #d8c9a6;
  flex-shrink: 0;
}
.tg-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #5fbf6a;
  box-shadow: 0 0 6px #5fbf6a;
  flex-shrink: 0;
  animation: blink 1.6s ease-in-out infinite;
}
.tg-dot.waiting { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.tg-status { flex: 1; }
.tg-role {
  font-size: 16px;
  color: #d8c9a6;
  padding: 4px 8px;
  border: 1px solid rgba(230, 180, 34, 0.3);
  border-radius: 14px;
}
.tg-role b { color: var(--gold); font-weight: 600; }

.tg-chat {
  flex: 1 1 auto;
  min-height: 80px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px;
  scrollbar-width: none;
}
.tg-chat::-webkit-scrollbar { display: none; }

.tg-msg { display: flex; flex-direction: column; gap: 3px; max-width: 82%; }
.tg-msg.recv { align-self: flex-start; align-items: flex-start; }
.tg-msg.send { align-self: flex-end; align-items: flex-end; }

.tg-bubble {
  padding: 7px 11px;
  border-radius: 14px;
  font-size: 16px;
  line-height: 1.45;
  word-break: break-word;
}
.tg-msg.recv .tg-bubble { background: var(--bubble-recv); color: var(--text); border-bottom-left-radius: 4px; }
.tg-msg.send .tg-bubble { background: var(--bubble-send); color: var(--text); border-bottom-right-radius: 4px; }

.tg-bubble-code {
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--gold-deep);
  margin-bottom: 4px;
  display: block;
  word-break: break-word;
}
.tg-bubble-text.fade-in { animation: fadeIn 0.6s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.tg-time { font-size: 14px; color: rgba(216, 201, 166, 0.7); padding: 0 4px; }
.tg-typing-cursor::after { content: "▋"; animation: blink 0.8s step-end infinite; color: var(--gold-deep); }

/* ========== 发报操作区 ========== */
.tg-keyzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.tg-code-preview {
  width: 100%;
  min-height: 34px;
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 0.12em;
  text-align: center;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(230, 180, 34, 0.22);
  border-radius: 8px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  word-break: break-word;
}
.tg-code-hint { font-family: inherit; font-size: 14px; letter-spacing: 0; color: rgba(216, 201, 166, 0.6); }

.tg-key {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #f5f0e1;
  background: radial-gradient(circle at 38% 32%, #6b6b6b, #3a3a3a 60%, #222);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.25);
  border: 2px solid #555;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: transform 0.08s, box-shadow 0.08s;
}
.tg-key-cap {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #888, #444);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3);
}
.tg-key-label { font-size: 14px; color: rgba(245, 240, 225, 0.75); }
.tg-key.pressed {
  transform: scale(0.94) translateY(2px);
  background: radial-gradient(circle at 38% 32%, #f4cf52, var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 0 0 7px rgba(230, 180, 34, 0.22), inset 0 2px 6px rgba(0, 0, 0, 0.3);
  color: #2c2416;
  border-color: var(--gold);
}
.tg-key.pressed .tg-key-cap { background: radial-gradient(circle at 40% 35%, #fff3cf, var(--gold-deep)); }
.tg-key.pressed .tg-key-label { color: #2c2416; }

.tg-key-actions { display: flex; gap: 8px; width: 100%; }
.tg-mini {
  flex: 1 1 0;
  height: 36px;
  font-size: 15px;
  color: #d8c9a6;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(230, 180, 34, 0.28);
  border-radius: 8px;
  white-space: nowrap;
  padding: 0 6px;
}
.tg-mini:active { background: rgba(230, 180, 34, 0.16); }
.tg-mini-send { color: #2c2416; background: var(--gold); border-color: var(--gold); font-weight: 600; }
.tg-mini-send:active { background: var(--gold-deep); }

.tg-input-row { display: flex; gap: 8px; flex-shrink: 0; }
.tg-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  font-size: 16px;
  color: var(--text);
  background: #fffdf6;
  border: 1px solid rgba(230, 180, 34, 0.3);
  border-radius: 10px;
  outline: none;
}
.tg-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(230, 180, 34, 0.2); }
.tg-send {
  flex-shrink: 0;
  width: 58px;
  height: 40px;
  font-size: 16px;
  font-weight: 600;
  color: #2c2416;
  background: var(--gold);
  border-radius: 10px;
}
.tg-send:active { background: var(--gold-deep); }

/* 操作按钮区：单行横滑 */
.tg-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
  flex-shrink: 0;
  padding-bottom: 2px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
.tg-actions::-webkit-scrollbar { display: none; }

.btn-action {
  flex-shrink: 0;
  height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--gold-deep);
  font-size: 15px;
}
.btn-action:active { background: rgba(230, 180, 34, 0.12); }

/* ========== 文章内容区 ========== */
.article-content h2 { font-size: 18px; color: var(--text); margin: 18px 0 8px; }
.article-content h2:first-child { margin-top: 0; }
.article-content h3.ref-group-title { font-size: 16px; color: var(--gold-deep); margin: 14px 0 4px; }
.article-content p { font-size: 16px; color: var(--text-sub); line-height: 1.8; margin-bottom: 8px; }
.panel-sub { font-size: 16px; color: var(--text-sub); margin-bottom: 8px; }
.morse-inline { font-family: var(--mono); color: var(--gold-deep); letter-spacing: 0.06em; }

.tutorial-steps, .tutorial-tips { padding-left: 1.25em; font-size: 16px; color: var(--text-sub); }
.tutorial-steps li, .tutorial-tips li { margin-bottom: 8px; }
.tutorial-steps strong, .tutorial-tips strong { color: var(--text); }

.faq-list dt { font-weight: 600; margin-top: 12px; font-size: 16px; color: var(--text); }
.faq-list dd { color: var(--text-sub); font-size: 16px; margin-left: 0; }

.about-site { font-size: 16px; color: var(--text-sub); line-height: 1.8; }
.about-site a { color: var(--gold-deep); }

/* ========== 广告位 ========== */
.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;
}
.ad-slot:not(:empty) { display: flex; flex: 0 0 60px; }

/* ========== 底部 TabBar ========== */
.tab-bar {
  display: flex;
  order: 999;
  flex-shrink: 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-tg);
  border-top: 1px solid rgba(230, 180, 34, 0.22);
  z-index: 20;
}
.tab-btn {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 16px;
  color: rgba(216, 201, 166, 0.7);
  padding: 4px 0 2px;
  transition: color 0.15s;
}
.tab-btn span { font-size: 14px; }
.tab-btn.active { color: var(--gold); }

/* ========== 页脚 ========== */
.site-footer {
  display: none;
  background: var(--bg-tg);
  color: #d8c9a6;
  text-align: center;
  padding: 16px 24px;
  font-size: 16px;
  line-height: 1.7;
}
.site-footer a { color: var(--gold); }

.pc-sidebar { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  transform: translateX(-50%) translateY(20px);
  background: rgba(44, 36, 22, 0.95);
  color: var(--gold);
  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 适配（主体 880px，导航/页脚通栏） ========== */
@media (min-width: 768px) {
  html {
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-page);
  }

  body {
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100dvh;
    background:
      radial-gradient(ellipse 680px 680px at 88% 12%, rgba(230, 180, 34, 0.08), transparent),
      radial-gradient(ellipse 520px 520px at 8% 88%, rgba(141, 110, 99, 0.08), transparent),
      var(--bg-page);
  }

  .app-container {
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    margin: 0;
    background: transparent;
    box-shadow: none;
  }

  .app-header { display: none; }
  .tab-bar { display: none; }

  /* 顶部导航通栏：左品牌、右菜单 */
  .pc-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    padding: 12px 24px;
    background: var(--bg-tg);
    border-bottom: 1px solid rgba(230, 180, 34, 0.2);
    flex-shrink: 0;
  }

  .pc-nav-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--gold);
    flex-shrink: 0;
  }
  .pc-nav-brand:hover { text-decoration: none; opacity: 0.9; }

  .pc-nav-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
  }

  .pc-nav-link {
    font-size: 16px;
    color: #d8c9a6;
    padding: 7px 12px;
    border-radius: 9px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
  }
  .pc-nav-link.active { color: var(--gold); font-weight: 600; background: rgba(230, 180, 34, 0.12); }
  .pc-nav-link:hover { background: rgba(230, 180, 34, 0.08); }
  .pc-nav-sound { display: inline-flex; align-items: center; color: var(--gold); padding: 7px 10px; }
  .pc-nav-sound.is-muted { opacity: 0.6; }

  .main-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
    background: transparent;
    max-width: var(--content-w);
    width: 100%;
    margin: 0 auto;
    padding: 20px 24px 28px;
  }

  .main-content {
    padding: 0;
    overflow: visible;
  }

  body[data-tab="telegraph"] .screen-telegraph {
    overflow-y: visible;
    min-height: calc(100dvh - 220px);
  }

  body[data-tab="telegraph"] .telegraph-card {
    min-height: 480px;
  }

  .screen {
    max-height: none;
  }

  .article-content {
    max-height: none;
  }

  /* 页脚通栏 */
  .site-footer {
    display: block;
    flex-shrink: 0;
    width: 100%;
    padding: 20px 24px;
    margin-top: auto;
  }

  .page-lead h1 { font-size: 22px; }
  .toast { bottom: 32px; }

  /* 隐私政策页 */
  .legal-body {
    background:
      radial-gradient(ellipse 680px 680px at 88% 12%, rgba(230, 180, 34, 0.08), transparent),
      radial-gradient(ellipse 520px 520px at 8% 88%, rgba(141, 110, 99, 0.08), transparent),
      var(--bg-page);
  }

  .legal-body .app-container {
    background: transparent;
  }

  .legal-header {
    width: 100%;
    padding-left: 24px;
    padding-right: 24px;
  }

  .legal-main {
    max-width: var(--content-w);
    padding-left: 24px;
    padding-right: 24px;
  }
}

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

/* ========== 隐私政策等法务页 ========== */
.about-site-links { margin-top: 12px; font-size: 16px; }
.about-site-links a { color: var(--gold-deep); }

.legal-body { background: var(--bg-page); }
.legal-body .app-container { background: var(--bg-page); }

.legal-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 16px;
}
.legal-main::-webkit-scrollbar { display: none; }

.legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: var(--bg-tg);
  border-bottom: 1px solid rgba(230, 180, 34, 0.25);
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
}
.legal-brand:hover { opacity: 0.9; text-decoration: none; }

.legal-back {
  font-size: 16px;
  color: var(--gold);
  text-decoration: none;
  white-space: nowrap;
}
.legal-back:hover { text-decoration: underline; }

.legal-main h1 { font-size: 26px; color: var(--text); margin-bottom: 8px; }
.legal-updated { font-size: 16px; color: var(--text-sub); margin-bottom: 20px; }
.legal-lead { font-size: 16px; line-height: 1.8; color: var(--text-sub); margin-bottom: 24px; }

.legal-section { margin-bottom: 28px; }
.legal-section h2 { font-size: 18px; color: var(--text); margin-bottom: 12px; }
.legal-section p,
.legal-section li { font-size: 16px; line-height: 1.8; color: var(--text-sub); margin-bottom: 10px; }
.legal-section ul { padding-left: 1.25em; margin-bottom: 10px; }
.legal-section code {
  font-size: 16px;
  background: rgba(212, 197, 169, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--mono);
}
.legal-section a { color: var(--gold-deep); }

.legal-icp { margin-top: 16px; font-size: 16px; color: var(--text-sub); }

.legal-footer {
  padding: 20px 0;
  border-top: 1px solid rgba(212, 197, 169, 0.45);
  text-align: center;
  font-size: 16px;
  color: var(--text-sub);
}
.legal-footer a { color: var(--gold-deep); }






