:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-muted: #eef3f5;
  --ink: #17232b;
  --ink-soft: #5a6972;
  --line: #d8e0e4;
  --blue: #1769e0;
  --blue-dark: #0f4fae;
  --blue-soft: #eaf3ff;
  --cyan: #079ab5;
  --green: #087f5b;
  --green-soft: #e7f7f0;
  --orange: #a75708;
  --orange-soft: #fff3df;
  --red: #b42318;
  --red-soft: #fff0ef;
  --shadow: 0 16px 45px rgba(27, 48, 61, 0.09);
  --radius: 8px;
  --content: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, var(--cyan) 0 5px, transparent 5px),
    var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: 0;
}

button,
textarea,
select,
input {
  font: inherit;
  letter-spacing: 0;
}

button,
select,
input[type="range"] {
  cursor: pointer;
}

button:focus-visible,
textarea:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(23, 105, 224, 0.25);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.35;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px max(24px, calc((100vw - var(--content)) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand-block,
.header-actions,
.voice-summary,
.learning-topline,
.learning-meta,
.input-actions,
.ready-actions,
.session-progress,
.session-actions,
.audio-options,
.audio-primary-actions,
.rating-actions,
.learning-footer-actions,
.dialog-header,
.rate-presets {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 11px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--blue);
  font-size: 20px;
  font-weight: 800;
}

.brand-name,
.brand-subtitle {
  margin: 0;
}

.brand-name {
  font-size: 14px;
  font-weight: 800;
}

.brand-subtitle {
  color: var(--ink-soft);
  font-size: 12px;
}

.header-actions {
  gap: 12px;
}

.voice-summary {
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
}

.voice-summary span + span::before {
  margin-right: 7px;
  content: "·";
}

.app-shell {
  width: min(calc(100% - 40px), var(--content));
  margin: 0 auto;
  padding: 54px 0 90px;
}

.view,
.tab-panel {
  display: none;
}

.view.is-active,
.tab-panel.is-active {
  display: block;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 30px;
}

.section-heading h1,
.learning-topline h1 {
  margin-bottom: 10px;
  font-size: clamp(28px, 3vw, 42px);
}

.section-heading p:last-child {
  margin-bottom: 0;
  color: var(--ink-soft);
}

.compact-heading {
  margin-bottom: 26px;
}

.step-label,
.mode-kicker {
  margin-bottom: 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.entry-layout,
.ready-grid,
.voice-settings-grid {
  display: grid;
  gap: 24px;
}

.entry-layout {
  grid-template-columns: minmax(0, 1fr) 310px;
}

.input-area,
.entry-guide,
.focus-panel,
.launch-panel,
.session-panel,
.results-panel,
.audio-stage,
.instant-stage,
.validation-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.input-area {
  padding: 26px;
  box-shadow: var(--shadow);
}

.input-area label,
.launch-controls label,
.audio-options label,
.voice-settings-grid label {
  display: block;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 340px;
  margin-top: 8px;
  padding: 16px;
  resize: vertical;
  border: 1px solid #bfcbd1;
  border-radius: 6px;
  color: var(--ink);
  background: #fbfcfc;
  line-height: 1.6;
}

.input-actions,
.ready-actions,
.audio-primary-actions,
.session-actions,
.learning-footer-actions {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.privacy-note,
.dialog-note {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.entry-guide {
  align-self: start;
  padding: 25px;
  background: #f0f8fa;
}

.entry-guide h2 {
  margin-bottom: 16px;
  font-size: 18px;
}

.entry-guide ol {
  margin: 0 0 18px;
  padding-left: 22px;
}

.entry-guide li + li {
  margin-top: 12px;
}

.entry-guide p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.button {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 750;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-primary {
  color: #fff;
  background: var(--blue);
}

.button-primary:hover:not(:disabled) {
  background: var(--blue-dark);
}

.button-secondary {
  border-color: #b7c6cd;
  color: var(--ink);
  background: #fff;
}

.button-quiet {
  color: var(--ink-soft);
  background: transparent;
}

.button-danger-quiet {
  border-color: #efc3be;
  color: var(--red);
  background: #fff;
}

.button-compact {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 13px;
}

.button-large {
  min-width: 220px;
  min-height: 52px;
  font-size: 17px;
}

.validation-panel {
  margin-top: 22px;
  padding: 20px 22px;
}

.validation-panel.is-success {
  border-color: #9bd0bb;
  background: var(--green-soft);
}

.validation-panel.is-error {
  border-color: #efb6b0;
  background: var(--red-soft);
}

.validation-panel.is-warning {
  border-color: #edcb9a;
  background: var(--orange-soft);
}

.validation-panel h2 {
  margin-bottom: 8px;
  font-size: 18px;
}

.validation-panel ul {
  margin-bottom: 0;
}

.copy-fix-block {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(180, 35, 24, 0.2);
}

.copy-fix-block textarea {
  min-height: 110px;
  background: #fff;
}

.summary-band {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.summary-band > div {
  padding: 18px 22px;
}

.summary-band > div + div {
  border-left: 1px solid var(--line);
}

.summary-band span,
.summary-band strong {
  display: block;
}

.summary-band span {
  color: var(--ink-soft);
  font-size: 12px;
}

.summary-band strong {
  margin-top: 3px;
  font-size: 16px;
}

.ready-grid {
  grid-template-columns: 1fr 1fr;
}

.focus-panel {
  padding: 25px;
}

.focus-panel h2 {
  margin-bottom: 16px;
  font-size: 18px;
}

.key-expression-list {
  display: grid;
  gap: 10px;
}

.key-expression-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.key-expression-row:last-child {
  border-bottom: 0;
}

.key-expression-row span:first-child {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.key-expression-row strong,
.key-expression-row small {
  display: block;
}

.key-expression-row small {
  color: var(--ink-soft);
}

.center-sentence-panel {
  background: #102135;
  color: #fff;
}

.center-sentence-ja {
  color: #bcd0df;
}

.center-sentence-en {
  font-size: 21px;
  font-weight: 750;
}

.learning-topline {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.learning-topline h1 {
  margin: 0;
  font-size: 30px;
}

.learning-meta {
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.learning-meta span {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface);
  font-size: 12px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 24px;
  border-bottom: 1px solid #bfcbd1;
}

.tab-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 58px;
  padding: 10px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--ink-soft);
  background: transparent;
  font-weight: 750;
}

.tab-button.is-active {
  border-bottom-color: var(--blue);
  color: var(--blue);
}

.tab-number {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #95a8b3;
  font-size: 12px;
}

.tab-button.is-active .tab-number {
  background: var(--blue);
}

.launch-panel {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 30px;
  align-items: center;
  padding: 30px;
}

.launch-panel h2 {
  margin-bottom: 8px;
  font-size: 23px;
}

.launch-panel p:last-child {
  margin: 0;
  color: var(--ink-soft);
}

.launch-controls {
  display: grid;
  gap: 9px;
}

select {
  width: 100%;
  min-height: 42px;
  padding: 7px 34px 7px 11px;
  border: 1px solid #b7c6cd;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}

.session-panel,
.audio-stage,
.instant-stage {
  padding: 28px;
}

.session-progress {
  gap: 14px;
  color: var(--ink-soft);
  font-size: 13px;
}

.progress-track {
  position: relative;
  flex: 1;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe7ea;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
  transition: width 180ms ease;
}

.quiz-question {
  max-width: 850px;
  margin: 42px auto 20px;
  text-align: center;
}

.question-label {
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.quiz-question h2 {
  margin-bottom: 28px;
  font-size: 25px;
}

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

.quiz-option {
  min-height: 66px;
  padding: 13px 16px;
  border: 1px solid #bac8ce;
  border-radius: 7px;
  color: var(--ink);
  background: #f7f9fa;
  text-align: left;
  font-weight: 700;
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.quiz-option.is-correct {
  border-color: var(--green);
  color: #065c42;
  background: var(--green-soft);
}

.quiz-option.is-wrong {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
}

.quiz-feedback {
  margin-top: 20px;
  padding: 17px;
  border-left: 4px solid var(--blue);
  background: var(--blue-soft);
  text-align: left;
}

.quiz-feedback strong,
.quiz-feedback span {
  display: block;
}

.quiz-feedback strong {
  font-size: 18px;
}

.quiz-feedback span {
  margin-top: 5px;
  color: var(--ink-soft);
}

.results-panel {
  padding: 28px;
}

.result-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.result-metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
}

.result-metric span,
.result-metric strong {
  display: block;
}

.result-metric span {
  color: var(--ink-soft);
  font-size: 12px;
}

.result-metric strong {
  margin-top: 4px;
  font-size: 23px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid #b7c6cd;
  border-radius: 7px;
}

.segment {
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  border-right: 1px solid #b7c6cd;
  color: var(--ink-soft);
  background: #fff;
  font-weight: 700;
}

.segment:last-child {
  border-right: 0;
}

.segment.is-active {
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.audio-toolbar {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 1.5fr;
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
}

.audio-options {
  justify-content: flex-end;
  gap: 12px;
}

.audio-options label {
  min-width: 120px;
}

.audio-stage {
  min-height: 390px;
  color: #fff;
  background: #102135;
}

.audio-stage .progress-track {
  background: #2a3f55;
}

.audio-stage .session-progress {
  color: #bdd0df;
}

.mode-help {
  margin: 28px auto 16px;
  color: #8cc8ff;
  text-align: center;
}

.expression-chip {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 18px;
  padding: 5px 11px;
  border: 1px solid rgba(81, 170, 255, 0.38);
  border-radius: 999px;
  color: #84d5ff;
  background: rgba(23, 105, 224, 0.12);
  font-size: 13px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.audio-sentence {
  max-width: 820px;
  min-height: 84px;
  margin: 0 auto 16px;
  font-size: 29px;
  text-align: center;
}

.audio-sentence mark {
  color: #5fe0b1;
  background: transparent;
}

.audio-translation,
.audio-usage {
  max-width: 760px;
  margin-right: auto;
  margin-left: auto;
  color: #bdd0df;
  text-align: center;
}

.audio-usage {
  font-size: 13px;
}

.audio-primary-actions {
  justify-content: center;
}

.sentence-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.sentence-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 44px;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.sentence-row.is-current {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.sentence-number {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.sentence-copy strong,
.sentence-copy small {
  display: block;
  overflow-wrap: anywhere;
}

.sentence-copy small {
  margin-top: 2px;
  color: var(--ink-soft);
}

.play-row-button,
.icon-button {
  display: grid;
  place-items: center;
  border: 1px solid #b7c6cd;
  border-radius: 6px;
  color: var(--blue);
  background: #fff;
}

.play-row-button {
  width: 40px;
  height: 40px;
  font-size: 15px;
}

.instant-stage {
  min-height: 470px;
  color: #fff;
  background: #102135;
  text-align: center;
}

.instant-stage .progress-track {
  background: #2a3f55;
}

.instant-stage .session-progress {
  color: #bdd0df;
}

.instant-stage .mode-kicker {
  margin-top: 36px;
  color: #71c9ff;
}

.instant-japanese {
  max-width: 820px;
  min-height: 74px;
  margin: 10px auto 22px;
  font-size: 27px;
}

.instant-countdown {
  min-height: 32px;
  color: #70e0bb;
  font-size: 18px;
  font-weight: 800;
}

.instant-answer {
  max-width: 800px;
  margin: 20px auto;
  padding: 20px;
  border: 1px solid #34506b;
  border-radius: 7px;
  background: #162d46;
}

.instant-answer p:last-child {
  margin: 0;
  font-size: 23px;
  font-weight: 750;
}

.rating-actions {
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.rating-actions .button {
  min-width: 140px;
  color: #fff;
}

.rating-good {
  background: var(--green);
}

.rating-close {
  background: var(--orange);
}

.rating-review {
  background: var(--red);
}

.learning-footer-actions {
  justify-content: space-between;
  margin-top: 32px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.voice-export-panel {
  margin-top: 32px;
  padding: 32px 0;
  border-top: 2px solid #9fc5dc;
  border-bottom: 1px solid #c6dbe7;
}

.voice-export-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.voice-export-heading h2 {
  margin-bottom: 6px;
  font-size: 24px;
}

.voice-export-heading p:last-child {
  margin: 0;
  color: var(--ink-soft);
}

.voice-target-count {
  display: grid;
  width: 66px;
  min-width: 66px;
  height: 66px;
  margin: 0;
  place-content: center;
  border-radius: 50%;
  color: #fff !important;
  background: var(--blue);
  text-align: center;
}

.voice-target-count strong,
.voice-target-count span {
  display: block;
  line-height: 1;
}

.voice-target-count strong {
  font-size: 25px;
}

.voice-target-count span {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 800;
}

.voice-export-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 28px;
  align-items: start;
}

.voice-export-layout h3,
.voice-export-controls legend {
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.voice-target-list {
  display: grid;
  gap: 8px;
}

.voice-target-row {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  min-height: 58px;
  padding: 9px 11px;
  border: 1px solid #c6dbe7;
  border-radius: 7px;
  background: #fff;
}

.voice-target-number {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #34586d;
  font-size: 12px;
  font-weight: 800;
}

.voice-target-copy strong,
.voice-target-copy small {
  display: block;
  overflow-wrap: anywhere;
}

.voice-target-copy small {
  margin-top: 2px;
  color: var(--ink-soft);
}

.voice-target-kind {
  padding: 4px 7px;
  border: 1px solid #afd9c9;
  border-radius: 5px;
  color: #066347;
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.voice-target-kind.is-review {
  border-color: #edc69b;
  color: #714006;
  background: var(--orange-soft);
}

.voice-target-kind.is-extra {
  border-color: #bfd0d8;
  color: #415864;
  background: #f2f6f7;
}

.voice-export-controls {
  padding: 20px;
  border: 1px solid #c6dbe7;
  border-radius: 7px;
  background: #fff;
}

.voice-export-controls fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.voice-mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.voice-mode-button {
  min-height: 76px;
  padding: 11px;
  border: 1px solid #b7c6cd;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.voice-mode-button strong,
.voice-mode-button span {
  display: block;
}

.voice-mode-button span {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11px;
}

.voice-mode-button.is-active {
  border-color: var(--blue);
  color: var(--blue-dark);
  background: var(--blue-soft);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.voice-mode-description {
  min-height: 48px;
  margin: 13px 0 16px;
  color: var(--ink-soft);
  font-size: 13px;
}

.voice-export-controls .button-large {
  width: 100%;
}

.voice-copy-steps {
  margin: 16px 0 0;
  padding-left: 22px;
  color: var(--ink-soft);
  font-size: 13px;
}

.voice-copy-steps li + li {
  margin-top: 5px;
}

.practice-controls {
  position: fixed;
  z-index: 30;
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.instant-resume-button {
  width: min(100%, 320px);
  margin: 0 auto 22px;
}

.voice-dialog {
  width: min(760px, calc(100% - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(23, 35, 43, 0.25);
}

.install-dialog {
  width: min(900px, calc(100% - 28px));
}

.install-status {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #b8d4e4;
  border-radius: 7px;
  color: #134968;
  background: #eef8fd;
  font-size: 14px;
  font-weight: 700;
}

.install-status.is-installed {
  border-color: #9bd0bb;
  color: #065c42;
  background: var(--green-soft);
}

.install-guide-section {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.install-guide-section h3 {
  margin-bottom: 12px;
  font-size: 17px;
}

.install-guide-section ol {
  margin: 0;
  padding-left: 22px;
}

.install-guide-section li + li {
  margin-top: 8px;
}

.install-guide-section p {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.install-platform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.platform-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}

.platform-heading h3 {
  margin: 0;
}

.platform-badge {
  padding: 3px 8px;
  border-radius: 999px;
  color: #fff;
  background: #202b33;
  font-size: 12px;
  font-weight: 800;
}

.android-badge {
  background: var(--green);
}

.install-warning {
  padding: 11px 12px;
  border-left: 4px solid var(--orange);
  color: #714006 !important;
  background: var(--orange-soft);
}

.install-link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
}

.install-finish {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 16px;
  align-items: center;
  margin-top: 16px;
  padding: 18px 20px;
  border-radius: 7px;
  color: #fff;
  background: #102135;
}

.install-finish img {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 14px;
}

.install-finish h3 {
  margin-bottom: 5px;
  font-size: 17px;
}

.install-finish p {
  margin: 0;
  color: #bdd0df;
  font-size: 13px;
}

.voice-dialog::backdrop {
  background: rgba(18, 31, 39, 0.5);
}

.dialog-shell {
  padding: 26px;
}

.dialog-header {
  justify-content: space-between;
  margin-bottom: 22px;
}

.dialog-header h2 {
  margin: 0;
}

.icon-button {
  width: 40px;
  height: 40px;
  font-size: 25px;
}

.voice-settings-grid {
  grid-template-columns: 1fr 1fr;
}

.voice-settings-grid section {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.voice-settings-grid h3 {
  margin-bottom: 16px;
  font-size: 17px;
}

.voice-settings-grid select,
.voice-settings-grid input[type="range"] {
  width: 100%;
  margin: 5px 0 14px;
}

.rate-presets {
  gap: 6px;
  margin-bottom: 14px;
}

.rate-presets button {
  flex: 1;
  min-height: 36px;
  padding: 6px;
  border: 1px solid #b7c6cd;
  border-radius: 5px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 24px;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  transform: translateX(-50%);
  border-radius: 6px;
  color: #fff;
  background: #17232b;
  box-shadow: var(--shadow);
  font-size: 14px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  .app-header {
    min-height: 68px;
    padding: 10px 16px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand-subtitle,
  .voice-summary {
    display: none;
  }

  .app-shell {
    width: min(calc(100% - 28px), var(--content));
    padding-top: 34px;
  }

  .entry-layout,
  .ready-grid,
  .launch-panel,
  .voice-settings-grid,
  .audio-toolbar,
  .install-platform-grid,
  .voice-export-layout {
    grid-template-columns: 1fr;
  }

  .entry-guide {
    order: -1;
  }

  .summary-band {
    grid-template-columns: 1fr;
  }

  .summary-band > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .learning-topline {
    display: block;
  }

  .learning-meta {
    justify-content: flex-start;
    margin-top: 9px;
  }

  .tabs {
    overflow: hidden;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .audio-options {
    justify-content: stretch;
  }

  .audio-options label {
    flex: 1;
    min-width: 0;
  }

  .quiz-options {
    grid-template-columns: 1fr;
  }

  .audio-sentence,
  .instant-japanese {
    font-size: 23px;
  }

  .result-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 15px;
  }

  .brand-block {
    gap: 8px;
  }

  .brand-name {
    max-width: 135px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .button-compact {
    padding: 7px 8px;
    font-size: 12px;
  }

  .section-heading h1 {
    font-size: 28px;
  }

  .input-area,
  .entry-guide,
  .focus-panel,
  .launch-panel,
  .session-panel,
  .results-panel,
  .audio-stage,
  .instant-stage,
  .voice-export-panel {
    padding: 20px;
  }

  .voice-export-panel {
    padding-right: 0;
    padding-left: 0;
  }

  .voice-export-heading h2 {
    font-size: 21px;
  }

  .voice-target-count {
    width: 56px;
    min-width: 56px;
    height: 56px;
  }

  .voice-target-row {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .voice-target-kind {
    grid-column: 2;
    justify-self: start;
  }

  .voice-mode-selector {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 280px;
  }

  .tabs {
    margin-right: -14px;
    margin-left: -14px;
  }

  .tab-button {
    min-height: 54px;
    padding: 6px 3px;
    font-size: 12px;
  }

  .tab-number {
    display: none;
  }

  .segmented-control {
    grid-template-columns: 1fr;
  }

  .segment {
    border-right: 0;
    border-bottom: 1px solid #b7c6cd;
  }

  .segment:last-child {
    border-bottom: 0;
  }

  .audio-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .audio-options label:first-child {
    grid-column: 1 / -1;
  }

  .sentence-row {
    grid-template-columns: 30px minmax(0, 1fr) 42px;
    padding: 11px 9px;
  }

  .sentence-copy strong {
    font-size: 14px;
  }

  .sentence-copy small {
    font-size: 12px;
  }

  .instant-answer p:last-child {
    font-size: 20px;
  }

  .practice-controls {
    right: 12px;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    justify-content: center;
    border-radius: 8px;
  }

  .practice-controls .button {
    flex: 1;
  }

  .learning-footer-actions {
    padding-bottom: 58px;
  }

  .rate-presets {
    display: grid;
    grid-template-columns: 1fr;
  }

  .install-finish {
    grid-template-columns: 52px 1fr;
    padding: 15px;
  }

  .install-finish img {
    width: 52px;
    height: 52px;
    border-radius: 11px;
  }
}

@media (display-mode: standalone) and (max-width: 560px) {
  .practice-controls {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
