*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0c0c0c;
  --sidebar: #111111;
  --surface: #191919;
  --surface2: #222222;
  --border: #2e2e2e;
  --accent: #03D1B7;
  --accent2: #5EECD5;
  --text: #e8e8e8;
  --muted: #606060;
  --green: #03D1B7;
  --red: #f87171;
  --yellow: #fbbf24;
  --s0: #03D1B7;
  --s1: #F2A7C3;
  --s2: #F5C26B;
  --s3: #7EB8F0;
}

body {
  font-family: "Space Grotesk", sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
  width: 60px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 8px;
  gap: 4px;
  flex-shrink: 0;
  transition: width 0.2s ease;
  overflow: hidden;
}
.sidebar.expanded { width: 180px; }
.logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
  flex-shrink: 0;
}
.logo-icon { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.logo-full { display: none; width: 100%; height: auto; object-fit: contain; }
.sidebar.expanded .logo {
  width: 100%; border-radius: 0; margin-bottom: 6px; padding: 0 12px; height: auto;
}
.sidebar.expanded .logo-icon { display: none; }
.sidebar.expanded .logo-full { display: block; }
.logo:hover { opacity: 0.8; }
.nav-item {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
}
.sidebar.expanded .nav-item { width: 100%; justify-content: flex-start; padding: 0 12px; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--surface2); color: var(--text); }
.nav-icon { width: 20px; height: 20px; display: block; flex-shrink: 0; }
.nav-item.mob-only { display: none; }
.nav-label { display: none; font-size: 13px; font-weight: 500; white-space: nowrap; }
.sidebar.expanded .nav-label { display: block; }
.sidebar-spacer { flex: 1; }
.sidebar-toggle {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  border-radius: 10px; border: none;
  background: transparent; color: var(--muted);
  cursor: pointer; flex-shrink: 0;
  transition: all 0.15s;
  overflow: hidden;
  white-space: nowrap;
}
.sidebar.expanded .sidebar-toggle { width: 100%; justify-content: flex-start; padding: 0 12px; }
.sidebar-toggle:hover { background: var(--surface); color: var(--text); }
.sidebar-toggle .nav-icon { transition: transform 0.2s ease; }
.sidebar.expanded .sidebar-toggle .nav-icon { transform: rotate(180deg); }
.toggle-label { display: none; font-size: 13px; font-weight: 500; white-space: nowrap; }
.sidebar.expanded .toggle-label { display: block; }
.eq {
  display: flex; align-items: flex-end;
  gap: 3px; height: 22px; margin-bottom: 12px;
}
.eq-bar {
  width: 4px; border-radius: 2px;
  background: var(--border);
}
.eq-bar.active {
  background: var(--accent);
  animation: eq var(--dur) ease-in-out infinite;
}
@keyframes eq {
  0%, 100% { height: 4px; }
  50% { height: var(--h); }
}

/* ── Credit badge ────────────────────────────── */
#credits-btn { position: relative; }
#settings-btn { position: relative; }
.credit-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--accent);
  color: var(--bg); font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  line-height: 1; pointer-events: none;
}
.sidebar.expanded .credit-badge { position: static; margin-left: auto; }

/* ── Settings modal ─────────────────────────── */
.settings-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 900; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.settings-overlay.open { opacity: 1; pointer-events: auto; }

.settings-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.95);
  width: 360px; max-width: calc(100vw - 32px); max-height: calc(100vh - 64px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  z-index: 901; overflow-y: auto;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.settings-panel.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }

.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0;
}
.settings-header h2 { font-size: 18px; font-weight: 700; margin: 0; }
.settings-close {
  background: none; border: none; color: var(--muted); font-size: 22px;
  cursor: pointer; padding: 4px 8px; line-height: 1;
}
.settings-close:hover { color: var(--text); }

.settings-section {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.settings-section:last-of-type { border-bottom: none; }

.settings-credits {
  display: flex; align-items: center; gap: 10px;
}
.settings-credits-icon { font-size: 20px; color: var(--accent); }
.settings-credits-val { font-size: 32px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.settings-credits-label { font-size: 14px; color: var(--muted); font-weight: 500; }

.settings-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.settings-hint { font-size: 12px; color: var(--muted); margin-bottom: 16px; }

.settings-link-block { margin-bottom: 14px; }
.settings-link-label { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }

.settings-code-row { display: flex; align-items: center; gap: 8px; }
.settings-code {
  font-size: 18px; font-weight: 700; font-family: monospace;
  letter-spacing: 0.2em; color: var(--text); padding: 6px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  min-width: 110px; text-align: center;
}
.settings-code-input {
  flex: 1; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-family: monospace;
  font-size: 14px; font-weight: 700; letter-spacing: 0.15em;
  text-transform: uppercase; outline: none;
}
.settings-code-input:focus { border-color: var(--accent); }
.settings-code-input::placeholder { color: var(--muted); font-weight: 400; letter-spacing: 0.05em; }

.settings-btn-sm {
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-family: inherit;
  font-size: 11px; font-weight: 700; cursor: pointer; transition: all 0.15s;
  white-space: nowrap;
}
.settings-btn-sm:hover { border-color: var(--accent); color: var(--text); }
.settings-btn-sm:disabled { opacity: 0.3; cursor: not-allowed; }

.settings-code-hint { font-size: 10px; color: var(--muted); margin-top: 4px; }
.settings-code-hint.error { color: var(--red); }

.settings-link-msg { font-size: 11px; font-weight: 600; margin-top: 8px; min-height: 16px; }
.settings-link-msg.success { color: var(--green); }
.settings-link-msg.error { color: var(--red); }

/* ── Get more + drawer ──────────────────────── */
.settings-getmore-btn {
  margin-left: auto; padding: 5px 12px; border-radius: 6px;
  border: 1px solid var(--accent); background: transparent;
  color: var(--accent); font-family: inherit;
  font-size: 11px; font-weight: 700; cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
}
.settings-getmore-btn:hover { background: rgba(3, 209, 183, 0.1); color: var(--text); }

.pkg-drawer {
  max-height: 0; overflow: hidden; transition: max-height 0.3s ease, margin 0.3s ease;
  margin-top: 0;
}
.pkg-drawer.open { max-height: 300px; margin-top: 16px; }

/* ── Promo section ──────────────────────────── */
.promo-label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  margin-bottom: 8px; font-style: italic;
}
.promo-msg { font-size: 11px; font-weight: 600; margin-top: 6px; min-height: 16px; }
.promo-msg.success { color: var(--green); }
.promo-msg.error { color: var(--red); }

/* ── Free credits CTA ───────────────────────── */
.free-credits-cta { border-bottom: none !important; }
.free-credits-title { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.free-credits-text { font-size: 11px; color: var(--muted); line-height: 1.5; margin: 0; }
.free-credits-text strong { color: var(--text); }

/* ── Package cards ──────────────────────────── */
.pkg-cards { display: flex; gap: 8px; margin-top: 10px; }
.pkg-card {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 14px 8px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg);
  cursor: pointer; transition: all 0.15s; position: relative;
  font-family: inherit; color: var(--text);
}
.pkg-card:hover { border-color: var(--accent); background: rgba(3, 209, 183, 0.05); }
.pkg-popular { border-color: var(--accent); }
.pkg-badge {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  padding: 2px 8px; border-radius: 4px;
  background: var(--accent); color: var(--bg);
  font-size: 8px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  white-space: nowrap;
}
.pkg-credits { font-size: 24px; font-weight: 800; line-height: 1.1; }
.pkg-label { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.pkg-price { font-size: 14px; font-weight: 700; margin-top: 4px; }
.pkg-per { font-size: 9px; color: var(--muted); }
.pkg-msg { font-size: 11px; font-weight: 600; margin-top: 8px; min-height: 16px; text-align: center; }
.pkg-msg.error { color: var(--red); }

.settings-footer {
  padding: 12px 24px 16px; font-size: 10px; color: var(--muted);
  font-family: monospace; opacity: 0.5;
}

/* ── Main ────────────────────────────────────── */
.main {
  flex: 1; display: flex;
  align-items: center; justify-content: center;
  overflow: hidden; position: relative; min-height: 0;
}
.main::before { display: none; }

/* ── Screens ─────────────────────────────────── */
.screen {
  position: absolute; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.screen.hidden { opacity: 0; pointer-events: none; transform: translateY(10px); }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 680px) {
  body { height: 100dvh; overflow: hidden; }
  .main { flex: 1; height: 100dvh; overflow: hidden; }
  #sidebar, #sidebar.expanded {
    position: fixed !important; bottom: 16px !important; left: 16px !important;
    top: auto !important; right: auto !important;
    transform: none !important;
    width: 48px !important; height: 48px !important;
    display: flex !important; flex-direction: column-reverse !important;
    align-items: center !important; justify-content: flex-start !important;
    gap: 0 !important; padding: 0 !important;
    z-index: 1000;
    border-radius: 50% !important; border: none !important;
    background: rgba(17, 17, 17, 0.85) !important;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    overflow: visible !important; transition: none !important;
  }
  .logo {
    display: flex !important; width: 48px !important; height: 48px !important;
    margin: 0 !important; border-radius: 50% !important; flex-shrink: 0;
    cursor: pointer; z-index: 2; position: relative;
  }
  .logo-full { display: none !important; }
  .logo-icon { display: block !important; width: 100%; height: 100%; padding: 8px; }
  .sidebar-spacer { display: none !important; }
  .sidebar-toggle { display: none !important; }
  .eq { display: none !important; }
  .toggle-label { display: none !important; }
  .nav-item, .nav-item.mob-only {
    width: auto; height: 44px; border-radius: 12px; padding: 0 14px; gap: 10px;
    display: flex !important; align-items: center; justify-content: flex-start;
    background: rgba(17, 17, 17, 0.92); border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    position: absolute; left: 0; white-space: nowrap;
    text-decoration: none; color: var(--muted);
    opacity: 0; pointer-events: none;
    transform: translateY(20px) scale(0.8);
    transition: opacity 0.15s ease, transform 0.2s ease;
  }
  .nav-item:hover { background: rgba(30, 30, 30, 0.95); color: var(--text); }
  .nav-item.active { color: var(--text); border-color: var(--accent); }
  .nav-label { display: block !important; font-size: 13px; font-weight: 500; }
  .nav-item:nth-child(2) { bottom: 310px; left: 26px; }
  .nav-item:nth-child(3) { bottom: 258px; left: 22px; }
  .nav-item:nth-child(4) { bottom: 206px; left: 18px; }
  #credits-btn  { position: absolute !important; bottom: 154px !important; left: 12px !important; }
  #settings-btn { position: absolute !important; bottom: 102px !important; left: 6px !important; }
  .credit-badge { position: static; margin-left: 6px; }
  #sidebar.mob-open .nav-item,
  #sidebar.mob-open .nav-item.mob-only {
    opacity: 1; pointer-events: auto;
    transform: translateY(0) scale(1);
    transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  #sidebar.mob-open #settings-btn { transition-delay: 0.03s; }
  #sidebar.mob-open #credits-btn  { transition-delay: 0.06s; }
  #sidebar.mob-open .nav-item:nth-child(4) { transition-delay: 0.09s; }
  #sidebar.mob-open .nav-item:nth-child(3) { transition-delay: 0.12s; }
  #sidebar.mob-open .nav-item:nth-child(2) { transition-delay: 0.15s; }
  input, select, textarea { font-size: 16px !important; }
}
