* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #0d0f14; --panel: #151a22; --panel2: #1c2733; --line: #232a35;
  --fg: #e8e8e8; --dim: #66707f; --green: #4a9d6b; --green2: #7fd6a0; --gold: #e8b84b;
}
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font-family: system-ui, -apple-system, sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
}
main { flex: 1; overflow-y: auto; }
section { padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); min-height: 100%; }

#tabbar {
  display: flex; border-top: 1px solid var(--line); background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom); flex-shrink: 0;
}
#tabbar a {
  flex: 1; text-align: center; padding: 12px 0; color: var(--dim);
  text-decoration: none; font-size: 14px;
}
#tabbar a.active { color: var(--fg); }
body.playing #tabbar { display: none; } /* 播放中全屏，防误触 */

h1 { font-size: 18px; margin-bottom: 4px; }
.dim { color: var(--dim); font-size: 12px; }

/* 首页故事卡 */
.storycard {
  display: flex; gap: 12px; align-items: center; background: var(--panel);
  border-radius: 14px; padding: 14px; margin-top: 10px; color: inherit;
  text-decoration: none; border: 1px solid transparent;
}
.storycard.current { border-color: var(--green); }
.storycard .meta { flex: 1; min-width: 0; }
.storycard b { display: block; font-size: 15px; margin-bottom: 2px; }
.storycard .pbar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 8px; }
.storycard .pbar div { height: 3px; background: var(--green); border-radius: 2px; }
.badge { background: var(--gold); color: #1a1a1a; font-size: 11px; font-weight: 700;
         border-radius: 9px; padding: 2px 8px; flex-shrink: 0; }
.weekgroup { margin-top: 18px; }
.weekgroup.resume { margin-top: 12px; }
.weekhead {
  display: flex; align-items: baseline; justify-content: space-between;
  color: var(--fg); margin: 0 2px 2px;
}
.weekhead b { font-size: 14px; }
.weekhead span { color: var(--dim); font-size: 11px; }

/* 播放页（黑屏点听） */
#view-player { display: flex; flex-direction: column; user-select: none; }
.modeswitch { display: flex; background: var(--panel); border-radius: 20px; padding: 3px;
              width: 190px; margin: 0 auto; }
.modeswitch button { flex: 1; border: 0; background: none; color: var(--dim);
                     padding: 7px 0; border-radius: 17px; font-size: 13px; }
.modeswitch button.on { background: #2a4a3a; color: var(--green2); }
#stage { flex: 1; display: flex; flex-direction: column; justify-content: center;
         align-items: center; gap: 28px; }
#bigdot {
  width: 96px; height: 96px; border-radius: 50%; border: 2px solid var(--green);
  color: var(--green); font-size: 36px; display: flex; align-items: center;
  justify-content: center; transition: opacity 1s;
}
body.playing #bigdot { animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.35; } }
#ptitle { text-align: center; color: var(--dim); font-size: 13px; line-height: 1.8; }

#overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 28px; background: rgba(13, 15, 20, 0.92); opacity: 0; pointer-events: none;
  transition: opacity 0.4s; text-align: center;
}
#overlay.show { opacity: 1; }
#overlay .sent { font-size: 24px; line-height: 1.6; font-weight: 500; }
#overlay .sent u { text-decoration-color: var(--gold); text-underline-offset: 5px; }
#overlay .hint { position: absolute; bottom: 40px; left: 0; right: 0; }

#vocab {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  padding: 24px; background: rgba(13, 15, 20, 0.95);
}
#vocab.show { display: flex; }
#vocab .card { background: var(--panel2); border: 1px solid #3a5a78; border-radius: 16px;
               padding: 18px; width: 100%; max-width: 340px; }
.word { background: var(--panel); border-radius: 10px; padding: 10px 12px; margin-top: 8px;
        font-size: 15px; line-height: 1.5; }
.word b { color: var(--gold); }

/* 复盘页 / 统计页共用 */
.reviewcard { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px;
              padding: 12px; margin-top: 10px; font-size: 14px; line-height: 1.6; }
.reviewcard.done { opacity: 0.5; }
.reviewcard .row { display: flex; gap: 10px; align-items: flex-start; }
.cbox { width: 22px; height: 22px; border: 2px solid var(--green); border-radius: 6px;
        flex-shrink: 0; color: var(--green); text-align: center; line-height: 19px;
        background: none; font-size: 14px; }
.btn { border: 0; border-radius: 10px; background: var(--panel); color: var(--fg);
       padding: 8px 14px; font-size: 13px; }
.btn.primary { background: var(--green); color: #fff; }
.statbig { display: flex; gap: 10px; margin: 14px 0; }
.statbig > div { flex: 1; background: var(--panel); border-radius: 14px; padding: 14px 8px;
                 text-align: center; }
.statbig b { font-size: 24px; color: var(--green2); display: block; }
.statbig span { font-size: 11px; color: var(--dim); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 64px; margin: 8px 0 2px; }
.bars div { flex: 1; background: #2a4a3a; border-radius: 3px 3px 0 0; min-height: 2px; }
.bars div.today { background: var(--gold); }
.daysrow { display: flex; font-size: 10px; color: var(--dim); }
.daysrow span { flex: 1; text-align: center; }
