:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --panel: #ffffff;
  --panel-strong: #eef6f3;
  --text: #14201d;
  --muted: #64736f;
  --line: #d9e5e1;
  --accent: #19745f;
  --accent-strong: #0e5a49;
  --accent-soft: #dff2ec;
  --warning: #a94b1f;
  --shadow: 0 18px 50px rgba(18, 46, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(223, 242, 236, 0.95), rgba(244, 247, 246, 0.8) 34%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans KR", sans-serif;
}

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

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.workspace {
  min-height: calc(100vh - 56px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.04;
}

h2 {
  font-size: 24px;
}

.status-pill {
  min-width: 92px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.status-pill.is-busy {
  color: var(--warning);
  background: #fff6ef;
  border-color: #f2d2bf;
}

.status-pill.is-ready {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: #a7d9ca;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.control-panel,
.output-panel {
  padding: 18px;
}

.field-group + .field-group,
.slider-group + .slider-group {
  margin-top: 18px;
}

.section-title,
.slider-line,
.meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title span,
.section-title label,
.slider-line label {
  color: var(--text);
  font-weight: 800;
}

.section-title strong,
.slider-line output,
.meter-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.language-button,
.voice-card,
.secondary-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.language-button {
  min-height: 42px;
  padding: 0 10px;
  font-weight: 800;
}

.language-button.is-active,
.voice-card.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.voice-card {
  min-height: 128px;
  padding: 12px;
  text-align: left;
}

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

.voice-card strong {
  min-height: 38px;
  font-size: 15px;
  line-height: 1.25;
}

.voice-card span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

textarea {
  display: block;
  width: 100%;
  min-height: 190px;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  background: #fbfdfc;
  color: var(--text);
  line-height: 1.6;
  outline: none;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(25, 116, 95, 0.12);
}

select {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--text);
  outline: none;
}

select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(25, 116, 95, 0.12);
}

.inline-label {
  display: block;
  margin-top: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

textarea[readonly] {
  min-height: 130px;
  background: #f4f8f6;
  color: var(--muted);
}

.helper-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.translation-panel {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.button-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.secondary-button {
  height: 40px;
  padding: 0 13px;
  font-weight: 800;
}

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

.meter-card {
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 16px;
}

.meter-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.waveform {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 5px;
  height: 92px;
  align-items: center;
  margin-top: 18px;
}

.waveform span {
  display: block;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #1a8b72, #89d6c1);
  opacity: 0.92;
}

.waveform span:nth-child(2n) {
  height: 54px;
}

.waveform span:nth-child(3n) {
  height: 74px;
}

.waveform span:nth-child(5n) {
  height: 42px;
}

.waveform.is-playing span {
  animation: pulse 780ms ease-in-out infinite alternate;
}

.waveform.is-playing span:nth-child(2n) {
  animation-delay: 90ms;
}

.waveform.is-playing span:nth-child(3n) {
  animation-delay: 160ms;
}

@keyframes pulse {
  from {
    transform: scaleY(0.62);
  }
  to {
    transform: scaleY(1);
  }
}

.slider-group {
  padding: 12px 0 2px;
}

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

.primary-button {
  width: 100%;
  min-height: 52px;
  margin-top: 20px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 900;
}

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

.result-box {
  display: none;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.result-box.is-visible {
  display: block;
}

audio {
  width: 100%;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: 10px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 900;
  text-decoration: none;
}

.notice {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  line-height: 1.45;
}

.notice strong {
  color: var(--text);
}

.notice.is-error {
  border-color: #e6b89f;
  background: #fff6ef;
}

.notice.is-error strong {
  color: var(--warning);
}

@media (max-width: 980px) {
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .voice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100vw - 20px, 1180px);
    padding: 12px 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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