:root {
  --paper: #FAFAF9;
  --surface: #FFFFFF;
  --surface-2: #FCFCFB;
  --sunken: #F5F5F4;
  --line: #E7E5E4;
  --ink: #1C1917;
  --ink-2: #44403C;
  --muted: #57534E;
  --faint: #A8A29E;
  --bar: #D6D3D1;
  --signal: #EA580C;
  --signal-text: #C2410C;
  --online: #16A34A;
  --on-ink: #FFFFFF;
  --shadow: 0 1px 2px rgba(28, 25, 23, .04), 0 12px 40px -12px rgba(28, 25, 23, .12);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --radius: 16px;
  --font: 'Geist', 'Noto Sans Devanagari', 'Noto Sans Bengali', 'Noto Sans Tamil', 'Noto Sans Telugu',
          'Noto Sans Kannada', 'Noto Sans Malayalam', 'Noto Sans Gujarati', 'Noto Sans Gurmukhi',
          'Noto Sans Oriya', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0C0A09; --surface: #161412; --surface-2: #1A1816; --sunken: #23201E; --line: #2E2A27;
    --ink: #F5F5F4; --ink-2: #D6D3D1; --muted: #A8A29E; --faint: #78716C; --bar: #44403C;
    --signal: #F97316; --signal-text: #FB923C; --online: #22C55E; --on-ink: #0C0A09;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 48px -16px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0C0A09; --surface: #161412; --surface-2: #1A1816; --sunken: #23201E; --line: #2E2A27;
  --ink: #F5F5F4; --ink-2: #D6D3D1; --muted: #A8A29E; --faint: #78716C; --bar: #44403C;
  --signal: #F97316; --signal-text: #FB923C; --online: #22C55E; --on-ink: #0C0A09;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 48px -16px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.02em; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.accent { color: var(--signal-text); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--ink); color: var(--on-ink); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* Nav */
.nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.nav__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.brand__mark { width: 28px; height: 28px; border-radius: 8px; background: var(--ink); display: flex; align-items: center; justify-content: center; gap: 2px; }
.brand__mark i { width: 2px; border-radius: 2px; background: var(--on-ink); transform-origin: center; animation: vb 1.4s var(--ease) infinite; }
.brand__mark i:nth-child(1) { height: 8px; animation-delay: -.2s; }
.brand__mark i:nth-child(2) { height: 14px; background: var(--signal); animation-delay: -.5s; }
.brand__mark i:nth-child(3) { height: 10px; animation-delay: -.8s; }
.nav__links { display: flex; gap: 2px; }
.nav__links a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink-2); transition: background .15s; }
.nav__links a:hover { background: var(--sunken); }
.nav__actions { display: flex; gap: 8px; align-items: center; }

.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: 12px var(--mono); color: var(--ink-2); white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex-shrink: 0; }
.dot--accent { background: var(--signal); }
.pill[data-state="ready"] .dot { background: var(--online); animation: pulse 2s ease-in-out infinite; }
.pill[data-state="loading"] .dot { background: var(--signal); animation: pulse 1s ease-in-out infinite; }

.icon-btn { width: 36px; height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s, transform .15s; }
.icon-btn:hover { background: var(--sunken); }
.icon-btn:active { transform: scale(.96); }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn--box { width: 44px; height: 44px; flex-shrink: 0; }
.icon-btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 0 20px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-weight: 500; cursor: pointer; transition: transform .15s var(--ease), background .15s, box-shadow .2s; }
.btn:hover { background: var(--sunken); }
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn--primary:hover { background: var(--ink); box-shadow: 0 6px 20px -6px color-mix(in srgb, var(--ink) 50%, transparent); }
.btn--sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; color: var(--ink-2); }
.btn--lg { min-height: 46px; }
.btn kbd { font-size: 12px; opacity: .6; }
.btn[disabled] { cursor: progress; }
.spinner { display: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--on-ink) 30%, transparent); border-top-color: var(--on-ink); animation: spin .8s linear infinite; }
.is-busy .spinner { display: block; }

/* Hero */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px; padding-top: 88px; padding-bottom: 40px; }
.eyebrow { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; color: var(--ink-2); }
.eyebrow .dot { width: 6px; height: 6px; }
.hero h1 { font-size: clamp(40px, 6.4vw, 68px); line-height: 1.03; letter-spacing: -0.035em; max-width: 820px; }
.lede { font-size: 18px; color: var(--muted); max-width: 600px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.hero__wave { width: min(100%, 560px); height: 88px; margin-top: 14px; }

/* Studio */
.studio-wrap { padding-top: 24px; padding-bottom: 72px; }
.studio { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.studio__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.studio__bar > .mono { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.traffic { display: flex; gap: 6px; }
.traffic i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.studio__body { display: flex; flex-wrap: wrap; }

.langs { flex: 1 1 260px; min-width: 0; max-width: 300px; border-right: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.langs__search { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.langs__search svg { width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; flex-shrink: 0; }
.langs__search input { border: 0; outline: 0; background: transparent; width: 100%; font: inherit; font-size: 14px; color: var(--ink); }
.langs__list { display: flex; flex-direction: column; gap: 2px; max-height: 520px; overflow-y: auto; scrollbar-width: thin; }
.lang { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 6px 10px; border-radius: 8px; border: 1px solid transparent; background: transparent; text-align: left; cursor: pointer; transition: background .15s, border-color .2s; }
.lang:hover { background: var(--sunken); }
.lang[aria-selected="true"] { border-color: var(--ink); background: var(--surface-2); }
.lang[aria-disabled="true"] { opacity: .45; }
.lang__name { display: flex; flex-direction: column; align-items: flex-start; font-weight: 500; font-size: 14px; }
.lang__code { font: 12px var(--mono); color: var(--muted); }
.lang__native { font-size: 15px; color: var(--ink-2); }

.editor { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.editor__main { padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; flex-grow: 1; }
.editor__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
#text { min-height: 240px; resize: vertical; border: 0; outline: 0; padding: 0; background: transparent; color: var(--ink); font: inherit; font-size: 22px; line-height: 1.55; }
#text::placeholder { color: var(--faint); }
.editor__meta { display: flex; justify-content: space-between; gap: 12px; }
.editor__controls { border-top: 1px solid var(--line); padding: 14px 24px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; background: var(--surface-2); }

.seg { position: relative; display: inline-flex; padding: 3px; background: var(--sunken); border-radius: 10px; gap: 2px; }
.seg::before { content: ""; position: absolute; top: 3px; bottom: 3px; left: var(--x, 3px); width: var(--w, 0); background: var(--surface); border-radius: 8px; box-shadow: 0 1px 2px rgba(28, 25, 23, .14); transition: left .3s var(--ease), width .3s var(--ease); }
.seg button { position: relative; min-height: 38px; padding: 0 16px; border: 0; background: transparent; border-radius: 8px; color: var(--muted); cursor: pointer; transition: color .2s; }
.seg button[aria-checked="true"] { color: var(--ink); font-weight: 500; }
.seg button:disabled { opacity: .4; cursor: not-allowed; }

.player { position: relative; overflow: hidden; border-top: 1px solid var(--line); padding: 16px 24px; display: flex; align-items: center; gap: 16px; }
.player__sweep { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--signal) 12%, transparent), transparent); transform: translateX(-100%); opacity: 0; pointer-events: none; }
.player[data-state="loading"] .player__sweep { opacity: 1; animation: sweep 1.2s linear infinite; }
.player__wave { flex: 1 1 auto; min-width: 0; height: 44px; cursor: pointer; }
.player[data-state="empty"] .player__wave, .player[data-state="loading"] .player__wave { cursor: default; }
.player__time { flex-shrink: 0; min-width: 76px; text-align: right; }
.play { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: 0; background: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .2s var(--ease), opacity .2s; }
.play:active { transform: scale(.94); }
.play:disabled { opacity: .25; cursor: default; }
.play svg { width: 14px; height: 14px; fill: var(--on-ink); }
.play .i-pause, .is-playing .play .i-play { display: none; }
.is-playing .play .i-pause { display: block; }

/* History */
.history { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.history__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.history__item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); animation: rise .5s var(--ease) both; }
.history__item .play { width: 36px; height: 36px; }
.history__text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history__meta { flex-shrink: 0; }

/* Languages band */
.band { border-block: 1px solid var(--line); background: var(--surface); padding: 48px 0; overflow: hidden; }
.band__head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }
.band__head p { max-width: 420px; }
.marquee { mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee__track { display: flex; width: max-content; animation: marquee 48s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__item { padding: 0 28px; font-size: clamp(32px, 4vw, 48px); white-space: nowrap; display: flex; align-items: baseline; gap: 12px; transition: color .2s; }
.marquee__item span { font: 12px var(--mono); color: var(--faint); }
.marquee__item:hover { color: var(--signal-text); }

/* How */
.how { padding-top: 80px; padding-bottom: 80px; display: flex; flex-direction: column; gap: 32px; }
.how__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 24px; display: flex; flex-direction: column; gap: 10px; transition: transform .3s var(--ease), box-shadow .3s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card h3 { font-size: 18px; }

.foot { border-top: 1px solid var(--line); }
.foot__row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; padding-top: 24px; padding-bottom: 24px; font-size: 13px; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(520px, calc(100% - 32px)); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--on-ink); font-size: 14px; box-shadow: var(--shadow); z-index: 40; animation: toast .35s var(--ease) both; }

/* Motion */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: calc(var(--d, 0) * 80ms); }
.reveal.is-in { opacity: 1; transform: none; }
@keyframes vb { 0%, 100% { transform: scaleY(.45); } 50% { transform: scaleY(1); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 860px) {
  .nav__links { display: none; }
  .langs { max-width: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .langs__list { flex-direction: row; overflow-x: auto; max-height: none; padding-bottom: 4px; }
  .lang { width: auto; flex-shrink: 0; gap: 12px; }
  .lang__name .lang__code { display: none; }
  .hide-sm { display: none; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 16px; }
  .hero { padding-top: 56px; }
  .editor__main, .editor__controls, .player { padding-left: 16px; padding-right: 16px; }
  .editor__controls .btn--lg { flex: 1; }
  .btn kbd, #format { display: none; }
  .player { gap: 10px; }
  .player__time { min-width: 0; }
  .pill #status-text { display: none; }
}
