:root {
  color-scheme: dark;
  --bg: #121214;
  --card: #1b1b1f;
  --card-hi: #232329;
  --ink: #f0f0f2;
  --ink-soft: #a2a2aa;
  --ink-faint: #71717a;
  --line: #2b2b31;
  --accent: #6ebf92;
  --accent-soft: #1e2c25;
  --accent-ink: #8fd6b0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 4px 16px rgba(0,0,0,.3);
}


* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- header ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top) + 9px) 14px 9px;
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
}

.back {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 17px;
  display: grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease;
}
.back:active { transform: scale(.92); }

.topbar h1 {
  flex: 1 1 auto;
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar .meta {
  flex: 0 0 auto;
  font-size: 12.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* progress bar under header */
.progress-wrap {
  max-width: 720px;
  margin: 7px auto 0;
  height: 2px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .35s cubic-bezier(.4,0,.2,1);
}

/* ---------- layout ---------- */

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px;
}

.hero {
  padding: 0 2px 10px;
}
.hero h2 {
  margin: 0 0 3px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.022em;
}
.hero p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

/* ---------- catalog cards ---------- */

.deck-list { display: grid; gap: 9px; }

.deck {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform .14s ease, border-color .14s ease;
}
.deck:active { transform: scale(.985); border-color: var(--accent); }

.deck-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 3px;
}
.deck-title {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -.012em;
}
.deck-count {
  flex: 0 0 auto;
  font-size: 11.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.deck-desc {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.deck-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}
.deck-progress .track {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.deck-progress .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .4s ease;
}
.deck-progress .pct {
  font-size: 12px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  text-align: right;
}

/* ---------- lesson cards ---------- */

.sent-list { display: grid; gap: 7px; }

.sent {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px 9px;
  box-shadow: var(--shadow);
  transition: border-color .2s ease;
}
.sent.revealed { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

.sent-no {
  position: absolute;
  top: 9px;
  right: 11px;
  font-size: 10.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.zh {
  font-size: 15px;
  font-weight: 550;
  line-height: 1.42;
  padding-right: 22px;
  color: var(--ink);
}

.en-block {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .3s cubic-bezier(.4,0,.2,1), opacity .25s ease;
  opacity: 0;
  margin-top: 0;
}
.sent.revealed .en-block {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 8px;
}
.en-inner { overflow: hidden; }

.en {
  font-size: 14.5px;
  line-height: 1.42;
  color: var(--accent-ink);
  font-weight: 500;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.actions {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}

.btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  transition: transform .1s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(.965); }

.btn-primary {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-ink);
  flex: 1 1 auto;
}

.btn-play {
  background: var(--accent);
  border-color: transparent;
  color: #12211a;
  min-width: 74px;
}
.btn-play.playing {
  background: var(--accent-ink);
}
.btn-play:disabled {
  opacity: .45;
  cursor: default;
}

.btn-icon { font-size: 13px; line-height: 1; }

/* footer note */
.foot {
  text-align: center;
  color: var(--ink-faint);
  font-size: 11.5px;
  padding: 18px 12px calc(18px + env(safe-area-inset-bottom));
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 50;
  max-width: 84vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* skeleton */
.skeleton {
  height: 96px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--card) 25%, var(--card-hi) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (min-width: 560px) {
  .hero h2 { font-size: 25px; }
  .sent { padding: 12px 14px 10px; }
}

/* ---------- 磨耳朵播放器 ---------- */

body.has-player { padding-bottom: 132px; }

.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.player.show { transform: translateY(0); }

.player-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pb-main {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #12211a;
  font-size: 19px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .12s ease, background .2s ease;
}
.pb-main:active { transform: scale(.93); }
.pb-main.on { background: var(--accent-ink); }

.pb-info { flex: 1 1 auto; min-width: 0; }

.pb-label {
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.pb-label b {
  color: var(--ink);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.pb-now {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--ink);
  opacity: .8;
}
.pb-track {
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
  margin-top: 6px;
}
.pb-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 2px;
  transition: width .3s linear;
}

.pb-btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.pb-btn:active { transform: scale(.95); }
.pb-btn.active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 600;
}

/* 当前句高亮 */
.sent.current {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent), var(--shadow);
}

@media (max-width: 380px) {
  .pb-btn.opt { display: none; }
}
