:root {
  --bg: #0b0d12;
  --bg-soft: #11141c;
  --panel: rgba(24, 27, 36, .88);
  --panel-solid: #181b24;
  --panel-raised: #202430;
  --line: rgba(255,255,255,.09);
  --line-strong: rgba(255,255,255,.16);
  --ink: #f7f8fb;
  --muted: #9aa3b5;
  --soft: #c8ceda;
  --cyan: #28c7df;
  --cyan-soft: rgba(40,199,223,.14);
  --amber: #f6a935;
  --amber-soft: rgba(246,169,53,.16);
  --green: #35d49a;
  --green-soft: rgba(53,212,154,.14);
  --red: #ff637a;
  --red-soft: rgba(255,99,122,.14);
  --shadow: 0 24px 70px rgba(0,0,0,.42);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -10%, rgba(40,199,223,.18), transparent 30%),
    radial-gradient(circle at 88% 10%, rgba(246,169,53,.12), transparent 28%),
    linear-gradient(180deg, #0d0f16 0%, #080a0f 100%);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.5), transparent 70%);
}

a { color: inherit; }
button, input, select { font: inherit; }
button {
  position: relative;
  isolation: isolate;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease, filter .16s ease, color .16s ease;
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0) scale(.985); }
button:disabled { cursor: not-allowed; filter: grayscale(.2); opacity: .62; transform: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 68px;
  padding: 0 max(22px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(9, 11, 16, .78);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  font-size: 18px;
  font-weight: 850;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: #071017;
  background: linear-gradient(135deg, #42e0ef, #f9b24a);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 10px 30px rgba(40,199,223,.22);
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar nav a,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  cursor: pointer;
}

.topbar nav a:hover,
.icon-button:hover {
  color: var(--ink);
  background: rgba(255,255,255,.06);
  border-color: var(--line);
}

.topbar nav a.active {
  color: var(--ink);
  background: rgba(255,255,255,.08);
  border-color: var(--line-strong);
}

.topbar form { margin: 0; }

.profile-menu {
  position: relative;
}

.profile-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 240px;
  min-height: 40px;
  padding: 5px 9px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--soft);
  background: rgba(255,255,255,.045);
  cursor: pointer;
}

.profile-button:hover,
.profile-menu.open .profile-button {
  color: var(--ink);
  border-color: rgba(40,199,223,.38);
  background: rgba(40,199,223,.09);
}

.profile-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #071017;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  font-size: 12px;
  font-weight: 900;
}

.profile-name {
  overflow: hidden;
  max-width: 170px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 40;
  display: none;
  min-width: 230px;
  overflow: hidden;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(24,27,36,.98);
  box-shadow: var(--shadow);
}

.profile-menu.open .profile-dropdown {
  display: grid;
  gap: 4px;
}

.profile-summary {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.profile-summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.profile-summary small {
  text-transform: capitalize;
}

.profile-dropdown a,
.profile-dropdown button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  color: var(--soft);
  background: transparent;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font-weight: 760;
}

.profile-dropdown a:hover,
.profile-dropdown button:hover {
  color: var(--ink);
  background: rgba(255,255,255,.06);
}

.page {
  position: relative;
  width: min(1180px, calc(100% - 40px));
  margin: 34px auto 96px;
}

.studio-heading {
  margin: 0 0 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1, h2, h3, p { letter-spacing: 0; }
h1 { margin: 0 0 6px; font-size: 38px; line-height: 1.05; }
h2 { margin: 0; font-size: 23px; line-height: 1.15; }
h3 { margin: 8px 0 4px; font-size: 18px; line-height: 1.25; }
.muted, small { color: var(--muted); }

.notice {
  margin-bottom: 20px;
  padding: 13px 15px;
  color: #dffbff;
  background: rgba(40,199,223,.09);
  border: 1px solid rgba(40,199,223,.2);
  border-left: 4px solid var(--cyan);
  border-radius: 12px;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 36px));
}

.toast {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  color: var(--ink);
  background: rgba(24,27,36,.96);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.toast button {
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.toast-success { border-color: rgba(53,212,154,.38); }
.toast-error { border-color: rgba(255,99,122,.42); }
.toast-progress { border-color: rgba(40,199,223,.38); }

.toast-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(40,199,223,.2);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.source-panel,
.editor-card,
.api-card,
.history-card,
.empty,
.auth-shell {
  background: linear-gradient(180deg, rgba(30,34,45,.92), rgba(19,22,31,.92));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.source-panel { padding: 22px; }

.source-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
}

.source-tab,
.account-switch button {
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  padding: 10px 15px;
  cursor: pointer;
  font-weight: 750;
}

.source-tab.active,
.account-switch button.active {
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,.045));
  border-color: rgba(40,199,223,.3);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 8px 22px rgba(0,0,0,.2);
}

.source-pane { display: none; }
.source-pane.active { display: block; }

.dropzone {
  display: grid;
  place-items: center;
  min-height: 220px;
  text-align: center;
  cursor: pointer;
  border: 1px dashed rgba(40,199,223,.35);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(40,199,223,.07), rgba(255,255,255,.025)),
    #111620;
}

.dropzone strong { font-size: 22px; }
.dropzone span { color: var(--muted); font-size: 13px; }
.dropzone input { max-width: 285px; margin-top: 16px; }

.upload-progress {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.upload-progress[hidden] { display: none; }

.upload-progress-bar {
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(40,199,223,.28);
  border-radius: 999px;
  background: rgba(7,9,14,.72);
}

.upload-progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  transition: width .16s ease;
}

.upload-progress strong {
  color: var(--cyan);
  font-size: 12px;
}

.upload-icon {
  display: grid !important;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border-radius: 14px;
  color: #071017 !important;
  background: var(--cyan);
  font-size: 26px !important;
  font-weight: 900;
}

.youtube-form,
.settings-form {
  display: grid;
  gap: 18px;
}

.url-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7,9,14,.65);
}

.url-field span { color: var(--red); }
.url-field input { border: 0; background: transparent; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid > *,
.sliders > *,
.trim-controls > *,
.api-card > *,
.history-card > * {
  min-width: 0;
}

label {
  display: grid;
  gap: 8px;
  color: var(--soft);
  font-size: 13px;
  font-weight: 720;
}

input,
select {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  padding: 12px 13px;
  color: var(--ink);
  background: rgba(7,9,14,.72);
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(40,199,223,.62);
  box-shadow: 0 0 0 3px rgba(40,199,223,.12);
}

input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  padding: 0;
  accent-color: var(--cyan);
  height: 28px;
  cursor: ew-resize;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border: 1px solid rgba(40,199,223,.2);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(40,199,223,.42), rgba(53,212,154,.32)), rgba(7,9,14,.82);
  box-shadow: inset 0 1px 4px rgba(0,0,0,.32);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 2px solid rgba(7,9,14,.95);
  border-radius: 50%;
  background: linear-gradient(135deg, #f7fbff, #4ee7ee 48%, #38d49c);
  box-shadow: 0 5px 15px rgba(40,199,223,.34), 0 0 0 4px rgba(40,199,223,.12);
}

input[type="range"]::-moz-range-track {
  height: 8px;
  border: 1px solid rgba(40,199,223,.2);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(40,199,223,.42), rgba(53,212,154,.32)), rgba(7,9,14,.82);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(7,9,14,.95);
  border-radius: 50%;
  background: #4ee7ee;
  box-shadow: 0 5px 15px rgba(40,199,223,.34);
}

input[type="file"]::file-selector-button {
  min-height: 38px;
  margin-right: 12px;
  padding: 8px 13px;
  border: 1px solid rgba(40,199,223,.32);
  border-radius: 10px;
  color: #dffbff;
  background: linear-gradient(180deg, rgba(40,199,223,.2), rgba(40,199,223,.08));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 8px 20px rgba(0,0,0,.18);
  cursor: pointer;
  font-weight: 820;
}

.wide { width: 100%; margin-top: 16px; }

.primary,
.roblox-button,
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 11px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 820;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 10px 24px rgba(0,0,0,.22);
}

.primary {
  border: 0;
  color: #071017;
  background: linear-gradient(135deg, #70f2ff 0%, #38d49c 48%, #f7b046 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 14px 34px rgba(40,199,223,.24);
}

.primary:hover { filter: brightness(1.07) saturate(1.08); box-shadow: inset 0 1px 0 rgba(255,255,255,.52), 0 17px 38px rgba(40,199,223,.3); }

.secondary {
  color: #dce6f5;
  border: 1px solid rgba(255,255,255,.13);
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.035));
}

.secondary:hover { border-color: rgba(40,199,223,.36); color: var(--ink); background: linear-gradient(180deg, rgba(40,199,223,.13), rgba(255,255,255,.045)); }

.roblox-button {
  color: #ffd08c;
  border: 1px solid rgba(246,169,53,.42);
  background: linear-gradient(180deg, rgba(246,169,53,.2), rgba(246,169,53,.08));
}

.roblox-button:hover {
  border-color: rgba(246,169,53,.64);
  background: linear-gradient(180deg, rgba(246,169,53,.26), rgba(246,169,53,.1));
}

.editor-card { padding: 24px; }

.editor-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.round-button {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 12px;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.035));
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 8px 18px rgba(0,0,0,.2);
}

.round-button:hover {
  color: #ffafba;
  border-color: rgba(255,99,122,.35);
  background: var(--red-soft);
}

.source-badge,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  text-transform: capitalize;
}

.source-badge {
  color: var(--soft);
  background: rgba(255,255,255,.07);
}

.editor-meta { margin-bottom: 18px; }

.wave-shell {
  position: relative;
  height: 180px;
  margin-top: 18px;
  overflow: visible;
  border: 1px solid rgba(40,199,223,.48);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(40,199,223,.11), transparent),
    #071823;
  box-shadow: inset 0 0 28px rgba(40,199,223,.08);
}

#waveform {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 14px;
}

.seek-hitbox {
  position: absolute;
  top: -18px;
  left: 0;
  right: 0;
  z-index: 4;
  height: 26px;
  cursor: ew-resize;
}

.wave-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: auto;
  cursor: grab;
  background: rgba(40,199,223,.15);
  border-left: 4px solid var(--cyan);
  border-right: 4px solid var(--cyan);
}

.wave-selection:active { cursor: grabbing; }

.trim-handle {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 46px;
  border-radius: 7px;
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(40,199,223,.18);
  transform: translateY(-50%);
  cursor: ew-resize;
}

.trim-handle-start { left: -9px; }
.trim-handle-end { right: -9px; }

.wave-toolbar {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(210px, 1fr) auto;
  gap: 18px;
  align-items: end;
  margin: 18px 0 12px;
}

.inline-control,
.range-edit {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 76px auto;
  align-items: center;
  gap: 9px;
}

.range-edit {
  grid-template-columns: minmax(80px, 1fr) 86px;
  grid-column: 1 / -1;
}

.mini-number {
  width: 76px;
  padding: 8px 9px;
}

.wave-help {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.playhead {
  position: absolute;
  top: 14px;
  bottom: 0;
  left: 0;
  width: 2px;
  background: #fff;
  opacity: .6;
}

.seek-arrow {
  position: absolute;
  top: -13px;
  left: 0;
  z-index: 5;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 12px solid #fff;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.35));
  transform: translateX(-8px);
  pointer-events: none;
}

.wave-panbar {
  position: relative;
  margin: 12px 2px 0;
  padding: 8px 10px;
  border: 1px solid rgba(40,199,223,.18);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(40,199,223,.08), rgba(255,255,255,.025));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.wave-panbar input {
  height: 20px;
}

.wave-panbar input::-webkit-slider-runnable-track {
  height: 7px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0 1px, transparent 1px 26px),
    linear-gradient(90deg, rgba(40,199,223,.28), rgba(53,212,154,.2)),
    rgba(7,9,14,.9);
}

.wave-panbar input::-webkit-slider-thumb {
  width: 34px;
  height: 16px;
  margin-top: -5px;
  border-radius: 999px;
}

.wave-panbar input::-moz-range-thumb {
  width: 32px;
  height: 14px;
  border-radius: 999px;
}

.time-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 2px 18px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 850;
}

.time-row strong {
  padding: 3px 8px;
  border-radius: 7px;
  color: #dffbff;
  background: rgba(40,199,223,.12);
}

.trim-controls,
.sliders {
  display: grid;
  gap: 18px;
}

.trim-controls { grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.sliders { grid-template-columns: repeat(4, 1fr); margin-top: 14px; }

.sliders label { grid-template-columns: 1fr auto; }
.sliders .range-edit { grid-column: 1 / -1; }
.sliders output { color: var(--cyan); }

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.preset {
  min-height: 36px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.025));
  color: var(--muted);
  padding: 8px 13px;
  cursor: pointer;
  font-weight: 780;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 7px 18px rgba(0,0,0,.16);
}

.preset.active,
.preset:hover {
  color: var(--ink);
  background: linear-gradient(180deg, rgba(40,199,223,.2), rgba(40,199,223,.08));
  border-color: rgba(40,199,223,.48);
}

.editor-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.fade-controls,
.play-controls,
.history-actions,
.badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 650;
}

.check-row input[type="checkbox"],
.attest input { width: auto; }
.seconds { width: 62px; padding: 7px 8px; }

.play-button {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(40,199,223,.26);
  border-radius: 14px;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(40,199,223,.16), rgba(255,255,255,.045));
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 10px 24px rgba(0,0,0,.23);
  font-weight: 900;
}

.play-button:hover {
  border-color: rgba(40,199,223,.5);
  background: linear-gradient(180deg, rgba(40,199,223,.24), rgba(255,255,255,.06));
}

.attest {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-weight: 620;
}

.history { margin-top: 64px; }

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
}

.history-list {
  display: grid;
  gap: 14px;
}

.history-card {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding: 18px;
}

.history-card:hover {
  border-color: rgba(40,199,223,.24);
}

.history-thumb {
  display: grid;
  place-items: center;
  width: 128px;
  height: 86px;
  overflow: hidden;
  border-radius: 14px;
  color: var(--cyan);
  background:
    linear-gradient(135deg, rgba(40,199,223,.18), rgba(246,169,53,.08)),
    #101720;
  font-size: 32px;
}

.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-content { min-width: 0; }

.status { color: var(--soft); background: rgba(255,255,255,.07); }
.status-accepted, .status-processed { color: #8df0ca; background: var(--green-soft); }
.status-pending, .status-uploading { color: #95cfff; background: rgba(75,146,255,.15); }
.status-deleted, .status-rejected, .status-error { color: #ffafba; background: var(--red-soft); }

.source-link {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: #7bddeb;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversion-meta {
  margin: 8px 0;
  color: var(--muted);
}

.roblox-result {
  margin: 8px 0;
}

.roblox-result span {
  display: inline-flex;
  padding: 3px 9px;
  margin-right: 8px;
  border-radius: 999px;
  color: #8df0ca;
  background: var(--green-soft);
  font-weight: 850;
}

.roblox-result a {
  color: #7bddeb;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  text-decoration: none;
}

.copy-asset {
  min-height: 30px;
  margin-left: 8px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--soft);
  background: rgba(255,255,255,.05);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.copy-asset:hover {
  color: var(--ink);
  border-color: rgba(40,199,223,.38);
}

.secondary.success {
  color: #91f1d0;
  background: var(--green-soft);
  border-color: rgba(53,212,154,.28);
}

.history-actions form { margin: 0; }

.format-action {
  display: inline-flex;
  align-items: stretch;
  margin: 0;
}

.format-action select {
  width: auto;
  min-width: 92px;
  border-radius: 11px 0 0 11px;
  border-right: 0;
  padding: 8px 10px;
}

.format-action button {
  border-radius: 0 11px 11px 0;
}

.delete-button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
  color: var(--muted);
  cursor: pointer;
}

.delete-button:hover {
  color: #ffafba;
  background: var(--red-soft);
  border-color: rgba(255,99,122,.2);
}

.empty {
  padding: 42px;
  text-align: center;
  color: var(--muted);
}

.api-card {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  overflow: hidden;
}

.tutorial {
  padding: 30px;
  border-right: 1px solid var(--line);
}

.tutorial p {
  margin-top: 0;
  color: var(--soft);
  font-weight: 720;
}

.docs-link {
  display: inline-flex;
  margin: 6px 0 20px;
  color: #7bddeb;
  text-decoration: none;
}

.account-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.04);
}

.tutorial ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tutorial li {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 34px;
  color: var(--muted);
}

.tutorial li span {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  color: #071017;
  background: var(--cyan);
  font-size: 12px;
  font-weight: 900;
}

.settings-form {
  padding: 30px;
}

.saved-key-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(53,212,154,.25);
  border-radius: 13px;
  background: rgba(53,212,154,.055);
}

.saved-key-panel.is-empty {
  border-color: var(--line);
  background: rgba(255,255,255,.025);
}

.saved-key-heading,
.saved-key-controls,
.saved-key-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.saved-key-heading {
  justify-content: space-between;
}

.saved-key-heading strong,
.saved-key-heading small {
  display: block;
}

.saved-key-heading small {
  margin-top: 4px;
  color: var(--muted);
}

.key-badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 8px;
  color: #91f1d0;
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 800;
}

.saved-key-panel.is-empty .key-badge {
  color: var(--muted);
  background: rgba(255,255,255,.05);
}

.saved-key-controls input {
  flex: 1 1 auto;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.saved-key-actions {
  flex: 0 0 auto;
}

.saved-key-actions button {
  min-height: 42px;
}

.danger-button {
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid rgba(255,99,122,.3);
  border-radius: 11px;
  color: #ffafba;
  background: var(--red-soft);
  cursor: pointer;
  font-weight: 820;
}

.danger-button:hover {
  border-color: rgba(255,99,122,.55);
  background: rgba(255,99,122,.18);
}

.security-note {
  padding: 16px;
  color: var(--soft);
  background: rgba(255,255,255,.045);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 28px 0;
}

.stats > div {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
}

.stats strong,
.stats span { display: block; }
.stats strong { font-size: 30px; }

.admin-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.admin-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.04);
  font-size: 12px;
  font-weight: 750;
}

.admin-live span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(53,212,154,.1);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.admin-stats article {
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  background: linear-gradient(180deg, rgba(30,34,45,.92), rgba(19,22,31,.92));
  border: 1px solid var(--line);
  border-radius: 16px;
}

.admin-stats article > div:last-child {
  min-width: 0;
}

.admin-stats span,
.admin-stats strong,
.admin-stats small {
  display: block;
}

.admin-stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.admin-stats strong {
  margin: 2px 0;
  font-size: 30px;
  line-height: 1;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 900;
}

.stat-users { color: #8fdfea; background: var(--cyan-soft); }
.stat-audio { color: #ffd08c; background: var(--amber-soft); }
.stat-ok { color: #8df0ca; background: var(--green-soft); }
.stat-bad { color: #ffafba; background: var(--red-soft); }

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, .75fr);
  gap: 18px;
  align-items: start;
}

.admin-panel {
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(30,34,45,.92), rgba(19,22,31,.92));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.panel-count {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 9px;
  color: var(--cyan);
  background: var(--cyan-soft);
  font-weight: 850;
}

.admin-upload-list,
.user-list {
  display: grid;
}

.admin-upload {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) minmax(190px, auto);
  gap: 14px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.admin-upload:last-child,
.user-row:last-child {
  border-bottom: 0;
}

.admin-upload:hover,
.user-row:hover {
  background: rgba(255,255,255,.025);
}

.admin-thumb {
  display: grid;
  place-items: center;
  width: 76px;
  height: 64px;
  overflow: hidden;
  border-radius: 12px;
  color: var(--cyan);
  background: linear-gradient(135deg, rgba(40,199,223,.18), rgba(246,169,53,.08)), #101720;
  font-size: 24px;
}

.admin-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-upload-main {
  display: grid;
  min-width: 0;
}

.admin-upload-main h3 {
  overflow: hidden;
  margin: 7px 0 2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-owner {
  overflow: hidden;
  color: #7bddeb;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-upload-meta {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 0;
}

.admin-upload-meta a {
  max-width: 220px;
  overflow: hidden;
  color: #7bddeb;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-upload-meta form {
  margin: 0;
}

.user-panel {
  position: sticky;
  top: 86px;
}

.user-list {
  max-height: 650px;
  overflow: auto;
}

.user-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.user-row > div:nth-child(2) {
  min-width: 0;
}

.user-row strong,
.user-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-row strong {
  font-size: 13px;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: #071017;
  background: linear-gradient(135deg, var(--cyan), #73e5b7);
  font-weight: 900;
}

.role-badge {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.06);
  font-size: 11px;
  font-weight: 850;
}

.role-superadmin {
  color: #ffd08c;
  background: var(--amber-soft);
}

.pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.pagination a {
  justify-self: start;
  min-width: 82px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--soft);
  background: rgba(255,255,255,.04);
  text-align: center;
  text-decoration: none;
  font-weight: 750;
}

.pagination a:last-child {
  justify-self: end;
}

.pagination a:hover {
  color: var(--ink);
  border-color: rgba(40,199,223,.35);
}

.pagination a.disabled {
  pointer-events: none;
  opacity: .35;
}

.pagination-compact {
  padding-inline: 16px;
}

.pagination-compact a {
  min-width: 64px;
  padding-inline: 8px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  display: grid;
  grid-template-columns: .95fr 1.05fr;
  width: min(920px, 100%);
  overflow: hidden;
}

.brand-panel {
  min-height: 500px;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(40,199,223,.2), transparent 32%),
    linear-gradient(160deg, #171c27, #10131b);
}

.brand-panel .brand-mark { margin-bottom: 28px; }
.brand-panel h1 { font-size: 42px; }
.brand-panel p { color: var(--muted); }

.auth-form {
  padding: 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-form form {
  display: grid;
  gap: 16px;
}

.auth-form h2 { margin-bottom: 22px; }
.auth-form > p { font-size: 13px; color: var(--muted); }
.auth-form a { color: #7bddeb; }

@media (max-width: 900px) {
  .page { width: calc(100% - 24px); margin-top: 24px; }
  h1 { font-size: 32px; }
  .api-card,
  .history-card,
  .form-grid,
  .trim-controls,
  .sliders,
  .wave-toolbar,
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .tutorial {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .editor-card,
  .source-panel,
  .tutorial,
  .settings-form {
    padding: 20px;
  }
  .sliders,
  .trim-controls,
  .form-grid {
    gap: 14px;
  }
  .history-thumb {
    width: 100%;
    height: 180px;
  }
  .editor-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .play-controls { justify-content: space-between; }
  .play-controls .primary,
  .history-actions > *,
  .history-actions form,
  .history-actions button,
  .history-actions a {
    width: 100%;
  }
  .format-action {
    display: grid;
    grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr);
  }
  .format-action select,
  .format-action button {
    width: 100%;
  }
  .wave-help { text-align: left; }
  .source-link,
  .conversion-meta,
  .security-note {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .saved-key-controls {
    align-items: stretch;
    flex-direction: column;
  }
  .saved-key-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .topbar { padding: 0 12px; }
  .topbar nav { gap: 4px; }
  .topbar nav a { padding: 7px 9px; }
  .profile-name { display: none; }
  .profile-button { padding-right: 5px; }
  .profile-dropdown { right: -4px; }
  .brand span:last-child { display: none; }
  .brand-panel { display: none; }
  .auth-form { padding: 34px; }
  .admin-heading {
    align-items: start;
    flex-direction: column;
  }
  .admin-stats {
    grid-template-columns: 1fr 1fr;
  }
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .user-panel {
    position: static;
  }
  .admin-upload {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .admin-thumb {
    width: 64px;
    height: 58px;
  }
  .admin-upload-meta {
    grid-column: 2;
    justify-items: start;
  }
}

@media (max-width: 520px) {
  .admin-stats {
    grid-template-columns: 1fr;
  }
  .admin-upload {
    padding: 14px;
  }
  .admin-upload-meta,
  .admin-upload-meta form,
  .admin-upload-meta button {
    width: 100%;
  }
}
