:root {
  --ink: #25213d;
  --muted: #6f6c7d;
  --purple: #573481;
  --blue: #2e5f9d;
  --cyan: #13a8c6;
  --cyan-soft: #e9f8fb;
  --purple-soft: #f1ecf7;
  --danger: #d84b58;
  --line: #e5e2ec;
  --paper: #f8f7fb;
  --white: #fff;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 8%, rgba(19,168,198,.10), transparent 25%),
    radial-gradient(circle at 90% 12%, rgba(87,52,129,.10), transparent 27%),
    var(--paper);
  font-family: "DM Sans", system-ui, sans-serif;
}
button, select { font: inherit; min-height: 44px; touch-action: manipulation; }
button { cursor: pointer; }
.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 70px; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(37,33,61,.08); }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; }
.brand-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 10px; }
.privacy-pill { font-size: 13px; color: var(--purple); background: rgba(255,255,255,.72); border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px; }
.hero { text-align: center; padding: 54px 16px 43px; }
.hero-logo { width: 98px; height: 98px; object-fit: contain; margin-bottom: 13px; filter: drop-shadow(0 12px 22px rgba(46,95,157,.14)); }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: 12px; font-weight: 700; color: var(--purple); margin: 0 0 17px; }
.hero h1 { font-size: clamp(43px, 6.5vw, 76px); line-height: .98; letter-spacing: -.06em; margin: 0; }
.hero h1 span { background: linear-gradient(95deg, var(--purple), var(--blue), var(--cyan)); -webkit-background-clip: text; color: transparent; }
.hero-copy { width: min(650px, 100%); margin: 24px auto 0; color: var(--muted); font-size: 17px; line-height: 1.65; }
.workspace { display: grid; grid-template-columns: 400px 1fr; gap: 22px; align-items: stretch; }
.control-card, .results-card { background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 18px 55px rgba(57,40,91,.08); }
.control-card { padding: 28px; }
.step-heading { display: flex; gap: 14px; align-items: flex-start; }
.step-heading.compact { margin-bottom: 20px; }
.step-number { flex: 0 0 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, var(--purple), var(--cyan)); color: white; font-size: 13px; font-weight: 700; }
.step-heading h2 { font-size: 17px; margin: 1px 0 5px; letter-spacing: -.025em; }
.step-heading p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.45; }
.first-language { margin-top: 20px; }
.recorder { margin: 24px 0 18px; background: linear-gradient(145deg, var(--purple-soft), var(--cyan-soft)); border: 1px solid #ddd8e9; border-radius: 18px; min-height: 164px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; position: relative; overflow: hidden; }
.record-button { width: 68px; height: 68px; min-height: 68px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--purple), var(--blue), var(--cyan)); box-shadow: 0 10px 24px rgba(46,95,157,.28); display: grid; place-items: center; transition: transform .2s ease; z-index: 2; }
.record-button:hover { transform: translateY(-2px); }
.record-icon { width: 16px; height: 22px; border: 2px solid white; border-radius: 10px; position: relative; }
.record-icon::after { content: ""; position: absolute; width: 24px; height: 12px; border: 2px solid white; border-top: 0; border-radius: 0 0 14px 14px; left: 50%; bottom: -8px; transform: translateX(-50%); }
.record-button.recording { background: var(--danger); animation: pulse 1.7s infinite; }
.record-button.recording .record-icon { width: 18px; height: 18px; border: 0; border-radius: 4px; background: white; }
.record-button.recording .record-icon::after { display: none; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(216,75,88,.28); } 50% { box-shadow: 0 0 0 13px rgba(216,75,88,0); } }
.record-state { display: flex; gap: 9px; margin-top: 16px; align-items: center; font-size: 13px; }
.record-state span { color: var(--muted); font-variant-numeric: tabular-nums; }
.visualizer { height: 25px; display: flex; gap: 3px; align-items: center; margin-top: 11px; opacity: .2; }
.visualizer i { display: block; width: 3px; height: 7px; border-radius: 99px; background: var(--purple); }
.visualizer.active { opacity: .75; }
.visualizer.active i { animation: sound .8s ease-in-out infinite alternate; }
.visualizer i:nth-child(2n) { animation-delay: -.3s; }
.visualizer i:nth-child(3n) { animation-delay: -.55s; }
@keyframes sound { from { height: 5px; } to { height: 24px; } }
.divider { border-top: 1px solid var(--line); margin: 25px 0; }
.language-row label { display: block; font-size: 12px; font-weight: 700; color: #56516a; margin: 0 0 8px; }
.language-row select { width: 100%; height: 50px; border-radius: 12px; border: 1px solid #d9d5e2; background: white; padding: 0 14px; outline: none; }
.language-row select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(19,168,198,.15); }
.process-button { width: 100%; height: 53px; border: 0; border-radius: 13px; margin-top: 17px; padding: 0 17px; background: linear-gradient(95deg, var(--purple), var(--blue), var(--cyan)); color: white; display: flex; align-items: center; justify-content: space-between; font-weight: 700; box-shadow: 0 9px 22px rgba(46,95,157,.18); }
.process-button:disabled { cursor: not-allowed; opacity: .35; box-shadow: none; }
.process-button:not(:disabled):hover .arrow { transform: translateX(3px); }
.arrow { transition: transform .2s ease; }
.status { min-height: 18px; color: var(--danger); font-size: 12px; line-height: 1.45; margin: 11px 2px 0; }
.results-card { min-height: 570px; padding: 8px; }
.empty-state { min-height: 552px; display: grid; place-content: center; text-align: center; padding: 40px; }
.empty-logo { width: 86px; height: 86px; object-fit: contain; margin: 0 auto 18px; opacity: .78; }
.empty-state h2 { margin: 0 0 8px; font-size: 20px; }
.empty-state p { color: var(--muted); width: min(420px, 100%); line-height: 1.6; margin: 0; font-size: 14px; }
.results-content { display: none; grid-template-columns: 1fr 1px 1fr; height: 100%; min-height: 552px; }
.results-card:not(.is-empty) .empty-state { display: none; }
.results-card:not(.is-empty) .results-content { display: grid; }
.result-column { padding: 29px 28px; min-width: 0; }
.vertical-rule { background: var(--line); margin: 22px 0; }
.result-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.result-label { display: block; color: var(--cyan); text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 700; margin-bottom: 6px; }
.result-header h3 { margin: 0; font-size: 19px; letter-spacing: -.03em; }
.copy-button { border: 1px solid var(--line); background: white; border-radius: 9px; padding: 7px 10px; font-size: 11px; color: var(--purple); }
.text-output { white-space: pre-wrap; font-size: 16px; line-height: 1.75; padding-top: 24px; color: #302d3b; overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .control-card { max-width: 620px; width: 100%; margin: 0 auto; }
  .results-card:not(.is-empty) .results-content { display: block; }
  .vertical-rule { margin: 0 28px; height: 1px; }
  .result-column { min-height: 260px; }
}
@media (max-width: 700px) {
  .page-shell { width: 100%; padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); padding-bottom: max(34px, env(safe-area-inset-bottom)); }
  .topbar { height: 64px; position: sticky; top: 0; z-index: 10; background: rgba(248,247,251,.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
  .brand { font-size: 14px; }
  .brand-logo { width: 36px; height: 36px; }
  .privacy-pill { display: none; }
  .hero { padding: 32px 2px 28px; }
  .hero-logo { width: 82px; height: 82px; }
  .eyebrow { font-size: 10px; letter-spacing: .13em; margin-bottom: 13px; }
  .hero h1 { font-size: clamp(38px, 12vw, 54px); line-height: 1.02; letter-spacing: -.055em; }
  .hero h1 br { display: none; }
  .hero-copy { margin-top: 18px; font-size: 15px; line-height: 1.55; }
  .workspace { gap: 14px; }
  .control-card, .results-card { width: 100%; border-radius: 18px; box-shadow: 0 12px 34px rgba(57,40,91,.08); }
  .control-card { padding: 20px 16px; }
  .step-heading { gap: 11px; }
  .step-number { flex-basis: 26px; height: 26px; }
  .step-heading h2 { font-size: 16px; }
  .step-heading p { font-size: 12px; }
  .recorder { min-height: 178px; margin: 21px 0 18px; padding: 24px 16px; border-radius: 16px; }
  .record-button { width: 74px; height: 74px; min-height: 74px; }
  .record-state { flex-wrap: wrap; justify-content: center; text-align: center; }
  .record-state strong { width: 100%; }
  .language-row select { height: 52px; font-size: 16px; padding-right: 40px; }
  .process-button { min-height: 54px; font-size: 15px; margin-top: 14px; }
  .status { font-size: 13px; }
  .results-card { padding: 6px; min-height: 0; }
  .empty-state { min-height: 310px; padding: 34px 20px; }
  .results-content { min-height: 0; }
  .result-column { min-height: 0; padding: 22px 16px 26px; }
  .vertical-rule { margin: 0 16px; }
  .result-header { gap: 10px; padding-bottom: 16px; }
  .result-header h3 { font-size: 18px; }
  .copy-button { flex: 0 0 auto; min-height: 40px; padding: 8px 12px; }
  .text-output { padding-top: 18px; font-size: 15px; line-height: 1.65; }
}
@media (max-width: 380px) {
  .page-shell { padding-left: 10px; padding-right: 10px; }
  .hero h1 { font-size: 36px; }
  .control-card { padding: 18px 14px; }
  .result-header { align-items: center; }
  .result-header h3 { font-size: 16px; }
}

/* Mobile navigation */
@media (max-width: 700px) {
  .topbar {
    width: auto;
    height: 64px;
    margin-left: calc(-1 * max(14px, env(safe-area-inset-left)));
    margin-right: calc(-1 * max(14px, env(safe-area-inset-right)));
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    background: rgba(248, 247, 251, 0.96);
    border-bottom: 1px solid rgba(37, 33, 61, 0.1);
    box-shadow: 0 6px 20px rgba(57, 40, 91, 0.06);
  }

  .brand {
    min-width: 0;
    max-width: 100%;
    gap: 9px;
  }

  .brand-logo {
    flex: 0 0 36px;
  }

  .brand span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .topbar {
    margin-left: -10px;
    margin-right: -10px;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  .brand {
    font-size: 13px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }
}
