:root {
  color-scheme: light;
  --paper: #f6f3ec;
  --paper-deep: #ece7dc;
  --ink: #21312d;
  --muted: #69736e;
  --sage: #779486;
  --sage-dark: #45665a;
  --sage-pale: #dce7df;
  --sky: #cadde1;
  --sand: #e8d8bd;
  --rose: #e4c8c5;
  --violet: #d9d2e5;
  --white: #fffefb;
  --shadow: 0 20px 50px rgba(45, 62, 55, .12);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(69, 102, 90, .3); outline-offset: 3px; }

.app-shell { width: min(100%, 980px); min-height: 100vh; margin: 0 auto; padding-bottom: calc(96px + var(--safe-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: 74px; padding: 10px 20px;
  background: rgba(246, 243, 236, .84); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand > span:last-child { display: grid; line-height: 1.05; }
.brand strong { font-family: ui-serif, "Songti SC", serif; font-size: 20px; letter-spacing: .12em; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 9px; letter-spacing: .18em; }
.brand-mark { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(69,102,90,.35); border-radius: 50%; }
.brand-mark::before, .brand-mark::after, .brand-mark span { content: ""; position: absolute; width: 10px; height: 18px; border: 1.5px solid var(--sage-dark); border-radius: 70% 0 70% 0; transform-origin: 100% 100%; }
.brand-mark::before { transform: translate(-4px,-1px) rotate(-36deg); }
.brand-mark::after { transform: translate(4px,-1px) scaleX(-1) rotate(-36deg); }
.brand-mark span { width: 8px; height: 14px; transform: translateY(5px) rotate(45deg); opacity: .75; }

.quiet-button, .text-button, .icon-button, .filter-chip { border: 0; background: transparent; cursor: pointer; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.lang-button { padding: 6px 12px; border: 1px solid rgba(69,102,90,.25); border-radius: 999px; background: rgba(255,255,255,.55); color: var(--sage-dark); font-size: 12px; font-weight: 750; letter-spacing: .05em; }
.install-button { padding: 9px 15px; border: 1px solid rgba(69,102,90,.25); border-radius: 999px; background: rgba(255,255,255,.55); color: var(--sage-dark); font-size: 13px; font-weight: 650; }
.view { display: none; padding: 0 18px 28px; animation: enter .35s ease; }
.view.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(7px); } }

.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 420px; padding: 52px 28px 32px;
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, #e9efe9 0%, #d8e3dc 55%, #d0ded8 100%);
}
.hero::after { content: ""; position: absolute; inset: auto -30px -100px auto; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.26); filter: blur(2px); z-index: -1; }
.eyebrow { margin: 0 0 9px; color: var(--sage-dark); font-size: 11px; font-weight: 750; letter-spacing: .18em; text-transform: uppercase; }
.hero h1, .page-intro h1 { margin: 0; font-family: ui-serif, "Songti SC", serif; font-weight: 520; letter-spacing: -.045em; line-height: 1.18; }
.hero h1 { max-width: 510px; font-size: clamp(38px, 8vw, 61px); }
.hero h1 em { color: var(--sage-dark); font-style: normal; }
.hero > p:not(.eyebrow) { max-width: 380px; margin: 20px 0 26px; color: #52635d; font-size: 15px; line-height: 1.8; }
.primary-button, .secondary-button, .complete-button, .danger-button {
  border: 0; border-radius: 999px; cursor: pointer; font-weight: 700;
}
.primary-button { display: inline-flex; align-items: center; gap: 12px; padding: 14px 20px 14px 14px; background: var(--ink); color: white; box-shadow: 0 12px 24px rgba(33,49,45,.2); }
.play-dot { display: grid; place-items: center; width: 31px; height: 31px; padding-left: 2px; border-radius: 50%; background: rgba(255,255,255,.18); font-size: 10px; }
.hero-orbit { position: absolute; z-index: -1; border: 1px solid rgba(69,102,90,.18); border-radius: 50%; }
.orbit-one { width: 245px; height: 245px; top: -74px; right: -52px; }
.orbit-two { width: 150px; height: 150px; top: -26px; right: -7px; }

.section-block { padding: 34px 2px 8px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.section-heading h2, .section-heading h3 { margin: 0; font-family: ui-serif, "Songti SC", serif; font-size: 25px; font-weight: 560; }
.text-button { padding: 8px 0; color: var(--sage-dark); font-size: 13px; font-weight: 650; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.quick-card { position: relative; min-height: 166px; overflow: hidden; padding: 18px; border: 0; border-radius: 22px; text-align: left; cursor: pointer; }
.quick-card.sage { background: var(--sage-pale); }
.quick-card.sky { background: var(--sky); }
.quick-card.sand { background: var(--sand); }
.quick-card.rose { background: var(--rose); }
.quick-card.violet { background: var(--violet); }
.quick-card::after { content: ""; position: absolute; width: 90px; height: 90px; right: -24px; bottom: -32px; border: 1px solid rgba(33,49,45,.15); border-radius: 50%; box-shadow: 0 0 0 19px rgba(255,255,255,.11); }
.quick-card small { display: block; margin-bottom: 21px; color: rgba(33,49,45,.62); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.quick-card strong { display: block; max-width: 130px; font-family: ui-serif, "Songti SC", serif; font-size: 20px; line-height: 1.35; }
.quick-card span { display: block; margin-top: 8px; color: rgba(33,49,45,.64); font-size: 12px; }

.breath-card { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 18px; margin: 26px 0 18px; padding: 25px 22px 25px 24px; border-radius: var(--radius-lg); background: var(--ink); color: white; }
.breath-copy h2 { margin: 0 0 12px; font-family: ui-serif, "Songti SC", serif; font-size: 24px; font-weight: 500; }
.breath-copy .eyebrow { color: #b9cec4; }
.breath-patterns { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pattern-chip { padding: 5px 11px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: rgba(255,255,255,.76); font-size: 11px; font-weight: 500; cursor: pointer; transition: all .2s ease; }
.pattern-chip:hover { background: rgba(255,255,255,.14); color: #fff; }
.pattern-chip.active { background: rgba(183,211,199,.28); border-color: rgba(183,211,199,.85); color: #fff; box-shadow: 0 0 12px rgba(183,211,199,.22); }
.breath-info-card { margin: 2px 0 16px; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); transition: background .2s; }
.breath-info-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.breath-info-header strong { font-size: 14px; color: #ffffff; font-weight: 600; }
.cadence-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(183,211,199,.18); color: #c9e2d6; font-weight: 500; letter-spacing: .02em; }
.breath-pattern-desc { margin: 0 !important; font-size: 12px !important; line-height: 1.55 !important; color: rgba(255,255,255,.72) !important; }
.breath-controls-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.secondary-button { padding: 9px 15px; border-radius: 999px; border: none; background: rgba(255,255,255,.14); color: white; font-size: 12px; font-weight: 500; cursor: pointer; transition: background .2s; }
.secondary-button:hover { background: rgba(255,255,255,.24); }
.breath-duration-group { display: flex; align-items: center; gap: 3px; background: rgba(255,255,255,.07); padding: 3px; border-radius: 999px; border: 1px solid rgba(255,255,255,.12); }
.duration-chip { padding: 3px 8px; border-radius: 999px; border: none; background: transparent; color: rgba(255,255,255,.58); font-size: 11px; cursor: pointer; transition: all .2s; }
.duration-chip:hover { color: #fff; }
.duration-chip.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }
.breath-visual { display: grid; place-items: center; min-height: 165px; }
.breath-orb { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 148px; height: 148px; border: 2px solid rgba(255,255,255,.32); border-radius: 50%; background: radial-gradient(circle, rgba(183,211,199,.22), rgba(255,255,255,.02)); text-align: center; box-shadow: 0 0 0 14px rgba(255,255,255,.04), 0 0 45px rgba(178,210,195,.15); transition: transform 4s ease-in-out, background .8s, border-color .4s, box-shadow .8s; will-change: transform; }
.breath-orb.inhale { transform: scale(1.22); border-color: rgba(142,205,175,.9); background: radial-gradient(circle, rgba(142,205,175,.35), rgba(255,255,255,.03)); box-shadow: 0 0 0 18px rgba(142,205,175,.16), 0 0 55px rgba(142,205,175,.4); }
.breath-orb.inhale span { color: #c4ecd8; }
.breath-orb.hold { transform: scale(1.22); border-color: rgba(246,196,92,.95); background: radial-gradient(circle, rgba(246,196,92,.38), rgba(255,255,255,.03)); box-shadow: 0 0 0 18px rgba(246,196,92,.18), 0 0 60px rgba(246,196,92,.45); }
.breath-orb.hold span { color: #fbe09e; }
.breath-orb.exhale { transform: scale(.82); border-color: rgba(135,198,235,.85); background: radial-gradient(circle, rgba(135,198,235,.28), rgba(255,255,255,.02)); box-shadow: 0 0 0 10px rgba(135,198,235,.12), 0 0 35px rgba(135,198,235,.28); }
.breath-orb.exhale span { color: #bde4fb; }
.breath-orb.pause { transform: scale(.82); border-color: rgba(198,162,238,.95); background: radial-gradient(circle, rgba(198,162,238,.35), rgba(255,255,255,.03)); box-shadow: 0 0 0 10px rgba(198,162,238,.16), 0 0 40px rgba(198,162,238,.35); }
.breath-orb.pause span { color: #e6d3fb; }
.breath-orb span { color: rgba(255,255,255,.78); font-size: 16px; font-weight: 600; letter-spacing: .08em; text-shadow: 0 1px 4px rgba(0,0,0,.35); transition: color .3s; }
.breath-orb b { margin: 2px 0 2px; font-size: 44px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.breath-orb .breath-total { font-size: 12px; color: rgba(255,255,255,.6); font-weight: 500; font-variant-numeric: tabular-nums; }

@media (max-width: 580px) {
  .breath-card { grid-template-columns: 1fr; text-align: center; gap: 20px; padding: 22px 18px; }
  .breath-patterns, .breath-controls-row, .breath-info-header { justify-content: center; }
  .breath-copy h2 { font-size: 22px; }
}

.safety-note { display: flex; gap: 13px; padding: 17px; border: 1px solid rgba(69,102,90,.14); border-radius: 18px; background: rgba(255,255,255,.42); }
.safety-note > span { color: var(--sage-dark); font-size: 23px; }
.safety-note p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.safety-note strong { display: block; margin-bottom: 2px; color: var(--ink); font-size: 13px; }

.page-intro { padding: 33px 4px 25px; }
.page-intro h1 { max-width: 650px; font-size: clamp(35px, 7vw, 54px); }
.page-intro > p:last-child { max-width: 590px; margin: 14px 0 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.filter-row { display: flex; gap: 8px; margin: 4px 0 20px; overflow-x: auto; scrollbar-width: none; }
.filter-chip { flex: none; padding: 9px 15px; border: 1px solid rgba(33,49,45,.12); border-radius: 999px; background: rgba(255,255,255,.4); color: var(--muted); font-size: 12px; }
.filter-chip.active { border-color: var(--ink); background: var(--ink); color: white; }
.library-list { display: grid; gap: 12px; }
.library-card { display: grid; grid-template-columns: 88px 1fr auto; align-items: center; gap: 15px; padding: 13px; border: 1px solid rgba(33,49,45,.08); border-radius: 22px; background: rgba(255,255,255,.58); cursor: pointer; text-align: left; }
.library-art { position: relative; display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; border-radius: 17px; }
.library-art.sage { background: var(--sage-pale); } .library-art.sky { background: var(--sky); } .library-art.sand { background: var(--sand); } .library-art.rose { background: var(--rose); } .library-art.violet { background: var(--violet); }
.library-art::before, .library-art::after { content: ""; position: absolute; border: 1px solid rgba(33,49,45,.18); border-radius: 50%; }
.library-art::before { width: 64px; height: 64px; } .library-art::after { width: 37px; height: 37px; }
.library-art span { position: relative; z-index: 1; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.54); font-size: 9px; }
.library-copy { min-width: 0; }
.library-copy small { color: var(--sage-dark); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.library-copy strong { display: block; margin: 5px 0; overflow: hidden; font-family: ui-serif, "Songti SC", serif; font-size: 18px; font-weight: 560; text-overflow: ellipsis; white-space: nowrap; }
.library-copy span { color: var(--muted); font-size: 11px; }
.save-button { position: relative; z-index: 2; width: 38px; height: 38px; border: 0; background: transparent; cursor: pointer; font-size: 24px; }
.empty-state { padding: 40px 20px; color: var(--muted); text-align: center; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats-grid article { padding: 22px 10px; border-radius: 21px; background: rgba(255,255,255,.56); text-align: center; }
.stats-grid strong { display: block; font-family: ui-serif, "Songti SC", serif; font-size: 32px; font-weight: 520; }
.stats-grid span { color: var(--muted); font-size: 10px; }
.history-card { margin-top: 25px; padding: 22px; border-radius: var(--radius-lg); background: rgba(255,255,255,.48); }
.history-list { display: grid; gap: 3px; }
.history-item { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 13px 0; border-top: 1px solid rgba(33,49,45,.08); }
.history-item strong { display: block; font-size: 13px; }.history-item span { color: var(--muted); font-size: 11px; }

.settings-list { display: grid; gap: 10px; }
.settings-list article { display: flex; gap: 15px; padding: 19px; border-radius: 20px; background: rgba(255,255,255,.5); }
.settings-icon { display: grid; flex: 0 0 38px; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--sage-pale); color: var(--sage-dark); }
.settings-list strong { font-size: 14px; }.settings-list p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.danger-button { width: 100%; margin-top: 24px; padding: 13px; background: rgba(143,75,75,.08); color: #8f4b4b; font-size: 12px; }
.version { margin: 20px 0; color: #999; font-size: 10px; text-align: center; }

.bottom-nav { position: fixed; z-index: 30; right: 12px; bottom: calc(10px + var(--safe-bottom)); left: 12px; display: grid; grid-template-columns: repeat(4,1fr); max-width: 580px; margin: auto; padding: 8px; border: 1px solid rgba(255,255,255,.7); border-radius: 25px; background: rgba(252,250,245,.88); box-shadow: 0 14px 40px rgba(33,49,45,.16); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.bottom-nav button { display: grid; place-items: center; gap: 2px; min-height: 52px; border: 0; border-radius: 18px; background: transparent; color: #7a837e; cursor: pointer; font-size: 9px; }
.bottom-nav button span { font-size: 18px; line-height: 1; }.bottom-nav button.active { background: var(--ink); color: white; }

.player-sheet { position: fixed; z-index: 100; inset: 0; visibility: hidden; opacity: 0; transition: opacity .25s, visibility .25s; }
.player-sheet.open { visibility: visible; opacity: 1; }
.player-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(21,31,28,.38); backdrop-filter: blur(4px); }
.player-panel { position: absolute; right: 0; bottom: 0; left: 0; max-width: 620px; max-height: 94vh; margin: auto; overflow-y: auto; padding: 10px 24px calc(30px + var(--safe-bottom)); border-radius: 32px 32px 0 0; background: var(--paper); box-shadow: 0 -20px 60px rgba(19,30,26,.2); transform: translateY(100%); transition: transform .35s cubic-bezier(.2,.75,.25,1); }
.player-sheet.open .player-panel { transform: translateY(0); }
.sheet-handle { width: 42px; height: 5px; margin: 0 auto 9px; border-radius: 10px; background: #cbc8c0; }
.player-actions { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.icon-button { width: 42px; height: 42px; color: var(--ink); font-size: 25px; }
.player-artwork { position: relative; display: grid; place-items: center; width: min(62vw, 270px); aspect-ratio: 1; margin: 15px auto 22px; overflow: hidden; border-radius: 50%; background: var(--sage-pale); transition: background .2s; }
.player-artwork.sage { background: var(--sage-pale); } .player-artwork.sky { background: var(--sky); } .player-artwork.sand { background: var(--sand); } .player-artwork.rose { background: var(--rose); } .player-artwork.violet { background: var(--violet); }
.art-ring { position: absolute; border: 1px solid rgba(33,49,45,.16); border-radius: 50%; }.ring-a { width: 74%; height: 74%; }.ring-b { width: 46%; height: 46%; }
.player-artwork i { width: 18%; height: 28%; border: 2px solid rgba(33,49,45,.42); border-radius: 70% 0 70% 0; transform: rotate(45deg); }
.player-panel > .eyebrow, .player-panel > h2, .player-summary { text-align: center; }
.player-panel > h2 { margin: 0; font-family: ui-serif, "Songti SC", serif; font-size: 28px; font-weight: 560; }
.player-summary { max-width: 440px; margin: 9px auto 22px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.voice-switch { display: grid; grid-template-columns: 1fr 1fr; max-width: 280px; margin: 0 auto 20px; padding: 4px; border: 1px solid rgba(69,102,90,.14); border-radius: 999px; background: rgba(255,255,255,.54); }
.voice-switch button { padding: 8px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.voice-switch button.active { background: var(--ink); color: white; box-shadow: 0 4px 12px rgba(33,49,45,.16); }
.seek-bar { width: 100%; height: 4px; accent-color: var(--sage-dark); cursor: pointer; }
.time-row { display: flex; justify-content: space-between; margin-top: 5px; color: var(--muted); font-size: 10px; }
.play-controls { display: grid; grid-template-columns: 1fr 48px 68px 48px 1fr; align-items: center; gap: 9px; margin: 17px 0 20px; }
.small-control, .round-control, .main-play { border: 0; background: transparent; cursor: pointer; }
.small-control { color: var(--muted); font-size: 11px; }.round-control { font-size: 25px; }.round-control small { font-size: 8px; }.main-play { display: grid; place-items: center; width: 68px; height: 68px; padding-left: 5px; border-radius: 50%; background: var(--ink); color: white; font-size: 22px; box-shadow: 0 14px 25px rgba(33,49,45,.2); }
.complete-button { width: 100%; padding: 13px; border: 1px solid rgba(69,102,90,.22); background: transparent; color: var(--sage-dark); font-size: 12px; }
.transcript-panel { margin-top: 22px; padding: 20px; border-radius: 22px; background: rgba(255,255,255,.58); }
.transcript-panel p { margin: 0; padding: 11px 0; border-top: 1px solid rgba(33,49,45,.07); color: #4f5a56; font-size: 13px; line-height: 1.8; }
.transcript-panel p:first-child { border-top: 0; }
.toast { position: fixed; z-index: 150; bottom: calc(98px + var(--safe-bottom)); left: 50%; visibility: hidden; min-width: 180px; padding: 12px 17px; border-radius: 999px; background: var(--ink); color: white; box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, 10px); transition: .25s; font-size: 12px; text-align: center; }
.toast.show { visibility: visible; opacity: 1; transform: translate(-50%,0); }

@media (min-width: 720px) {
  .topbar { padding-inline: 28px; }
  .view { padding-inline: 28px; }
  .hero { padding: 65px 50px 42px; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .library-list { grid-template-columns: repeat(2, 1fr); }
  .library-card { grid-template-columns: 78px 1fr auto; }
}

/* Study cards on Home */
.study-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .study-grid { grid-template-columns: 1fr 1fr; } }
.study-card { display: flex; flex-direction: column; justify-content: space-between; padding: 22px; border: 1px solid rgba(33,49,45,.08); border-radius: var(--radius-lg); cursor: pointer; transition: transform .2s, box-shadow .2s; }
.study-card:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(33,49,45,.08); }
.study-card.sage { background: linear-gradient(135deg, rgba(220,231,223,.75), rgba(255,255,255,.6)); }
.study-card.sky { background: linear-gradient(135deg, rgba(202,221,225,.75), rgba(255,255,255,.6)); }
.study-tag { align-self: flex-start; padding: 3px 9px; border-radius: 999px; background: rgba(33,49,45,.08); color: var(--sage-dark); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.study-card strong { margin: 10px 0 6px; font-family: ui-serif, "Songti SC", serif; font-size: 19px; line-height: 1.35; }
.study-card p { margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.study-action { color: var(--sage-dark); font-size: 12px; font-weight: 600; }

/* Library Tab Switcher */
.library-tabs { display: flex; gap: 6px; margin: 0 0 20px; padding: 5px; border-radius: 999px; background: rgba(33,49,45,.06); max-width: 480px; }
.lib-tab { flex: 1; padding: 9px 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 500; transition: all .2s; text-align: center; }
.lib-tab.active { background: var(--ink); color: white; box-shadow: 0 3px 10px rgba(33,49,45,.14); }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Featured Lecture Card */
.featured-lecture-card { padding: 26px 22px; border: 1px solid rgba(69,102,90,.18); border-radius: var(--radius-lg); background: rgba(255,255,255,.72); box-shadow: 0 12px 36px rgba(33,49,45,.06); }
.featured-lecture-header { margin-bottom: 16px; }
.featured-lecture-header h2 { margin: 6px 0 4px; font-family: ui-serif, "Songti SC", serif; font-size: 24px; font-weight: 580; }
.featured-lecture-header p { margin: 0; color: var(--muted); font-size: 13px; }
.lecture-intro-summary { padding: 14px; border-radius: 16px; background: var(--sage-pale); color: #2e433b; font-size: 13px; line-height: 1.7; margin-bottom: 20px; }
.lecture-intro-summary p { margin: 6px 0 0; }
.lecture-axioms-grid { display: grid; gap: 8px; margin-bottom: 24px; }
@media (min-width: 600px) { .lecture-axioms-grid { grid-template-columns: 1fr 1fr; } }
.axiom-card { padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.8); border: 1px solid rgba(33,49,45,.06); }
.axiom-badge { display: inline-block; padding: 2px 7px; border-radius: 6px; background: rgba(69,102,90,.12); color: var(--sage-dark); font-size: 10px; font-weight: 700; margin-bottom: 5px; }
.axiom-card p { margin: 0; font-size: 12px; line-height: 1.6; color: #374642; }

.lecture-sections { display: grid; gap: 16px; }
.lecture-section-block { padding: 18px 20px; border-radius: 18px; background: rgba(252,250,245,.82); border: 1px solid rgba(33,49,45,.06); }
.lecture-section-block h3 { margin: 0 0 12px; font-family: ui-serif, "Songti SC", serif; font-size: 17px; font-weight: 600; color: var(--ink); }
.lecture-body p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.8; color: #374642; }
.lecture-body p:last-child { margin-bottom: 0; }
.lecture-body strong { color: #1c2b27; font-weight: 600; }
.lecture-body code { font-family: monospace; font-size: 12px; padding: 2px 5px; background: rgba(33,49,45,.08); border-radius: 4px; }
.lecture-ol, .lecture-ul { margin: 8px 0 12px 20px; padding: 0; font-size: 13.5px; line-height: 1.8; color: #374642; }
.lecture-ol li, .lecture-ul li { margin-bottom: 6px; }
.lecture-ol li strong, .lecture-ul li strong { color: #1c2b27; }
.lecture-quote { margin: 12px 0 14px; padding: 12px 16px; border-left: 3px solid var(--sage); background: rgba(220,231,223,.3); border-radius: 0 12px 12px 0; font-style: normal; color: #283d36; line-height: 1.75; font-size: 13px; }
.lecture-action-box { margin-top: 20px; padding: 16px; border-radius: 16px; background: var(--paper-deep); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lecture-action-box p { margin: 0; font-size: 12px; color: var(--muted); }

/* Curriculum Stages (30 Lectures) */
.curriculum-stages { display: grid; gap: 12px; }
.stage-item { border: 1px solid rgba(33,49,45,.08); border-radius: 18px; background: rgba(255,255,255,.55); overflow: hidden; }
.stage-summary-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.stage-summary-btn strong { font-size: 14px; color: var(--ink); display: block; }
.stage-summary-btn span { font-size: 11px; color: var(--muted); }
.stage-chevron { font-size: 12px; color: var(--muted); transition: transform .25s; }
.stage-item.open .stage-chevron { transform: rotate(180deg); }
.stage-lectures-list { display: none; padding: 0 16px 14px; border-top: 1px solid rgba(33,49,45,.06); }
.stage-item.open .stage-lectures-list { display: grid; gap: 8px; padding-top: 12px; }
.curriculum-lecture-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.6); font-size: 12px; }
.curriculum-lecture-row.completed { border-left: 3px solid var(--sage-dark); background: rgba(220,231,223,.4); }
.lecture-status-pill { font-size: 10px; padding: 2px 7px; border-radius: 999px; background: rgba(33,49,45,.07); color: var(--muted); }
.lecture-status-pill.ready { background: var(--sage-pale); color: var(--sage-dark); font-weight: 600; }

/* Cases List & Case Cards */
.cases-list { display: grid; gap: 16px; }
.case-card { border: 1px solid rgba(33,49,45,.08); border-radius: 20px; background: rgba(255,255,255,.8); box-shadow: 0 4px 20px rgba(33,49,45,.03); overflow: hidden; transition: all .2s ease; }
.case-card:hover { box-shadow: 0 8px 28px rgba(33,49,45,.06); background: rgba(255,255,255,.95); }
.case-card-header { padding: 18px 20px; cursor: pointer; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.case-badge-row { display: flex; gap: 6px; margin-bottom: 8px; }
.case-cat-pill { font-size: 10px; font-weight: 700; color: var(--sage-dark); background: var(--sage-pale); padding: 2px 8px; border-radius: 999px; }
.case-tag-pill { font-size: 10px; color: var(--muted); background: rgba(33,49,45,.06); padding: 2px 8px; border-radius: 999px; }
.case-card-header h3 { margin: 0 0 6px; font-family: ui-serif, "Songti SC", serif; font-size: 18px; font-weight: 560; color: var(--ink); }
.case-card-header p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.case-toggle-arrow { flex: none; font-size: 12px; color: var(--muted); padding-top: 4px; transition: transform .25s ease; }
.case-card.open .case-toggle-arrow { transform: rotate(180deg); color: var(--sage-dark); }

.case-card-body { display: none; padding: 16px 22px 24px; border-top: 1px solid rgba(33,49,45,.06); }
.case-card.open .case-card-body { display: block; animation: fadeIn .22s ease; }

/* Scenes inside the case */
.case-scene-section { margin-top: 22px; }
.case-scene-section:first-child { margin-top: 4px; }

.scene-label-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.scene-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; letter-spacing: .02em; }
.scene-badge.student { background: rgba(184, 155, 126, 0.15); color: #8c6843; }
.scene-badge.coach { background: var(--sage-pale); color: var(--sage-dark); }
.scene-badge.science { background: rgba(69, 102, 90, 0.08); color: #3f5e53; }
.scene-hint { font-size: 11px; color: var(--muted); }

/* 1. Student Voice (Experiential quote) */
.student-experience-quote { margin: 0; padding: 14px 18px; background: rgba(246, 243, 236, 0.65); border-left: 3px solid #c9b9a6; border-radius: 0 14px 14px 0; font-size: 13.5px; line-height: 1.75; color: #3b3934; }
.student-experience-quote p { margin: 0; }

/* 2. Dialogue Timeline (No boxes, pure progressive flow) */
.dialogue-timeline { display: flex; flex-direction: column; padding-left: 2px; margin-top: 4px; }
.dialogue-node { display: flex; gap: 14px; position: relative; }
.node-indicator { display: flex; flex-direction: column; align-items: center; flex: none; width: 24px; }
.node-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--sage-pale); color: var(--sage-dark); font-family: ui-monospace, SFMono-Regular, monospace; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 3px #ffffff; z-index: 1; }
.node-stem { width: 1.5px; flex: 1; background: rgba(69, 102, 90, 0.16); margin: 4px 0; }
.dialogue-node:last-child .node-stem { display: none; }

.node-body { flex: 1; padding-bottom: 18px; }
.dialogue-node:last-child .node-body { padding-bottom: 4px; }
.node-title-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; padding-top: 2px; }
.node-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.node-intent { font-size: 11px; color: var(--muted); }

.node-content { font-size: 13px; line-height: 1.72; color: #2b3b35; }
.dialogue-line { margin: 0 0 6px; }
.dialogue-line:last-child { margin-bottom: 0; }

/* Mantra Group / Sequential Recitation */
.mantra-group { margin: 10px 0 8px; padding: 12px 16px; background: rgba(220, 231, 223, 0.42); border-left: 3px solid var(--sage-dark); border-radius: 0 14px 14px 0; }
.mantra-group:last-child { margin-bottom: 0; }
.mantra-group-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mantra-tag { font-size: 10px; font-weight: 700; color: var(--sage-dark); text-transform: uppercase; letter-spacing: .06em; }
.mantra-subtag { font-size: 10px; color: var(--muted); padding: 1px 6px; border-radius: 4px; background: rgba(255,255,255,.65); }
.mantra-list { display: flex; flex-direction: column; gap: 10px; }
.mantra-item { display: flex; align-items: flex-start; gap: 10px; }
.mantra-index { flex: none; width: 18px; height: 18px; border-radius: 50%; background: rgba(69, 102, 90, 0.15); color: var(--sage-dark); font-family: ui-monospace, monospace; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.mantra-content { flex: 1; }
.mantra-quote { font-family: ui-serif, "Songti SC", serif; font-size: 14.5px; font-weight: 600; line-height: 1.6; color: #12241f; }
.mantra-hint { display: block; font-size: 11px; color: #4a6358; margin-top: 2px; }

/* 3. Mechanism Prose */
.mechanism-section { padding-top: 14px; border-top: 1px dashed rgba(33,49,45,.1); }
.mechanism-prose { font-size: 12.5px; line-height: 1.75; color: #4a5a54; padding-left: 2px; }
.mechanism-prose p { margin: 0; }

.case-action-row { margin-top: 20px; display: flex; justify-content: flex-end; }

/* Account / Cloud Sync Card */
.account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
  background: var(--white);
  border: 1px solid rgba(69, 102, 90, 0.12);
  box-shadow: 0 4px 16px rgba(45, 62, 55, 0.04);
}
.account-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.account-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.account-badge::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a0aba5;
}
.account-badge.online {
  color: var(--sage-dark);
}
.account-badge.online::before {
  background: #2ea043;
  box-shadow: 0 0 0 2px rgba(46, 160, 67, 0.2);
}
.account-tip {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}
.account-email {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}
.account-action-btn {
  padding: 8px 16px;
  border: 1px solid rgba(69, 102, 90, 0.25);
  border-radius: 999px;
  background: var(--sage-pale);
  color: var(--sage-dark);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.account-logout-btn {
  padding: 6px 14px;
  border: 1px solid rgba(200, 60, 60, 0.2);
  border-radius: 999px;
  background: transparent;
  color: #a83838;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* Auth Modal / Panel */
.auth-panel {
  max-width: 440px;
  margin: 0 auto;
  text-align: left;
}
.auth-header {
  margin-bottom: 24px;
}
.auth-header h2 {
  margin: 0 0 8px;
  font-family: ui-serif, "Songti SC", serif;
  font-size: 24px;
  color: var(--ink);
}
.auth-subtitle {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.form-group input {
  padding: 12px 16px;
  border: 1px solid rgba(69, 102, 90, 0.2);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  font-size: 15px;
}
.form-group input:focus {
  border-color: var(--sage-dark);
  outline: none;
  box-shadow: 0 0 0 3px rgba(69, 102, 90, 0.15);
}
.link-button {
  background: transparent;
  border: none;
  color: var(--sage-dark);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 0;
  text-align: right;
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
