/* ── reset ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Inter', sans-serif;
  background: #dcd9d2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  overflow: hidden;
}
button { font-family: inherit; color: inherit; }
textarea::placeholder { color: var(--sub); }
::-webkit-scrollbar { width: 0; height: 0; }

/* ── animations ────────────────────────────────────────────────────────── */
@keyframes cardIn   { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }
@keyframes qIn      { from { opacity:0; transform:translateY(8px);  } to { opacity:1; transform:none; } }
@keyframes wordPop  { from { opacity:.35; } to { opacity:1; } }
@keyframes spin     { to { transform:rotate(360deg); } }
@keyframes pulse    { 0%,100% { opacity:.2; } 50% { opacity:1; } }
@keyframes eq       { from { transform:scaleY(.28); } to { transform:scaleY(1); } }
@keyframes recdot   { 0%,100% { opacity:1; } 50% { opacity:.2; } }
@keyframes slideInRight { from { transform:translateX(100%); } to { transform:translateX(0); } }
@keyframes slideInLeft  { from { transform:translateX(-100%); } to { transform:translateX(0); } }
@keyframes fadeSlow { from { opacity:0; } to { opacity:1; } }
@keyframes doneIn   { from { opacity:0; transform:scale(.96); } to { opacity:1; transform:none; } }
@keyframes flagWave { from { transform:rotate(-4deg); } to { transform:rotate(3deg); } }
@keyframes fillBar  { from { width:0%; } to { width:100%; } }

/* ── device frame (desktop) ────────────────────────────────────────────── */
.stage { display: flex; align-items: center; justify-content: center; }
.device {
  width: 392px; height: 812px;
  background: #0c0c0c;
  border-radius: 54px;
  padding: 11px;
  position: relative;
  box-shadow: 0 2px 1px rgba(255,255,255,.12) inset,
              0 40px 80px -24px rgba(20,18,14,.5),
              0 0 0 1px rgba(0,0,0,.3);
  flex: none;
}
.notch {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 108px; height: 30px; background: #000; border-radius: 999px; z-index: 40;
}

/* ── theme tokens + screen ─────────────────────────────────────────────── */
.screen {
  --rad: 13px;
  --fd: 'Archivo', sans-serif;
  --fb: 'Archivo', sans-serif;
  --fm: 'JetBrains Mono', monospace;
  --sat: env(safe-area-inset-top, 0px);
  position: relative;
  width: 100%; height: 100%;
  border-radius: 43px;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--fb);
  display: flex; flex-direction: column;
  padding-top: var(--sat);
}
.screen[data-theme="light"] {
  --bg:#ffffff; --sf:#f5f5f4; --sf2:#ececeb; --ink:#141414; --sub:#9a9a98;
  --ln:#e7e7e5; --ibg:#141414; --iink:#ffffff;
}
.screen[data-theme="dark"] {
  --bg:#0b0b0b; --sf:#161615; --sf2:#1f1f1e; --ink:#f3f3f1; --sub:#79797a;
  --ln:#262625; --ibg:#f3f3f1; --iink:#0b0b0b;
}

/* ── ios status bar ────────────────────────────────────────────────────── */


/* viewport for screens */
.viewport { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.scr { flex: 1; min-height: 0; display: flex; flex-direction: column; animation: qIn .26s ease both; }

/* ── generic ──────────────────────────────────────────────────────────── */
.mono { font-family: var(--fm); }
.eyebrow {
  font-family: var(--fm); font-size: 10px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--sub);
}
.icon-btn {
  background: transparent; border: 0; cursor: pointer; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.navgrid {
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  padding: 14px 16px 0; flex: none;
}
.hairline { height: 1px; background: var(--ln); }

/* ── login ────────────────────────────────────────────────────────────── */
.login-scr { padding: 0 30px 30px; }
.login-hero {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.login-icon {
  width: 60px; height: 60px; border-radius: 16px; background: var(--ibg);
  display: flex; align-items: center; justify-content: center; margin-bottom: 30px;
}
.login-icon span {
  font-family: var(--fd); font-size: 30px; font-weight: 700;
  color: var(--iink); letter-spacing: -.04em;
}
.login-title {
  margin: 0; font-family: var(--fd); font-weight: 600; font-size: 34px;
  line-height: 1; letter-spacing: -.03em; color: var(--ink);
}
.login-sub {
  margin: 12px 0 0; font-size: 14px; line-height: 1.5; color: var(--sub); max-width: 230px;
}
.login-foot { flex: none; display: flex; flex-direction: column; gap: 11px; }
.login-btn {
  display: flex; align-items: center; gap: 13px; width: 100%;
  background: var(--sf); border: 1px solid var(--ln); border-radius: var(--rad);
  padding: 15px 18px; cursor: pointer; font-family: var(--fb);
}
.login-ic { width: 22px; height: 22px; flex: none; display: flex; align-items: center; justify-content: center; }
.login-label { flex: 1; text-align: left; font-size: 15px; font-weight: 600; color: var(--ink); }
.login-chev { color: var(--sub); display: flex; align-items: center; }
.login-tos { margin: 11px 0 0; text-align: center; font-size: 11px; line-height: 1.6; color: var(--sub); }
.tos-link { color: var(--ink); text-decoration: underline; cursor: pointer; }

/* ── library ──────────────────────────────────────────────────────────── */
.lib-head { padding: 22px 24px 14px; flex: none; }
.lib-title {
  margin: 0; font-family: var(--fd); font-weight: 600; font-size: 38px;
  line-height: .95; letter-spacing: -.03em; color: var(--ink);
}
.add-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--ln);
  background: transparent; color: var(--ink); font-size: 20px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.lib-list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 24px 30px; }
.book-row {
  display: flex; gap: 15px; align-items: center; width: 100%; text-align: left;
  background: transparent; border: 0; border-top: 1px solid var(--ln);
  padding: 17px 2px; cursor: pointer;
}
.book-cover {
  width: 48px; height: 66px; flex: none; background: var(--sf2);
  border: 1px solid var(--ln); border-radius: var(--rad); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover .initials {
  font-family: var(--fm); font-size: 12px; font-weight: 500;
  letter-spacing: .04em; color: var(--ink);
}
.book-meta { flex: 1; min-width: 0; }
.book-meta .bt {
  font-family: var(--fd); font-size: 18px; font-weight: 600; line-height: 1.12;
  letter-spacing: -.02em; color: var(--ink); margin-bottom: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.book-meta .ba { font-size: 12px; color: var(--sub); margin-bottom: 10px; }
.book-prog { display: flex; align-items: center; gap: 9px; }
.book-prog .track { flex: 1; height: 2px; background: var(--ln); position: relative; overflow: hidden; }
.book-prog .fill { position: absolute; left: 0; top: 0; height: 100%; background: var(--ink); }
.book-prog .pct { font-family: var(--fm); font-size: 9px; letter-spacing: .08em; color: var(--sub); flex: none; }
.book-chev { color: var(--sub); flex: none; display: flex; align-items: center; }
.lib-empty { text-align: center; color: var(--sub); padding: 60px 24px; font-size: 14px; line-height: 1.6; }

/* ── profile button (library) ─────────────────────────────────────────── */
.profile-btn {
  width: 38px; height: 38px; border-radius: 50%; background: var(--ibg);
  border: 0; cursor: pointer; font-family: var(--fd); font-size: 13px;
  font-weight: 600; color: var(--iink); letter-spacing: .01em;
  display: flex; align-items: center; justify-content: center;
}

/* ── profile screen ───────────────────────────────────────────────────── */
.prof-head { padding: 18px 24px 6px; flex: none; display: flex; align-items: center; gap: 14px; }
.prof-avatar {
  width: 54px; height: 54px; border-radius: 50%; background: var(--ibg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--fd); font-size: 20px; font-weight: 600; color: var(--iink); flex: none;
}
.prof-name { font-family: var(--fd); font-size: 22px; font-weight: 600; letter-spacing: -.02em; color: var(--ink); line-height: 1.05; }
.prof-email { font-size: 12px; color: var(--sub); margin-top: 3px; }
.prof-tabs { padding: 16px 24px 0; flex: none; display: flex; gap: 5px; background: transparent; }
.prof-tabs-wrap { background: var(--sf); border: 1px solid var(--ln); border-radius: 999px; padding: 4px; display: flex; gap: 5px; }
.prof-tab {
  flex: 1; border: 0; cursor: pointer; padding: 9px; border-radius: 999px;
  font-family: var(--fb); font-size: 12px; font-weight: 500;
  background: transparent; color: var(--sub);
}
.prof-tab.on { font-weight: 600; background: var(--ibg); color: var(--iink); }
.prof-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px 30px; }

/* stats 2×2 */
.prof-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-bottom: 24px; }
.stat-card { border: 1px solid var(--ln); border-radius: var(--rad); padding: 16px; }
.stat-val { font-family: var(--fd); font-size: 30px; font-weight: 600; letter-spacing: -.03em; color: var(--ink); line-height: 1; }
.stat-lbl { font-family: var(--fm); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--sub); margin-top: 8px; }

/* heatmap */
.heat-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 5px; margin-top: 11px; }

/* settings */
.settings-group { margin-bottom: 22px; }
.settings-rows { border: 1px solid var(--ln); border-radius: var(--rad); overflow: hidden; }
.settings-row {
  display: flex; align-items: center; gap: 10px; width: 100%; background: transparent;
  border: 0; cursor: pointer; padding: 14px 15px; font-family: var(--fb);
}
.settings-row.sep { border-top: 1px solid var(--ln); }
.settings-label { flex: 1; text-align: left; font-size: 14px; font-weight: 500; color: var(--ink); }
.settings-val { font-family: var(--fm); font-size: 11px; letter-spacing: .04em; color: var(--sub); }
.settings-chev { font-size: 17px; color: var(--sub); }
.signout-btn {
  width: 100%; background: transparent; border: 1px solid var(--ln); border-radius: 999px;
  padding: 13px; cursor: pointer; font-family: var(--fb); font-size: 13px;
  font-weight: 500; color: var(--sub); margin-top: 2px;
}

/* ── reader ───────────────────────────────────────────────────────────── */
.rd-title {
  font-family: var(--fd); font-size: 15px; font-weight: 600; letter-spacing: -.02em;
  color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rd-author { font-family: var(--fm); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--sub); margin-top: 2px; }
.dots { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.dots span { width: 4px; height: 4px; border-radius: 50%; background: var(--ink); }
.rd-chapter { text-align: center; padding: 20px 26px 0; flex: none; }
#rdChapter {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.45; height: 2.9em;
}
.rd-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; }
.rd-word { position: relative; width: 100%; height: 140px; }
.guide { position: absolute; left: 34px; right: 34px; height: 1px; background: var(--ln); }
.guide.top { top: calc(50% - 46px); }
.guide.bot { top: calc(50% + 46px); }
.tick { position: absolute; left: 50%; transform: translateX(-50%); width: 1px; background: var(--ink); }
.tick.top { top: calc(50% - 60px); height: 14px; }
.tick.bot { top: calc(50% + 46px); height: 14px; }
.word {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline;
  font-family: var(--fd); font-size: 44px; letter-spacing: -.02em;
}
.word .b { justify-self: end;   color: var(--ink); white-space: nowrap; }
.word .p { color: var(--ink); font-weight: 700; white-space: nowrap; }
.word .a { justify-self: start; color: var(--ink); white-space: nowrap; }
.word.pop { animation: wordPop .11s ease both; }
.rd-controls { flex: none; padding: 0 26px 30px; }
.rd-times { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.rd-pct { font-family: var(--fm); font-size: 11px; font-weight: 500; letter-spacing: .04em; color: var(--ink); }
.rd-left { font-family: var(--fm); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--sub); }
.scrub { position: relative; height: 22px; cursor: pointer; margin-bottom: 18px; }
.scrub .track { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); height: 2px; background: var(--ln); }
.scrub .fill { position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 2px; background: var(--ink); }
.scrub .mark { position: absolute; top: 50%; transform: translate(-50%,-50%); width: 1.5px; height: 9px; background: var(--sub); opacity: .6; }
.scrub .handle { position: absolute; top: 50%; transform: translate(-50%,-50%); width: 15px; height: 15px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 4px var(--bg); }
.transport { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.wpm-box { display: flex; align-items: center; gap: 10px; justify-self: start; }
.wpm-step {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--ln);
  background: transparent; color: var(--ink); font-size: 16px; line-height: 1; cursor: pointer;
}
.wpm-val { text-align: center; min-width: 34px; }
.wpm-val .n { font-family: var(--fd); font-size: 18px; font-weight: 700; line-height: 1; color: var(--ink); }
.wpm-val .l { font-family: var(--fm); font-size: 8px; letter-spacing: .16em; color: var(--sub); margin-top: 2px; }
.play {
  width: 62px; height: 62px; border-radius: 50%; background: var(--ibg); border: 0;
  cursor: pointer; display: flex; align-items: center; justify-content: center; justify-self: center;
}
.play .tri { width: 0; height: 0; border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent var(--iink); margin-left: 4px; }
.play .bars { display: flex; gap: 5px; }
.play .bars i { width: 5px; height: 20px; background: var(--iink); border-radius: 1px; display: block; }
.back10 { justify-self: end; background: transparent; border: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; color: var(--ink); }
.back10 .g { display: flex; align-items: center; justify-content: center; }
.back10 .l { font-family: var(--fm); font-size: 8px; letter-spacing: .1em; color: var(--sub); margin-top: 1px; }

/* ── loading ──────────────────────────────────────────────────────────── */
.loading { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 48px; animation: qIn .3s ease both; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--ln); border-top-color: var(--ink); animation: spin .8s linear infinite; }
.loading .lc { font-family: var(--fm); font-size: 10px; letter-spacing: .24em; text-transform: uppercase; color: var(--sub); margin-top: 30px; }
.loading .lt { margin: 13px 0 0; font-family: var(--fd); font-size: 22px; line-height: 1.3; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.dots-pulse { display: flex; gap: 6px; margin-top: 24px; }
.dots-pulse i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); animation: pulse 1.1s ease-in-out infinite; }
.dots-pulse i:nth-child(2) { animation-delay: .2s; }
.dots-pulse i:nth-child(3) { animation-delay: .4s; }

/* ── quiz ─────────────────────────────────────────────────────────────── */
.quiz-prog { height: 3px; background: var(--ln); flex: none; position: relative; }
.quiz-prog .fill { position: absolute; left: 0; top: 0; height: 100%; background: var(--ink); transition: width .3s ease; }
.quiz-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px 8px; }
.quiz-card-wrap { animation: qIn .3s ease both; }
.quiz-eyebrow { font-family: var(--fm); font-size: 9px; letter-spacing: .2em; text-transform: uppercase; color: var(--sub); margin-bottom: 16px; }
.quiz-context { margin: 0 0 14px; font-family: var(--fb); font-size: 14px; line-height: 1.55; color: var(--sub); }
.quiz-ask { margin: 0 0 22px; font-family: var(--fd); font-size: 20px; line-height: 1.32; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.quiz-opts { display: flex; flex-direction: column; gap: 9px; }
.quiz-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px;
  border-radius: var(--rad); font-family: var(--fb); text-align: left;
  transition: background .2s, color .2s, border-color .2s, opacity .2s;
  animation: cardIn .34s ease both;
  background: var(--sf); border: 1px solid var(--ln); color: var(--ink); cursor: pointer;
}
.quiz-opt .badge {
  width: 26px; height: 26px; border-radius: 7px; flex: none; display: flex;
  align-items: center; justify-content: center; font-family: var(--fm);
  font-size: 11px; font-weight: 500; background: var(--sf2); color: var(--sub);
}
.quiz-opt .txt { flex: 1; font-size: 13px; line-height: 1.4; }
.quiz-opt .mark { font-family: var(--fm); font-size: 13px; width: 14px; flex: none; text-align: center; }
.quiz-opt.correct { background: var(--ibg); border-color: var(--ibg); color: var(--iink); }
.quiz-opt.correct .badge { background: var(--iink); color: var(--ibg); }
.quiz-opt.wrong { background: transparent; border-color: var(--sub); color: var(--sub); }
.quiz-opt.wrong .badge { background: transparent; color: var(--sub); border: 1px solid var(--sub); }
.quiz-opt.dim { opacity: .4; }
.quiz-opt.locked { cursor: default; }
.quiz-foot { flex: none; padding: 8px 22px 24px; display: flex; flex-direction: column; gap: 11px; align-items: center; }
.quiz-feedback { font-family: var(--fm); font-size: 10px; letter-spacing: .12em; color: var(--sub); min-height: 13px; }
.btn-pill-out { background: transparent; border: 1px solid var(--ln); color: var(--sub); border-radius: 999px; padding: 12px 28px; font-family: var(--fb); font-size: 13px; font-weight: 500; cursor: pointer; }
.btn-pill { background: var(--ibg); border: 0; color: var(--iink); border-radius: 999px; padding: 13px 34px; font-family: var(--fb); font-size: 14px; font-weight: 600; cursor: pointer; }

/* ── chapter result ───────────────────────────────────────────────────── */
.chr-body { flex: 1; min-height: 0; overflow-y: auto; padding: 30px 26px 14px; }
.chr-center { text-align: center; }
.chr-score { font-family: var(--fd); font-size: 66px; line-height: .9; font-weight: 600; letter-spacing: -.04em; color: var(--ink); margin-top: 12px; }
.chr-pct { font-family: var(--fm); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--sub); margin-top: 11px; }
.chr-msg { margin: 16px auto 0; font-family: var(--fd); font-size: 15px; line-height: 1.45; color: var(--ink); max-width: 250px; }
.thoughts { border-top: 1px solid var(--ln); margin-top: 28px; padding-top: 20px; }
.thoughts .sub { margin: 0 0 14px; font-size: 12px; line-height: 1.45; color: var(--sub); }
.seg { display: flex; gap: 5px; background: var(--sf); border: 1px solid var(--ln); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; cursor: pointer; padding: 9px; border-radius: 999px; font-family: var(--fb); font-size: 12px; font-weight: 500; background: transparent; color: var(--sub); }
.seg button.on { font-weight: 600; background: var(--ibg); color: var(--iink); }
.thought-area { width: 100%; min-height: 104px; resize: none; background: var(--sf); border: 1px solid var(--ln); border-radius: var(--rad); padding: 13px 14px; font-family: var(--fb); font-size: 14px; line-height: 1.5; color: var(--ink); outline: none; }
.thought-count { text-align: right; font-family: var(--fm); font-size: 9px; letter-spacing: .06em; color: var(--sub); margin-top: 6px; }
.rec-idle { display: flex; align-items: center; gap: 12px; width: 100%; background: var(--sf); border: 1px solid var(--ln); border-radius: var(--rad); padding: 13px; cursor: pointer; font-family: var(--fb); }
.rec-active { display: flex; align-items: center; gap: 12px; width: 100%; background: var(--sf); border: 1px solid var(--ink); border-radius: var(--rad); padding: 13px; }
.rec-saved { display: flex; align-items: center; gap: 11px; width: 100%; background: var(--sf); border: 1px solid var(--ln); border-radius: var(--rad); padding: 13px; }
.rec-circle { width: 40px; height: 40px; border-radius: 50%; background: var(--ibg); display: flex; align-items: center; justify-content: center; flex: none; border: 0; cursor: pointer; }
.rec-mic { width: 11px; height: 16px; border-radius: 6px; background: var(--iink); }
.rec-stop { width: 13px; height: 13px; border-radius: 3px; background: var(--iink); }
.rec-play-tri { width: 0; height: 0; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent var(--iink); margin-left: 3px; }
.rec-label { text-align: left; }
.rec-label .t { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.rec-label .s { display: block; font-size: 11px; color: var(--sub); margin-top: 2px; }
.eq { flex: 1; display: flex; align-items: center; gap: 2px; height: 26px; overflow: hidden; }
.eq i { flex: 1; border-radius: 2px; background: var(--ink); transform-origin: center; display: block; }
.eq.saved i { background: var(--ln); }
.rec-meta { display: flex; align-items: center; gap: 6px; flex: none; }
.rec-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); animation: recdot 1s ease-in-out infinite; }
.rec-time { font-family: var(--fm); font-size: 12px; color: var(--ink); }
.rec-del { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--ln); background: transparent; color: var(--sub); font-size: 13px; cursor: pointer; flex: none; }
.chr-foot { flex: none; padding: 8px 26px 24px; }
.btn-block { width: 100%; background: var(--ibg); color: var(--iink); border: 0; border-radius: 999px; padding: 15px; font-family: var(--fb); font-size: 14px; font-weight: 600; letter-spacing: .01em; cursor: pointer; }

/* ── recap ────────────────────────────────────────────────────────────── */
.recap-head { padding: 26px 24px 18px; flex: none; text-align: center; }
.recap-score { font-family: var(--fd); font-size: 62px; line-height: .9; font-weight: 600; letter-spacing: -.04em; color: var(--ink); margin-top: 14px; }
.recap-list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 24px 18px; display: flex; flex-direction: column; gap: 10px; }
.recap-chhead { font-family: var(--fm); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--sub); margin: 6px 0 9px; }
.recap-item { display: flex; gap: 11px; align-items: flex-start; border: 1px solid var(--ln); border-radius: var(--rad); padding: 13px 14px; }
.recap-status { width: 23px; height: 23px; border-radius: 6px; flex: none; display: flex; align-items: center; justify-content: center; font-family: var(--fm); font-size: 12px; }
.recap-status.ok { background: var(--ibg); color: var(--iink); }
.recap-status.no { background: transparent; border: 1px solid var(--sub); color: var(--sub); }
.recap-q { font-family: var(--fd); font-size: 13.5px; line-height: 1.34; font-weight: 600; letter-spacing: -.01em; color: var(--ink); margin-bottom: 7px; }
.recap-ans { display: flex; gap: 9px; align-items: baseline; }
.recap-ans .l { font-family: var(--fm); font-size: 8px; letter-spacing: .14em; text-transform: uppercase; color: var(--sub); flex: none; }
.recap-ans .v { flex: 1; font-size: 12.5px; line-height: 1.4; font-weight: 500; color: var(--ink); }
.recap-foot { flex: none; padding: 6px 24px 26px; display: flex; justify-content: center; }

/* ── chapter done / intro transitions ────────────────────────────────── */
.ch-done {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 0 48px; animation: fadeSlow .85s ease both;
}
.ch-done-flag {
  margin-bottom: 28px;
  animation: flagWave 1.3s ease-in-out infinite alternate;
  transform-origin: bottom left;
}
.ch-done-title {
  margin: 0; font-family: var(--fd); font-size: 32px; line-height: 1.1;
  font-weight: 600; letter-spacing: -.03em; color: var(--ink);
  animation: doneIn 1s ease .15s both;
}
.ch-done-sub { margin-top: 14px; letter-spacing: .26em; animation: doneIn 1s ease .28s both; }

.ch-intro { flex: 1; min-height: 0; display: flex; flex-direction: column; animation: fadeSlow .7s ease both; }
.ch-intro-body {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 0 48px;
}
.ch-intro-title {
  margin: 16px 0 0; font-family: var(--fd); font-size: 34px; line-height: 1.12;
  font-weight: 600; letter-spacing: -.03em; color: var(--ink);
  animation: doneIn 1s ease .22s both;
}
.ch-intro-foot {
  flex: none; padding: 0 32px 40px; display: flex; flex-direction: column;
  align-items: center; gap: 16px;
}
.ch-intro-skip {
  position: relative; overflow: hidden; width: 100%;
  background: var(--sf); border: 1px solid var(--ln); border-radius: 999px;
  padding: 14px; cursor: pointer; font-family: var(--fb);
  font-size: 13px; font-weight: 500; letter-spacing: .02em; color: var(--sub);
}
.ch-intro-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: var(--sf2); animation: fillBar 3.4s linear both;
}
.ch-intro-later {
  background: transparent; border: 0; cursor: pointer; font-family: var(--fb);
  font-size: 12.5px; line-height: 1.4; color: var(--sub); padding: 2px 6px;
}

/* ── menu + notes overlays ────────────────────────────────────────────── */
.overlay { position: absolute; inset: 0; z-index: 30; }
.overlay .scrim { position: absolute; inset: 0; background: rgba(0,0,0,.18); }
.menu {
  position: absolute; top: 54px; right: 16px; width: 230px; background: var(--bg);
  border: 1px solid var(--ln); border-radius: var(--rad);
  box-shadow: 0 18px 44px -12px rgba(0,0,0,.4); overflow: hidden; animation: qIn .16s ease both;
}
.menu .mtitle { font-family: var(--fm); font-size: 9px; letter-spacing: .2em; text-transform: uppercase; color: var(--sub); padding: 14px 16px 9px; }
.menu .mitem { display: flex; align-items: center; gap: 12px; width: 100%; background: transparent; border: 0; border-top: 1px solid var(--ln); padding: 14px 16px; cursor: pointer; font-family: var(--fb); text-align: left; }
.menu .mitem .label { flex: 1; }
.menu .mitem .label .t { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.menu .mitem .label .s { display: block; font-size: 11px; color: var(--sub); margin-top: 1px; }
.menu .mitem .gly { width: 22px; flex: none; text-align: center; font-size: 15px; color: var(--ink); }
.menu .mitem .chev { color: var(--sub); display: flex; align-items: center; }
.menu .mitem .tag { font-family: var(--fm); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--sub); }
.df-track {
  width: 38px; height: 22px; border-radius: 999px; flex: none; padding: 2px;
  display: flex; align-items: center; justify-content: flex-start;
  background: var(--ln); transition: background .2s, justify-content .2s;
}
.df-track.on { background: var(--ibg); justify-content: flex-end; }
.df-knob {
  width: 18px; height: 18px; border-radius: 50%; background: var(--bg);
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.notes-screen { position: absolute; inset: 0; z-index: 35; background: var(--bg); display: flex; flex-direction: column; animation: qIn .24s ease both; }
.notes-title { padding: 14px 24px 6px; flex: none; }
.notes-title h1 { margin: 0; font-family: var(--fd); font-weight: 600; font-size: 30px; line-height: 1; letter-spacing: -.03em; color: var(--ink); }
.notes-title .sub { font-size: 12px; color: var(--sub); margin-top: 5px; }
.notes-list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 24px 26px; display: flex; flex-direction: column; gap: 14px; }
.note-card { border: 1px solid var(--ln); border-radius: var(--rad); padding: 15px 16px; }
.note-card .ch { font-family: var(--fm); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--sub); margin-bottom: 10px; }
.note-card .text { margin: 0; font-family: var(--fd); font-size: 14px; line-height: 1.5; color: var(--ink); }
.note-card .empty { font-size: 13px; color: var(--sub); font-style: italic; }
.note-audio { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.note-audio .pc { width: 30px; height: 30px; border-radius: 50%; background: var(--ibg); display: flex; align-items: center; justify-content: center; flex: none; border: 0; cursor: pointer; }
.note-audio .pc .tri { width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 8px; border-color: transparent transparent transparent var(--iink); margin-left: 2px; }
.note-audio .time { font-family: var(--fm); font-size: 11px; color: var(--ink); flex: none; }

/* ── header (desktop chrome above phone) ──────────────────────────────── */
.app-header {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; z-index: 50;
}
.app-header .brand { font-family: var(--fb, 'Inter'); font-size: 17px; font-weight: 700; color: #2a2823; letter-spacing: -.02em; }
.app-header .tag { font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: #8a877e; }
.theme-toggle {
  display: flex; align-items: center; gap: 7px; background: #cdc9c0; border: 0;
  border-radius: 999px; padding: 8px 14px; cursor: pointer;
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: #2a2823;
}

/* desktop: sem safe-area (notch é mock visual) */
@media (min-width: 481px) and (display-mode: browser) {
  .screen { padding-top: 0; }
}

/* ── fullscreen on real phone / installed PWA ─────────────────────────── */
@media (max-width: 480px), (display-mode: standalone) {
  body { background: #000; }
  .app-header { display: none; }
  .device {
    width: 100vw; width: 100dvw; height: 100vh; height: 100dvh;
    border-radius: 0; padding: 0; box-shadow: none; background: var(--bg);
  }
  .notch { display: none; }
  .screen { border-radius: 0; padding-top: env(safe-area-inset-top, 0px); }
  .rd-controls, .chr-foot, .quiz-foot, .recap-foot, .ch-intro-foot { padding-bottom: max(30px, env(safe-area-inset-bottom)); }
}
