/* ============================================================
   英语发音口腔图谱 — 学术研究风 · 亮色主题
   设计取向：纸张底色、墨色文字、细规则线、克制的强调色；
   不使用大面积圆角卡片，多用直线分栏与留白。
   ============================================================ */

:root {
  --paper: #f7f4ee;
  --paper-2: #fdfbf6;
  --ink: #22201b;
  --ink-soft: #514c43;
  --muted: #857d6f;
  --rule: #ddd6c8;
  --rule-strong: #c4bba9;
  --accent: #1f5b57;        /* 深青，学术感 */
  --accent-soft: #e4ede9;
  --highlight: #9c3b28;     /* 赭红，用于英美差异/重点 */
  --highlight-soft: #f2e2dc;
  --tongue: #e3a597;
  --tongue-line: #b56a5b;
  --lip: #d98b78;
  --lip-line: #b26350;
  --anatomy-line: #4a453c;
  /* 用户 SVG 之上新增的小舌活动提示色 */
  --velum-fill: #e6a99b;
  --velum-line: #c07c6c;
  --shadow: 0 1px 0 rgba(0,0,0,.04);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "Noto Serif SC", serif;
  --sans: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image: linear-gradient(var(--paper), var(--paper));
}
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 28px; }

/* ---------- 页眉 ---------- */
.site-head {
  border-bottom: 2px solid var(--ink);
  background: var(--paper-2);
}
.head-inner {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; padding: 26px 28px 20px;
}
.site-head h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 30px;
  letter-spacing: .5px;
  margin: 0 0 4px;
}
.tagline { margin: 0; color: var(--ink-soft); font-size: 15px; }
.tagline abbr { text-decoration: none; border-bottom: 1px dotted var(--muted); }
.head-meta { text-align: right; }
.meta-line {
  font-size: 12.5px; color: var(--muted);
  border-left: 2px solid var(--accent); padding-left: 10px;
}

/* 自定义滚动条（音标列表 + 部位列表） */
.index::-webkit-scrollbar,
.part-list::-webkit-scrollbar {
  width: 8px;
}
.index::-webkit-scrollbar-track,
.part-list::-webkit-scrollbar-track {
  background: var(--paper-2);
  border-left: 1px solid var(--rule);
}
.index::-webkit-scrollbar-thumb,
.part-list::-webkit-scrollbar-thumb {
  background: var(--accent-soft);
  border-radius: 4px;
}
.index::-webkit-scrollbar-thumb:hover,
.part-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
/* Firefox 滚动条样式 */
.index,
.part-list {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-soft) var(--paper-2);
}

/* ---------- 主布局：左索引 + 右舞台 ---------- */
.layout {
  display: grid;
  grid-template-columns: 232px 1fr;
  gap: 0;
  padding-top: 0;
  align-items: start;
}
.index {
  border-right: 1px solid var(--rule);
  padding: 24px 22px 60px 0;
  position: sticky; top: 0;
  align-self: start;
  overflow-y: auto;
  max-height: calc(100vh - 120px);
}
.index-group { margin-bottom: 26px; }
.index-title {
  font-family: var(--serif);
  font-size: 13px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--muted); margin: 0 0 10px;
  border-bottom: 1px solid var(--rule); padding-bottom: 6px;
}
.chip-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-family: var(--serif);
  font-size: 20px; line-height: 1;
  min-width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 8px;
  background: var(--paper-2);
  border: 1px solid var(--rule-strong);
  color: var(--ink);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  position: relative;
}
.chip:hover { background: var(--accent-soft); border-color: var(--accent); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.star::after {
  content: "★"; position: absolute; top: -6px; right: -5px;
  font-size: 10px; color: var(--highlight);
}
.chip.active.star::after { color: #ffd9b0; }

/* ---------- 舞台：图 + 讲解 ---------- */
.stage { padding: 26px 0 26px 30px; min-height: 640px; }
.stage-grid {
  display: grid;
  grid-template-columns: minmax(340px, 460px) 1fr;
  gap: 34px;
  align-items: start;
}

/* 音标标题区 */
.phon-head { border-bottom: 2px solid var(--ink); padding-bottom: 14px; margin-bottom: 18px; }
.phon-symbol-row { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.phon-symbol {
  font-family: var(--serif); font-size: 62px; line-height: .9;
  color: var(--ink);
}
.phon-symbol .slash { color: var(--muted); font-size: 40px; }
.phon-titles h2 { font-family: var(--serif); font-weight: 600; font-size: 20px; margin: 0; }
.phon-titles .sub { color: var(--ink-soft); font-size: 14px; }
.phon-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tag {
  font-size: 12px; letter-spacing: .3px;
  padding: 3px 9px; border: 1px solid var(--rule-strong);
  background: var(--paper-2); color: var(--ink-soft);
}
.tag.accent { border-color: var(--accent); color: var(--accent); }
.tag.hl { border-color: var(--highlight); color: var(--highlight); background: var(--highlight-soft); }

/* 图区 */
.diagram-wrap { }
.diagram-frame {
  border: 1px solid var(--rule-strong);
  background:
    linear-gradient(var(--paper-2), var(--paper-2));
  position: relative;
  box-shadow: var(--shadow);
}
.diagram-frame svg { display: block; width: 100%; height: auto; }
.diagram-caption {
  font-size: 12px; color: var(--muted); text-align: center;
  padding: 7px 10px; border-top: 1px solid var(--rule);
  font-family: var(--serif); letter-spacing: .3px;
}

/* 播放控制 */
.controls { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn {
  font-family: var(--sans); font-size: 14px;
  padding: 9px 16px; border: 1px solid var(--ink); background: var(--ink); color: #fff;
  cursor: pointer; transition: opacity .15s, background .15s;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { opacity: .88; }
.btn.play { background: var(--accent); border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn:disabled { opacity: .5; cursor: default; }
.btn .ico { font-size: 12px; }

/* 英美 / 变体切换 */
.variant-bar { display: flex; flex-wrap: wrap; gap: 0; margin-top: 4px; border: 1px solid var(--rule-strong); width: fit-content; }
.variant-btn {
  font-family: var(--sans); font-size: 13px;
  padding: 8px 14px; background: var(--paper-2); border: none;
  border-right: 1px solid var(--rule-strong); cursor: pointer; color: var(--ink-soft);
  display: flex; flex-direction: column; align-items: center; gap: 2px; line-height: 1.2;
}
.variant-btn:last-child { border-right: none; }
.variant-btn .vsym { font-family: var(--serif); font-size: 18px; color: var(--ink); }
.variant-btn.active { background: var(--accent); color: #fff; }
.variant-btn.active .vsym { color: #fff; }
.variant-btn:not(.active):hover { background: var(--accent-soft); }

/* 讲解区 */
.info-col { }
.section-label {
  font-family: var(--serif); font-size: 13px; letter-spacing: .8px;
  text-transform: uppercase; color: var(--accent); margin: 0 0 8px;
}
.section + .section { margin-top: 22px; }
.notes { color: var(--ink-soft); font-size: 15px; margin: 0; }
.variant-note {
  border-left: 3px solid var(--highlight); background: var(--highlight-soft);
  padding: 10px 14px; font-size: 14.5px; color: var(--ink-soft); margin: 0;
}

/* 例词表 */
.examples { list-style: none; margin: 0; padding: 0; }
.examples li {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 0; border-bottom: 1px solid var(--rule);
}
.examples li:first-child { border-top: 1px solid var(--rule); }
.ex-word { font-family: var(--serif); font-size: 20px; min-width: 92px; }
.ex-ipa { color: var(--accent); font-family: var(--serif); font-size: 16px; min-width: 96px; }
.ex-play {
  margin-left: auto; width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--rule-strong); background: var(--paper-2); color: var(--ink);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; transition: background .15s, border-color .15s;
}
.ex-play:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.ex-accent { font-size: 11px; color: var(--muted); border: 1px solid var(--rule); padding: 1px 6px; }

/* 英美发音对比表 */
.compare-list { list-style: none; margin: 0; padding: 0; }
.compare-list li {
  display: grid; grid-template-columns: 84px 1fr 1fr; gap: 10px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--rule);
}
.compare-list li:first-child { border-top: 1px solid var(--rule); }
.cmp-word { font-family: var(--serif); font-size: 17px; }
.cmp-side { display: flex; align-items: center; gap: 6px; }
.cmp-flag { font-size: 11px; color: #fff; background: var(--accent); padding: 1px 5px; }
.cmp-flag.am { background: var(--highlight); }
.cmp-ipa { font-family: var(--serif); font-size: 14px; color: var(--ink-soft); flex: 1; }
.compare-list .ex-play { width: 28px; height: 28px; font-size: 12px; }

/* 部位速览 */
.place-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 14px; }
.place-grid dt { color: var(--muted); }
.place-grid dd { margin: 0; color: var(--ink); }

/* ---------- 页脚 ---------- */
.site-foot { border-top: 2px solid var(--ink); margin-top: 40px; background: var(--paper-2); }
.foot-inner { padding: 20px 28px 30px; font-size: 13.5px; color: var(--ink-soft); }
.foot-inner a { color: var(--accent); }
.foot-dim { color: var(--muted); font-size: 12.5px; }
.foot-credit {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rule);
  font-size: 12.5px; color: var(--ink-soft); line-height: 1.9;
}
.foot-credit .fc-author { font-family: var(--serif); font-size: 14px; color: var(--ink); }
.foot-credit a { color: var(--accent); }

/* ============================================================
   SVG 解剖插画与可动结构样式
   ============================================================ */

/* 交互命中区（透明） */
.hit { fill: transparent; stroke: none; cursor: pointer; pointer-events: all; }

/* 声带 */
.layer-glottis { transform-box: fill-box; transform-origin: center; }
.layer-glottis.voiced { animation: voice .16s linear infinite; }
.layer-glottis.closed { opacity: .62; filter: saturate(1.35); }
@keyframes voice { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(.88); } }

/* 用户提供底图的器官分层：外链 <use> 仍是矢量，动画只施加在可动结构上。 */
.anatomy-layer { transform-box: fill-box; transform-origin: center; }
.velum-hint { fill: var(--velum-fill); stroke: var(--velum-line); stroke-width: 3; stroke-linejoin: round; opacity: .92; }
.velum-hint.lowered { opacity: .78; }

/* 气流 */
.airflow { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 1 11; opacity: 0; transition: opacity .2s; }
.airflow.active { opacity: .85; animation: flow 1s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -60; } }
.nasal-gate { fill: none; stroke: var(--highlight); stroke-width: 2.4; stroke-dasharray: 3 5; transition: opacity .3s; }

/* 爆破 puff */
.puff { fill: var(--accent); opacity: 0; }
.puff.burst { animation: puff .5s ease-out; }
@keyframes puff { 0% { opacity: .7; r: 3; } 100% { opacity: 0; r: 26; } }

/* 标注 */
.label .leader { stroke: var(--muted); stroke-width: 1; }
.label .leader-dot { fill: var(--muted); }
.label-text { font-family: var(--serif); font-size: 12px; fill: var(--ink-soft); }
.asset-label { font-size: 24px; font-weight: 600; paint-order: stroke; stroke: var(--paper-2); stroke-width: 3px; }

/* ============================================================
   发声部位交互页（explorer.html）
   ============================================================ */
.explorer-layout {
  display: grid; grid-template-columns: minmax(380px, 1fr) 330px;
  gap: 32px; padding: 26px 0 40px; align-items: start;
}
/* 左侧口腔图固定可见，右侧部位列表独立滚动（不带动整页） */
.diagram-col { position: sticky; top: 16px; }
.explorer-panel {
  position: sticky; top: 16px;
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
}
.explorer-panel .info-card { flex: 0 0 auto; }
.explorer-panel .part-list { flex: 1 1 auto; overflow-y: auto; min-height: 0; padding-right: 4px; }
.explorer-hint { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.info-card {
  border: 1px solid var(--ink); background: var(--paper-2); padding: 16px 18px; min-height: 118px;
}
.info-card .ic-zh { font-family: var(--serif); font-size: 26px; line-height: 1.1; }
.info-card .ic-en { color: var(--ink-soft); font-size: 14px; margin-top: 2px; }
.info-card .ic-row { margin-top: 12px; font-size: 14px; display: flex; gap: 8px; }
.info-card .ic-k { color: var(--muted); min-width: 60px; }
.info-card .ic-v { color: var(--ink); }
.info-card.empty .ic-en, .info-card.empty .ic-row { display: none; }

.part-list { margin-top: 22px; }
.part-list h4 {
  font-family: var(--serif); font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--muted); margin: 16px 0 8px; border-bottom: 1px solid var(--rule); padding-bottom: 5px;
}
.pl-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 7px 11px; border: 1px solid var(--rule-strong); margin-bottom: -1px;
  background: var(--paper-2); cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.pl-item .pl-zh { font-size: 14.5px; }
.pl-item .pl-en { font-size: 11.5px; color: var(--muted); }
.pl-item:hover, .pl-item.active { background: var(--accent); color: #fff; border-color: var(--accent); position: relative; z-index: 1; }
.pl-item:hover .pl-en, .pl-item.active .pl-en { color: #d5e5e1; }

/* 悬停高亮：可见器官描边加重、命中区显影 */
.part { transition: fill .15s, stroke .15s, stroke-width .15s; }
.hit.lit { fill: rgba(31, 91, 87, .24); }
.layer-tongue.lit, .layer-hardPalate.lit, .layer-softPalate.lit, .layer-upperLip.lit,
.layer-lowerLip.lit, .layer-upperTeeth.lit, .layer-lowerTeeth.lit, .layer-mandible.lit, .layer-epiglottis.lit {
  stroke: var(--accent); stroke-width: 3.4;
}
.glottis.lit .fold, .layer-glottis.lit { filter: sepia(1) saturate(3) hue-rotate(125deg); }
.diagram-frame svg .part { outline: none; }

/* 顶部分段式导航按钮 */
.head-links { display: inline-flex; border: 1px solid var(--accent); }
.head-links a {
  padding: 8px 18px; font-size: 14px; color: var(--accent); text-decoration: none;
  background: var(--paper-2); border-right: 1px solid var(--accent);
  transition: background .15s, color .15s; letter-spacing: .5px;
}
.head-links a:last-child { border-right: none; }
.head-links a:hover { background: var(--accent-soft); }
.head-links a.active { background: var(--accent); color: #fff; }

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .explorer-layout { grid-template-columns: 1fr; }
}
/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .index { position: static; border-right: none; border-bottom: 1px solid var(--rule); padding: 18px 0; }
  .stage { padding: 22px 0; }
  .stage-grid { grid-template-columns: 1fr; }
  .head-inner { flex-direction: column; align-items: flex-start; }
  .head-meta { text-align: left; }
}
