:root {
  /* ACTIV'AD brand palette
     Red:    #E30613  (the bright red in the logo)
     Black:  #1f1f1f  (the dark grey in the "D" and "ACTIV'AD" text)
     Backgrounds tuned slightly warmer than neutral so the red feels native. */
  --bg-0: #0d0d0e;
  --bg-1: #16161a;
  --bg-2: #1f1f23;
  --bg-3: #2a2a30;
  --border: #2e2e34;
  --border-2: #3b3b42;
  --text: #f1f1f3;
  --text-dim: #a3a3a8;
  --text-muted: #6f6f76;
  --brand-red: #E30613;
  --brand-red-hi: #ff2530;
  --brand-dark: #1f1f1f;
  --accent: var(--brand-red);
  --accent-2: var(--brand-red-hi);
  --success: #5cd6a0;
  --danger: #ff6b6b;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --radius: 12px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.page-viewer { height: 100vh; height: 100dvh; overscroll-behavior: none; overflow: hidden; }
body.page-library { min-height: 100vh; }

a { color: inherit; text-decoration: none; }
code {
  background: var(--bg-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.muted { color: var(--text-dim); }
.small { font-size: 12px; }

/* App layout (viewer page) */
.app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  height: 100dvh;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: linear-gradient(180deg, rgba(20, 23, 28, 0.95), rgba(20, 23, 28, 0.8));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 5;
  position: sticky;
  top: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.brand-mark {
  height: 36px;
  width: auto;          /* preserve aspect ratio of the source image */
  display: block;
  /* PNG now ships with a transparent background, so no blend-mode or filter
     hacks needed — it just renders correctly on any UI background. */
}
.page-viewer .brand-mark { height: 32px; }

.brand-text {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text);
}
.brand-name b { color: var(--brand-red); font-weight: 700; }

.brand-tagline {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 2px;
}
.topbar-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  font-family: inherit;
}
.btn:hover { background: var(--bg-3); border-color: var(--border-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--bg-2); }
.btn-primary {
  background: var(--brand-red);
  border: 1px solid var(--brand-red);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--brand-red-hi);
  border-color: var(--brand-red-hi);
}
.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.3);
}
.btn-danger:hover { background: rgba(255, 107, 107, 0.08); }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

/* ========= Auth UI ========= */
.user-badge {
  font-size: 12px;
  color: var(--text-dim);
  padding: 4px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-gate {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  text-align: center;
  box-shadow: var(--shadow);
}
.login-mark {
  height: 64px;
  width: auto;
  display: block;
  margin: 0 auto 18px;
}
.login-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.login-card .muted {
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 22px;
}
.login-card form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field span {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.3px;
}
.field input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.15);
}

/* ========= Library page ========= */
.library-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.hero { margin-bottom: 28px; }
.hero h1 { margin: 0 0 6px; font-size: 26px; font-weight: 700; }
.hero p { margin: 0; color: var(--text-dim); font-size: 14px; max-width: 640px; line-height: 1.55; }

.empty-state {
  text-align: center;
  padding: 80px 20px;
  border: 1.5px dashed var(--border);
  border-radius: 16px;
  background: rgba(20, 23, 28, 0.4);
}
.empty-icon { color: var(--accent); opacity: 0.7; margin-bottom: 14px; }
.empty-state h2 { margin: 0 0 6px; font-size: 18px; }
.empty-state p { margin: 0 0 18px; color: var(--text-dim); font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-2);
  box-shadow: var(--shadow);
}

.card-thumb {
  aspect-ratio: 16 / 10;
  background:
    radial-gradient(600px 300px at 50% 60%, rgba(227, 6, 19, 0.14), transparent 60%),
    radial-gradient(500px 300px at 80% 20%, rgba(227, 6, 19, 0.08), transparent 60%),
    var(--bg-0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.15);
  position: relative;
  border-bottom: 1px solid var(--border);
}
.card-thumb svg { width: 56px; height: 56px; }

.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--text-dim);
}
.card-meta b { color: var(--text); font-weight: 600; }
.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.card-actions .btn { flex: 1; justify-content: center; padding: 7px 10px; font-size: 12px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.status-pill.processing { background: rgba(227, 6, 19, 0.12); color: var(--accent); }
.status-pill.ready { background: rgba(92, 214, 160, 0.12); color: var(--success); }
.status-pill.failed { background: rgba(255, 107, 107, 0.12); color: var(--danger); }
.status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-pill.processing .dot { animation: pulse 1.2s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.savings-badge {
  font-size: 11px;
  color: var(--success);
  font-weight: 600;
}

/* ========= Modal ========= */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  max-width: 520px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}
.modal-card > p {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
}
.modal-close:hover { background: var(--bg-2); color: var(--text); }

.drop-zone {
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.dragging {
  border-color: var(--accent);
  background: rgba(227, 6, 19, 0.04);
}
.drop-zone-inner svg { color: var(--accent); margin-bottom: 10px; opacity: 0.85; }
.drop-zone p { margin: 4px 0; font-size: 13px; color: var(--text-dim); }
.drop-zone p strong { color: var(--text); }

.preset-row { margin: 18px 0 4px; }
.preset-label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-weight: 500;
}
.preset-options {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.preset-options label {
  cursor: pointer;
  position: relative;
}
.preset-options input { position: absolute; opacity: 0; pointer-events: none; }
.preset-options span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-2);
  text-align: center;
  transition: all 0.15s;
}
.preset-options span small {
  font-weight: 400;
  font-size: 10.5px;
  color: var(--text-muted);
}
.preset-options input:checked + span {
  border-color: var(--accent);
  background: rgba(227, 6, 19, 0.06);
  color: var(--accent);
}
.preset-options input:checked + span small { color: var(--text-dim); }

.upload-status {
  margin-top: 18px;
  padding: 14px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.upload-status-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

/* ========= Settings panel ========= */
.settings-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  background: rgba(20, 23, 28, 0.96);
  border-left: 1px solid var(--border);
  backdrop-filter: blur(14px);
  z-index: 20;
  overflow-y: auto;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.4);
  animation: panelSlide 0.18s ease;
}
@keyframes panelSlide {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 1;
}
.settings-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.settings-section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.settings-section:last-child { border-bottom: none; }

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 10px;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.value-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-2);
  padding: 1px 7px;
  border-radius: 4px;
  text-transform: none;
  letter-spacing: 0;
}

.bg-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.swatch {
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s, border-color 0.15s;
  outline: 1px solid var(--border);
  outline-offset: -1px;
}
.swatch:hover { transform: scale(1.06); }
.swatch.selected {
  border-color: var(--accent);
  outline: none;
}
.swatch-gradient {
  background: linear-gradient(135deg, #0b0d10 0%, #2a3548 60%, #6e7a96 100%);
}
.swatch-sky {
  background: linear-gradient(180deg, #4a8bc8 0%, #c8d8e8 100%);
}

.custom-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 0;
}
.custom-color-row label {
  font-size: 12px;
  color: var(--text-dim);
}
.custom-color-row input[type="color"] {
  width: 40px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa3b2' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.select:hover { border-color: var(--border-2); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg-1);
  box-shadow: 0 0 8px rgba(227, 6, 19, 0.4);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg-1);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.toggle-row input[type="checkbox"] {
  appearance: none;
  width: 32px;
  height: 18px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}
.toggle-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 1px; left: 1px;
  width: 14px; height: 14px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform 0.15s, background 0.15s;
}
.toggle-row input[type="checkbox"]:checked {
  background: rgba(227, 6, 19, 0.2);
  border-color: var(--accent);
}
.toggle-row input[type="checkbox"]:checked::after {
  transform: translateX(14px);
  background: var(--accent);
}

@media (max-width: 600px) {
  .settings-panel { width: 88%; max-width: 320px; }
}

.qr-image {
  background: #fff;
  padding: 16px;
  border-radius: 12px;
  margin: 8px auto 14px;
  width: max-content;
  display: block;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.qr-image img,
.qr-image table {
  display: block;
  margin: 0 auto;
  border-collapse: collapse;
}

.error-banner-inline {
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(255, 107, 107, 0.10);
  border: 1px solid rgba(255, 107, 107, 0.4);
  color: #ffd1d1;
  border-radius: 8px;
  font-size: 13px;
}

/* ========= Stage / viewer ========= */
.stage {
  position: relative;
  background:
    radial-gradient(1200px 600px at 50% 30%, rgba(227, 6, 19, 0.08), transparent 60%),
    radial-gradient(900px 500px at 85% 90%, rgba(227, 6, 19, 0.04), transparent 60%),
    var(--bg-0);
  overflow: hidden;
}
.stage[data-bg="gradient"] {
  background: linear-gradient(135deg, #0b0d10 0%, #2a3548 60%, #6e7a96 100%);
}
.stage[data-bg="sky"] {
  background: linear-gradient(180deg, #4a8bc8 0%, #c8d8e8 100%);
}
.canvas-holder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.canvas-holder canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
}

/* ========= Animation player (only shown when GLB has clips) ========= */
.anim-player {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(20, 23, 28, 0.92);
  border: 1px solid var(--border);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  z-index: 6;
  max-width: calc(100% - 32px);
}

.anim-play-btn {
  width: 30px; height: 30px;
  border: none;
  background: var(--brand-red);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.05s;
}
.anim-play-btn:hover { background: var(--brand-red-hi); }
.anim-play-btn:active { transform: scale(0.96); }

.anim-select {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  max-width: 160px;
  text-overflow: ellipsis;
}
.anim-select:hover { border-color: var(--border-2); }

.anim-scrub {
  -webkit-appearance: none;
  appearance: none;
  width: 220px;
  height: 4px;
  background: var(--bg-2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.anim-scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  background: var(--brand-red);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg-1);
  box-shadow: 0 0 6px rgba(227, 6, 19, 0.5);
}
.anim-scrub::-moz-range-thumb {
  width: 12px; height: 12px;
  background: var(--brand-red);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg-1);
}

.anim-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--text-dim);
  min-width: 80px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
  .anim-scrub { width: 120px; }
  .anim-time { min-width: 60px; }
  .anim-select { max-width: 100px; }
}

.hud-help {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 18px;
  padding: 8px 14px;
  background: rgba(20, 23, 28, 0.7);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-dim);
  backdrop-filter: blur(8px);
  pointer-events: none;
  opacity: 0;
  animation: hudFade 4s ease forwards;
}
.hud-help b { color: var(--text); font-weight: 600; }

@keyframes hudFade {
  0%, 10% { opacity: 0; }
  20%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

.loading-panel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 4;
}
.loading-card {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  width: 90%;
  padding: 20px 22px;
  background: rgba(20, 23, 28, 0.92);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}
.loading-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.loading-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.loading-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s ease;
}
.loading-meta {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.error-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.4);
  color: #ffd1d1;
  border-radius: 8px;
  font-size: 13px;
  max-width: calc(100% - 32px);
  z-index: 6;
}
.error-banner button {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

/* Bottom bar */
.bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: linear-gradient(0deg, rgba(20, 23, 28, 0.95), rgba(20, 23, 28, 0.8));
  border-top: 1px solid var(--border);
  font-size: 13px;
  backdrop-filter: blur(10px);
  z-index: 5;
}
.model-name {
  color: var(--text-dim);
  font-size: 12.5px;
  max-width: 50vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bottombar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.zoom-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-2);
}
.zoom-btn {
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
  width: 32px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.zoom-btn + .zoom-btn { border-left: 1px solid var(--border); }
.zoom-btn:hover { background: var(--bg-3); }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.toggle input {
  appearance: none;
  width: 32px;
  height: 18px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}
.toggle input::after {
  content: "";
  position: absolute;
  top: 1px; left: 1px;
  width: 14px; height: 14px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform 0.15s, background 0.15s;
}
.toggle input:checked {
  background: rgba(227, 6, 19, 0.2);
  border-color: var(--accent);
}
.toggle input:checked::after {
  transform: translateX(14px);
  background: var(--accent);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 200;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 600px) {
  .topbar { padding: 10px 12px; }
  .bottombar { padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
  .btn span:not(.brand-name) { display: none; }
  .btn-primary span { display: inline; }
  .btn { padding: 8px 10px; }
  .preset-options { grid-template-columns: 1fr; }
  .library-main { padding: 20px 16px 60px; }
  .hero h1 { font-size: 22px; }
}
