:root {
  --bg: #0e1116;
  --bg-soft: #12161d;
  --panel: #161b23;
  --panel-2: #1b212b;
  --border: #232b36;
  --border-soft: #1c232d;
  --text: #e9edf4;
  --text-dim: #b3bccb;
  --muted: #7f8a9b;
  --accent: #4f9cf9;
  --accent-soft: rgba(79, 156, 249, .14);
  --accent-line: rgba(79, 156, 249, .45);
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(900px 480px at 50% -160px, rgba(79, 156, 249, .12), transparent 70%);
  background-repeat: no-repeat;
}

.hidden { display: none !important; }

.view {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px calc(40px + var(--safe-b));
}

/* ---------------- 首页 ---------------- */
.home-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.home-head h1 {
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: .5px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  letter-spacing: .3px;
}

.stats {
  text-align: right;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}
.stats b { color: var(--accent); font-size: 15px; }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 600px) {
  .grid { grid-template-columns: 1fr 1fr; gap: 14px; }
}

.card {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 18px 18px 16px;
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color .18s, transform .18s, background .18s;
  overflow: hidden;
}

.card:hover { border-color: #2f3a48; transform: translateY(-1px); }
.card:active { transform: scale(.994); }

.card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(255,255,255,.05);
  color: var(--text-dim);
  border: 1px solid var(--border);
  letter-spacing: .4px;
}
.tag.lv { color: #9ecbff; border-color: rgba(79,156,249,.3); background: var(--accent-soft); }
.tag.done { color: #6ee7a8; border-color: rgba(110,231,168,.28); background: rgba(110,231,168,.1); }

.card-title {
  font-size: 16.5px;
  font-weight: 650;
  margin: 0 0 4px;
  line-height: 1.35;
}
.card-title-zh {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 12px;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.bar {
  height: 3px;
  background: #232a35;
  border-radius: 3px;
  margin-top: 12px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #4f9cf9, #6ee7a8);
  border-radius: 3px;
  transition: width .3s;
}

.home-foot {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border-soft);
  padding-top: 16px;
}
.home-foot b { color: var(--text-dim); font-weight: 600; }
.hint-key { opacity: .7; }

/* ---------------- 播放页 ---------------- */
#view-player {
  max-width: 620px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.player-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 22px;
}

.titles { flex: 1; min-width: 0; }
.titles h2 {
  font-size: 18px;
  margin: 0 0 5px;
  font-weight: 650;
  line-height: 1.35;
}
.titles p { margin: 0; font-size: 12.5px; color: var(--muted); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  cursor: pointer;
  transition: background .16s, color .16s, border-color .16s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }

.icon-btn.round { border-radius: 50%; width: 46px; height: 46px; }

.player-body { flex: 1; display: flex; flex-direction: column; }

.seek-wrap { margin: 4px 0 18px; }

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent) var(--p, 0%), #262e3a var(--p, 0%));
}
input[type=range]::-moz-range-track {
  height: 5px; border-radius: 4px; background: #262e3a;
}
input[type=range]::-moz-range-progress {
  height: 5px; border-radius: 4px; background: var(--accent);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  margin-top: -4.5px;
  box-shadow: 0 0 0 4px rgba(79,156,249,.22);
}
input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; border: none; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 4px rgba(79,156,249,.22);
}

.times {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  margin: 6px 0 26px;
}

.play-btn {
  width: 76px; height: 76px;
  border-radius: 50%;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #5aa6ff, #3d7fe0);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 30px -8px rgba(79,156,249,.75), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .14s, box-shadow .18s;
}
.play-btn:hover { transform: scale(1.03); }
.play-btn:active { transform: scale(.96); }
.play-btn svg { width: 32px; height: 32px; }
#icon-play { margin-left: 3px; }

.rate-row {
  display: flex;
  gap: 7px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.rate-row button {
  min-width: 52px;
  padding: 7px 10px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  transition: all .15s;
}
.rate-row button:hover { color: var(--text-dim); border-color: #33404f; }
.rate-row button.on {
  color: #cfe4ff;
  border-color: var(--accent-line);
  background: var(--accent-soft);
  font-weight: 600;
}

.sub-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}

.cc-btn {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.cc-btn.on {
  color: #cfe4ff;
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.lang-switch {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  padding: 2px;
  margin-left: 2px;
}
.lang-switch button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.lang-switch button.on { background: #2b3644; color: #dfe9f7; }

.loop-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  font-size: 12.5px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.loop-btn svg { width: 15px; height: 15px; }
.loop-btn.on {
  color: #ffd48a;
  border-color: rgba(255,212,138,.4);
  background: rgba(255,212,138,.1);
}

.sub-area {
  margin-top: 14px;
  flex: 1;
  min-height: 190px;
  max-height: 42vh;
  overflow-y: auto;
  padding: 6px 2px 22px;
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sub-area::-webkit-scrollbar { display: none; }

.line {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  opacity: .42;
}
.line:hover { background: rgba(255,255,255,.035); opacity: .8; }
.line.active { background: rgba(255,255,255,.055); opacity: 1; }

.spk {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 10.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 3px;
  font-weight: 700;
  background: #2a3340;
  color: #93a1b5;
}
.spk.a { background: rgba(79,156,249,.18); color: #8ec2ff; }
.spk.b { background: rgba(110,231,168,.14); color: #7fd9a8; }

.line-text { flex: 1; min-width: 0; }
.en-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-dim);
  letter-spacing: .1px;
}
.line.active .en-text { color: #fff; }
.zh-text {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  margin-top: 3px;
}
.line.active .zh-text { color: #9fb0c6; }

.sub-off-hint {
  margin: 14px 0 30px;
  padding: 34px 0;
  text-align: center;
  font-size: 12.5px;
  color: #5d697a;
  border: 1px dashed var(--border);
  border-radius: 14px;
}

/* ---------------- 短语抽屉 ---------------- */
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 13, .62);
  backdrop-filter: blur(6px);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }

.sheet-inner {
  width: 100%;
  max-width: 620px;
  max-height: 78vh;
  background: var(--bg-soft);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  border: 1px solid var(--border-soft);
  border-bottom: none;
  padding: 20px 20px calc(24px + var(--safe-b));
  overflow-y: auto;
  animation: up .24s cubic-bezier(.2,.8,.3,1);
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.sheet-head h3 { margin: 0; font-size: 15px; font-weight: 650; }

.phrase-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.phrase-item:last-child { border-bottom: none; }
.ph-en { font-size: 14.5px; color: #cfe4ff; font-weight: 600; }
.ph-zh { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; }
.ph-note { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

@media (max-width: 400px) {
  .view { padding-left: 16px; padding-right: 16px; }
  .rate-row button { min-width: 46px; padding: 7px 7px; }
  .controls { gap: 18px; }
  .play-btn { width: 68px; height: 68px; }
}
