/* ═══════════════════════════════════════════════════════
   AUDIO STUDIO — GOLD PREMIUM (VipSeve brand) v11
   Deep black + #FFCC00 gold. Dark ink on gold surfaces.
   Class/ID names unchanged (app.js bog'liq).
   ═══════════════════════════════════════════════════════ */

:root {
  --bg: #08080a; --bg-soft: #0e0e11;
  --card: #16150f; --card-2: #1e1c14; --card-3: #28251a;
  --border: #2b281c; --border-2: #3a3527;
  --text: #fff; --text-2: #ece9dd; --muted: #9a968a; --muted-2: #62604f;
  --accent: #ffcc00; --accent-2: #ffdb57;
  --accent-soft: rgba(255,204,0,.10); --accent-soft-2: rgba(255,204,0,.18);
  --accent-glow: rgba(255,204,0,.40);
  --accent-grad: linear-gradient(135deg, #ffd93d 0%, #ffcc00 46%, #f5a623 100%);
  --ink: #1a1400;                 /* oltin yuzalarda to'q matn/ikona */
  --success: #34d399; --err: #fb7185;
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px;
  --tap: cubic-bezier(.2,0,.2,1);
  --spring: cubic-bezier(.34,1.56,.64,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent !important; }

html, body {
  height: 100%; width: 100%;
  overflow: hidden; position: fixed; top: 0; left: 0;
  overscroll-behavior: none;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5; letter-spacing: -.01em;
  -webkit-user-select: none; user-select: none;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 52% at 50% -12%, rgba(255,204,0,.14), transparent 64%),
    radial-gradient(ellipse 44% 36% at 92% 112%, rgba(245,166,35,.07), transparent 60%);
}
input, textarea { -webkit-user-select: text !important; user-select: text !important; }

/* === Viewport container — single screen, internal scroll === */
.container {
  height: 100dvh; max-height: 100dvh;
  display: flex; flex-direction: column;
  position: relative; z-index: 1;
  overflow: hidden;
}
main {
  flex: 1; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px 16px 110px;
  display: flex; flex-direction: column;
}
main::-webkit-scrollbar { display: none; }

header.top, header.top-center { display: none !important; }

button, .tab, .fx-chip, .knob, .lib-item, .play-btn, .btn-apply, .trim-btn,
.reset-btn, .clear, .fab-upload, .cover-upload, .rec-btn, a, [role="button"] {
  outline: none !important; -webkit-user-select: none; user-select: none;
}

/* ═══════════════ CARD BASE ═══════════════ */
.card {
  background: var(--card); border-radius: var(--r-md);
  padding: 18px; margin-bottom: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 32px rgba(0,0,0,.35);
}

/* ═══════════════ HOME: LIBRARY ═══════════════ */
.library-full {
  background: transparent !important; border: none !important;
  padding: 0 !important; margin: 0 !important; box-shadow: none !important;
  flex: 1; display: flex; flex-direction: column; min-height: 0;
}
.library-list { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.lib-item {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; cursor: pointer;
  transition: transform .12s var(--tap), background .15s, border-color .15s;
  flex-shrink: 0;
}
.lib-item:active { transform: scale(.98); background: var(--card-2); border-color: var(--border-2); }
.lib-item .fico {
  width: 48px; height: 48px; flex-shrink: 0;
  background: var(--accent-grad); color: var(--ink); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(255,204,0,.30), inset 0 1px 0 rgba(255,255,255,.35);
}
.lib-item .meta { flex: 1; min-width: 0; }
.lib-item .ttl { font-weight: 600; font-size: 14.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-item .at { font-size: 11px; color: var(--muted); margin-top: 2px; font-weight: 500; }
.lib-item .arr { color: var(--muted-2); flex-shrink: 0; }

.lib-loading {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  min-height: 60vh; color: var(--muted); font-size: 14px; font-weight: 600;
}
.lib-loading .spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
  box-shadow: 0 0 22px rgba(255,204,0,.22);
}
.lib-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 60vh; text-align: center; color: var(--muted);
}
.lib-empty .empty-ico {
  width: 80px; height: 80px; border-radius: 24px;
  background: var(--card-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted-2); margin-bottom: 18px;
}
.lib-empty .empty-title { font-size: 16px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.lib-empty .empty-sub { font-size: 13px; color: var(--muted); line-height: 1.5; max-width: 280px; }
.lib-empty .empty-arrow { margin-top: 16px; color: var(--accent); animation: bounce 1.8s ease-in-out infinite; }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(6px)} }

/* ═══════════════ FAB UPLOAD ═══════════════ */
.fab-upload {
  position: fixed; right: 20px; bottom: calc(24px + env(safe-area-inset-bottom));
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); cursor: pointer; z-index: 40;
  box-shadow: 0 10px 30px rgba(255,204,0,.45), 0 2px 8px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.4);
  transition: transform .15s var(--spring);
}
.fab-upload::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: linear-gradient(180deg, rgba(255,255,255,.32), transparent 52%); pointer-events: none; }
.fab-upload:active { transform: scale(.9); }
.fab-upload svg { position: relative; z-index: 1; }
.fab-upload.hidden { display: none !important; }

/* ═══════════════ CENTERED LOADER ═══════════════ */
#loadCard {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: transparent !important; border: none !important;
  padding: 0 !important; margin: 0 !important; min-height: 70vh;
}
.tg-loader { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; width: 100%; }
.tg-loader .ring-wrap { width: 120px; height: 120px; position: relative; margin-bottom: 22px; }
.tg-loader .ring-wrap svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.tg-loader .ring-bg { fill: none; stroke: var(--border); stroke-width: 6; }
.tg-loader .ring-fg { fill: none; stroke: url(#knob-grad); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset .3s var(--tap); filter: drop-shadow(0 0 12px rgba(255,204,0,.55)); }
.tg-loader .pct {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; letter-spacing: -.5px;
  background: var(--accent-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; font-variant-numeric: tabular-nums;
}
.tg-loader.indeterminate .ring-fg { stroke-dasharray: 80 250; animation: ringRotate 1.4s linear infinite; }
@keyframes ringRotate { to { stroke-dashoffset: -330; } }
.tg-loader .ico-note { display: none; }
.tg-loader .t { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.tg-loader .s { font-size: 13px; color: var(--muted); font-weight: 500; max-width: 260px; }

/* ═══════════════ EDITOR: HERO TRACK CARD ═══════════════ */
#editorCard { animation: cardReveal .35s var(--tap); }
@keyframes cardReveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.track-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 18px; text-align: center; position: relative;
  background: linear-gradient(180deg, var(--card-2) 0%, var(--card) 100%);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  margin-bottom: 14px;
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 16px 40px rgba(0,0,0,.4);
}
.album-art {
  width: 180px; height: 180px; border-radius: 22px;
  background: var(--accent-grad);
  box-shadow: 0 24px 52px rgba(255,204,0,.26), 0 6px 16px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.35);
  position: relative; overflow: hidden; margin-bottom: 20px; flex-shrink: 0;
}
.album-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,.18), transparent 50%); pointer-events: none; }
.album-art img { width: 100%; height: 100%; object-fit: cover; display: block; animation: artFade .5s var(--tap); }
@keyframes artFade { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: scale(1); } }
.album-art .art-fallback { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink); }
.track-meta { width: 100%; min-width: 0; }
.track-title { font-size: 19px; font-weight: 700; color: var(--text); letter-spacing: -.4px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px; }
.track-artist { font-size: 14px; font-weight: 600; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.track-info { font-size: 11.5px; color: var(--muted-2); font-weight: 500; }
.track-card .clear {
  position: absolute; top: 12px; right: 12px;
  background: var(--card-3); border: 1px solid var(--border); color: var(--muted);
  cursor: pointer; padding: 8px; display: flex; border-radius: 10px; transition: all .15s;
}
.track-card .clear:active { transform: scale(.9); }

/* === Waveform === */
.wave-wrap { flex: 1; min-width: 0; background: transparent; border: none; border-radius: 0; padding: 0; margin: 0; }
#waveform { height: 46px; width: 100%; cursor: pointer; }
.player { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; margin-top: 20px; background: var(--card-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.play-btn {
  width: 50px; height: 50px; border-radius: 50%; background: var(--accent-grad);
  color: var(--ink); border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; position: relative;
  transition: transform .12s var(--tap), box-shadow .15s, filter .15s;
  box-shadow: 0 8px 24px rgba(255,204,0,.34), inset 0 1px 0 rgba(255,255,255,.4);
}
.play-btn::after { content: ""; position: absolute; inset: 1px; border-radius: 50%; background: linear-gradient(180deg, rgba(255,255,255,.3), transparent 52%); pointer-events: none; }
.play-btn:active:not(:disabled) { transform: scale(.92); }
.play-btn:disabled { opacity: .3; cursor: not-allowed; box-shadow: none; filter: grayscale(.5); }
.time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; flex-shrink: 0; }

/* ═══════════════ TABS ═══════════════ */
#proCard { animation: cardReveal .35s var(--tap) .08s both; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--card-2); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 16px; position: relative; }
.tabs::before { content: ""; position: absolute; background: var(--card-3); border-radius: 11px; box-shadow: 0 1px 4px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.04); top: 4px; left: 4px; width: calc(25% - 6px); height: calc(100% - 8px); transition: transform .35s cubic-bezier(.4,0,.2,1); z-index: 0; }
.tabs[data-active="0"]::before { transform: translateX(0); }
.tabs[data-active="1"]::before { transform: translateX(100%); }
.tabs[data-active="2"]::before { transform: translateX(200%); }
.tabs[data-active="3"]::before { transform: translateX(300%); }
.tab { flex: 1; padding: 11px 8px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); border-radius: 10px; cursor: pointer; position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: color .25s; background: transparent !important; }
.tab svg { width: 18px; height: 18px; opacity: .7; transition: opacity .25s, transform .25s var(--spring); }
.tab.active { color: var(--text); }
.tab.active svg { opacity: 1; color: var(--accent); transform: scale(1.08); }
.tab:active { transform: scale(.96); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: panelSlide .35s var(--tap); }
@keyframes panelSlide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* === Effect strip === */
.section-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 12px; }
.section-head .title { font-size: 14px; font-weight: 700; }
.fx-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 4px 14px; margin: 0 -16px; scrollbar-width: none; }
.fx-strip::-webkit-scrollbar { display: none; }
.fx-strip > :first-child { margin-left: 16px; }
.fx-strip > :last-child { margin-right: 16px; }
.fx-chip { flex-shrink: 0; width: 92px; background: var(--card-2); border: 2px solid var(--border); border-radius: 16px; padding: 14px 6px 12px; text-align: center; cursor: pointer; transition: all .2s var(--tap); position: relative; }
.fx-chip:active { transform: scale(.93); }
.fx-chip .ico { width: 32px; height: 32px; margin: 0 auto 8px; color: var(--muted); transition: transform .3s var(--spring), color .2s; display: flex; align-items: center; justify-content: center; }
.fx-chip .lbl { font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.fx-chip.active { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft-2), transparent 70%), var(--card-2); box-shadow: 0 6px 20px rgba(255,204,0,.20); }
.fx-chip.active .ico { color: var(--accent); transform: scale(1.12); }
.fx-chip.active::after { content: ""; position: absolute; top: 7px; right: 7px; width: 16px; height: 16px; border-radius: 50%; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%231a1400' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8l3 3 5-6'/%3E%3C/svg%3E"), var(--accent-grad); background-size: 16px, cover; background-position: center; background-repeat: no-repeat; box-shadow: 0 2px 6px rgba(255,204,0,.45); }

/* === Knobs === */
.knob-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; padding: 6px 0 0; }
.knob { display: flex; flex-direction: column; align-items: center; padding: 12px 4px; border-radius: 12px; cursor: ns-resize; touch-action: none; transition: background .15s, transform .12s; }
.knob:active, .knob.dragging { background: var(--card-2); }
.knob.dragging { transform: scale(1.05); }
.knob-svg { width: 56px; height: 56px; }
.knob-svg .track { fill: none; stroke: var(--border-2); stroke-width: 3; stroke-linecap: round; }
.knob-svg .arc { fill: none; stroke: url(#knob-grad); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .08s linear; }
.knob-svg .face { fill: var(--card-2); stroke: var(--border); stroke-width: 1; }
.knob-svg .pointer { stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; }
.knob-svg .center { fill: var(--accent); }
.knob-label { font-size: 11px; color: var(--muted); margin-top: 8px; font-weight: 600; white-space: nowrap; }
.knob-value { font-size: 11px; font-weight: 700; color: var(--accent); margin-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.param-group { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.param-group:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.param-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted-2); font-weight: 700; margin-bottom: 8px; padding: 0 4px; }

/* === Trim === */
.trim-wrap { background: var(--card-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 16px; }
.trim-times { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
.trim-times b { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 700; }
.trim-track { height: 40px; position: relative; background: var(--bg); border-radius: 10px; overflow: hidden; cursor: pointer; border: 1px solid var(--border); }
.trim-fill { position: absolute; top: 0; bottom: 0; background: linear-gradient(180deg, rgba(255,204,0,.26), rgba(245,166,35,.16)); border-left: 2px solid var(--accent); border-right: 2px solid var(--accent); }
.trim-handle { position: absolute; top: 0; bottom: 0; width: 16px; background: var(--accent-grad); cursor: ew-resize; z-index: 2; touch-action: none; }
.trim-handle::before, .trim-handle::after { content: ""; position: absolute; width: 2px; height: 14px; background: var(--ink); border-radius: 1px; top: 13px; }
.trim-handle::before { left: 5px; } .trim-handle::after { left: 9px; }
.trim-handle.h-start { border-radius: 10px 0 0 10px; } .trim-handle.h-end { border-radius: 0 10px 10px 0; }
.trim-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.trim-btn { padding: 8px 14px; font-size: 11.5px; font-weight: 600; background: var(--card-3); border: 1px solid var(--border); border-radius: 8px; color: var(--text-2); cursor: pointer; transition: all .15s; }
.trim-btn:active { transform: scale(.94); background: var(--border); }

/* === Metadata === */
.meta-grid { display: flex; flex-direction: column; gap: 12px; }
.meta-field { display: flex; flex-direction: column; gap: 6px; }
.meta-field label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; }
.meta-field input[type=text] { background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; color: var(--text); font-size: 15px; font-family: inherit; outline: none; transition: border-color .15s, background .15s, box-shadow .15s; font-weight: 500; }
.meta-field input[type=text]:focus { border-color: var(--accent); background: var(--card-3); box-shadow: 0 0 0 3px var(--accent-soft); }
.cover-upload { display: flex; gap: 14px; align-items: center; padding: 14px; background: var(--card-2); border: 1.5px dashed var(--border-2); border-radius: 12px; cursor: pointer; transition: all .15s; }
.cover-upload:active { border-color: var(--accent); }
.cover-upload input { display: none; }
.cover-preview { width: 64px; height: 64px; border-radius: 12px; flex-shrink: 0; background: var(--accent-grad); overflow: hidden; box-shadow: 0 4px 14px rgba(255,204,0,.28); }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-upload .info { flex: 1; min-width: 0; }
.cover-upload .info .t { font-weight: 700; font-size: 13.5px; }
.cover-upload .info .s { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* === Voice === */
.voice-panel { background: var(--card-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 16px; }
.rec-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 16px; background: var(--card-3); color: var(--text); border: 1.5px solid var(--border); border-radius: 12px; font-weight: 700; font-size: 14.5px; cursor: pointer; transition: all .15s; }
.rec-btn.recording { background: linear-gradient(135deg, #ef4444, #f87171); color: #fff; border-color: #ef4444; animation: recPulse 1.4s ease-in-out infinite; }
@keyframes recPulse { 0%,100%{box-shadow:0 0 0 0 rgba(239,68,68,.5)} 50%{box-shadow:0 0 0 12px rgba(239,68,68,0)} }
.rec-btn .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.rec-time { text-align: center; margin-top: 10px; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; color: var(--accent); display: none; }
.rec-time.show { display: block; }
.voice-clip { margin-top: 12px; padding: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; display: none; align-items: center; gap: 10px; }
.voice-clip.show { display: flex; }
.voice-clip audio { flex: 1; height: 36px; }
.voice-clip .del { background: transparent; border: none; color: var(--muted); cursor: pointer; padding: 6px; display: flex; }
.voice-mix .row { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 6px; }
.voice-mix .row .l { color: var(--muted); font-weight: 500; }
.voice-mix .row .v { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.reset-btn { background: transparent; border: 1px solid var(--border); color: var(--muted); padding: 6px 12px; border-radius: 8px; font-size: 11.5px; font-weight: 600; cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 4px; }
.reset-btn:active { background: var(--card-2); }

/* Range slider */
input[type=range] { width: 100%; -webkit-appearance: none; background: transparent; height: 28px; }
input[type=range]::-webkit-slider-runnable-track { background: var(--border-2); height: 5px; border-radius: 3px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-grad); margin-top: -9px; cursor: pointer; border: 2.5px solid var(--ink); box-shadow: 0 3px 10px rgba(255,204,0,.45); }
input[type=range]:focus { outline: none !important; }

/* === Status === */
.status { padding: 12px 16px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 12px; display: none; align-items: center; gap: 10px; border: 1px solid transparent; font-weight: 500; }
.status.show { display: flex; }
.status.loading { background: var(--accent-soft); color: var(--accent); border-color: rgba(255,204,0,.28); }
.status.error { background: rgba(251,113,133,.1); color: var(--err); border-color: rgba(251,113,133,.25); }
.status.success { background: rgba(52,211,153,.08); color: var(--success); border-color: rgba(52,211,153,.25); }
.status .sico { width: 18px; height: 18px; display: flex; }
.spinner { width: 16px; height: 16px; border: 2.5px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === Toast === */
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(8px); background: var(--card-2); color: var(--text); padding: 12px 20px; border-radius: 14px; font-size: 13px; font-weight: 600; box-shadow: 0 8px 32px rgba(0,0,0,.55); z-index: 50; opacity: 0; pointer-events: none; transition: all .3s var(--tap); border: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--err); color: var(--err); }
.toast.ok { border-color: var(--success); color: var(--success); }

/* === Action bar === */
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); display: none; z-index: 20; }
.action-bar.show { display: block; }
.btn-apply { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 16px; border-radius: 16px; font-weight: 800; font-size: 15.5px; border: none; cursor: pointer; color: var(--ink); background: var(--accent-grad); transition: all .15s var(--tap); box-shadow: 0 10px 30px rgba(255,204,0,.42), inset 0 1px 0 rgba(255,255,255,.4); position: relative; overflow: hidden; letter-spacing: -.2px; }
.btn-apply::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,.24), transparent 50%); pointer-events: none; }
.btn-apply:active:not(:disabled) { transform: scale(.985); }
.btn-apply:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; filter: saturate(.6); }
.btn-apply > * { position: relative; z-index: 1; }

/* === Progress overlay === */
.progress-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(8,8,10,.93); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); display: none; align-items: center; justify-content: center; padding: 24px; }
.progress-overlay.show { display: flex; }
.progress-box { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--border); border-radius: 22px; padding: 28px 24px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.progress-ring { width: 130px; height: 130px; margin: 0 auto 20px; position: relative; }
.progress-ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.progress-ring .bg-circle { fill: none; stroke: var(--border); stroke-width: 7; }
.progress-ring .fg-circle { fill: none; stroke: url(#knob-grad); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset .35s var(--tap); filter: drop-shadow(0 0 10px rgba(255,204,0,.5)); }
.progress-ring .pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; background: var(--accent-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; font-variant-numeric: tabular-nums; }
.progress-stage { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.progress-sub { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.progress-stages { display: flex; justify-content: center; gap: 6px; margin-top: 20px; }
.progress-stages .step { width: 32px; height: 3px; border-radius: 99px; background: var(--border); transition: background .25s; }
.progress-stages .step.done { background: var(--accent); }
.progress-stages .step.active { background: var(--accent-2); animation: stepPulse 1.2s ease-in-out infinite; }
@keyframes stepPulse { 0%,100%{opacity:1} 50%{opacity:.5} }

/* hidden helper */
[hidden] { display: none !important; }
