@font-face {
  font-family: "Pretendard";
  src: url("/fonts/PretendardVariable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #fff9e9;
  --surface: #f0f5fa;
  --surface-raised: #f8fafc;
  --line: #d6e0e9;
  --text: #142f4b;
  --muted: #5c7186;
  --accent: #1769b5;
  --accent-deep: #207aca;
  --accent-soft: #e3f0ff;
  --accent-line: #b8d8f5;
  --warm: #a56b0b;
  --warm-soft: #fcf0d5;
  --danger: #b13e41;
  --neutral: #edeeec;
  --neutral-text: #66696c;
  --neutral-line: #d2d5d5;
  --shadow: 0 14px 45px rgb(15 39 64 / 10%);
  --topbar-height: calc(88px + env(safe-area-inset-top));
  --composer-height: 180px;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080f17;
  --surface: #112337;
  --surface-raised: #152a40;
  --line: #253c51;
  --text: #edf3fa;
  --muted: #9cbbd5;
  --accent: #65b9ff;
  --accent-deep: #247dca;
  --accent-soft: #183650;
  --accent-line: #315f86;
  --warm: #f0b737;
  --warm-soft: #2c271a;
  --danger: #f19191;
  --neutral: #262a2e;
  --neutral-text: #a6aaad;
  --neutral-line: #41464b;
  --shadow: 0 14px 45px rgb(0 0 0 / 25%);
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, textarea, input { font: inherit; }
button { color: inherit; }

button:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.app-shell { min-height: 100dvh; width: min(100%, 760px); margin: 0 auto; position: relative; background: var(--bg); }

.topbar { position: fixed; z-index: 20; top: 0; left: 50%; translate: -50% 0; width: min(100%, 760px); min-height: calc(74px + env(safe-area-inset-top)); padding: calc(10px + env(safe-area-inset-top)) 20px 10px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 6px 8px; align-items: start; background: var(--bg); border-bottom: 1px solid var(--line); }

.brand { display: flex; align-items: center; justify-content: flex-start; min-width: 0; }

.brand-mark { display: none; }

.brand strong, .brand small { display: block; }
.brand-title-row { display: flex; align-items: center; flex-wrap: nowrap; gap: 6px; min-height: 44px; }
.brand-name { white-space: nowrap; }
.brand strong { font-size: clamp(17px, 4.7vw, 22px); font-weight: 760; letter-spacing: -.045em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 9px; letter-spacing: .16em; }

.usage-status { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 3px 6px; color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.5; }
.usage-status b { color: var(--muted); font-size: 10px; font-weight: 550; }
.usage-status.is-low { background: var(--warm-soft); color: var(--warm); }
.token-status { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 9px; }
.token-status[hidden] { display: none; }
.api-cost-status, .admin-user-cost { display: grid; gap: 1px; overflow-wrap: anywhere; }
.topbar:has(.api-cost-status:not([hidden])) { height: auto; min-height: calc(74px + env(safe-area-inset-top)); }
.token-gauge { width: 42px; height: 4px; border-radius: 99px; background: var(--accent); }
.admin-ai-usage { display: grid; gap: 5px; font-size: 12px; overflow-wrap: anywhere; }
.admin-ai-usage p { margin: 0; }
.admin-ai-usage small { color: var(--muted); }

.icon-button, .small-icon, .composer-icon, .send-button, .answer-actions button {
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.icon-button { width: 44px; height: 44px; aspect-ratio: 1; border: 0; border-radius: 12px; background: transparent; color: var(--accent); }

.icon-button svg { width: 22px; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.install-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: auto;
  min-width: 44px;
  height: 44px;
  aspect-ratio: auto;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.install-button svg { width: 18px; height: 18px; flex-shrink: 0; }
.install-button[hidden] { display: none; }
.install-button:disabled { opacity: .55; cursor: default; }
.topbar:has(.install-button:not([hidden])) { height: auto; min-height: calc(74px + env(safe-area-inset-top)); }
.topbar:has(.install-button:not([hidden])) .brand > .brand-content { min-width: 0; }
.topbar:has(.install-button:not([hidden])) .brand-title-row { flex-wrap: wrap; gap: 2px 7px; }
.topbar:has(.install-button:not([hidden])) .usage-status { max-width: 100%; flex-wrap: wrap; white-space: normal; }
.topbar:has(.install-button:not([hidden])) .usage-status b { min-width: 0; overflow-wrap: anywhere; }
.usage-status[hidden] { display: none; }
.new-button.study-active { border-color: var(--warm); background: var(--warm-soft); color: var(--warm); box-shadow: none; }
.study-status { position: fixed; z-index: 19; top: var(--topbar-height); left: 50%; translate: -50% 0; width: min(100%, 760px); margin: 0; padding: 8px 16px; background: var(--warm-soft); color: var(--warm); font-size: 11px; line-height: 1.5; text-align: center; }
.small-icon svg, .composer-icon svg, .answer-actions svg, .send-button svg { width: 21px; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.conversation { min-height: 100dvh; padding: calc(var(--topbar-height) + 24px) 26px calc(var(--composer-height) + 32px + env(safe-area-inset-bottom)); }
.conversation.study-on { padding-top: calc(var(--topbar-height) + 58px); }

.empty-state { display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 36px 0 28px; }

.language-controls { display: grid; margin-bottom: 34px; }
.language-hint { max-width: 100%; margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; text-align: center; overflow-wrap: anywhere; }
.language-hint.needs-language { color: var(--warm); font-weight: 700; }

.language-orbit { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }

.language-orbit button {
  min-width: 0; min-height: 48px; padding: 10px 6px;
  border: 1px solid var(--accent-line); border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); font-size: 14px;
  font-weight: 650; cursor: pointer; transition: background .16s, border-color .16s;
}
.language-orbit button[aria-pressed="false"] { background: var(--neutral); color: var(--neutral-text); border-color: var(--neutral-line); font-weight: 500; }
.language-orbit button:hover:not(:disabled) { border-color: var(--accent); }
.language-orbit button:focus-visible, .language-orbit button.needs-language { outline: 2px solid var(--accent); outline-offset: 3px; }
.language-orbit button:disabled { cursor: wait; }

.eyebrow {
  color: var(--warm);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.empty-state h2 { margin: 16px 0 0; color: var(--text); font-size: clamp(27px, 6.7vw, 38px); font-weight: 720; line-height: 1.4; letter-spacing: -.04em; }
.welcome-tagline { margin: 0; color: var(--muted); font-size: 10px; letter-spacing: .05em; text-transform: none; }

.message-list { display: grid; gap: 32px; }
.exchange { display: grid; gap: 22px; }
.user-row { display: block; }

.user-bubble { width: 100%; max-width: 100%; padding: 0 0 24px; border-bottom: 1px solid var(--line); background: transparent; font-size: clamp(23px, 5.8vw, 28px); font-weight: 600; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }

.user-attachment {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 13px;
  background: var(--accent-soft);
  font-size: 12px;
}
.user-attachment svg { width: 18px; flex: 0 0 auto; }
.user-attachment span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.user-heading .translation-actions button { color: var(--muted); }
.user-heading .translation-actions button:hover { background: var(--accent-soft); color: var(--text); }
.user-text:empty { display: none; }

.assistant-message { padding: 6px 0 28px; border-bottom: 1px solid var(--line); }

.answer-body { display: grid; gap: 30px; }
.wordbook-intro { margin: 0; color: var(--muted); font-size: 12px; font-weight: 750; }
.wordbook-sense { display: grid; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.wordbook-sense-title { font-size: 14px; overflow-wrap: anywhere; }
.wordbook-sense-note { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.wordbook-sense .translation-block { padding-top: 10px; border-top: 1px solid var(--line); }
.word-language-choices { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.word-language-choices strong { flex-basis: 100%; font-size: 13px; }

.translation-block { display: grid; gap: 8px; padding-left: 17px; border-left: 3px solid var(--accent-deep); }
.translation-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.translation-title-group { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; min-width: 0; }
.translation-label { color: var(--accent); font-size: 14px; font-weight: 600; letter-spacing: 0; }
.tts-gauge { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); letter-spacing: 0; text-transform: none; }
.tts-gauge[hidden] { display: none; }
.tts-gauge-label { font-size: 10px; font-weight: 700; white-space: nowrap; }
.tts-gauge-track { width: 42px; height: 5px; overflow: hidden; border-radius: 999px; background: var(--line); }
.tts-gauge-fill { display: block; width: 35%; height: 100%; border-radius: inherit; background: var(--accent); animation: tts-gauge-slide 1.15s ease-in-out infinite; }
@keyframes tts-gauge-slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@media (prefers-reduced-motion: reduce) { .tts-gauge-fill { width: 100%; animation: none; opacity: .65; } }
.translation-actions { display: flex; flex: 0 0 auto; gap: 4px; }
.translation-actions button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.translation-actions button:hover { background: var(--surface); color: var(--text); }
.translation-actions button[data-action="speak"][aria-pressed="true"] { background: var(--surface); color: var(--text); }
.translation-actions svg { width: 20px; }

.translation-text { margin: 0; font-size: clamp(23px, 5.8vw, 28px); font-weight: 550; line-height: 1.65; letter-spacing: -.02em; overflow-wrap: anywhere; white-space: pre-wrap; }

.correction-block {
  margin-bottom: 1px;
  padding: 14px 15px;
  border-left: 2px solid var(--warm);
  border-radius: 0 12px 12px 0;
  background: var(--warm-soft);
}

.correction-block .translation-label { color: var(--warm); }
.correction-block .translation-text { margin-top: 5px; font-size: 16px; }

.study-block { display: grid; gap: 18px; margin-top: 4px; padding: 0; color: var(--text); font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.study-heading { color: var(--text); font-size: 24px; font-weight: 720; letter-spacing: -.03em; }
.study-item { display: grid; gap: 0; padding: 0; }
.study-item small { margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.study-item p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.study-sentence { padding: 8px 0 16px 17px; border-left: 3px solid var(--accent-deep); color: var(--text); font-size: 23px; font-weight: 650; line-height: 1.6; }
.study-section { display: grid; gap: 7px; padding-top: 13px; }
.study-section + .study-section { margin-top: 13px; border-top: 1px solid var(--line); }
.study-section-label { margin: 0; color: var(--accent); font-size: 13px; font-weight: 800; line-height: 1.3; }
.study-section-content { color: var(--text); font-size: 20px; }
.study-detail-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.study-detail-list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.study-term, .study-description { display: block; }
.study-term { color: var(--text); font-size: 16px; font-weight: 650; line-height: 1.5; }
.study-description { margin-top: 3px; color: var(--muted); line-height: 1.65; }
.study-note { margin: 0; color: var(--muted); font-size: 13px; }

@media (max-width: 420px) {
  .study-block { gap: 16px; padding: 0; }
  .study-item { padding: 0; }
  .study-detail-list li { padding: 8px; }
}

.answer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 18px;
}

.answer-actions button {
  width: 38px;
  aspect-ratio: 1;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}

.answer-actions button:hover { background: var(--surface); color: var(--text); }

.loading .assistant-message { opacity: .8; }
.thinking { display: flex; gap: 5px; padding: 12px 0; }
.thinking span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: pulse 1s infinite ease-in-out; }
.thinking span:nth-child(2) { animation-delay: .15s; }
.thinking span:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

.composer-wrap { position: fixed; z-index: 18; bottom: 0; left: 50%; translate: -50% 0; width: min(100%, 760px); padding: 14px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--bg); }
.fast-mode-switch { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 44px; min-height: 44px; flex-shrink: 0; border: 0; padding: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 9px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.fast-mode-track { position: relative; display: block; width: 40px; height: 22px; border: 1px solid var(--neutral-line); border-radius: 999px; background: var(--neutral); transition: background .16s, box-shadow .16s; }
.fast-mode-thumb { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--neutral-text); transition: transform .16s, background .16s; }
.fast-mode-switch[aria-checked="true"] .fast-mode-track { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 10px var(--accent-line); }
.fast-mode-switch[aria-checked="true"] .fast-mode-thumb { transform: translateX(18px); background: #fff; }
.fast-mode-switch[aria-checked="true"] { color: var(--accent); }
.fast-mode-switch:disabled { opacity: .6; cursor: wait; }
.correction-switch:disabled { cursor: default; }
.nmt-status { overflow-wrap: anywhere; line-height: 1.5; }
.member-usage-bar { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 1.3fr; min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-raised); padding: 6px 0; }
.member-usage-bar[hidden] { display: none; }
.usage-segment { min-width: 0; padding: 0 8px; }
.usage-segment + .usage-segment { border-left: 1px solid var(--line); }
.usage-segment-text { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; color: var(--muted); font-size: 10px; line-height: 1.2; white-space: nowrap; }
.usage-segment-text b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.usage-track { display: block; height: 3px; margin-top: 5px; overflow: hidden; border-radius: 99px; background: var(--line); }
.usage-track > span { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--accent); transition: width .2s ease; }
.usage-segment.is-low .usage-track > span { background: var(--warm); }
@media (prefers-reduced-motion: reduce) { .fast-mode-track, .fast-mode-thumb { transition: none; } }

.composer { display: flex; flex-wrap: wrap; align-items: end; gap: 3px; padding: 7px; border: 1px solid var(--accent-line); border-radius: 30px; background: var(--surface); box-shadow: 0 6px 24px rgb(10 40 70 / 5%); }

.attachment-preview { order: -1; flex: 1 0 calc(100% - 16px); min-width: 0; height: 42px; margin: 0 4px 6px; padding: 5px 8px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-raised); }
.attachment-preview[hidden] { display: none; }
.attachment-preview-icon {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--accent);
  overflow: hidden;
}
.attachment-preview-icon img { width: 100%; height: 100%; object-fit: cover; }
.attachment-preview-icon svg { width: 15px; }
.attachment-preview > strong { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.attachment-preview > button { width: 20px; height: 20px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--surface); color: var(--muted); cursor: pointer; }
.attachment-preview > button:hover { background: var(--accent-soft); color: var(--text); }
.attachment-preview > button svg { width: 12px; }

.composer textarea { flex: 1 1 0; min-width: 0; width: 0; max-height: 128px; min-height: 40px; overflow-y: hidden; resize: none; border: 0; outline: 0; padding: 10px 6px 6px; background: transparent; color: var(--text); font-size: 15px; line-height: 1.45; }

.composer textarea::placeholder { color: var(--muted); }
.composer-icon { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; background: transparent; }
.composer-icon:hover { background: var(--accent-soft); }
.composer-icon.active { background: var(--accent-soft); color: var(--accent); animation: mic-glow 1.2s ease-in-out infinite; }
.mic-button {
  position: relative;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background: transparent;
  transition: background .16s ease, scale .16s ease;
}
.mic-button svg { width: 19px; translate: -2px -1px; }
.mic-button.pressing { background: var(--accent-soft); scale: .96; }
.mic-language-mark {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface-raised);
  border-radius: 50%;
  background: var(--accent-deep);
  color: #fffdf6;
  font-size: 9px;
  font-weight: 850;
  line-height: 1;
  box-shadow: none;
}
@keyframes mic-glow { 50% { box-shadow: 0 0 0 7px var(--accent-soft); } }

.send-button { width: 46px; height: 46px; flex: 0 0 46px; align-self: flex-end; margin-left: 1px; border-radius: 50%; background: var(--accent-deep); color: #fff; transition: scale .18s ease, opacity .18s ease; }
.send-button svg { width: 23px; }

.send-button:disabled { opacity: .32; cursor: default; }
.send-button:not(:disabled):active { scale: .92; }
.composer-note { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; text-align: center; }

.drawer { position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(100vw, 430px); padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); border-right: 1px solid var(--line); box-shadow: var(--shadow); translate: -105% 0; transition: translate .24s ease; }

.drawer.open { translate: 0; }
.drawer-head { display: flex; align-items: start; justify-content: space-between; }
.drawer h2 { margin: 0; font-size: 30px; font-weight: 740; letter-spacing: -.04em; }
.small-icon { width: 36px; aspect-ratio: 1; border-radius: 50%; background: var(--surface-raised); box-shadow: none; }
.about-card {
  flex: 0 0 auto;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}
.about-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}
.about-card summary::-webkit-details-marker { display: none; }
.about-card summary span, .about-card summary strong { display: block; }
.about-card summary strong { margin-top: 5px; font-size: 14px; }
.about-card summary svg { width: 19px; flex: 0 0 auto; color: var(--muted); transition: rotate .18s ease; }
.about-card[open] summary svg { rotate: 180deg; }
.about-content { padding: 0 14px 15px; border-top: 1px solid var(--line); }
.about-content > p { margin: 13px 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.about-content ul { display: grid; gap: 11px; margin: 0; padding: 0; list-style: none; }
.about-content li { display: grid; gap: 3px; }
.about-content li strong { color: var(--text); font-size: 12px; }
.about-content li span { color: var(--muted); font-size: 11px; line-height: 1.5; }
.about-content .about-note { margin-bottom: 0; padding: 10px; border-radius: 10px; background: var(--accent-soft); color: var(--muted); }
.history-list { flex: 1 0 100px; min-width: 0; min-height: 100px; max-height: min(42dvh, 360px); overflow-x: hidden; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; align-content: start; gap: 7px; margin: 18px 0; }
.history-list[hidden], .history-detail[hidden] { display: none; }
.history-detail { min-width: 0; margin: 18px 0; }
.history-back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; padding-left: 0; color: var(--accent); }
.history-back svg { width: 20px; height: 20px; }
.history-detail .user-bubble { font-size: 20px; }

.history-item { width: 100%; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--surface); text-align: left; line-height: 1.5; cursor: pointer; }
.history-item:hover { border-color: var(--line); background: var(--surface); }
.history-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 650; }
.history-item small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.history-empty { color: var(--muted); font-size: 13px; }
.drawer-actions { display: grid; gap: 0; margin: 8px 0 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.secondary-button { border: 1px solid var(--line); border-radius: 12px; padding: 11px; background: var(--surface-raised); cursor: pointer; }
.feedback-button, .feedback-submit { border-color: var(--line); background: var(--accent-soft); font-weight: 700; }
.text-button { border: 0; padding: 10px; background: transparent; cursor: pointer; }
.danger { color: var(--danger); }
.scrim { position: fixed; z-index: 40; inset: 0; background: rgb(4 15 28 / 38%); backdrop-filter: blur(3px); }

.feedback-dialog { width: min(calc(100% - 32px), 480px); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 22px; background: var(--bg); color: var(--text); box-shadow: var(--shadow); }
.feedback-dialog::backdrop { background: rgb(4 15 28 / 48%); backdrop-filter: blur(4px); }
.feedback-form { padding: 20px; }
.feedback-form progress { display: block; width: 100%; height: 10px; accent-color: var(--warm); }
.feedback-form progress[hidden] { display: none; }
.feedback-form .tts-credit { margin-top: 10px; }
.tts-credit a { color: var(--accent); }
.feedback-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.feedback-head h2 { margin: 0; font-size: 28px; font-weight: 730; letter-spacing: -.04em; }
.feedback-form > p { margin: 16px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.feedback-form > label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 700; }
.feedback-form input { width: 100%; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 12px; padding: 11px; background: var(--surface-raised); color: var(--text); }
.auth-note { min-height: 20px; margin: 0 0 8px !important; color: var(--muted); font-size: 12px; }
#pdfError:not(:empty) { color: var(--danger); }
.admin-form { overflow: auto; }
#adminDialog { width: min(calc(100% - 24px), 720px); }
.admin-menu { position: sticky; z-index: 2; top: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 12px; padding: 10px 0; background: var(--bg); backdrop-filter: blur(10px); }
.admin-menu button { min-width: 0; padding: 10px 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-raised); color: var(--text); font-size: 12px; font-weight: 700; cursor: pointer; }
.admin-menu button[aria-pressed="true"] { border-color: var(--line); background: var(--accent-soft); }
.admin-menu button:focus-visible { outline: 2px solid var(--warm); outline-offset: 2px; }
.admin-section { display: grid; gap: 10px; margin-top: 12px; }
.admin-section[hidden] { display: none; }
@media (min-width: 560px) { .admin-menu { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.admin-section h3 { margin: 0; font-size: 17px; }
.admin-section > p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.admin-section-head { display: flex; justify-content: space-between; align-items: end; gap: 10px; }
.usage-report-scopes { display: flex; flex-wrap: wrap; gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.usage-report-scopes button { flex: 1 0 auto; border: 0; border-radius: 10px; min-height: 40px; padding: 9px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.usage-report-scopes button[aria-pressed="true"] { background: var(--accent-deep); color: #fff; font-weight: 650; }
.usage-report-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; align-items: end; }
.usage-report-dates[hidden] { display: none; }
.usage-report-dates label, .usage-report-bucket { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.usage-report-dates input, .usage-report-bucket select, .usage-report-user-controls input, .usage-report-user-controls select { min-width: 0; width: 100%; margin: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--surface-raised); color: var(--text); font-size: 12px; }
.usage-report-dates button { grid-column: 1 / -1; padding: 8px; }
.usage-report-bucket { width: 120px; }
.usage-report-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.usage-report-card { display: grid; gap: 8px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.usage-report-card span { color: var(--muted); font-size: 11px; }
.usage-report-card strong { overflow-wrap: anywhere; color: var(--text); font-size: clamp(17px, 4.8vw, 24px); font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.usage-report-card small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.usage-report-card progress { width: 100%; height: 6px; accent-color: var(--warm); }
.usage-report-alert:not([hidden]) { padding: 9px; border-radius: 10px; background: var(--warm-soft); color: var(--warm); }
.usage-report-block { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.usage-report-block h4 { margin: 0; font-size: 15px; }
.usage-report-chart { display: grid; gap: 8px; max-height: 300px; overflow-y: auto; }
.usage-report-chart-row { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 5px 8px; align-items: center; font-size: 11px; }
.usage-report-chart-row small { grid-column: 2; color: var(--muted); }
.usage-report-chart-track { height: 9px; border-radius: 99px; background: var(--line); overflow: hidden; }
.usage-report-chart-bar { display: flex; height: 100%; border-radius: inherit; overflow: hidden; }
.usage-report-chart-current { height: 100%; background: var(--accent-deep); }
.usage-report-chart-extra { height: 100%; background: var(--warm); }
.usage-report-legend { color: var(--muted); font-size: 10px; }
.usage-report-models, .usage-report-users { display: grid; gap: 6px; }
.usage-report-model, .usage-report-user { display: grid; gap: 4px; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 11px; }
.usage-report-model strong, .usage-report-user strong { font-size: 12px; overflow-wrap: anywhere; }
.usage-report-model span, .usage-report-user span { color: var(--muted); line-height: 1.45; }
.usage-report-table-head, .usage-report-user-controls { display: flex; gap: 7px; align-items: center; justify-content: space-between; }
.usage-report-user-controls > * { flex: 1; }
.usage-report-table-head .text-button { padding: 4px; font-size: 11px; }
.usage-report-empty { margin: 0; color: var(--muted); font-size: 11px; }
@media (min-width: 560px) { .usage-report-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.memory-search { display: grid; grid-template-columns: minmax(108px, .4fr) minmax(0, 1fr) auto; gap: 7px; }
.memory-search input, .memory-search select, .memory-editor input, .memory-editor select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px; background: var(--surface-raised); color: var(--text); }
.memory-search input { margin: 0; }
.memory-editor { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.memory-editor label { font-size: 11px; font-weight: 750; }
.memory-editor textarea { min-height: 58px; }
.memory-active { display: flex; align-items: center; gap: 7px; }
.memory-active input { width: auto; margin: 0; }
.admin-note { color: var(--muted); font-size: 11px; line-height: 1.5; }
.memory-source { white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-users { display: grid; gap: 8px; }
.admin-user { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.admin-user-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.admin-user small { color: var(--muted); }
.admin-user-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-user-actions button { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--surface-raised); cursor: pointer; font-size: 12px; }
.feedback-form textarea { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 13px; padding: 12px; background: var(--surface-raised); color: var(--text); line-height: 1.55; }
.feedback-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.admin-user-head strong { overflow-wrap: anywhere; min-width: 0; }
.feedback-submit { min-width: 92px; }
.feedback-submit:disabled { opacity: .55; cursor: wait; }

.attachment-sheet {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  translate: -50% 0;
  width: min(calc(100% - 28px), 732px);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(1.15);
}
.attachment-sheet[hidden] { display: none; }
.attachment-sheet .eyebrow { display: block; margin: 0 4px 11px; }
.attachment-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.attachment-options > button {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 7px;
  background: var(--surface);
  text-align: center;
  cursor: pointer;
}
.attachment-options > button:hover { border-color: var(--line); background: var(--accent-soft); }
.attachment-options .option-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.attachment-options .option-icon svg { width: 20px; }
.attachment-options strong, .attachment-options small { display: block; }
.attachment-options strong { font-size: 12px; }
.attachment-options small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.35; }

.attachment-limit { margin: 12px 4px 0; color: var(--muted); font-size: 11px; }

.status-toast { position: fixed; z-index: 70; left: 50%; bottom: calc(var(--composer-height) + 12px); translate: -50% 0; width: max-content; max-width: calc(100vw - 32px); padding: 12px 16px; border: 1px solid var(--accent-line); border-radius: 14px; background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow); font-size: 13px; text-align: center; white-space: pre-line; }
.status-toast.dialog-toast { bottom: calc(24px + env(safe-area-inset-bottom)); max-width: min(calc(100vw - 48px), 440px); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (min-width: 761px) {
  body { background: var(--bg); }
  .app-shell { border-inline: 1px solid var(--line); }
  .translation-text { font-size: 24px; }
}

@media (max-width: 420px) {
  .conversation { padding-inline: 16px; }
  .topbar { padding-inline: 12px; }
  .brand-mark { display: none; }
  .usage-status { padding-inline: 6px; }

  .user-bubble { max-width: 100%; }
  .memory-search { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .brand-title-row { gap: 4px; }
  .brand strong { font-size: clamp(13px, calc(13px + (100vw - 350px) * .05), 18px); }
  .topbar .practice-entry-buttons { flex-direction: row; gap: 2px; }
  .topbar .practice-entry-buttons .new-button { flex-direction: column; justify-content: center; width: 44px; min-width: 44px; height: 44px; gap: 3px; padding: 3px; font-size: 10px; }
  .topbar .practice-entry-buttons .new-button svg { width: 18px; height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Shared reading layout and full-height secondary pages. */
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 3px; }
button, select, summary, a { -webkit-tap-highlight-color: transparent; }
select { font: inherit; }
button:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.brand-name { margin: 0; font-size: inherit; line-height: 1.25; }
.brand > .brand-content { min-width: 0; }
.brand .token-status { margin-top: 4px; line-height: 1.45; }
.token-gauge { background: var(--accent); opacity: .6; }
.new-button { display: flex; align-items: center; gap: 6px; width: auto; min-width: 72px; padding: 0 8px; aspect-ratio: auto; color: var(--warm); font-size: 13px; font-weight: 650; border: 1px solid transparent; }
.new-button svg { width: 20px; }
.language-hint { font-size: 10px; }
.correction-block { border-color: var(--warm); padding: 12px 16px; }
.translation-actions button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.study-meaning { padding-bottom: 10px; }
.study-grammar-list { padding: 0 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.study-grammar-list li:last-child { border-bottom: 0; }
.panel-brand { order: -2; margin-bottom: 26px; color: var(--text); font-size: 16px; font-weight: 700; text-align: center; letter-spacing: -.035em; }
.drawer-head { order: -1; }
.panel-description { margin: 10px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.drawer .about-card { order: 2; margin-top: 20px; }
.history-list { max-height: min(50dvh, 500px); }
.history-date { margin: 14px 0 3px; color: var(--muted); font-size: 13px; font-weight: 600; }
.history-item .history-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.drawer-actions > button { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; font-weight: 550; font-size: 14px; text-align: left; }
.drawer-actions > button:last-child { border-bottom: 0; }
.drawer-actions svg, .menu-row svg, .password-settings summary svg { flex: 0 0 21px; width: 21px; height: 21px; color: var(--accent); }
.drawer-actions > button > span, .menu-row > span, .password-settings summary > span { flex: 1; }
.drawer-actions svg:last-child:not(:first-child), .menu-row svg:last-child, .password-settings summary svg:last-child { width: 17px; flex-basis: 17px; color: var(--muted); }
.page-dialog { max-width: 100%; width: min(100%, 560px); height: 100dvh; max-height: 100dvh; margin: 0 auto; border-radius: 0; border-block: 0; }
.page-dialog > .feedback-form { min-height: 100%; padding: calc(24px + env(safe-area-inset-top)) 24px calc(32px + env(safe-area-inset-bottom)); }
.page-dialog .feedback-head { align-items: center; margin-bottom: 28px; }
#adminDialog { width: min(100%, 760px); }
.admin-menu { display: flex; overflow-x: auto; gap: 6px; padding: 8px 0 12px; margin-bottom: 18px; background: var(--bg); }
.admin-menu button { flex: 0 0 auto; border-radius: 10px; padding: 10px 12px; }
.admin-menu button[aria-pressed="true"] { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.account-profile { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; padding: 20px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.account-profile > div { min-width: 0; flex: 1; }
.account-profile strong { display: block; font-size: 18px; overflow-wrap: anywhere; }
.account-profile p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.account-avatar { display: grid; place-items: center; flex: 0 0 48px; height: 48px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.account-avatar svg { width: 28px; }
.account-role { flex-shrink: 0; align-self: start; padding: 5px 8px; border-radius: 20px; background: var(--warm-soft); color: var(--warm); font-size: 10px; }
.appearance-settings h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.theme-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 26px; }
.theme-choices button { min-height: 68px; padding: 10px 4px; display: grid; justify-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font-size: 12px; cursor: pointer; }
.theme-choices button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.theme-choices svg { width: 20px; height: 20px; }
.account-menu { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; }
.menu-row, .password-settings summary { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 15px 16px; border: 0; background: transparent; text-align: left; font-size: 14px; font-weight: 550; cursor: pointer; }
.account-menu > * + * { border-top: 1px solid var(--line); }
.password-settings summary { list-style: none; }
.password-settings summary::-webkit-details-marker { display: none; }
.password-settings[open] summary svg:last-child { rotate: 90deg; }
.password-editor { padding: 0 16px 18px; }
.password-editor label { display: block; margin: 12px 0 7px; font-size: 12px; }
.logout-row { margin-top: 20px; }
.account-footer { margin: 32px 0 0 !important; font-size: 11px !important; text-align: center; }
.usage-report-cards { gap: 10px; }
.usage-report-card:first-child strong, .usage-report-card:nth-child(4) strong { color: var(--warm); }
.usage-report-model, .usage-report-user { padding: 12px; background: var(--surface-raised); }
.usage-report-chart-track { height: 10px; background: var(--accent-soft); }
.usage-report-table-head { flex-wrap: wrap; }
#attachButton { width: 46px; height: 46px; flex-basis: 46px; color: var(--accent); background: var(--accent-soft); }
.composer-icon { color: var(--accent); }
@media (max-width: 560px) {
  .topbar:has(.install-button:not([hidden])) { grid-template-columns: 38px minmax(0, 1fr); }
  .topbar:has(.install-button:not([hidden])) .topbar-actions { grid-column: 2; justify-content: flex-end; }
  .page-dialog > .feedback-form { padding-inline: 20px; }
}
@media (max-width: 359px) {
  .topbar { column-gap: 4px; grid-template-columns: 32px minmax(0, 1fr) auto; }
  .topbar .menu-button { width: 32px; }
  .topbar .practice-entry-buttons .new-button { width: 32px; min-width: 32px; padding-inline: 0; font-size: 9px; }
  .status-toast { font-size: 12px; }
  .new-button { min-width: 64px; gap: 4px; padding-inline: 4px; font-size: 12px; }
  .language-orbit button { font-size: 13px; }
  .composer-wrap { padding-inline: 10px; }
  .composer textarea { font-size: 13px; padding-inline: 4px; }
  .composer-icon { width: 36px; flex-basis: 36px; }
  .usage-report-card { padding: 12px; }
  .usage-report-card strong { font-size: 18px; }
}

.credits-page { width: min(calc(100% - 40px), 680px); margin: 40px auto 80px; line-height: 1.8; }
.credits-page h1 { margin: 30px 0; font-size: 28px; letter-spacing: -.04em; }
.credits-page h2 { margin-top: 30px; font-size: 20px; }
.credits-page p { color: var(--muted); }

.drawer, .history-list, .admin-menu, .page-dialog { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

html { scroll-padding-top: calc(var(--topbar-height) + 48px); scroll-padding-bottom: var(--composer-height); }

.practice-entry-buttons { display: flex; gap: 2px; align-items: center; }
.new-button.speak-active { color: var(--warm); background: var(--warm-soft); }
.speak-dialog { --speak-padding: 20px; width: min(calc(100% - 24px), 680px); }
.speak-dialog [hidden] { display: none !important; }
.speak-dialog .feedback-form { padding: var(--speak-padding); }
.speak-dialog .feedback-head { position: sticky; top: 0; z-index: 2; margin: calc(-1 * var(--speak-padding)) calc(-1 * var(--speak-padding)) 16px; padding: var(--speak-padding) var(--speak-padding) 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
.speak-dialog .feedback-head .small-icon { width: 44px; flex-shrink: 0; }
.speak-languages { display: flex; gap: 8px; }
.speak-languages button { flex: 1; min-width: 0; padding: 10px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.speak-languages button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.speak-note { color: var(--muted); font-size: 12px; line-height: 1.7; white-space: pre-wrap; }
.speak-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.speak-toolbar input { flex: 1; min-width: 120px; margin-bottom: 0; }
.speak-category-picker { display: grid; gap: 6px; margin: 10px 0; color: var(--muted); font-size: 13px; }
.speak-category-picker select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--surface-raised); color: var(--text); font: inherit; }
.speak-category-create { margin: 10px 0 14px; color: var(--accent); font-size: 13px; }
.speak-category-create summary { cursor: pointer; padding: 8px 0; }
.speak-category-create .text-button { min-height: 44px; }
.speak-sentence-row .speak-category-label { color: var(--accent); font-size: 12px; }
.speak-library-menu { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 18px 0 20px; }
.speak-menu-button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; min-width: 0; min-height: 78px; padding: 12px 6px; border: 1px solid var(--accent-line); border-radius: 14px; background: var(--surface-raised); color: var(--accent); font-size: 13px; font-weight: 650; line-height: 1.3; letter-spacing: -.01em; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.speak-menu-button:first-child { background: var(--accent-soft); }
.speak-menu-button svg { width: 23px; height: 23px; }
.speak-menu-button:hover { background: var(--accent-soft); border-color: var(--accent); }
.speak-menu-button:active, .speak-action-button:not(:disabled):active { transform: translateY(1px); }
.speak-sentence-list { display: grid; gap: 0; }
.speak-more-button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 56px; margin: 16px 0 4px; padding: 14px 16px; border: 1px solid var(--accent-line); border-radius: 14px; background: var(--surface-raised); color: var(--accent); font: inherit; text-align: left; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.speak-more-button > span { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; min-width: 0; }
.speak-more-button strong { font-size: 14px; font-weight: 650; line-height: 1.4; }
.speak-more-button small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.speak-more-button svg { width: 22px; height: 22px; flex-shrink: 0; transform: rotate(90deg); }
.speak-more-button:not(:disabled):hover { background: var(--accent-soft); border-color: var(--accent); }
.speak-more-button:not(:disabled):active { transform: translateY(1px); }
.speak-sentence-row { padding: 14px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.speak-sentence-row strong, .speak-sentence-row small { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.speak-sentence-row strong { color: var(--text); font-size: 16px; line-height: 1.6; }
.speak-sentence-row small { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.speak-check { display: flex; align-items: start; gap: 10px; font-size: 13px; }
.speak-dialog .speak-check input { width: 18px; height: 18px; flex-shrink: 0; padding: 0; margin: 5px 0 0; accent-color: var(--accent); }
.speak-check > span { min-width: 0; }
.speak-row-actions { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 8px 0 0 28px; }
.speak-row-actions button { min-height: 44px; }
.speak-start-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 20px 0; }
.speak-start-actions button { white-space: normal; min-height: 46px; }
.speak-backup { border-top: 1px solid var(--line); padding-top: 16px; }
.speak-backup summary { cursor: pointer; color: var(--accent); font-size: 13px; }
#speakSentenceForm { display: grid; gap: 8px; }
#speakSentenceForm label { font-size: 13px; font-weight: 650; }
.speak-practice { padding: 8px 0; }
.speak-prompt { margin: 20px 0 12px; padding-left: 16px; border-left: 3px solid var(--accent); color: var(--text); font-size: 28px; font-weight: 650; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
#speakStatus:empty { display: none; }
.speak-prompt span { transition: color .12s ease, background-color .12s ease; border-radius: 4px; }
.speak-prompt .speak-matched { color: #fff; background: var(--accent-deep); box-shadow: 0 0 0 2px var(--accent-deep); }
.speak-prompt .speak-resume:not(.speak-matched) { text-decoration: underline; text-decoration-color: var(--warm); text-decoration-thickness: 3px; text-underline-offset: 6px; }
.speak-meaning { margin: 0 0 24px; padding-left: 19px; color: var(--muted); font-size: 17px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.speak-practice-status { color: var(--accent); font-size: 14px; line-height: 1.6; min-height: 24px; }
.speak-heard { color: var(--muted); font-size: 12px; line-height: 1.6; min-height: 20px; overflow-wrap: anywhere; }
.speak-practice-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.speak-navigation-actions, .speak-primary-actions { display: grid; gap: 10px; align-content: start; }
.speak-action-button { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 54px; padding: 12px 8px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-raised); color: var(--text); font-size: 13px; font-weight: 650; line-height: 1.3; letter-spacing: -.01em; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.speak-action-button svg { width: 19px; height: 19px; flex-shrink: 0; }
.speak-primary-actions .speak-action-button { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.speak-primary-actions .speak-retry-button { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.speak-finish-button { color: var(--muted); }
.speak-action-button:not(:disabled):hover { border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .speak-menu-button, .speak-action-button, .speak-more-button, .usage-track > span { transition: none; } }
.speak-consent { padding: 14px; border: 1px solid var(--line); border-radius: 14px; font-size: 13px; line-height: 1.7; }
.speak-dialog button:disabled { opacity: .45; cursor: default; }
.answer-actions .save-sentence-button { width: auto; height: 38px; aspect-ratio: auto; padding: 0 8px; font-size: 12px; font-weight: 550; }
@media (min-width: 421px) {
  .practice-entry-buttons > :first-child { padding-right: 3.5px; }
  .practice-entry-buttons > :last-child { padding-left: 3.5px; }
}
@media (max-width: 420px) {
  .practice-entry-buttons { flex-direction: column; gap: 1px; align-items: stretch; }
  .practice-entry-buttons .new-button { height: 32px; }
  .speak-dialog { --speak-padding: 18px; }
  .speak-prompt { font-size: 25px; }
  .speak-start-actions { grid-template-columns: 1fr; }
}
