:root {
  --bg: #faf9f5;
  --surface: #ffffff;
  --text: #1f1e1d;
  --muted: #75716b;
  --line: #e7e3da;
  --accent: #c2603f;
  --on-accent: #ffffff;
  --user: #f3e7dd;
  --ja: #f4f1ea;
  --code: #f0ede5;
  --danger: #c0392b;
  --high: #3f7d58;
  --mid: #b0873a;
  --low: #c2603f;
  --poor: #c0392b;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  --font-ja: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1e1d;
    --surface: #2a2927;
    --text: #f3f1eb;
    --muted: #a19c93;
    --line: #3a3834;
    --accent: #e3906f;
    --on-accent: #1f1e1d;
    --user: #3a2d26;
    --ja: #242321;
    --code: #181716;
    --danger: #ff7b6b;
    --high: #7fbf95;
    --mid: #d8b26a;
    --low: #e3906f;
    --poor: #ff7b6b;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }

/* ---------- header ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 96px 1fr 96px;
  align-items: center;
  min-height: calc(52px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid var(--line);
}
.bar-left { display: flex; justify-content: flex-start; }
.bar-right { display: flex; justify-content: flex-end; }
.bar h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-btn {
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:active { background: var(--line); }
#back { font-size: 34px; font-weight: 300; padding-bottom: 4px; }
#action { font-size: 17px; font-weight: 700; }
#action.on { background: var(--accent); color: var(--on-accent); }

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 max(14px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

/* ---------- chat list ---------- */
.search { padding-top: 12px; }
.search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.search input:focus { border-color: var(--accent); }
.status { min-height: 1.2em; margin: 10px 4px 0; font-size: 13px; color: var(--muted); }
.status.error { color: var(--danger); }
.status.busy::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border: 2px solid var(--muted);
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -1px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.group { margin: 22px 4px 8px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.session {
  display: block;
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.session:active { background: var(--ja); }
.s-title { display: block; font-weight: 600; line-height: 1.35; }
.s-meta { display: flex; gap: 8px; margin-top: 4px; font-size: 13px; color: var(--muted); }
.s-proj { max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-meta time { margin-left: auto; white-space: nowrap; }
.empty { padding: 48px 12px; text-align: center; color: var(--muted); }

/* ---------- chat ---------- */
.chat-head { padding: 18px 4px 4px; }
.chat-title { margin: 0; font-size: 22px; line-height: 1.3; }
.chat-title-ja { margin: 6px 0 0; font-family: var(--font-ja); font-size: 14px; color: var(--muted); }
.chat-sub { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.hint { margin: 10px 0 0; font-size: 13px; color: var(--accent); }
.day { display: flex; align-items: center; gap: 10px; margin: 26px 0 6px; font-size: 12px; color: var(--muted); }
.day::before, .day::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.msg { display: flex; flex-direction: column; align-items: flex-start; margin: 12px 0; }
.msg.user { align-items: flex-end; }
.bubble {
  max-width: 100%;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 18px 18px 18px 6px;
  background: var(--surface);
  cursor: pointer;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}
.msg.user .bubble { max-width: 88%; border-color: transparent; border-radius: 18px 18px 6px 18px; background: var(--user); }
.bubble:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bubble[aria-expanded="true"] { border-color: var(--accent); }
.bubble.static { cursor: default; }
.bubble.pending .en { font-family: var(--font-ja); font-size: 15px; }
.meta { margin: 4px 8px 0; font-size: 12px; color: var(--muted); }
.ja {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  background: var(--ja);
  font-family: var(--font-ja);
  font-size: 15px;
  line-height: 1.75;
}
.msg.user .ja { background: color-mix(in srgb, var(--bg) 70%, transparent); }
.ja-label { margin-bottom: 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--accent); }
.badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--ja);
  color: var(--muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
}
.muted { color: var(--muted); }

/* ---------- rendered markdown ---------- */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .65em; }
.md h3, .md h4, .md h5, .md h6 { margin: .9em 0 .35em; font-size: 1em; line-height: 1.35; }
.md h3 { font-size: 1.08em; }
.md ul, .md ol { margin: 0 0 .65em; padding-left: 1.35em; }
.md li { margin: .2em 0; }
.md li.d1 { margin-left: 1.2em; }
.md li.d2 { margin-left: 2.4em; }
.md li.d3 { margin-left: 3.6em; }
.md blockquote { margin: 0 0 .65em; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.md code { padding: .1em .35em; border-radius: 5px; background: var(--code); font-family: var(--mono); font-size: .84em; }
.md pre {
  margin: 0 0 .65em;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--code);
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
  overflow-wrap: normal;
  -webkit-overflow-scrolling: touch;
}
.md pre code { padding: 0; background: none; font-size: inherit; white-space: pre; }
.md .table { margin: 0 0 .65em; overflow-x: auto; }
.md table { border-collapse: collapse; font-size: 14px; line-height: 1.45; }
.md th, .md td { padding: 5px 9px; border: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: normal; }
.md th { background: var(--ja); }
.md a, .md .ref { color: var(--accent); }
.md hr { margin: 1em 0; border: 0; border-top: 1px solid var(--line); }

/* ---------- read aloud + shadowing ---------- */
.tools { display: flex; gap: 8px; margin-top: 9px; }
.msg.user .tools { justify-content: flex-end; }
.tool {
  min-height: 26px;
  padding: 1px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tool.speak { min-width: 36px; }
.tool.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sh { padding-top: 14px; }
.sh-src { margin: 0; font-size: 13px; color: var(--muted); }
.sh-note { margin: 6px 0 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.sh-lines { margin: 16px 0 0; padding: 0; list-style: none; }
.sh-line {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  font-size: 19px;
  line-height: 1.5;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sh-line.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--text); }
.sh-n { flex: none; width: 1.5em; padding-top: .45em; color: var(--accent); font-size: 12px; font-weight: 700; }
.sh-ja { margin-top: 12px; }
.sh-bar {
  position: sticky;
  bottom: 0;
  margin-top: 18px;
  padding: 12px 0 calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
}
.sh-keys { display: flex; justify-content: center; gap: 10px; }
.sh-key {
  min-width: 56px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--accent);
  font-size: 17px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sh-key.wide { min-width: 92px; }
.sh-key.on, .sh-key:active { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.sh-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.sh-row .sh-note { flex: 1 1 100%; margin: 0; }
.sh-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sh-chip {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sh-chip.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.sh-chip[disabled] { opacity: .45; cursor: default; }
.seg { display: flex; margin-left: auto; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button {
  padding: 6px 10px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--accent); color: var(--on-accent); }

/* ---------- speaking practice ---------- */
.practice {
  display: block;
  margin-top: 12px;
  padding: 13px 16px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.practice:active { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.practice-main { display: block; font-weight: 600; color: var(--accent); }
.practice-main::after { content: " ›"; }
.practice-sub { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }

.qz { padding-top: 14px; }
.qz-top { display: flex; align-items: center; gap: 10px; }
.qz-day {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.qz-count { flex: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qz-dots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.qz-dot {
  min-width: 44px;
  height: 44px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.qz-dot.done { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.qz-dot.done::after { content: "✓"; margin-left: 3px; font-size: 11px; }
.qz-dot.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.qz-card { margin: 16px 0 0; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.qz-theme { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.qz-theme-ja { font-family: var(--font-ja); font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--muted); }
.qz-ask { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.qz-ask:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
.qz-en { margin: 0; font-size: 21px; line-height: 1.45; overflow-wrap: anywhere; }
.qz-ja {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  background: var(--ja);
  font-family: var(--font-ja);
  font-size: 15px;
  line-height: 1.75;
}
.qz-tap { margin: 10px 0 0; font-family: var(--font-ja); font-size: 12px; color: var(--muted); }
.qz-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.qz-speak {
  flex: none;
  min-width: 56px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--accent);
  font-size: 15px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.qz-speak.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.qz-speak:focus-visible, .qz-chip:focus-visible, .qz-btn:focus-visible, .qz-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qz-src {
  max-width: 58%;
  min-height: 44px;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qz-label { display: block; margin: 20px 2px 8px; font-size: 14px; font-weight: 600; }
.qz-label-ja { display: block; margin-top: 2px; font-family: var(--font-ja); font-size: 12px; font-weight: 400; color: var(--muted); }
.qz-tag {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  vertical-align: 1px;
}
.qz-answer {
  display: block;
  width: 100%;
  min-height: 132px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  line-height: 1.55;
  resize: vertical;
  -webkit-appearance: none;
  appearance: none;
}
.qz-answer:focus { border-color: var(--accent); outline: none; }
.qz-saved { margin: 6px 2px 0; font-size: 12px; color: var(--muted); }
.qz-saved.on { color: var(--accent); }

/* ---------- saying it out loud ---------- */
.qz-mic { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.qz-rec, .qz-check {
  flex: 1 1 46%;
  min-width: 140px;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: var(--surface);
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.qz-rec.on { border-color: var(--danger); background: var(--danger); color: var(--on-accent); animation: pulse 1.4s ease-in-out infinite; }
.qz-rec[disabled], .qz-check[disabled] { border-color: var(--line); color: var(--muted); cursor: default; animation: none; }
.qz-rec:focus-visible, .qz-check:focus-visible, .qz-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes pulse { 50% { opacity: .62; } }

.qz-note { min-height: 1.3em; margin: 10px 2px 0; font-size: 13px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.qz-note.ok { color: var(--accent); }
.qz-note.error { color: var(--danger); }
.qz-note.busy::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border: 2px solid var(--muted);
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -1px;
  animation: spin .8s linear infinite;
}

.tools-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.tool-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}
.tool-en { font-size: 15px; font-weight: 700; }
.tool-en i { margin-left: 7px; font-family: var(--font-ja); font-style: normal; font-size: 11px; font-weight: 400; color: var(--muted); }
.tool-sub { font-family: var(--font-ja); font-size: 11px; color: var(--muted); }

.qz-skip {
  margin-left: auto;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-family: var(--font-ja);
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.qz-skip span { margin-left: 6px; font-family: var(--font); font-size: 11px; letter-spacing: .03em; text-transform: uppercase; }
.qz-skip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.qz-takes { display: flex; gap: 8px; margin: 16px 0 -4px; }
.qz-take {
  flex: 1;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font: inherit;
  font-family: var(--font-ja);
  font-size: 11px;
  color: var(--muted);
}
.qz-take b { font-family: var(--font); font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); }
.qz-take.done { cursor: pointer; }
.qz-take.now { border-style: dashed; border-color: var(--accent); color: var(--accent); }
.qz-take.now::after { content: attr(data-now); font-size: 15px; font-weight: 800; }
.qz-take.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.qz-set {
  margin: 14px 0 0;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--ja);
  font-family: var(--font-ja);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.qz-set b { margin-left: 6px; font-size: 15px; }
.qz-row.again { margin-top: 14px; }
.qz-coach { margin-top: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.qz-verdict { margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--muted); }
.qz-verdict.ok { color: var(--accent); }
.qz-verdict.no { color: var(--danger); }
.qz-score { margin: 0 0 4px; }
.qz-score-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.qz-kicker-ja { margin-left: 6px; font-family: var(--font-ja); font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--muted); }
.qz-pct { font-size: 30px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.qz-pct i { font-size: 15px; font-style: normal; font-weight: 700; }
.qz-bars { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.qz-bars li { display: grid; grid-template-columns: 92px 1fr 42px; align-items: center; gap: 9px; }
.qz-bar-name { font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.qz-bar-name i { display: block; font-family: var(--font-ja); font-style: normal; font-weight: 400; font-size: 10px; letter-spacing: 0; text-transform: none; }
.qz-bar { height: 7px; border-radius: 4px; background: var(--ja); overflow: hidden; }
.qz-bar i { display: block; height: 100%; border-radius: 4px; }
.qz-bars b { font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.qz-fix-pct { float: right; font-size: 13px; font-weight: 800; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.high { color: var(--high); }
.mid { color: var(--mid); }
.low { color: var(--low); }
.poor { color: var(--poor); }
.qz-bar i.high { background: var(--high); }
.qz-bar i.mid { background: var(--mid); }
.qz-bar i.low { background: var(--low); }
.qz-bar i.poor { background: var(--poor); }
.qz-keep { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.qz-keep-list { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.qz-keep-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 7px 11px; border-radius: 10px; background: var(--ja); font-size: 15px; }
.qz-keep-list li.said { background: var(--user); }
.qz-keep-list li.said b::after { content: " ✓"; color: var(--high); }
.qz-keep-list span { font-family: var(--font-ja); font-size: 12px; color: var(--muted); }
.qz-review { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin: 0 0 10px; }
.qz-review b { padding: 3px 9px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.qz-review span { font-family: var(--font-ja); font-size: 12px; color: var(--muted); }
.qz-fix { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.qz-fix:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.qz-fix-en { margin: 6px 0 0; font-size: 17px; line-height: 1.55; overflow-wrap: anywhere; }
.qz-tips {
  margin: 14px 0 0;
  padding: 12px 14px 12px 30px;
  border-radius: 12px;
  background: var(--ja);
  font-family: var(--font-ja);
  font-size: 14px;
  line-height: 1.7;
}
.qz-tips li { margin: 2px 0; overflow-wrap: anywhere; }
.qz-follow {
  margin: 14px -15px -15px;
  padding: 14px 15px;
  border-top: 1px solid var(--accent);
  border-radius: 0 0 15px 15px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.qz-go {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.qz-go.again { width: 100%; font-family: var(--font-ja); font-size: 15px; }

.qz-turns { margin: 16px 0 0; padding: 0; list-style: none; }
.qz-turn {
  margin-bottom: 8px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.qz-turn.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.qz-turn-en { margin: 6px 0 0; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.qz-turn.on .qz-turn-en { font-size: 19px; font-weight: 600; }
/* A turn he is not answering is a reminder, not the text itself. */
.qz-turn:not(.on) .qz-turn-en, .qz-turn-ans {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.qz-turn-ans {
  margin: 10px 0 0;
  padding: 9px 12px;
  border-left: 3px solid var(--line);
  border-radius: 10px;
  background: var(--ja);
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.qz-turn-now { font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--accent); }
.qz-turn .qz-speak { background: var(--surface); }

.qz-hints { margin: 16px 0 0; padding: 0; list-style: none; }
.qz-hint {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-size: 16px;
  overflow-wrap: anywhere;
}
.qz-hint-n { flex: none; color: var(--accent); font-size: 11px; font-weight: 700; }
.qz-hint-en { font-weight: 600; }
.qz-hint-ja { font-family: var(--font-ja); font-size: 13px; color: var(--muted); }
.qz-starter {
  margin-bottom: 8px;
  padding: 13px 15px;
  border: 1px dashed var(--accent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.qz-kicker { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.qz-starter-en { margin: 6px 0 10px; font-size: 18px; line-height: 1.45; overflow-wrap: anywhere; }
.qz-starter .qz-speak { background: var(--surface); }

.qz-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.qz-btn {
  flex: 1 1 46%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: var(--surface);
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.qz-btn.model { border-style: dashed; }
.qz-btn[disabled] { border-color: var(--line); color: var(--muted); cursor: default; }
.qz-locked { flex: 1 1 46%; font-size: 12px; line-height: 1.4; color: var(--muted); }

.qz-model {
  margin-top: 16px;
  padding: 15px;
  border: 1px solid var(--accent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.qz-model-en { margin: 8px 0 0; font-size: 17px; line-height: 1.6; overflow-wrap: anywhere; }
.qz-model-ja {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--ja);
  font-family: var(--font-ja);
  font-size: 15px;
  line-height: 1.75;
}
.qz-chip {
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-family: var(--font-ja);
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.qz-chip.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

.qz-nav { display: flex; gap: 10px; margin-top: 26px; }
.qz-move {
  flex: 1;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.qz-move[disabled] { color: var(--muted); opacity: .5; cursor: default; }
.qz-none { font-size: 18px; font-weight: 600; color: var(--text); }

/* ---------- setup + settings ---------- */
.setup { max-width: 420px; margin: 0 auto; padding: 48px 8px; text-align: center; }
.setup-icon { border-radius: 22px; }
.setup h2 { margin: 18px 0 8px; font-size: 24px; }
.setup p { color: var(--muted); }
.keyform { display: flex; flex-direction: column; gap: 10px; margin: 22px 0 8px; }
.keyform input {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
}
.keyform button, .buttons button {
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  cursor: pointer;
}
.buttons { display: flex; flex-direction: column; gap: 10px; }
.buttons button { border: 1px solid var(--line); background: var(--surface); color: var(--accent); }
.buttons button.danger { color: var(--danger); }
.fine { margin-top: 24px; font-size: 12px; line-height: 1.6; color: var(--muted); }
.fine code { font-family: var(--mono); font-size: 11px; word-break: break-all; }
.card { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.kv-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); font-size: 15px; }
.kv-row:first-child { border-top: 0; }
.kv-row span:last-child { color: var(--muted); text-align: right; overflow-wrap: anywhere; }
.kv-note { margin: 0; padding: 10px 14px 12px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.5; color: var(--muted); }
.field {
  max-width: 56vw;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.check { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  box-shadow: 0 6px 24px rgb(0 0 0 / .25);
  transform: translateX(-50%);
}
.toast button { padding: 0; border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* chat-list source filter */
.seg.sources { margin: 10px 0 0; }
.seg.sources button { flex: 1; padding: 9px 6px; font-size: 13px; }

/* sign-in links (links, so they work even if a script above them fails) */
.btn-link {
  display: block;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
.authbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: var(--surface);
  font-size: 14px;
}
.authbar .btn-link { background: var(--accent); color: var(--on-accent); border-color: transparent; }

/* shadowing: how much of the sentence came through */
.sh-diff:empty { display: none; }
.sh-diff {
  margin: 10px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.sh-score { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--accent); }
.sh-model { margin: 0 0 6px; font-size: 17px; line-height: 1.5; }
.sh-model .miss { color: var(--danger); text-decoration: underline wavy; }
.sh-heard { margin: 0; font-size: 13px; color: var(--muted); }
