/* Nova Audio: phone-first. One column, a sticky save bar at the bottom while editing. */
:root {
  --bg: #0b0b12;
  --panel: #14141d;
  --panel-2: #1c1c28;
  --line: #2a2a3a;
  --text: #ecebf7;
  --muted: #8f8eaa;
  --accent: #7DFABC;
  --accent-ink: #08080E;
  --danger: #ff6b6b;
  --rec: #ff4d5e;
  --radius: 12px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
button, a, input { font: inherit; color: inherit; touch-action: manipulation; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#au-app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }

/* Top bar */
#au-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.au-ibtn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; padding: 0; background: none; border-radius: 10px; color: var(--text); text-decoration: none; }
.au-ibtn:active { background: var(--panel-2); }
.au-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; white-space: nowrap; min-width: 0; }
.au-brand { flex-shrink: 0; }
.au-brand span { color: var(--accent); margin-left: -4px; }
.au-tool { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-weight: 500; font-size: 14px; }
.au-tool:empty { display: none; }
.au-tool::before { content: "\00b7"; margin-right: 6px; }
.au-logo { color: var(--accent); }
.au-grow { flex: 1; min-width: 0; }
.au-ibtn:disabled { opacity: .4; cursor: default; }
@media (max-width: 340px) { .au-logo { display: none; } }

/* Menu: a sheet from the bottom on phones, a card under the top bar on bigger screens */
.au-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .55); }
.au-sheet { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; max-height: min(86vh, 640px); max-height: min(86dvh, 640px); background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); box-shadow: 0 -12px 40px rgba(0, 0, 0, .45); animation: au-rise .18s ease-out; }
@keyframes au-rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .au-sheet { animation: none; } }
.au-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 0 18px; }
.au-sheet-head h2 { margin: 0; font-size: 18px; }
.au-sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 12px 16px; }
.au-sheet .au-label { margin: 10px 4px 6px; }
.au-menulist { display: flex; flex-direction: column; gap: 6px; }
.au-menulist > button, .au-menulist > a { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--text); text-align: left; text-decoration: none; }
.au-menulist > button:active, .au-menulist > a:active { background: var(--line); }
.au-menulist span { display: flex; flex-direction: column; min-width: 0; }
.au-menulist b { font-weight: 600; }
.au-menulist small { color: var(--muted); font-size: 12px; font-weight: 400; }
.au-menulist > button[aria-current="true"] { border-color: var(--accent); background: rgba(125, 250, 188, .1); box-shadow: inset 0 0 0 1px var(--accent); }
.au-menulist .au-tick { margin-left: auto; color: var(--accent); visibility: hidden; }
.au-menulist > button[aria-current="true"] .au-tick { visibility: visible; }
@media (min-width: 700px) {
  .au-sheet { left: auto; right: 12px; bottom: auto; top: calc(56px + env(safe-area-inset-top)); width: 380px; max-height: calc(100vh - 80px); border: 1px solid var(--line); border-radius: 16px; padding: 0; animation-duration: .12s; box-shadow: 0 16px 48px rgba(0, 0, 0, .5); }
  .au-scrim { background: rgba(0, 0, 0, .3); }
}

/* Page */
#au-main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 20px 16px 28px; }
.au-screen > h1 { font-size: 28px; line-height: 1.15; margin: 8px 0 8px; letter-spacing: -.01em; }
.au-screen > h2 { font-size: 20px; margin: 4px 0 8px; }
.au-lede { color: var(--muted); margin: 0 0 20px; font-size: 16px; }
.au-center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 36px; }
.au-hint { color: var(--muted); font-size: 13px; margin: 8px 0; }
.au-hint.au-formats { margin-top: 2px; }
.au-privacy { text-align: center; margin-top: 18px; }
.au-msg { min-height: 20px; margin: 8px 0 0; color: var(--danger); font-size: 14px; }
.au-msg.ok { color: var(--accent); }

/* Buttons */
.au-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none; }
.au-primary:active { filter: brightness(.9); }
.au-primary:disabled, .au-primary[aria-disabled="true"] { opacity: .45; cursor: default; }
.au-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); }
.au-ghost:active { background: var(--line); }
.au-ghost:disabled { opacity: .45; cursor: default; }
.au-big { min-height: 54px; font-size: 16px; }
.au-wide { width: 100%; }
.au-link-btn { border: 0; background: none; color: var(--accent); padding: 8px 4px; font-size: 14px; }
.au-center-btn { display: block; margin: 8px auto 0; }
.au-chip { height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--text); font-size: 13px; }
.au-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* Start */
.au-drop { border: 2px dashed var(--line); border-radius: 16px; padding: 18px 14px 12px; margin-bottom: 14px; text-align: center; transition: border-color .15s, background .15s; }
.au-drop.over { border-color: var(--accent); background: rgba(125, 250, 188, .06); }
.au-drop .au-primary { margin-bottom: 6px; }

/* Working */
.au-spin { width: 38px; height: 38px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: au-spin .9s linear infinite; }
@keyframes au-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .au-spin { animation-duration: 3s; } }
.au-bar { width: 100%; max-width: 420px; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.au-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }

/* Editor */
.au-fileinfo { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.au-fi-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.au-fi-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-fi-text span { color: var(--muted); font-size: 13px; }
.au-wave { position: relative; height: 150px; margin: 0 28px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.au-box { position: absolute; inset: 0; overflow: hidden; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); cursor: pointer; }
#au-canvas { display: block; width: 100%; height: 100%; }
.au-dim { position: absolute; top: 0; bottom: 0; background: rgba(8, 8, 14, .62); pointer-events: none; }
.au-dim-l { left: 0; width: 0; }
.au-dim-r { right: 0; width: 0; }
.au-playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: #fff; pointer-events: none; box-shadow: 0 0 6px rgba(255, 255, 255, .6); }
.au-handle { position: absolute; top: 0; bottom: 0; width: 46px; z-index: 3; touch-action: none; cursor: ew-resize; }
.au-h-start { margin-left: -46px; }
.au-handle i { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.au-h-start i { right: 0; }
.au-h-end i { left: 0; }
.au-handle i::after { content: ""; position: absolute; top: 50%; width: 20px; height: 34px; margin-top: -17px; background: var(--accent); }
.au-h-start i::after { right: 0; border-radius: 8px 0 0 8px; }
.au-h-end i::after { left: 0; border-radius: 0 8px 8px 0; }
.au-handle:focus-visible { outline: none; }
.au-handle:focus-visible i, .au-handle.drag i { box-shadow: 0 0 0 3px rgba(125, 250, 188, .35); }
.au-readout { display: flex; align-items: center; gap: 10px; margin: 10px 0 8px; font-variant-numeric: tabular-nums; }
.au-readout .au-sel { flex: 1; color: var(--muted); font-size: 14px; }
.au-readout .au-sel b { color: var(--text); }
.au-transport { display: grid; grid-template-columns: 58px 1fr 1fr; gap: 8px; align-items: center; }
.au-play { width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; }
.au-play .ic { width: 26px; height: 26px; }
.au-play:active { filter: brightness(.9); }
.au-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 4px; }
.au-step { display: grid; grid-template-columns: auto 38px 1fr 38px; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-variant-numeric: tabular-nums; }
.au-step span { color: var(--muted); font-size: 13px; padding-right: 4px; }
.au-step output { text-align: center; font-size: 14px; }
.au-step button { height: 40px; border: 0; border-radius: 10px; background: var(--panel-2); font-size: 20px; line-height: 1; }
.au-step button:active { background: var(--line); }
.au-label { margin: 16px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.au-seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.au-seg3 { grid-template-columns: repeat(3, 1fr); }
.au-seg4 { grid-template-columns: repeat(4, 1fr); }
.au-seg button { min-height: 46px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); font-weight: 600; }
.au-seg button small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.au-seg button[aria-pressed="true"] { border-color: var(--accent); background: rgba(125, 250, 188, .12); box-shadow: inset 0 0 0 1px var(--accent); }
.au-seg button:disabled { opacity: .4; }
#au-quality-wrap { margin-top: 8px; }
.au-pro { font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 1px 5px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); vertical-align: 1px; }
.au-opts { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 0 12px; }
.au-opts[open] { padding-bottom: 12px; }
.au-opts > summary { list-style: none; cursor: pointer; padding: 13px 0; font-weight: 600; font-size: 14px; }
.au-opts > summary::-webkit-details-marker { display: none; }
.au-opts > summary::after { content: "▾"; float: right; color: var(--muted); }
.au-opts[open] > summary::after { content: "▴"; }

/* Save bar */
.au-actions { position: sticky; bottom: 0; z-index: 15; background: var(--panel); border-top: 1px solid var(--line); padding: 8px 16px calc(10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; }
.au-actions > * { width: 100%; max-width: 608px; }
.au-summary { margin: 0 auto 8px; text-align: center; color: var(--muted); font-size: 13px; min-height: 18px; }
.au-summary.warn { color: var(--danger); }

/* Recorder */
.au-meter { width: 100%; max-width: 360px; height: 12px; border-radius: 6px; background: var(--line); overflow: hidden; }
.au-meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #ffd166 75%, var(--rec)); transition: width .06s linear; }
.au-timer { font-size: 44px; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: .02em; margin: 6px 0; }
.au-recbtn { width: 96px; height: 96px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .25); background: var(--rec); color: #fff; display: inline-flex; align-items: center; justify-content: center; margin: 8px 0; }
.au-recbtn .ic { width: 38px; height: 38px; }
.au-recbtn.on { animation: au-pulse 1.4s ease-in-out infinite; }
@keyframes au-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 94, .5); } 50% { box-shadow: 0 0 0 16px rgba(255, 77, 94, 0); } }
@media (prefers-reduced-motion: reduce) { .au-recbtn.on { animation: none; } }

/* Done */
#au-result { width: 100%; margin: 6px 0 14px; color-scheme: dark; }
#au-download { margin-bottom: 8px; }
#au-done .au-ghost { margin-bottom: 8px; }

@media (min-width: 700px) {
  #au-main { padding-top: 36px; }
  .au-screen > h1 { font-size: 34px; }
  .au-wave { height: 180px; }
}
