:root {
  --bg-main: #101214;
  --bg-surface: #15181c;
  --bg-card: #1b1f24;
  --bg-elevated: #22272f;
  --bg-subtle: #111315;
  --text-main: #f8fafc;
  --text-muted: #aab4c0;
  --text-soft: #7f8a99;
  --red-main: #c1121f;
  --red-hover: #e0202d;
  --red-dark: #7f1117;
  --yellow-main: #f1bf00;
  --yellow-soft: #ffd43b;
  --green-score: #7ee787;
  --border-soft: #303640;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --shadow-panel: 0 18px 42px rgba(0, 0, 0, 0.24);
  --bg: var(--bg-main);
  --surface: var(--bg-card);
  --surface-2: var(--bg-elevated);
  --surface-3: var(--bg-subtle);
  --player: #181c21;
  --text: var(--text-main);
  --muted: var(--text-muted);
  --muted-2: var(--text-soft);
  --primary: var(--red-main);
  --primary-dark: var(--red-dark);
  --primary-hover: var(--red-hover);
  --accent: var(--yellow-main);
  --accent-bright: var(--yellow-soft);
  --accent-soft: rgba(241, 191, 0, 0.14);
  --success: var(--green-score);
  --border: var(--border-soft);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.25);
  --radius: var(--radius-lg);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(193, 18, 31, 0.055), transparent 32%),
    linear-gradient(135deg, var(--bg-main), var(--bg-subtle) 52%, #0d0f11);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: var(--space-7) 0 72px;
}

.page-container {
  min-width: 0;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-5);
  align-items: start;
}

.main-column,
.side-column {
  min-width: 0;
}

header {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

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

h1 {
  max-width: 900px;
  color: var(--text);
  font-size: clamp(2rem, 3.4vw, 3rem);
  line-height: 1.04;
  letter-spacing: 0;
}

h2,
h3 {
  color: var(--text);
}

.intro {
  max-width: 820px;
  color: var(--muted);
  font-size: 1.08rem;
}

.app-shell {
  color: var(--text);
}

.page-header {
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.app-title,
.page-title {
  color: var(--text-main);
  font-size: clamp(2.35rem, 4vw, 3rem);
  font-weight: 950;
  line-height: 1.02;
}

.app-subtitle,
.page-subtitle {
  max-width: 760px;
  color: var(--text-muted);
  font-size: clamp(1rem, 1.3vw, 1.08rem);
  font-weight: 600;
}

.panel {
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.panel-primary {
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-card));
  border-color: rgba(255, 255, 255, 0.08);
}

.panel-secondary {
  background: var(--bg-card);
  border-color: var(--border-subtle);
}

.panel-muted {
  background: rgba(21, 24, 28, 0.76);
  box-shadow: none;
}

.panel-highlight {
  background:
    linear-gradient(180deg, rgba(241, 191, 0, 0.06), rgba(34, 39, 47, 0.96)),
    var(--bg-elevated);
  border-color: rgba(241, 191, 0, 0.18);
  box-shadow: var(--shadow-panel);
}

.config-panel {
  display: grid;
  gap: var(--space-5);
  padding: clamp(20px, 3vw, 28px);
  margin-bottom: var(--space-6);
}

.main-header {
  max-width: 900px;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 4px;
}

.panel-heading h2 {
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.panel-heading p {
  max-width: 420px;
  color: var(--muted-2);
  font-weight: 700;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.config-grid,
.control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: var(--space-4);
  align-items: end;
}

.voice-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) minmax(180px, 260px);
  gap: var(--space-4);
  align-items: end;
}

.field {
  min-width: 0;
}

label,
.field-label {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

select,
.select,
textarea,
input[type="text"],
.input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

select:focus,
textarea:focus,
input[type="text"]:focus,
input[type="range"]:focus-visible,
button:focus-visible,
.button-link:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(241, 191, 0, 0.16);
}

.range-line {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.range-control {
  min-height: 48px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.pill-value {
  min-width: 3.2rem;
  border: 1px solid rgba(241, 191, 0, 0.32);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  text-align: center;
  padding: 5px 8px;
}

.actions,
.actions-row,
.card-actions,
.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.btn,
button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  color: #fff;
  background: var(--primary);
  font: inherit;
  font-weight: 900;
  padding: 12px 18px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: none;
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.btn:hover,
button:hover,
.button-link:hover {
  background: var(--primary-hover);
  box-shadow: 0 10px 22px rgba(193, 18, 31, 0.18);
  transform: translateY(-1px);
}

.btn:active,
button:active,
.button-link:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(193, 18, 31, 0.2);
}

.btn-primary {
  border-color: rgba(255, 255, 255, 0.08);
  background: var(--primary);
  color: #fff;
}

.button-secondary {
  border-color: var(--border);
  color: var(--text);
  background: #181c21;
  box-shadow: none;
}

.button-secondary:hover {
  color: var(--text);
  background: #20252c;
  box-shadow: none;
}

.btn-secondary {
  border-color: var(--border);
  color: var(--text);
  background: var(--bg-surface);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  box-shadow: none;
}

.btn-warning {
  border-color: rgba(241, 191, 0, 0.32);
  background: rgba(241, 191, 0, 0.1);
  color: var(--yellow-soft);
  box-shadow: none;
}

.btn-warning:hover {
  background: rgba(241, 191, 0, 0.16);
  color: var(--text-main);
  box-shadow: none;
}

.button-accent {
  background: rgba(193, 18, 31, 0.13);
  border-color: rgba(193, 18, 31, 0.35);
  color: #ffb4b8;
}

.button-tertiary,
.btn-ghost {
  border-color: var(--border);
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.button-tertiary:hover,
.btn-ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: none;
}

.btn-danger {
  border-color: rgba(193, 18, 31, 0.35);
  color: #ffb4b8;
  background: rgba(193, 18, 31, 0.12);
  box-shadow: none;
}

.btn-danger:hover {
  color: #fff;
  background: rgba(193, 18, 31, 0.22);
  box-shadow: none;
}

.button-light,
.history-button {
  border: 1px solid var(--border);
  color: var(--muted);
  background: #202429;
  box-shadow: none;
}

.button-light:hover,
.history-button:hover {
  color: var(--text);
  background: #2a2f35;
  box-shadow: none;
}

.notice {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted-2);
  padding: 11px 13px;
  font-size: 0.92rem;
  font-weight: 700;
}

.notice-soft {
  border-color: var(--border-subtle);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted-2);
}

.notice-warning {
  border-color: rgba(241, 191, 0, 0.22);
  background: rgba(241, 191, 0, 0.07);
  color: var(--text-muted);
}

.message {
  display: none;
  margin: 14px 0;
  border: 1px solid rgba(241, 191, 0, 0.24);
  border-radius: 14px;
  background: rgba(241, 191, 0, 0.08);
  color: var(--muted);
  padding: 12px 14px;
  font-weight: 800;
}

.message.show {
  display: block;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 30px 0 14px;
}

.section-heading h2 {
  font-size: clamp(1.22rem, 2vw, 1.65rem);
}

.hint {
  color: var(--muted-2);
  font-size: 0.94rem;
}

.global-player-wrap {
  display: none;
  margin: 12px 0 14px;
}

.global-player-wrap.show {
  display: block;
}

.training-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.training-section {
  display: grid;
  gap: var(--space-4);
  padding: clamp(18px, 2.6vw, 24px);
  margin-top: var(--space-5);
}

.training-card {
  display: grid;
  gap: 13px;
  padding: 18px;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 34px;
  border: 1px solid rgba(241, 191, 0, 0.22);
  border-radius: 999px;
  background: rgba(241, 191, 0, 0.09);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 900;
}

.badge-level {
  border-color: rgba(126, 231, 135, 0.22);
  background: rgba(126, 231, 135, 0.08);
  color: var(--green-score);
}

.tag {
  border: 1px solid rgba(193, 18, 31, 0.22);
  border-radius: 999px;
  background: rgba(193, 18, 31, 0.12);
  color: #ffb4b8;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 6px 10px;
}

.main-text {
  color: var(--text);
  font-size: 1.14rem;
  font-weight: 900;
}

.secondary-text,
.answer-text {
  color: var(--muted);
  font-size: 0.98rem;
}

.answer-box {
  display: none;
  border: 1px solid rgba(241, 191, 0, 0.32);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  background: rgba(241, 191, 0, 0.1);
  padding: 10px 12px;
}

.answer-box.show {
  display: block;
}

.audio-player {
  display: grid;
  gap: 11px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--player);
  padding: 12px;
}

.audio-player.is-playing {
  border-color: rgba(46, 125, 50, 0.55);
  box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.12);
}

.player-top,
.player-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.player-buttons,
.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #181b1f;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
  box-shadow: none;
}

.player-button:hover {
  background: #2a2f35;
  color: var(--text);
  box-shadow: none;
}

.player-button.play {
  border-color: rgba(46, 125, 50, 0.38);
  color: #77d879;
}

.player-button.stop {
  border-color: rgba(193, 18, 31, 0.38);
  color: #ff8a90;
}

.status {
  border-radius: 999px;
  background: #181b1f;
  color: var(--muted-2);
  font-size: 0.84rem;
  font-weight: 900;
  padding: 6px 10px;
}

.status.playing {
  background: rgba(46, 125, 50, 0.16);
  color: #77d879;
}

.progress-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.progress-container {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #111315;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.12s linear;
}

.time-label {
  min-width: 86px;
  color: var(--muted-2);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.volume-control label {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.volume-control input {
  width: 96px;
}

.current-phrase {
  min-height: 1.35rem;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 800;
}

.history-panel {
  display: none;
  padding: 16px;
  margin-top: 24px;
}

.history-panel.show {
  display: grid;
  gap: 12px;
}

.history-button {
  text-align: left;
}

.empty-state {
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 20px;
  color: var(--muted-2);
  text-align: center;
}

.oral-cta,
.feature-cta,
.btn-oral-cta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  width: min(560px, 100%);
  border: 1px solid rgba(241, 191, 0, 0.18);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(193, 18, 31, 0.26), rgba(241, 191, 0, 0.1)),
    #171b20;
  color: var(--text);
  padding: 18px;
  text-decoration: none;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.badge-progress {
  border-color: rgba(241, 191, 0, 0.22);
  background: rgba(241, 191, 0, 0.08);
  color: var(--accent);
}

.badge-topic {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
}

.badge-status {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
}

.oral-cta:hover,
.feature-cta:hover,
.btn-oral-cta:hover {
  border-color: rgba(241, 191, 0, 0.36);
  background:
    linear-gradient(135deg, rgba(193, 18, 31, 0.34), rgba(241, 191, 0, 0.13)),
    #1b2026;
  transform: translateY(-2px);
}

.oral-cta-icon,
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #8d1019);
  color: #fff;
  font-size: 1.3rem;
}

.oral-cta-title,
.oral-cta-subtitle,
.feature-cta strong,
.feature-cta small {
  display: block;
}

.oral-cta-title,
.feature-cta strong {
  font-size: 1.08rem;
}

.oral-cta-subtitle,
.feature-cta small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

@media (max-width: 900px) {
  .page-grid,
  .config-grid,
  .voice-grid,
  .training-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .page {
    width: min(100% - 22px, 1220px);
    padding-top: 20px;
  }

  .section-heading,
  .panel-heading,
  .player-top,
  .player-bottom {
    align-items: start;
    flex-direction: column;
  }

  .actions > button,
  .actions > .button-link,
  .card-actions > button,
  .history-button,
  .oral-cta,
  .feature-cta,
  .btn-oral-cta {
    width: 100%;
  }

  .progress-row {
    grid-template-columns: 1fr;
  }

  .time-label {
    text-align: left;
  }

  .volume-control,
  .volume-control input {
    width: 100%;
  }
}
