:root {
  color-scheme: dark;
  --bg: #090b10;
  --panel: #11151d;
  --panel-2: #171c26;
  --line: #283040;
  --text: #f4f7fb;
  --muted: #929dad;
  --accent: #7c5cff;
  --accent-2: #28d6c0;
  --danger: #ff6b81;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 12% 0%, rgba(124,92,255,.18), transparent 30rem),
    radial-gradient(circle at 95% 12%, rgba(40,214,192,.12), transparent 26rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, sans-serif;
}
button, input { font: inherit; }
button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .75rem 1rem;
  background: #1a202b;
  color: var(--text);
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: #61708a; transform: translateY(-1px); }
button:disabled { opacity: .4; cursor: not-allowed; }
.app { width: min(1280px, calc(100% - 32px)); margin: 0 auto; padding: 40px 0 80px; }
.hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow { color: var(--accent-2); letter-spacing: .18em; font-weight: 800; font-size: .78rem; }
h1 { margin: 5px 0 8px; font-size: clamp(2rem, 5vw, 4.4rem); line-height: .98; letter-spacing: -.055em; }
.subtitle, .export-card p { color: var(--muted); }
.ghost-button { background: transparent; white-space: nowrap; }
.upload-card, .transport-card, .module, .export-card, .meter-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(23,28,38,.96), rgba(13,16,23,.96));
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
}
.upload-card { border-radius: 18px; padding: 14px; margin-bottom: 16px; }
.drop-zone {
  min-height: 160px;
  border: 1px dashed #49546a;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}
.drop-zone.dragging { border-color: var(--accent-2); background: rgba(40,214,192,.06); }
.drop-zone input { display: none; }
.drop-zone strong { color: var(--text); }
.upload-icon { font-size: 2.6rem; color: var(--accent); }
.file-info { padding: 13px 8px 2px; color: var(--muted); font-size: .9rem; }
.transport-card { border-radius: 18px; padding: 18px; margin-bottom: 16px; }
.transport-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.primary-button { border: 0; background: linear-gradient(135deg, var(--accent), #5a9cff); font-weight: 800; }
.timeline { display: grid; grid-template-columns: 54px 1fr 54px; gap: 10px; align-items: center; margin: 18px 0 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
#waveform { display: block; width: 100%; height: 170px; border-radius: 12px; background: #090c12; }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.meter-card { border-radius: 14px; padding: 14px; display: grid; grid-template-columns: 64px 1fr 72px; align-items: center; gap: 12px; font-size: .8rem; color: var(--muted); }
.meter { height: 10px; border-radius: 99px; background: #090c12; overflow: hidden; }
.meter-fill { width: 0%; height: 100%; background: linear-gradient(90deg, var(--accent-2), #d9dc52, var(--danger)); transition: width 60ms linear; }
.rack { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.module { border-radius: 18px; padding: 20px; min-width: 0; }
.module:last-child { grid-column: 1 / -1; }
.module-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.module-header > div { display: flex; align-items: baseline; gap: 10px; }
.module-number { color: var(--accent-2); font: 700 .75rem ui-monospace, monospace; }
.module h2 { margin: 0; font-size: 1.08rem; }
.controls { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.controls.three-columns { grid-template-columns: repeat(3, minmax(0,1fr)); }
.controls label { color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .08em; }
.controls output { float: right; color: var(--text); font-weight: 600; letter-spacing: 0; }
.controls input { display: block; margin-top: 12px; }
.switch input { display: none; }
.switch span { display:block; width: 43px; height: 24px; border-radius: 99px; background:#313949; padding:3px; cursor:pointer; }
.switch span::after { content:""; display:block; width:18px; height:18px; border-radius:50%; background:#aeb6c5; transition:.2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(19px); background:white; }
.export-card { margin-top: 16px; border-radius: 18px; padding: 22px; display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.export-card h2 { margin: 0 0 6px; }
.export-card p { margin: 0; }
.export-card progress, .export-card #statusText { grid-column: 1 / -1; width: 100%; }
progress { height: 8px; accent-color: var(--accent-2); }
#statusText { color: var(--muted); font-size: .85rem; }
@media (max-width: 760px) {
  .app { width: min(100% - 20px, 1280px); padding-top: 22px; }
  .hero { flex-direction: column; }
  .rack, .meters { grid-template-columns: 1fr; }
  .module:last-child { grid-column: auto; }
  .controls, .controls.three-columns { grid-template-columns: 1fr; }
  .export-card { grid-template-columns: 1fr; }
  .export-card button { width: 100%; }
}


.limiter-module {
  border-color: rgba(255, 107, 129, .36);
  background:
    radial-gradient(circle at 100% 0%, rgba(255,107,129,.10), transparent 18rem),
    linear-gradient(145deg, rgba(23,28,38,.96), rgba(13,16,23,.96));
}
.gain-reduction {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.gain-reduction-title {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  margin-bottom: 10px;
}
.gain-reduction-title output {
  color: var(--text);
  letter-spacing: 0;
}
.gain-reduction-meter {
  height: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: #090c12;
}
.gain-reduction-fill {
  width: 0%;
  height: 100%;
  margin-left: auto;
  background: linear-gradient(90deg, #ffb86b, var(--danger));
  transition: width 60ms linear;
}


.ai-card {
  border: 1px solid rgba(124, 92, 255, .42);
  background:
    radial-gradient(circle at 100% 0%, rgba(124,92,255,.15), transparent 24rem),
    linear-gradient(145deg, rgba(23,28,38,.98), rgba(13,16,23,.98));
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 16px;
}
.ai-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}
.ai-card h2 {
  margin: 4px 0 6px;
}
.ai-card p {
  margin: 0;
  color: var(--muted);
}
.ai-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.ai-actions select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .75rem .9rem;
  background: #0d1118;
  color: var(--text);
}
.analysis-empty {
  margin-top: 18px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}
.analysis-results {
  margin-top: 18px;
}
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
}
.analysis-grid > div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8,11,16,.45);
}
.analysis-grid span {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .07em;
}
.analysis-grid strong {
  display: block;
  margin-top: 7px;
  font-size: 1.05rem;
}
.recommendation-box {
  margin-top: 12px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(40,214,192,.07);
  border: 1px solid rgba(40,214,192,.25);
}
.recommendation-box h3 {
  margin: 0 0 7px;
  font-size: .9rem;
}
.recommendation-box p {
  line-height: 1.7;
}
@media (max-width: 760px) {
  .ai-card-header { flex-direction: column; }
  .ai-actions { width: 100%; }
  .ai-actions select,
  .ai-actions button { flex: 1 1 100%; }
  .analysis-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}


.spectrum-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}
.spectrum-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 11, 17, .62);
}
.spectrum-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 10px;
}
.spectrum-header > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.spectrum-header h3 {
  margin: 0;
  font-size: .95rem;
}
.spectrum-header output {
  color: var(--muted);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.spectrum-label {
  color: var(--accent-2);
  font: 800 .7rem ui-monospace, monospace;
  letter-spacing: .08em;
}
.spectrum-label.processed {
  color: var(--accent);
}
#inputSpectrum,
#outputSpectrum {
  display: block;
  width: 100%;
  height: 210px;
  border-radius: 10px;
  background: #080b10;
}
@media (min-width: 980px) {
  .spectrum-section {
    grid-template-columns: 1fr 1fr;
  }
}


.full-waveform-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 4px;
}
.full-waveform-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 11, 17, .58);
}
.processed-waveform-card {
  border-color: rgba(124, 92, 255, .34);
}
.full-waveform-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 10px;
}
.full-waveform-header > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.full-waveform-header h3 {
  margin: 0;
  font-size: .95rem;
}
.full-waveform-header > span,
.processed-waveform-actions > span {
  color: var(--muted);
  font-size: .78rem;
}
.full-waveform-label {
  font: 800 .7rem ui-monospace, monospace;
  letter-spacing: .08em;
}
.full-waveform-label.input {
  color: var(--accent-2);
}
.full-waveform-label.output {
  color: var(--accent);
}
.processed-waveform-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}
.processed-waveform-actions button {
  padding: .48rem .7rem;
  font-size: .76rem;
}
#processedWaveform {
  display: block;
  width: 100%;
  height: 170px;
  border-radius: 12px;
  background: #090c12;
}
@media (max-width: 760px) {
  .full-waveform-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .processed-waveform-actions {
    width: 100%;
    justify-content: space-between;
  }
}


.loudness-card {
  border: 1px solid rgba(40, 214, 192, .32);
  background:
    radial-gradient(circle at 100% 0%, rgba(40,214,192,.10), transparent 22rem),
    linear-gradient(145deg, rgba(23,28,38,.98), rgba(13,16,23,.98));
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 16px;
}
.loudness-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}
.loudness-header h2 {
  margin: 4px 0 6px;
}
.loudness-header p {
  margin: 0;
  color: var(--muted);
}
.loudness-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
  margin-top: 18px;
}
.loudness-grid > div {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8,11,16,.45);
}
.loudness-grid span {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
}
.loudness-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 1.1rem;
}
.loudness-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: .84rem;
}
.final-export-card {
  grid-template-columns: 1fr auto;
}
.export-copy {
  min-width: 0;
}
.export-options {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
}
.export-options label {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
}
.export-options select,
.export-options input[type="number"] {
  display: block;
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: .72rem .8rem;
  background: #0d1118;
  color: var(--text);
}
.normalize-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-top: 24px;
}
.normalize-option input {
  width: 18px;
  height: 18px;
}
.export-warning {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.6;
}
@media (max-width: 760px) {
  .loudness-header {
    flex-direction: column;
  }
  .loudness-grid {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
  .export-options {
    grid-template-columns: 1fr;
  }
  .normalize-option {
    padding-top: 0;
  }
}
