/* ===========================================================================
   phonetics.css — 发音教练 module (loaded only by phonetics.html).
   Reuses the global palette / fonts from style.css (:root vars, .app-header,
   .say, .btn-*). Everything here is namespaced .ph-* to stay isolated.
   =========================================================================== */

.ph-wrap { max-width: 760px; margin: 0 auto; padding: 14px 14px calc(28px + var(--safe-b)); }

/* ---------- home ---------- */
.ph-hello {
  background: var(--card); border: 1px solid var(--hair); border-radius: 16px;
  padding: 14px 16px; margin-bottom: 18px; color: var(--ink-soft);
  font-size: 14.5px; line-height: 1.7; box-shadow: var(--shadow-sm);
}
.ph-hello b { color: var(--clay-deep); }

.ph-group { margin-bottom: 22px; }
.ph-group-head { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 10px; }
.ph-group-label { font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--ink); }
.ph-group-count { font-size: 12px; color: var(--muted); }
.ph-group-desc { margin: 0 2px 12px; font-size: 13px; line-height: 1.6; color: var(--muted); }

.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }

.ph-card {
  position: relative; display: flex; flex-direction: column; gap: 3px;
  background: var(--card); border: 1px solid var(--hair-2); border-radius: 14px;
  padding: 14px 14px 12px; text-align: left; cursor: pointer; overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  -webkit-tap-highlight-color: transparent; font: inherit; color: inherit;
}
.ph-card:hover, .ph-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--clay-soft); outline: none; }
.ph-card:focus-visible { border-color: var(--clay); }
.ph-sym {
  font-family: var(--serif); font-weight: 600; color: var(--clay-deep);
  line-height: 1; letter-spacing: .5px; margin-bottom: 5px;
  font-size: clamp(18px, 6vw, 30px);
}
.ph-sym.small { font-size: 19px; letter-spacing: 0; }
.ph-card-fr { font-size: 13px; color: var(--ink); line-height: 1.35; }
.ph-card-zh { font-size: 12px; color: var(--muted); }

/* locked (video/data not ready yet) */
.ph-card.locked { cursor: default; background: var(--bg-2); border-style: dashed; box-shadow: none; }
.ph-card.locked:hover { transform: none; box-shadow: none; border-color: var(--hair-2); }
.ph-card.locked .ph-sym { color: var(--muted); }
.ph-card.locked .ph-card-fr { color: var(--muted); }
.ph-badge {
  position: absolute; top: 8px; right: 8px; font-size: 10px; color: var(--muted);
  background: var(--bg); border: 1px solid var(--hair-2); border-radius: 999px; padding: 1px 7px;
}
.ph-check {
  position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--green); color: #fff; display: grid; place-items: center;
}
.ph-check svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 3; fill: none; }

/* ---------- topic page ---------- */
.ph-back {
  display: inline-flex; align-items: center; gap: 4px; background: none; border: none;
  color: var(--clay-deep); font: inherit; font-size: 14px; cursor: pointer; padding: 4px 2px; margin-bottom: 8px;
}
.ph-topic-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.ph-topic-sym {
  flex: none; min-width: 62px; height: 62px; padding: 0 10px; display: grid; place-items: center;
  background: var(--clay-tint); border: 1px solid var(--clay-soft); border-radius: 16px;
  font-family: var(--serif); font-weight: 600; color: var(--clay-deep); font-size: 26px;
}
.ph-topic-sym.small { font-size: 17px; }
.ph-topic-title { font-family: var(--serif); font-size: 21px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.ph-topic-zh { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* guide card (导学卡) */
.ph-guide { background: var(--card); border: 1px solid var(--hair); border-radius: 16px; padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.pg-oneliner { font-size: 16px; line-height: 1.6; color: var(--ink); font-weight: 500; }
.pg-anchor { margin-top: 10px; font-size: 14px; line-height: 1.6; color: var(--ink-soft); background: var(--clay-tint); border-radius: 10px; padding: 9px 12px; }
.pg-anchor b { color: var(--clay-deep); }
.pg-h { margin: 14px 0 6px; font-size: 13px; font-weight: 600; color: var(--clay-deep); }
.pg-list { margin: 0; padding-left: 18px; }
.pg-list li { font-size: 14px; line-height: 1.7; color: var(--ink-soft); margin-bottom: 3px; }
.pg-pitfalls li { color: var(--ink); }
.pg-pitfalls li::marker { content: "🚩 "; }

/* video player */
.ph-player { margin-bottom: 16px; }
.ph-stage { position: relative; background: #14110d; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-md); }
.ph-video { display: block; width: 100%; max-height: 62vh; background: #14110d; }
.ph-caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 14px 14px;
  background: linear-gradient(to top, rgba(10,8,6,.82), rgba(10,8,6,0));
  color: #fff; pointer-events: none; text-align: center;
}
.ph-caption.off { display: none; }
.ph-cap-fr { font-size: clamp(15px, 4.4vw, 20px); line-height: 1.35; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.ph-cap-zh { font-size: clamp(12px, 3.4vw, 15px); line-height: 1.35; color: #f3e7d8; margin-top: 3px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.ph-cap-zh.off { display: none; }
.ph-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #d9cdbb; font-size: 14px; }

/* control bar */
.ph-controls { margin-top: 12px; }
.ph-timerow { display: flex; align-items: center; gap: 10px; }
.ph-t { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; }
.ph-t.end { text-align: right; }
.ph-seek { flex: 1; -webkit-appearance: none; appearance: none; height: 5px; border-radius: 999px; background: linear-gradient(var(--clay), var(--clay)) 0/var(--fill,0%) 100% no-repeat, var(--hair-2); outline: none; }
.ph-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: var(--clay); box-shadow: 0 1px 3px rgba(0,0,0,.3); cursor: pointer; }
.ph-seek::-moz-range-thumb { width: 15px; height: 15px; border: none; border-radius: 50%; background: var(--clay); cursor: pointer; }

.ph-primary { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 12px 0 10px; }
.ph-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--hair-2); background: var(--card); color: var(--ink); cursor: pointer; box-shadow: var(--shadow-sm); }
.ph-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ph-btn.play { width: 58px; height: 58px; background: var(--clay); border-color: var(--clay); color: #fff; box-shadow: var(--shadow-fab); }
.ph-btn.play svg { width: 26px; height: 26px; fill: #fff; stroke: none; }
.ph-btn:active { transform: scale(.94); }

.ph-toggles { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.ph-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--hair-2); background: var(--card); color: var(--ink-soft); font: inherit; font-size: 13px; cursor: pointer; }
.ph-chip svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ph-chip[aria-pressed="true"] { background: var(--clay-tint); border-color: var(--clay); color: var(--clay-deep); }
.ph-speeds { display: inline-flex; gap: 2px; background: var(--bg-2); border: 1px solid var(--hair-2); border-radius: 999px; padding: 2px; }
.ph-speed { border: none; background: none; font: inherit; font-size: 12.5px; color: var(--ink-soft); padding: 5px 10px; border-radius: 999px; cursor: pointer; }
.ph-speed.active { background: var(--clay); color: #fff; }

/* transcript */
.ph-transcript { margin-top: 18px; border-top: 1px solid var(--hair); padding-top: 12px; }
.ph-tr-title { font-size: 13px; color: var(--muted); margin: 0 2px 8px; }
.ph-seg { position: relative; display: flex; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; scroll-margin: 90px; }
.ph-seg:hover { background: var(--bg-2); }
.ph-seg.active { background: var(--clay-tint); }
.ph-seg-idx { flex: none; width: 20px; text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.ph-seg.active .ph-seg-idx { color: var(--clay-deep); font-weight: 600; }
.ph-seg-body { flex: 1; min-width: 0; }
.ph-seg-fr { font-size: 14.5px; line-height: 1.5; color: var(--ink); }
.ph-seg.active .ph-seg-fr { color: var(--clay-deep); font-weight: 500; }
.ph-seg-zh { font-size: 12.5px; line-height: 1.45; color: var(--muted); margin-top: 1px; }
.ph-seg-zh.off { display: none; }
.ph-seg-tag { flex: none; align-self: flex-start; margin-top: 2px; font-size: 10px; color: var(--amber); border: 1px solid var(--amber); border-radius: 999px; padding: 0 6px; line-height: 1.5; }

.ph-hint { text-align: center; color: var(--muted); font-size: 13.5px; padding: 30px 16px; line-height: 1.7; }
.ph-credit { text-align: center; color: var(--muted); font-size: 12px; margin-top: 26px; }
