/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0d0f;
  --surface: #16181c;
  --surface2: #1e2027;
  --border: #2a2d38;
  --accent: #6c63ff;
  --accent2: #a78bfa;
  --text: #e8eaf0;
  --text-muted: #7b7f91;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 10px;
  --radius-lg: 16px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 58px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: .45rem;
  text-decoration: none;
  color: var(--text);
}

nav { display: flex; gap: .5rem; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1.2rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #5a52e0; transform: translateY(-1px); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-sm { padding: .35rem .8rem; font-size: 12px; }
.btn-danger { background: var(--danger); color: #fff; }
.run-btn { margin-top: 1.5rem; padding: .7rem 2rem; font-size: 14px; }

/* ── Drop zone ───────────────────────────────────────────────────────────── */
.drop-section { padding: 2rem; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--surface);
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(108,99,255,.06);
}
.drop-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.dropzone p { color: var(--text-muted); }
.dropzone .sub { font-size: 12px; margin-top: .25rem; }
.link { color: var(--accent); cursor: pointer; text-decoration: underline; }

/* File list */
.file-list {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.file-chip {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .3rem .75rem;
  font-size: 12px;
  max-width: 220px;
}
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip button {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 14px; padding: 0; line-height: 1;
}
.file-chip button:hover { color: var(--danger); }

/* ── Workspace ───────────────────────────────────────────────────────────── */
.workspace { padding: 0 2rem 3rem; }

/* Tab bar */
.tab-bar {
  display: flex;
  gap: .25rem;
  overflow-x: auto;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab {
  padding: .5rem 1.1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all .15s;
}
.tab:hover { color: var(--text); background: var(--surface2); }
.tab.active { background: var(--accent); color: #fff; }

/* Panels */
.panel { display: none; }
.panel.active { display: block; }

.panel h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  color: var(--text);
}

/* Form grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem;
  margin-bottom: .5rem;
}

.field { display: flex; flex-direction: column; gap: .4rem; }
.field label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }

.toggle-field { flex-direction: row; align-items: center; justify-content: space-between; }
.toggle-field > label:first-child { text-transform: none; font-size: 13px; color: var(--text); letter-spacing: 0; }

input[type="text"],
input[type="number"],
select,
textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: .55rem .8rem;
  font-size: 13px;
  outline: none;
  width: 100%;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

input[type="range"] {
  accent-color: var(--accent);
  width: 100%;
  height: 6px;
  cursor: pointer;
}

.color-input {
  width: 48px !important;
  height: 36px;
  padding: 2px;
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
}

/* Toggle */
.toggle { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: .2s;
}
.toggle span::after {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
}
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(18px); }

/* Checkbox group */
.checkbox-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.checkbox-group label {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  transition: border-color .15s;
}
.checkbox-group label:hover { border-color: var(--accent); }
.checkbox-group input[type="checkbox"] { accent-color: var(--accent); }

/* Utilities */
.hidden { display: none !important; }
.row { display: flex; align-items: center; }
.gap-8 { gap: .5rem; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: .25rem; }

/* ── Pipeline ─────────────────────────────────────────────────────────────── */
.pipeline-controls { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.pipeline-controls select { width: auto; }

#pipeline-ops { display: flex; flex-direction: column; gap: .75rem; }

.pipeline-step {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.pipeline-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}
.pipeline-step-header h4 { font-size: 13px; font-weight: 600; color: var(--accent2); }
.step-num {
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  margin-right: .5rem; flex-shrink: 0;
}
.pipeline-step .form-grid { margin-bottom: 0; }

/* ── Results ──────────────────────────────────────────────────────────────── */
.results {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.results h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }

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

.result-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s;
}
.result-card:hover { transform: translateY(-2px); }

.result-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: repeating-conic-gradient(#222 0% 25%, #1a1a1a 0% 50%) 0 0 / 16px 16px;
  display: block;
}

.result-card-body { padding: .75rem; }
.result-card-body p { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-card-body a {
  display: inline-block;
  margin-top: .4rem;
  font-size: 12px;
  color: var(--accent2);
  text-decoration: none;
}
.result-card-body a:hover { text-decoration: underline; }

.result-zip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.zip-icon { font-size: 2rem; }

.result-error {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius);
  padding: .75rem;
  font-size: 12px;
  color: var(--danger);
}

/* ── Loading ──────────────────────────────────────────────────────────────── */
/* loading overlay → see bottom of file */

/* ── Guided Mask Editor ───────────────────────────────────────────────────────── */
.mask-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.87);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.mask-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(980px, 97vw);
  max-height: 94vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.mask-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mask-header h3 { font-size: .95rem; font-weight: 700; }
.mask-toolbar {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; flex-shrink: 0;
}
.tool-btn {
  padding: .35rem .85rem;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface2);
  color: var(--text); cursor: pointer;
  font-size: 12px; font-weight: 600;
  transition: all .15s; white-space: nowrap;
}
.tool-btn.active { border-color: var(--accent); background: rgba(108,99,255,.15); }
.tool-sep { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; }

.mask-editor-body {
  display: flex; gap: .75rem;
  padding: .75rem;
  flex: 1; min-height: 0; overflow: hidden;
}
.mask-canvas-section {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
}
.mask-result-section {
  width: 240px; flex-shrink: 0; display: flex; flex-direction: column; gap: 0;
}
.mask-section-label {
  font-size: 11px; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: .35rem;
}
.mask-canvas-wrap {
  flex: 1; overflow: auto; position: relative;
  background: repeating-conic-gradient(#1a1a1a 0% 25%, #222 0% 50%) 0 0 / 18px 18px;
  cursor: none; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  min-height: 180px;
}
#me-base-canvas {
  display: block; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
#me-ann-canvas {
  display: block; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  cursor: none;
}
.mask-result-wrap {
  flex: 1; min-height: 150px;
  background: repeating-conic-gradient(#1a1a1a 0% 25%, #222 0% 50%) 0 0 / 14px 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); overflow: hidden;
}
#me-result-canvas { max-width: 100%; max-height: 100%; display: block; }

#me-cursor {
  position: fixed; pointer-events: none;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.85);
  transform: translate(-50%, -50%);
  z-index: 300; opacity: 0;
  transition: border-color .1s, width .05s, height .05s;
}

/* ── Mode switcher ───────────────────────────────────────────────────────────── */
.mode-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  margin-bottom: .25rem;
}
.mode-btn {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  padding: .75rem 1rem;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  transition: all .15s;
}
.mode-btn span { font-weight: 400; font-size: 11px; color: var(--text-muted); }
.mode-btn:hover { border-color: var(--accent); color: var(--text); }
.mode-btn.active { border-color: var(--accent); background: rgba(108,99,255,.12); color: var(--text); }

/* ── Batch Hero Banner ──────────────────────────────────────────────────────── */
.batch-hero {
  background: linear-gradient(135deg, rgba(108,99,255,.18) 0%, rgba(167,139,250,.10) 100%);
  border-bottom: 1px solid rgba(108,99,255,.25);
  padding: .9rem 2rem;
}
.batch-hero-inner {
  max-width: 900px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
}
.batch-hero-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: .25rem .65rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.batch-hero-text {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
  min-width: 200px;
}
.batch-hero-text em { color: var(--accent2); font-style: normal; font-weight: 600; }
.batch-hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.batch-hero-chips span {
  font-size: 11px;
  color: var(--accent2);
  background: rgba(167,139,250,.1);
  border: 1px solid rgba(167,139,250,.25);
  border-radius: 999px;
  padding: .2rem .65rem;
  white-space: nowrap;
}

/* ── Center Subject ──────────────────────────────────────────────────────────── */
.batch-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: .15rem .55rem;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: .5rem;
  letter-spacing: .3px;
}

.cs-header-row { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.2rem; }
.cs-header-row h2 { margin-bottom: 0; }

.cs-fill-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: .25rem;
}
.cs-fill-row input[type="range"] { flex: 1; }
.cs-fill-num {
  width: 72px !important;
  text-align: center;
  flex-shrink: 0;
}
.cs-fill-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: .2rem;
}
.cs-fill-display {
  font-weight: 700;
  color: var(--accent2);
  font-size: 13px;
}

.cs-preview-section {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface2);
}
.cs-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
}
.cs-preview-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}
.cs-canvas-wrap {
  position: relative;
  width: 100%;
  min-height: 240px;
  max-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(#1a1a1a 0% 25%, #222 0% 50%) 0 0 / 18px 18px;
  overflow: hidden;
}
#cs-canvas,
#cs-frame-canvas {
  position: absolute;
  max-width: 100%;
  max-height: 100%;
  display: block;
}
#cs-frame-canvas {
  pointer-events: none;
}
.cs-preview-hint {
  position: relative;
  z-index: 2;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 3rem 1rem;
}

/* ── GEO / Landing Content ───────────────────────────────────────────────── */
.geo {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 4rem 2rem 5rem;
  margin-top: 2rem;
}
.geo-inner {
  max-width: 900px;
  margin: 0 auto;
}
.geo h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 2.5rem 0 1.1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.geo h2:first-child { margin-top: 0; }
.geo h3 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--accent2);
  margin-bottom: .4rem;
}
.geo p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.75;
}
.geo strong { color: var(--text); font-weight: 600; }

.geo-intro p {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-muted);
}

/* Features grid */
.geo-features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1rem;
  margin-bottom: .5rem;
}
.geo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  transition: border-color .15s;
}
.geo-card:hover { border-color: rgba(108,99,255,.35); }

/* Use cases */
.geo-usecases {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: .5rem;
}
.geo-uc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}

/* FAQ */
.geo-faq {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: .5rem;
}
.geo-faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s;
}
.geo-faq details[open] { border-color: rgba(108,99,255,.4); }
.geo-faq summary {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding: .85rem 1.1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .6rem;
  user-select: none;
}
.geo-faq summary::before {
  content: '+';
  color: var(--accent2);
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: transform .2s;
}
.geo-faq details[open] summary::before { content: '−'; }
.geo-faq details p {
  padding: 0 1.1rem 1rem;
  margin: 0;
  border-top: 1px solid var(--border);
  padding-top: .75rem;
}
.geo-faq summary::-webkit-details-marker { display: none; }

/* How it works */
.geo-steps {
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.geo-steps li {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  padding-left: .3rem;
}
.geo-steps li strong { color: var(--text); }

/* scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Rainbow pipeline tab ─────────────────────────────────────────────────── */
@keyframes rainbowShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.tab.tab-rainbow {
  border: 3px solid transparent !important;
  background:
    linear-gradient(135deg, #ff0080, #ff6600, #ffcc00, #00dd66, #0088ff, #8844ff, #ff0080) padding-box,
    linear-gradient(135deg, #990040, #993300, #997700, #007733, #004d99, #441177, #990040) border-box !important;
  background-size: 300% 300% !important;
  animation: rainbowShift 4s ease infinite;
  color: #fff !important;
  font-weight: 700 !important;
}
.tab.tab-rainbow.active,
.tab.tab-rainbow:hover {
  border: 3px solid transparent !important;
  background:
    linear-gradient(135deg, #ff0080, #ff6600, #ffcc00, #00dd66, #0088ff, #8844ff, #ff0080) padding-box,
    linear-gradient(135deg, #990040, #993300, #997700, #007733, #004d99, #441177, #990040) border-box !important;
  background-size: 300% 300% !important;
  animation: rainbowShift 4s ease infinite;
  color: #fff !important;
}

/* ── Pipeline step preview ────────────────────────────────────────────────── */
.step-preview-area {
  margin-top: .8rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.step-prev-img { }
.step-prev-img img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  background: repeating-conic-gradient(#2a2a2a 0% 25%, #1a1a1a 0% 50%) 0 0/16px 16px;
}
.step-preview-thumb {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  flex-wrap: wrap;
}

/* ── File list header with Remove All ────────────────────────────────────── */
.file-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .2rem .4rem .5rem;
}

/* ── Loading overlay with logo + progress bar ────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,18,0.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.loading-overlay.hidden { display: none; }
.loading-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2.5rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  min-width: 280px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.loading-logo {
  animation: loadingPulse 2s ease-in-out infinite;
}
@keyframes loadingPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.7; transform: scale(0.92); }
}
.loading-bar-track {
  width: 220px;
  height: 5px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.loading-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6c63ff, #ff0080, #ffcc00, #6c63ff);
  background-size: 200% 100%;
  animation: loadingShimmer 1.6s linear infinite;
  width: 0%;
  transition: width .45s ease;
}
@keyframes loadingShimmer {
  0%   { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}
#loading-msg {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
  max-width: 240px;
}

/* ── Advanced BG mode button ─────────────────────────────────────────────── */
.mode-btn-advanced {
  border: 1.5px solid rgba(108,99,255,0.4) !important;
}
.mode-btn-advanced.active {
  background: linear-gradient(135deg, rgba(108,99,255,0.2), rgba(255,0,128,0.1)) !important;
  border-color: #6c63ff !important;
  color: var(--accent2) !important;
}

/* ── Upload consent banner ───────────────────────────────────────────────── */
.upload-consent {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin: .4rem 0 0;
  padding: 0 1rem;
}
.upload-consent a { color: var(--accent2); text-decoration: none; }
.upload-consent a:hover { text-decoration: underline; }

/* ── Gradient/image bg picker extras ────────────────────────────────────── */
.bg-angle-label { font-size: 12px; color: var(--text-muted); }

/* ── Site footer ─────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 2rem 2rem;
  background: var(--surface);
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-brand {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .1rem;
  align-items: center;
}
.footer-links a {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  padding: .25rem .6rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.footer-links a:hover {
  color: var(--accent2);
  background: var(--surface2);
}
@media (max-width: 600px) {
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* ── Cookie consent banner ───────────────────────────────────────────────── */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 9998;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
}
.cookie-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}
.cookie-text { flex: 1; min-width: 200px; }
.cookie-text strong { font-size: 14px; color: var(--text); display: block; margin-bottom: .25rem; }
.cookie-text p { font-size: 12px; color: var(--text-muted); margin: 0; line-height: 1.5; }
.cookie-text a { color: var(--accent2); text-decoration: none; }
.cookie-text a:hover { text-decoration: underline; }
.cookie-btns { display: flex; gap: .5rem; flex-shrink: 0; }

/* ── Mobile polish ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .mask-inner { width: 100vw; max-height: 100dvh; border-radius: 0; }
  .mask-toolbar { gap: .4rem; padding: .5rem .75rem; }
  .mask-toolbar input[type="range"] { width: 64px !important; }
  .mask-header { padding: .75rem .75rem .5rem; }
  .mask-editor-body { flex-direction: column; }
  .mask-result-section { max-width: 100% !important; width: 100%; }
  .loading-card { padding: 1.75rem 1.25rem; min-width: 0; width: min(320px, 88vw); }
  .mode-btn { font-size: 13px; padding: .6rem .5rem; }
  .mode-btn span { font-size: 10px; }
  .results-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .form-grid { gap: .9rem; }
  .tool-btn { padding: .3rem .6rem; font-size: 12px; }
}
