:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f5f7fb;
  color: #17202a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(245, 247, 251, 0.94)),
    #f5f7fb;
}

body.modal-open {
  overflow: hidden;
}

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

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

.topbar h1,
.topbar p,
.panel h2,
.status-text {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 6px;
  color: #5d6b78;
  font-size: 15px;
}

.runtime-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 34px;
  border-radius: 8px;
  background: #163b2d;
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  border: 1px solid #d9e1ea;
  border-radius: 8px;
  background: #ffffff;
  padding: 20px;
  box-shadow: 0 12px 30px rgba(22, 38, 54, 0.08);
}

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

.panel-heading h2 {
  font-size: 18px;
  letter-spacing: 0;
}

.panel-heading span {
  color: #6c7a86;
  font-size: 13px;
  white-space: nowrap;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: #354452;
  font-size: 14px;
  font-weight: 700;
}

.reference-text,
.target-text {
  width: 100%;
  border: 1px solid #cbd5df;
  border-radius: 8px;
  background: #fbfcfe;
  color: #17202a;
  font: inherit;
  line-height: 1.55;
  resize: vertical;
}

.reference-text {
  min-height: 96px;
  padding: 12px;
}

.target-text {
  min-height: 314px;
  padding: 14px;
}

.reference-text:focus,
.target-text:focus {
  outline: 2px solid #3c8dbc;
  outline-offset: 2px;
}

.meter {
  display: block;
  width: 100%;
  height: 96px;
  margin: 18px 0;
  border: 1px solid #d9e1ea;
  border-radius: 8px;
  background: #eef2f7;
}

.button-row,
.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  min-height: 42px;
  border: 1px solid #c4ced8;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  padding: 0 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button.primary {
  border-color: #0f7d5b;
  background: #0f7d5b;
  color: #ffffff;
}

.button:hover:not(:disabled) {
  filter: brightness(0.97);
}

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

.audio-preview {
  width: 100%;
  margin-top: 18px;
}

.action-row {
  justify-content: space-between;
  margin-top: 14px;
}

.status-text {
  color: #5d6b78;
  font-size: 14px;
}

.status-text[data-state="active"] {
  color: #9a5c00;
}

.status-text[data-state="ready"] {
  color: #0f7d5b;
}

.status-text[data-state="error"] {
  color: #b42318;
}

.result-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e3e9ef;
}

.result-panel audio {
  width: 100%;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: 12px;
  border-radius: 8px;
  background: #294a67;
  color: #ffffff;
  padding: 0 16px;
  text-decoration: none;
  font-weight: 700;
}

.site-footer {
  margin-top: 20px;
  padding: 4px 0 8px;
  color: #6c7a86;
  font-size: 13px;
  text-align: center;
}

.site-footer a {
  color: #0f7d5b;
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.progress-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.46);
}

.progress-overlay[hidden] {
  display: none;
}

.progress-dialog {
  width: min(360px, 100%);
  border: 1px solid #d9e1ea;
  border-radius: 8px;
  background: #ffffff;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.loading-spinner {
  width: 46px;
  height: 46px;
  margin: 0 auto 18px;
  border: 4px solid #dbe4ec;
  border-top-color: #0f7d5b;
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.progress-dialog h2 {
  margin: 0;
  color: #17202a;
  font-size: 18px;
  letter-spacing: 0;
}

.progress-message {
  min-height: 22px;
  margin: 10px 0 0;
  color: #4d5c68;
  font-size: 14px;
  line-height: 1.45;
}

.progress-overlay[data-state="error"] .progress-message {
  color: #b42318;
}

.progress-overlay[data-state="error"] .loading-spinner {
  border-color: #f4c7c3;
  border-top-color: #b42318;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100vw - 20px, 680px);
    padding-top: 18px;
  }

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

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

  .panel {
    padding: 16px;
  }

  .target-text {
    min-height: 240px;
  }

  .progress-dialog {
    padding: 18px;
  }
}
