:root {
  --ink: #f2f0e9;
  --muted: #9b9d96;
  --faint: #6e716b;
  --surface: #151816;
  --surface-2: #1b1e1b;
  --line: #2c312c;
  --lime: #d9ff63;
  --lime-soft: rgba(217, 255, 99, 0.1);
  --dark: #0c0f0d;
  --danger: #ff806e;
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--ink);
  background: var(--dark);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--dark); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% 10%, #1a2118 0, transparent 28rem), var(--dark); }
button, select, textarea, input { font: inherit; }
button, select { color: inherit; }
button, a, select, summary, .drop-zone { -webkit-tap-highlight-color: transparent; }
button { border: 0; cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); padding: 30px 22px; display: flex; flex-direction: column; background: rgba(12, 15, 13, .86); backdrop-filter: blur(16px); z-index: 10; }
.brand { color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 700; letter-spacing: -.04em; display: flex; align-items: center; gap: 11px; margin: 0 8px 42px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--lime); display: flex; align-items: center; justify-content: center; gap: 2px; }
.brand-mark i { width: 2px; height: 8px; border-radius: 4px; background: var(--dark); }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(4) { height: 14px; }
.brand-mark i:nth-child(3) { height: 19px; }
nav { display: grid; gap: 6px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; background: transparent; color: var(--muted); padding: 12px 13px; border-radius: 9px; text-align: left; font-size: 13px; font-weight: 600; }
.nav-item:hover, .nav-item.active { color: var(--ink); background: #1a1e1a; }
.nav-icon { width: 18px; color: var(--faint); font-size: 16px; }
.nav-item.active .nav-icon { color: var(--lime); }
.count { margin-left: auto; color: var(--faint); font-family: "DM Mono", monospace; font-size: 10px; }
.sidebar-bottom { margin-top: auto; }
.runtime-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; align-items: center; gap: 10px; }
.runtime-card strong, .runtime-card small { display: block; }
.runtime-card strong { font-size: 11px; margin-bottom: 2px; }
.runtime-card small { color: var(--faint); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.runtime-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); }
.privacy-note { color: var(--faint); font-size: 9px; line-height: 1.5; margin: 12px 4px 0; }

main { min-width: 0; }
.topbar { height: 72px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(24px, 5vw, 72px); }
.eyebrow { display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: 10px; font-family: "DM Mono", monospace; text-transform: uppercase; letter-spacing: .1em; }
.eyebrow span { width: 5px; height: 5px; border-radius: 50%; background: var(--lime); }
.local-badge { font-family: "DM Mono", monospace; font-size: 9px; letter-spacing: .12em; color: #aeb5a6; border: 1px solid var(--line); padding: 7px 9px; border-radius: 5px; }
.local-badge b { color: var(--lime); font-weight: 500; }
.account-actions { display: flex; align-items: center; gap: 9px; }
.signout-button { color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 5px; padding: 7px 9px; font-size: 9px; }
.mobile-menu { display: none; background: transparent; }
.view { display: none; }
.view.active { display: block; }
#studio-view, #history-view { max-width: 1180px; margin: 0 auto; padding: 66px clamp(24px, 5vw, 72px) 24px; }
.hero-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; margin-bottom: 48px; }
.kicker { font: 500 9px/1 "DM Mono", monospace; color: var(--lime); letter-spacing: .17em; margin: 0 0 19px; }
h1 { font-size: clamp(40px, 5vw, 68px); line-height: .98; letter-spacing: -.065em; font-weight: 500; margin: 0; }
.intro { color: var(--muted); font-size: 13px; line-height: 1.7; max-width: 530px; margin: 23px 0 0; }
.hero-orb { width: 132px; height: 132px; flex: 0 0 auto; border: 1px solid #2a3028; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, rgba(217,255,99,.1), transparent 68%); box-shadow: 0 0 70px rgba(217,255,99,.05); }
.orb-wave { display: flex; align-items: center; gap: 4px; height: 44px; }
.orb-wave i { width: 3px; height: 10px; border-radius: 4px; background: var(--lime); animation: wave 1.6s ease-in-out infinite; opacity: .8; }
.orb-wave i:nth-child(2), .orb-wave i:nth-child(8) { animation-delay: -.25s; height: 20px; }
.orb-wave i:nth-child(3), .orb-wave i:nth-child(7) { animation-delay: -.5s; height: 29px; }
.orb-wave i:nth-child(4), .orb-wave i:nth-child(6) { animation-delay: -.75s; height: 38px; }
.orb-wave i:nth-child(5) { animation-delay: -1s; height: 44px; }
@keyframes wave { 0%,100% { transform: scaleY(.45); } 50% { transform: scaleY(1); } }

.workspace-grid { display: grid; grid-template-columns: .88fr 1.12fr; gap: 14px; }
.panel { background: rgba(21, 24, 22, .9); border: 1px solid var(--line); border-radius: 15px; padding: 28px; }
.panel-heading { display: flex; gap: 15px; align-items: flex-start; margin-bottom: 24px; }
.step-number { color: var(--lime); font: 500 9px/1 "DM Mono", monospace; border: 1px solid #3f4932; border-radius: 5px; padding: 6px; }
.panel h2 { font-size: 15px; letter-spacing: -.02em; margin: 1px 0 6px; }
.panel-heading p { font-size: 10px; color: var(--faint); margin: 0; line-height: 1.5; }
.drop-zone { min-height: 142px; border: 1px dashed #3a403a; border-radius: 11px; display: grid; place-items: center; text-align: center; padding: 20px; transition: .2s; cursor: pointer; }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--lime); background: var(--lime-soft); }
.upload-state { display: grid; justify-items: center; }
.upload-icon { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #3a403a; border-radius: 50%; color: var(--lime); margin-bottom: 13px; }
.upload-state strong { font-size: 11px; margin-bottom: 5px; }
.upload-state span { color: var(--faint); font-size: 8px; }
.file-state { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; }
.file-icon { width: 40px; height: 40px; border-radius: 9px; background: var(--lime-soft); color: var(--lime); display: grid; place-items: center; font-size: 18px; }
.file-copy { min-width: 0; flex: 1; }
.file-copy strong, .file-copy span { display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.file-copy strong { font-size: 11px; margin-bottom: 4px; }
.file-copy span { color: var(--faint); font-size: 9px; }
#remove-file { width: 26px; height: 26px; border-radius: 50%; background: #272b27; color: var(--muted); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--faint); font: 400 8px/1 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .08em; margin: 18px 0; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.record-button { width: 100%; height: 42px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: transparent; display: flex; align-items: center; gap: 10px; font-size: 10px; }
.record-button:hover { background: #1b1e1b; }
.record-button.recording { border-color: var(--danger); color: var(--danger); }
.record-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.record-button.recording .record-dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255,128,110,.12); } }
.record-button time { margin-left: auto; color: var(--faint); font: 400 9px/1 "DM Mono", monospace; }
.consent-box { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; color: var(--faint); font-size: 9px; line-height: 1.5; cursor: pointer; }
.consent-box input { position: absolute; opacity: 0; }
.checkmark { flex: 0 0 auto; width: 16px; height: 16px; border: 1px solid #444a44; border-radius: 4px; display: grid; place-items: center; color: transparent; margin-top: 1px; }
.consent-box input:checked + .checkmark { color: var(--dark); background: var(--lime); border-color: var(--lime); }
.editor-wrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #111412; }
textarea { display: block; width: 100%; min-height: 162px; resize: vertical; background: transparent; color: var(--ink); border: 0; outline: 0; padding: 17px; font-size: 12px; line-height: 1.7; }
textarea::placeholder { color: #565a55; }
.editor-footer { border-top: 1px solid var(--line); min-height: 37px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; color: var(--faint); font: 400 8px/1 "DM Mono", monospace; }
.editor-footer button { background: transparent; color: var(--lime); font: inherit; padding: 7px 0; }
.editor-footer b { color: var(--muted); font-weight: 400; }
.control-row { display: grid; grid-template-columns: 1.1fr .9fr; gap: 10px; margin-top: 13px; }
.control-row label > span { display: block; color: var(--faint); font: 400 8px/1 "DM Mono", monospace; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 7px 2px; }
select { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: #111412; padding: 0 12px; font-size: 10px; outline: 0; }
select:focus { border-color: #586744; }
.advanced { border-top: 1px solid var(--line); margin-top: 17px; padding-top: 13px; }
.advanced summary { list-style: none; display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; cursor: pointer; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced[open] summary span { transform: rotate(45deg); }
.slider-grid { display: grid; gap: 13px; margin-top: 16px; }
.slider-grid label > span { display: flex; justify-content: space-between; color: var(--faint); font-size: 8px; }
.slider-grid output { color: var(--muted); font-family: "DM Mono", monospace; }
input[type="range"] { width: 100%; accent-color: var(--lime); height: 3px; margin: 9px 0 0; }
.action-row { display: flex; justify-content: flex-end; align-items: center; gap: 22px; margin-top: 18px; }
.estimate { display: flex; align-items: center; gap: 10px; }
.estimate-icon { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--lime); }
.estimate strong, .estimate small { display: block; }
.estimate strong { font: 500 9px/1.2 "DM Mono", monospace; }
.estimate small { color: var(--faint); font-size: 7px; margin-top: 3px; }
.generate-button { min-width: 210px; height: 49px; border-radius: 9px; padding: 0 17px 0 20px; background: var(--lime); color: #10130f; display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 700; box-shadow: 0 12px 35px rgba(217,255,99,.08); }
.generate-button:hover { background: #e4ff8c; transform: translateY(-1px); }
.generate-button:disabled { opacity: .5; cursor: wait; transform: none; }
.generate-button b { font-size: 18px; font-weight: 400; }

.result-card { margin-top: 40px; border: 1px solid #36412d; background: linear-gradient(135deg, rgba(217,255,99,.06), rgba(21,24,22,.96) 35%); border-radius: 15px; padding: 24px; }
.result-status { display: flex; align-items: center; gap: 12px; }
.result-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; color: var(--lime); background: var(--lime-soft); }
.result-status small { color: var(--lime); font: 500 8px/1 "DM Mono", monospace; letter-spacing: .12em; }
.result-status h2 { font-size: 14px; margin: 5px 0 0; }
.result-time { margin-left: auto; color: var(--faint); font: 400 8px/1 "DM Mono", monospace; }
.progress-track { height: 3px; background: #252a24; margin-top: 22px; border-radius: 3px; overflow: hidden; }
.progress-track i { display: block; width: 0; height: 100%; background: var(--lime); box-shadow: 0 0 10px var(--lime); transition: width .45s ease; }
.result-message { color: var(--faint); font-size: 9px; margin: 9px 0 0; }
.player { margin-top: 20px; display: grid; grid-template-columns: 38px minmax(100px, 1fr) 42px auto; gap: 13px; align-items: center; }
.play-button { width: 38px; height: 38px; border-radius: 50%; background: var(--lime); color: var(--dark); font-size: 12px; padding-left: 3px; }
#waveform { width: 100%; height: 52px; }
.player time { color: var(--muted); font: 400 9px/1 "DM Mono", monospace; }
.download-button { text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 7px; padding: 10px 13px; font-size: 9px; white-space: nowrap; }
.download-button:hover { border-color: var(--lime); }

.history-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 40px; }
.history-header h1 { font-size: clamp(38px, 5vw, 58px); }
.history-header > p { color: var(--faint); font-size: 10px; }
.history-list { display: grid; gap: 9px; }
.history-item { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 15px 17px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.history-icon { width: 40px; height: 40px; display: grid; place-items: center; background: #20241f; border-radius: 8px; color: var(--lime); }
.history-copy { min-width: 0; }
.history-copy strong, .history-copy span { display: block; }
.history-copy strong { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-copy span { color: var(--faint); font: 400 8px/1.4 "DM Mono", monospace; margin-top: 4px; }
.history-actions { display: flex; align-items: center; gap: 9px; }
.history-status { color: var(--faint); font: 400 8px/1 "DM Mono", monospace; text-transform: uppercase; }
.history-actions a, .history-download { color: var(--ink); text-decoration: none; background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 8px; }
.empty-state { padding: 70px 20px; text-align: center; color: var(--faint); border: 1px dashed var(--line); border-radius: 13px; font-size: 11px; }
footer { max-width: 1180px; margin: 0 auto; padding: 34px clamp(24px,5vw,72px); display: flex; justify-content: space-between; color: #555a54; font-size: 8px; }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: 360px; padding: 12px 15px; border: 1px solid #40483b; background: #181c18; border-radius: 8px; color: var(--ink); font-size: 10px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .25s; box-shadow: 0 14px 50px rgba(0,0,0,.35); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #653c36; color: #ffb2a7; }
.auth-overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: rgba(7,9,8,.88); backdrop-filter: blur(18px); }
.auth-card { width: min(400px, 100%); padding: 32px; border: 1px solid var(--line); border-radius: 16px; background: #121512; box-shadow: 0 30px 100px rgba(0,0,0,.5); }
.auth-card > .brand-mark { margin-bottom: 26px; }
.auth-card h2 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.auth-card > p:not(.kicker) { color: var(--muted); font-size: 11px; line-height: 1.6; margin: 10px 0 24px; }
.auth-card label { display: grid; gap: 7px; margin: 13px 0; color: var(--muted); font: 500 8px/1 "DM Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.auth-card input { height: 43px; border: 1px solid var(--line); border-radius: 8px; background: #0d100e; color: var(--ink); padding: 0 12px; outline: none; }
.auth-card input:focus { border-color: var(--lime); }
.auth-card .generate-button { width: 100%; margin-top: 18px; }
.auth-secondary { width: 100%; margin-top: 9px; padding: 10px; color: var(--muted); background: transparent; font-size: 10px; }
.auth-card small { display: block; min-height: 16px; margin-top: 7px; color: var(--danger); font-size: 9px; text-align: center; }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; transform: translateX(-100%); transition: .25s; width: 236px; }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: block; }
  .eyebrow { display: none; }
  .workspace-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  #studio-view, #history-view { padding-top: 42px; }
  .topbar { height: 60px; }
  .hero-row { align-items: flex-start; }
  .hero-orb { display: none; }
  .panel { padding: 21px; }
  .control-row { grid-template-columns: 1fr; }
  .action-row { align-items: stretch; flex-direction: column; }
  .estimate { align-self: flex-end; }
  .generate-button { width: 100%; }
  .player { grid-template-columns: 38px 1fr 40px; }
  .download-button { grid-column: 1 / -1; text-align: center; }
  .history-header { align-items: flex-start; flex-direction: column; gap: 18px; }
  .history-item { grid-template-columns: 40px minmax(0,1fr); }
  .history-actions { grid-column: 2; }
  footer { flex-direction: column; gap: 8px; }
}

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

