:root, [data-theme="dark"] {
  --bg: #0b0b0f; --panel: #13131a; --panel2: #1a1a23; --card2: #101016; --line: #2a2a36; --line2: #3a3a4a;
  --text: #ececf1; --dim: #9a9aab; --faint: #6b6b7d;
  --acc: #a78bfa; --acc2: #7c3aed; --accText: #a78bfa; --live: #f43f5e; --ok: #34d399; --err: #fda4af;
  --track: #0e0e14; --tick: #3b3b4d; --btn: #0e0e14; --modeOn: #2b2540; --head: #ffffff;
  --glow1: #2a1b4d55; --glow2: #4c1d9533; --shadow: #000;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f6f5fb; --panel: #ffffff; --panel2: #f2f0f9; --card2: #fbfaff; --line: #e2dfee; --line2: #cfcbe0;
  --text: #17151f; --dim: #555268; --faint: #6f6c84;
  --acc: #8b5cf6; --acc2: #6d28d9; --accText: #6d28d9; --live: #e11d48; --ok: #059669; --err: #be123c;
  --track: #ece9f6; --tick: #cbc6de; --btn: #ffffff; --modeOn: #e7e1fb; --head: #17151f;
  --glow1: #c4b5fd55; --glow2: #ddd6fe66; --shadow: #4c1d9540;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Hebrew", "Arial Hebrew", Arial, sans-serif;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--glow1), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, var(--glow2), transparent 60%),
    var(--bg);
  transition: background-color .2s, color .2s;
}
.mono { font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.shell { max-width: 760px; margin: 0 auto; padding: 40px 20px 64px; }

.brand { display: flex; gap: 16px; align-items: center; margin-bottom: 28px; }
.brandText { flex: 1; min-width: 0; }
.brand h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.tag { margin: 2px 0 0; color: var(--dim); }
.logo { width: 48px; height: 48px; flex: none; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line);
  display: flex; gap: 4px; align-items: center; justify-content: center; direction: ltr; }
.logo i { display: block; width: 4px; border-radius: 2px; background: var(--acc); animation: eq 1.2s ease-in-out infinite; }
.logo i:nth-child(1) { height: 14px; animation-delay: -.2s } .logo i:nth-child(2) { height: 24px; animation-delay: -.5s }
.logo i:nth-child(3) { height: 18px; animation-delay: -.8s } .logo i:nth-child(4) { height: 10px; animation-delay: -.1s }
@keyframes eq { 50% { transform: scaleY(.45); } }
@media (prefers-reduced-motion: reduce) { .logo i, .pill.live::before { animation: none !important; } }

.toolbar { display: flex; gap: 8px; flex: none; align-self: flex-start; }
.tbtn { height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.tbtn:hover { border-color: var(--line2); }
.tbtn.icon { width: 36px; padding: 0; display: grid; place-items: center; }
.tbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.tbtn .moon { fill: currentColor; stroke: none; }
[data-theme="dark"] .tbtn .moon, [data-theme="light"] .tbtn .sun { display: none; }
.tbtn:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

.lookup { display: flex; gap: 10px; }
.lookup input {
  flex: 1; min-width: 0; height: 52px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: inherit; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.lookup input:focus { border-color: var(--acc); box-shadow: 0 0 0 4px #a78bfa22; }
.btn { height: 52px; padding: 0 22px; border-radius: 14px; border: 1px solid transparent; font: inherit; font-weight: 600;
  cursor: pointer; color: var(--text); background: var(--panel2); transition: transform .08s, filter .15s, background .15s;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; gap: 8px; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .mode:focus-visible, .chips button:focus-visible, .handle:focus-visible, summary:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.btn.primary { background: linear-gradient(135deg, var(--acc), var(--acc2)); color: #fff; box-shadow: 0 8px 24px -8px #7c3aedaa; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: var(--line); background: transparent; height: 44px; }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn.wide { width: 100%; }
.btn .spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff6; border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.err { margin: 12px 2px 0; color: var(--err); }

.card { margin-top: 24px; padding: 24px; border-radius: 22px; background: linear-gradient(180deg, var(--panel), var(--card2));
  border: 1px solid var(--line); box-shadow: 0 30px 80px -40px var(--shadow); animation: rise .35s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
#space > .card + .card { margin-top: 16px; }
.secTitle { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 13px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.secIcon { font-size: 16px; }
#listenCard .meta { margin-bottom: 18px; }
#listenCard .player { margin: 0; }
#saveCard .stats { margin-top: 0; }
.meta h2 { margin: 10px 0 2px; font-size: 22px; line-height: 1.3; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.sub { margin: 0; color: var(--dim); }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 26px; padding: 0 11px; border-radius: 99px; font-size: 12px;
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--panel2); color: var(--dim); border: 1px solid var(--line); }
.pill.live { color: var(--text); background: #f43f5e22; border-color: #f43f5e66; }
.pill.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 #f43f5e88; animation: ping 1.6s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px #f43f5e00; } 100% { box-shadow: 0 0 0 0 #f43f5e00; } }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0; }
.stats > div { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.k { display: block; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.v { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: start; }

.timeline { margin: 6px 0 18px; user-select: none; -webkit-user-select: none; }
.track { position: relative; height: 64px; border-radius: 12px; background: var(--track); border: 1px solid var(--line); overflow: hidden; touch-action: none; cursor: crosshair; }
.wave { position: absolute; inset: 14px 0; opacity: .6;
  background: repeating-linear-gradient(90deg, var(--tick) 0 2px, transparent 2px 6px); border-radius: 4px; }
.sel { position: absolute; top: 0; bottom: 0; background: #a78bfa2e; border-left: 2px solid var(--acc); border-right: 2px solid var(--acc); cursor: grab; }
.sel.drag { cursor: grabbing; }
.handle { position: absolute; top: 50%; width: 14px; height: 34px; margin-top: -17px; border-radius: 6px; border: 0; padding: 0;
  background: var(--acc); cursor: ew-resize; box-shadow: 0 2px 10px #0006; }
.handle.l { left: -8px; } .handle.r { right: -8px; }
.handle::after { content: ""; position: absolute; inset: 10px 5px; border-left: 1px solid #fff9; border-right: 1px solid #fff9; }
.now { position: absolute; top: 0; bottom: 0; right: 0; width: 2px; background: var(--live); }
.now span { position: absolute; top: 4px; right: 6px; font-size: 10px; color: var(--live); font-weight: 700; text-transform: uppercase; }
.ticks { position: relative; height: 18px; font-size: 11px; color: var(--faint); margin-top: 4px; }
.ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ticks span:first-child { transform: none; } .ticks span:last-child { transform: translateX(-100%); }

.playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--head); box-shadow: 0 0 8px var(--head); pointer-events: none; }

.player { display: flex; gap: 14px; align-items: flex-start; padding: 14px; margin: 0 0 18px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line); }
.pmain { flex: 1; min-width: 0; display: grid; gap: 8px; }
.prow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pbtn { border: 1px solid var(--line); background: var(--btn); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 10px; height: 32px; padding: 0 10px; }
.pbtn:hover { border-color: var(--line2); }
.pbtn:focus-visible, .chipbtn:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.pbtn.play { width: 56px; height: 56px; border-radius: 50%; padding: 0; flex: none; display: grid; place-items: center; border: 0;
  background: linear-gradient(135deg, var(--acc), var(--acc2)); box-shadow: 0 8px 24px -8px #7c3aedaa; }
.pbtn.play svg { width: 26px; height: 26px; fill: #fff; }
.pbtn.play.loading svg { animation: spin 1s linear infinite; }
.pbtn:disabled { opacity: .4; cursor: not-allowed; }
.ptime { margin-left: 6px; color: var(--dim); font-size: 13px; white-space: nowrap; }
.pbtn.rate { margin-left: auto; min-width: 46px; }
.pbtn.golive { color: var(--live); border-color: #f43f5e66; background: #f43f5e1a; }
.pbtn.golive.at { opacity: .6; }
.pseek { width: 100%; accent-color: var(--acc); height: 22px; margin: 0; }
.marks { gap: 8px; }
.chipbtn { border: 1px dashed var(--line2); background: transparent; color: var(--dim); font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 99px; cursor: pointer; }
.chipbtn:hover:not(:disabled) { color: var(--text); border-color: var(--acc); }
.chipbtn:disabled { opacity: .35; cursor: not-allowed; }

.modes { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); margin-bottom: 14px; }
.mode { border: 0; background: transparent; color: var(--dim); font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 9px; cursor: pointer; }
.mode.on { background: var(--modeOn); color: var(--text); }

.lastRow { display: flex; align-items: center; gap: 16px; }
.lastRow input[type=range] { flex: 1; accent-color: var(--acc); height: 28px; }
.big { font-size: 26px; font-weight: 700; min-width: 92px; text-align: end; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips button { border: 1px solid var(--line); background: transparent; color: var(--dim); font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 99px; cursor: pointer; }
.chips button.on { color: var(--text); border-color: var(--acc); background: #a78bfa1a; }
.chips button:disabled { opacity: .35; cursor: not-allowed; }
.hint { color: var(--faint); font-size: 13px; margin: 10px 0 0; }

.clockSwitch { display: flex; gap: 16px; margin-bottom: 10px; color: var(--dim); font-size: 14px; }
.clockSwitch input { accent-color: var(--acc); }
.rangeRow { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.rangeRow label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.rangeRow input { width: 160px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  font-size: 17px; padding: 0 12px; outline: none; }
.rangeRow input:focus { border-color: var(--acc); }
.rangeRow input.bad { border-color: var(--live); }
.arrow { color: var(--faint); padding-bottom: 10px; }
[dir="rtl"] .arrow { transform: scaleX(-1); }

.actions { margin-top: 22px; }
.progress { position: relative; height: 40px; margin-top: 12px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); overflow: hidden; }
.bar { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #7c3aed66, #a78bfa88); transition: width .2s; }
[dir="rtl"] .bar { inset: 0 0 0 auto; }
.progress span { position: relative; display: flex; height: 100%; align-items: center; justify-content: center; font-size: 13px; color: var(--text); }

.result { margin-top: 18px; padding: 16px; border-radius: 14px; background: #34d39914; border: 1px solid #34d39955; display: grid; gap: 12px; }
.result audio { width: 100%; }
.result .hint { overflow-wrap: anywhere; }

.usage { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 32px; }
.usage > div { text-align: center; padding: 14px 8px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.uv { display: block; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; color: var(--accText); }
.uk { display: block; font-size: 12px; color: var(--faint); margin-top: 2px; }
@media (max-width: 600px) { .usage { grid-template-columns: repeat(2, 1fr); } }
.faq { margin-top: 36px; }
.faq h2 { font-size: 20px; margin: 0 0 12px; letter-spacing: -0.01em; }
.faq details { border: 1px solid var(--line); background: var(--panel); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.faq summary { cursor: pointer; padding: 14px 18px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 10px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: ""; width: 8px; height: 8px; flex: none; border-right: 2px solid var(--acc); border-bottom: 2px solid var(--acc); transform: rotate(-45deg); transition: transform .15s; }
[dir="rtl"] .faq summary::before { transform: rotate(135deg); }
.faq details[open] summary::before { transform: rotate(45deg); }
.ans { padding: 0 18px 16px; color: var(--dim); }
.ans p { margin: 0 0 10px; }
.ans b { color: var(--text); }
.ans ol { margin: 0 0 10px; padding-inline-start: 22px; }
.ans li { margin-bottom: 6px; }
.ans .mono { color: var(--text); font-size: .92em; }
.ans pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-size: 12.5px; line-height: 1.5; color: var(--text); text-align: left; margin: 0 0 10px; }

.foot { margin-top: 32px; color: var(--faint); font-size: 13px; text-align: center; }
.foot p { margin: 6px 0; }
.foot .mono { color: var(--dim); }
.credit { margin-top: 18px !important; padding-top: 16px; border-top: 1px solid var(--line); }
.credit a { color: var(--accText); text-decoration: none; font-weight: 600; }
.credit a:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .shell { padding-top: 24px; }
  .brand { flex-wrap: wrap; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .lookup { flex-direction: column; }
  .lookup input { flex: none; }
  .rangeRow input { width: 130px; }
  .card { padding: 18px; }
}
