/* ========================================================
   ScoreReel - style.css
   Light theme with orange accent
======================================================== */

/* --- Design tokens --- */
:root {
  --bg:              #f8f9fb;
  --surface:         #ffffff;
  --card:            #ffffff;
  --card-hover:      #f3f4f6;
  --border:          #e2e4e9;
  --border-light:    #d1d5db;

  --primary:         #e67e22;
  --primary-dark:    #cf6d17;
  --primary-glow:    rgba(230,126,34,0.12);
  --primary-glow-lg: rgba(230,126,34,0.22);

  --accent:          #e67e22;
  --accent-dark:     #cf6d17;
  --accent-glow:     rgba(230,126,34,0.10);

  --success:         #16a34a;
  --success-bg:      rgba(22,163,74,0.08);
  --error:           #dc2626;
  --error-bg:        rgba(220,38,38,0.07);
  --warning:         #d97706;
  --warning-bg:      rgba(217,119,6,0.08);

  --text:            #1a1a2e;
  --text-muted:      #5f6b7a;
  --text-faint:      #9ca3af;

  --gradient:        linear-gradient(135deg, #e67e22 0%, #f39c12 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(230,126,34,0.06) 0%, rgba(243,156,18,0.06) 100%);

  --radius-sm:  6px;
  --radius:     12px;
  --radius-lg:  20px;
  --radius-xl:  32px;

  --shadow:    0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);

  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;

  --tr:     0.2s cubic-bezier(0.4,0,0.2,1);
  --tr-lg:  0.4s cubic-bezier(0.4,0,0.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

a { color: var(--primary); text-decoration: none; transition: color var(--tr); }
a:hover { color: var(--primary-dark); }

img, video { max-width: 100%; height: auto; }

h1,h2,h3,h4,h5,h6 {
  font-family: var(--font-serif);
  line-height: 1.2;
  color: var(--text);
}

code { font-family: 'Courier New', monospace; }

/* --- Utils --- */
.container       { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 900px; }
.text-center     { text-align: center; }
.text-muted      { color: var(--text-muted); }
.text-sm         { font-size: 0.875rem; }
.text-base       { font-size: 1rem; }
.text-error      { color: var(--error); }
.mt-sm  { margin-top: 8px; }
.mt-md  { margin-top: 16px; }
.mt-lg  { margin-top: 24px; }
.mt-xl  { margin-top: 40px; }
.mb-md  { margin-bottom: 16px; }
.mb-lg  { margin-bottom: 24px; }
.mb-xl  { margin-bottom: 48px; }
.hidden { display: none !important; }
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--tr);
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 20px var(--primary-glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--primary-glow-lg);
  color: #fff;
}
.btn-secondary {
  background: var(--card-hover);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--border);
  color: var(--text);
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--card-hover);
  color: var(--text);
}
.btn-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(220,38,38,0.2);
  font-size: 0.8rem;
  padding: 6px 12px;
}
.btn-error:hover { background: rgba(220,38,38,0.15); color: var(--error); }
.btn-sm  { padding: 6px 14px; font-size: 0.85rem; }
.btn-lg  { padding: 14px 32px; font-size: 1.0625rem; }
.btn-full { width: 100%; justify-content: center; }

/* --- Navbar --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  height: 64px;
  gap: 32px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-brand:hover { color: var(--text); }
.brand-icon { width: 32px; height: 32px; border-radius: 8px; }
.brand-icon--sm { width: 28px; height: 28px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.nav-link {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--tr);
}
.nav-link:hover { color: var(--text); background: var(--card-hover); }
.nav-admin { color: var(--primary) !important; }
.nav-admin:hover { color: var(--primary-dark) !important; }

.nav-credits {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--card-hover);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
}
.nav-credits svg { width: 14px; height: 14px; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--tr);
}

/* --- Alerts & flash --- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 20px;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(22,163,74,0.2); }
.alert-error   { background: var(--error-bg);   color: var(--error);   border: 1px solid rgba(220,38,38,0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(217,119,6,0.2); }

/* --- Cards --- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  transition: border-color var(--tr);
  box-shadow: var(--shadow);
}
.card-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  margin-bottom: 20px;
  color: var(--text);
}

/* --- Forms --- */
.input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 11px 16px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.input--sm { padding: 7px 12px; font-size: 0.875rem; }
.input::placeholder { color: var(--text-faint); }

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.form-group { margin-bottom: 20px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }

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

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--card-hover);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge-success { background: var(--success-bg); color: var(--success); border-color: rgba(22,163,74,0.2); }

/* --- Section layout --- */
.section { padding: 80px 0; }
.section-header { text-align: center; margin-bottom: 56px; }
.section-header h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: 12px; }
.section-header p  { color: var(--text-muted); font-size: 1.0625rem; }

/* --- HERO --- */
.hero {
  position: relative;
  padding: 100px 0 80px;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 20% 50%, rgba(230,126,34,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 60% 60% at 80% 40%, rgba(243,156,18,0.06) 0%, transparent 70%);
  pointer-events: none;
}

/* Side-by-side grid layout */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
.hero-content {
  position: relative;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-glow);
  border: 1px solid rgba(230,126,34,0.25);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 28px;
}
.hero-title {
  font-size: clamp(2.25rem, 4vw, 3.75rem);
  line-height: 1.1;
  margin-bottom: 24px;
}
.hero-sub {
  font-size: 1.125rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 36px;
  max-width: 540px;
}
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.hero-note { font-size: 0.875rem; color: var(--text-faint); }

/* Hero showcase visual */
.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}
.hero-showcase {
  position: relative;
  width: 100%;
  max-width: 560px;
}
.hero-showcase-main {
  width: 100%;
  border-radius: var(--radius-xl);
  box-shadow:
    0 4px 24px rgba(0,0,0,0.08),
    0 12px 48px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
}
.hero-showcase-float {
  position: absolute;
  border-radius: var(--radius-lg);
  box-shadow:
    0 4px 20px rgba(0,0,0,0.10),
    0 8px 32px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
  background: var(--surface);
}
.hero-showcase-float--top {
  width: 38%;
  top: -20px;
  right: -24px;
  animation: heroFloat 5s ease-in-out infinite alternate;
}
.hero-showcase-float--bottom {
  width: 28%;
  bottom: -16px;
  left: -20px;
  animation: heroFloat 5s ease-in-out infinite alternate-reverse;
}
@keyframes heroFloat {
  from { transform: translateY(0); }
  to   { transform: translateY(-12px); }
}

/* --- Features --- */
.features { background: var(--surface); }
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.feature-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: transform var(--tr), border-color var(--tr), box-shadow var(--tr);
}
.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.feature-icon { font-size: 2rem; margin-bottom: 16px; color: var(--primary); display: flex; justify-content: center; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: 10px; }
.feature-card p  { color: var(--text-muted); font-size: 0.9375rem; }

/* --- How it works --- */
.steps-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.step {
  flex: 1;
  min-width: 160px;
  max-width: 220px;
  text-align: center;
}
.step-num {
  width: 52px; height: 52px;
  background: var(--gradient);
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 16px;
  box-shadow: 0 4px 20px var(--primary-glow);
}
.step h3 { font-size: 1rem; margin-bottom: 8px; }
.step p  { color: var(--text-muted); font-size: 0.9rem; }
.step-arrow {
  color: var(--border-light);
  font-size: 1.5rem;
  padding-top: 16px;
  flex-shrink: 0;
}

/* --- Pricing preview --- */
.pricing-preview { background: var(--bg); }
.pricing-cards {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}
.pricing-card {
  flex: 1;
  min-width: 180px;
  max-width: 260px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  position: relative;
  transition: transform var(--tr), border-color var(--tr);
  box-shadow: var(--shadow);
}
.pricing-card:hover { transform: translateY(-4px); }
.pricing-card--featured {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-lg);
}
.price-tag { font-family: var(--font-serif); font-size: 2.25rem; font-weight: 800; margin-bottom: 4px; }
.price-credits { color: var(--primary); font-weight: 700; font-size: 1.1rem; margin-bottom: 10px; }
.price-badge {
  position: absolute;
  top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--gradient);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
}

/* --- CTA section --- */
.cta-section { padding: 60px 0; }
.cta-card {
  background: var(--gradient-subtle);
  border: 1px solid rgba(230,126,34,0.15);
  border-radius: var(--radius-xl);
  padding: 64px 48px;
  text-align: center;
}
.cta-card h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); margin-bottom: 12px; }
.cta-card p  { color: var(--text-muted); margin-bottom: 28px; }

/* --- Showcase rows (landing page feature sections) --- */
.showcase-row {
  display: flex;
  gap: 48px;
  align-items: center;
  flex-wrap: wrap;
}
.showcase-row--reverse { flex-direction: row-reverse; }
.showcase-text { flex: 1; min-width: 300px; }
.showcase-text h3 { font-size: 1.35rem; margin-bottom: 16px; }
.showcase-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}
.showcase-list li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 12px;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
}
.showcase-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}
.showcase-img { flex: 1; min-width: 280px; display: flex; justify-content: center; }

/* Image placeholders for screenshots */
.img-placeholder {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 16/10;
  background: var(--surface);
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-faint);
  font-size: 0.875rem;
  transition: border-color var(--tr);
}
.img-placeholder:hover { border-color: var(--primary); }
.img-placeholder svg { opacity: 0.4; }
.img-placeholder span { opacity: 0.6; }

/* Row of image placeholders */
.showcase-img-row {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 40px;
}
.showcase-img-row .img-placeholder {
  max-width: 300px;
  aspect-ratio: 16/9;
}

/* Showcase demo cards with real images */
.showcase-demo-card {
  max-width: 300px;
  flex: 1;
  min-width: 220px;
  text-align: center;
}
.showcase-demo-card img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform var(--tr), box-shadow var(--tr);
}
.showcase-demo-card img:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.showcase-demo-card span {
  display: block;
  margin-top: 10px;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Showcase comparison (landscape vs portrait) */
.showcase-comparison {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  max-width: 480px;
}
.showcase-real-img {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.showcase-comparison .showcase-real-img {
  flex: 2;
  width: 65%;
  height: auto;
}
.showcase-comparison .showcase-real-img--portrait {
  flex: 1;
  width: 30%;
}

/* When real images are placed, they fill the placeholder */
.img-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding-top: 48px;
}
.footer-inner {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
  padding-bottom: 40px;
}
.footer-brand { flex: 1; min-width: 200px; }
.footer-tagline { color: var(--text-muted); font-size: 0.9rem; margin-top: 12px; }
.footer-links { display: flex; gap: 48px; flex-wrap: wrap; }
.footer-col h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 14px;
}
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-col a { color: var(--text-muted); font-size: 0.9rem; }
.footer-col a:hover { color: var(--text); }
.footer-link-btn {
  background: none; border: none; color: var(--text-muted);
  font-size: 0.9rem; cursor: pointer; text-align: left; padding: 0;
}
.footer-link-btn:hover { color: var(--text); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 20px 0;
}
.footer-bottom .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-bottom p { color: var(--text-faint); font-size: 0.85rem; }
.footer-bottom a { color: var(--text-faint); }
.footer-bottom a:hover { color: var(--text-muted); }

/* --- Dashboard --- */
.page-main { padding: 48px 0 80px; }
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}
.dash-header h1 { font-size: clamp(1.5rem, 4vw, 2rem); }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stats-row--4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-value { font-family: var(--font-serif); font-size: 2.5rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

.promo-form { display: flex; gap: 12px; flex-wrap: wrap; }
.promo-form .input { flex: 1; min-width: 200px; }

.buy-credits-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 12px; color: var(--primary); display: flex; justify-content: center; }

/* Video section header with search/sort */
.video-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.video-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-faint);
  pointer-events: none;
}
.search-input {
  padding-left: 32px !important;
  width: 200px;
}
.sort-select {
  width: 150px;
  cursor: pointer;
}

.video-list { display: flex; flex-direction: column; gap: 12px; }
.video-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  gap: 16px;
  flex-wrap: wrap;
  transition: opacity 0.3s, transform 0.3s;
}
.video-thumb {
  width: 64px;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--card-hover);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.video-thumb-placeholder {
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-info { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.video-status {
  width: 32px; height: 32px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}
.status-complete   { background: var(--success-bg); color: var(--success); }
.status-error      { background: var(--error-bg);   color: var(--error); }
.status-processing { background: var(--primary-glow); color: var(--primary); }
.status-pending, .status-uploading, .status-ready
                   { background: var(--card-hover); color: var(--text-faint); border: 1px solid var(--border); }

.video-name { font-weight: 500; font-size: 0.9rem; }
.video-date { font-size: 0.8rem; }
.video-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Dashboard progress bar */
.dash-progress { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.dash-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  min-width: 100px;
}
.dash-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent, #7c5ae0));
  border-radius: 4px;
  transition: width 0.4s ease;
}
.dash-progress-pct {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  min-width: 36px;
  text-align: right;
}
/* Cancel button in dashboard (next to progress bar) */
.cancel-btn {
  font-size: 0.75rem;
  padding: 4px 10px;
  gap: 4px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: color var(--tr), border-color var(--tr), background var(--tr);
}
.cancel-btn:hover {
  color: var(--error);
  border-color: var(--error);
  background: var(--error-bg);
}

/* --- Auth pages --- */
.auth-page { min-height: calc(100vh - 200px); display: flex; align-items: center; padding: 40px 0; }
.auth-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 44px;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
}
.auth-logo { display: flex; justify-content: center; margin-bottom: 28px; }
.auth-title { font-size: 1.75rem; text-align: center; margin-bottom: 8px; }
.auth-sub   { text-align: center; color: var(--text-muted); margin-bottom: 28px; }
.auth-form  { display: flex; flex-direction: column; gap: 4px; }
.auth-legal { font-size: 0.8rem; color: var(--text-faint); text-align: center; margin-bottom: 16px; }
.auth-legal a { color: var(--text-muted); }
.auth-switch { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-top: 20px; }

/* --- Create page / Wizard --- */
.create-page { padding: 40px 0 80px; }
.create-header { text-align: center; margin-bottom: 40px; }
.create-header h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: 10px; }

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  margin-bottom: 40px;
  overflow-x: auto;
  padding: 8px 4px;
  gap: 0;
}
.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  cursor: default;
}
.step-item.done, .step-item.active { cursor: pointer; }
.step-item.done:hover .step-dot, .step-item.active:hover .step-dot { transform: scale(1.12); }
.step-item span { font-size: 0.75rem; color: var(--text-faint); white-space: nowrap; }
.step-item.active .step-dot {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 0 20px var(--primary-glow);
}
.step-item.done .step-dot {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success);
}
.step-item.active span { color: var(--primary); font-weight: 600; }
.step-item.done span { color: var(--success); }
.step-dot {
  width: 36px; height: 36px;
  border-radius: 999px;
  background: var(--card);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-faint);
  transition: all var(--tr);
}
.step-line { flex: 1; min-width: 24px; height: 2px; background: var(--border); margin: 0 4px; margin-bottom: 22px; }

/* Wizard panels */
.wizard-panel { display: none; animation: slideIn 0.3s ease; }
.wizard-panel.active { display: block; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--tr);
  margin-bottom: 16px;
  position: relative;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-glow);
}
.dropzone--sm { padding: 20px 16px; }
.dropzone-icon { font-size: 2.5rem; margin-bottom: 12px; color: var(--primary); display: flex; justify-content: center; }
.dropzone-text { color: var(--text); font-size: 1rem; margin-bottom: 6px; }
.dropzone-hint { color: var(--text-faint); font-size: 0.85rem; }
.dropzone-inner { pointer-events: none; }
.dropzone-inner .link-btn { pointer-events: all; position: relative; z-index: 1; }

/* Upload progress */
.upload-progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.upload-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

/* Orientation badge */
.orient-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  background: var(--card-hover);
}

/* Thumbnail grid */
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-bottom: 24px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}
.thumb-item {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--border);
  position: relative;
  transition: transform var(--tr);
}
.thumb-item:hover { transform: scale(1.05); }
.thumb-item img { width: 100%; height: 100%; object-fit: cover; }
.thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: none;
  background: rgba(220, 38, 38, 0.85);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--tr);
  z-index: 2;
  padding: 0;
}
.thumb-item:hover .thumb-remove { opacity: 1; }
.thumb-remove:hover { background: rgba(220, 38, 38, 1); }
.thumb-name {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 0.55rem;
  padding: 2px 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Audio status */
.audio-status {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.audio-filename { font-weight: 600; font-size: 0.9375rem; }

/* Info box */
.info-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--primary-glow);
  border: 1px solid rgba(230,126,34,0.18);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.info-box svg { flex-shrink: 0; color: var(--primary); margin-top: 2px; }
.info-box strong { color: var(--text); }
.info-box code { background: var(--card-hover); padding: 1px 5px; border-radius: 4px; font-size: 0.825rem; }

/* Timestamp grid */
.xml-section { margin-bottom: 24px; }
.xml-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.xml-header h3 { font-size: 1rem; font-family: var(--font-sans); font-weight: 600; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider span { color: var(--text-faint); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }

/* ── Roadmap builder ──── */
.roadmap-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 480px;
  overflow-y: auto;
  padding: 4px 0;
}
.roadmap-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  cursor: grab;
  user-select: none;
}
.roadmap-item:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 5%, var(--bg));
}
.roadmap-item:active { cursor: grabbing; }
.roadmap-dragging {
  opacity: 0.4;
  border-style: dashed;
}
.roadmap-drop-above {
  box-shadow: 0 -3px 0 0 var(--primary);
}
.roadmap-drop-below {
  box-shadow: 0 3px 0 0 var(--primary);
}
.roadmap-grip {
  font-size: 1rem;
  color: var(--text-faint);
  cursor: grab;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}
.roadmap-pos {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 24px;
}
.roadmap-thumb {
  width: 40px;
  height: 52px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}
.roadmap-thumb-placeholder {
  width: 40px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}
.roadmap-label {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.roadmap-filename {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}
.roadmap-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.15s;
  padding: 0;
  flex-shrink: 0;
}
.roadmap-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--card));
}
.roadmap-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.roadmap-btn.roadmap-remove:hover:not(:disabled) {
  border-color: var(--error);
  color: var(--error);
  background: color-mix(in srgb, var(--error) 8%, var(--card));
}
.roadmap-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.roadmap-summary {
  padding: 10px 14px;
  background: color-mix(in srgb, var(--primary) 6%, var(--bg));
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--primary) 15%, var(--border));
}
.badge-small {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--primary) 15%, var(--bg));
  color: var(--primary);
  font-weight: 600;
  vertical-align: middle;
}

/* ── Roadmap spread pair thumbnails ──── */
.roadmap-thumb-pair {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

/* ── Insert modal: spread cards ──── */
.insert-spread-card {
  min-width: 0;
}
.insert-spread-card .insert-page-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.insert-spread-thumbs {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-shrink: 0;
}
.insert-spread-thumbs img {
  width: 50px;
  height: 66px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}
.insert-spread-thumbs .insert-page-placeholder {
  width: 50px;
  height: 66px;
  flex-shrink: 0;
}

/* ── Insert modal: spread preview (two images side by side) ──── */
.insert-spread-preview {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}
.insert-spread-preview img {
  max-width: 48%;
  max-height: 55vh;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* ── Warning info box ──── */
.info-box--warning {
  background: color-mix(in srgb, #f0ad4e 8%, var(--bg));
  border: 1px solid color-mix(in srgb, #f0ad4e 30%, var(--border));
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.info-box--warning svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: #f0ad4e;
}

.info-box--subtle {
  background: color-mix(in srgb, var(--text-muted) 5%, var(--bg));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* ── Page names in timestamp cards ──── */
.ts-page-names {
  font-size: 0.72rem;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* ── Clickable thumbnails ──── */
.ts-thumb-clickable {
  cursor: pointer;
  transition: outline 0.15s, transform 0.15s;
}
.ts-thumb-clickable:hover {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  transform: scale(1.05);
}

/* ── Shared Modal Overlay ──── */
.sr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.sr-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.sr-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 16px);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  position: relative;
}
.sr-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: rgba(0,0,0,0.5);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.15s;
}
.sr-modal-close:hover { background: rgba(0,0,0,0.8); }
.sr-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.sr-modal-header h3 { margin: 0; font-size: 1.1rem; }
.sr-modal-header .sr-modal-close {
  position: static;
  background: transparent;
  color: var(--text-muted);
}
.sr-modal-header .sr-modal-close:hover { color: var(--text); background: var(--bg); }
.sr-modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(90vh - 80px);
}

/* ── Image Preview Modal ──── */
.sr-modal--preview {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sr-modal--preview .sr-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
}
.sr-modal--preview img {
  max-width: 85vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 30px rgba(0,0,0,0.5);
}
.sr-modal-caption {
  margin-top: 10px;
  color: #ccc;
  font-size: 0.85rem;
  text-align: center;
}

/* ── Spread Preview (two pages side by side in modal) ──── */
.spread-preview-pair {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}
.spread-preview-pair img {
  max-width: 42vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 30px rgba(0,0,0,0.5);
}

/* ── Clickable roadmap thumbnails ──── */
.roadmap-thumb-clickable {
  cursor: pointer;
  transition: outline 0.15s, transform 0.15s;
}
.roadmap-thumb-clickable:hover {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  transform: scale(1.08);
}

/* ── Insert Page Modal ──── */
.sr-modal--insert {
  width: 680px;
  max-width: 92vw;
}
.insert-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
}
.insert-page-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  min-width: 0;
  overflow: hidden;
}
.insert-page-card:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--bg));
  transform: translateY(-2px);
}
.insert-page-card img {
  width: 70px;
  height: 90px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}
.insert-page-card .insert-page-placeholder {
  width: 70px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
}
.insert-page-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  word-break: break-word;
  line-height: 1.3;
}
.insert-page-file {
  font-size: 0.65rem;
  color: var(--text-faint);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* ── Insert Page Preview (Step 2) ──── */
.insert-page-preview-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 0;
  max-height: 60vh;
  overflow: auto;
}
.insert-page-preview-wrap img {
  max-width: 100%;
  max-height: 55vh;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.insert-page-confirm-btns {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  padding-bottom: 4px;
}

.info-box--subtle svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--text-muted);
}

.ts-prompt {
  font-size: 0.95rem;
  margin: 0 0 16px;
  line-height: 1.5;
}
.ts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px 2px;
}
.ts-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s;
}
.ts-card:focus-within {
  border-color: var(--primary);
}
.ts-card .ts-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.ts-card .ts-input {
  font-size: 0.95rem;
  border: none;
  background: transparent;
  color: var(--text);
  outline: none;
  width: 100%;
  padding: 4px 0;
  font-family: inherit;
}
.ts-card .ts-input::placeholder {
  color: var(--text-faint);
}
.ts-thumb-pair {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin: 2px 0;
}
.ts-thumb-single {
  display: flex;
  justify-content: center;
  margin: 2px 0;
}
.ts-thumb {
  max-height: 80px;
  max-width: 100%;
  border-radius: 4px;
  border: 1px solid var(--border);
  object-fit: contain;
  background: var(--card);
}
.ts-thumb-pair .ts-thumb {
  max-width: 48%;
}
.music-end-section {
  max-width: 360px;
  margin: 8px 0 20px;
}
.music-end-section .label {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  display: block;
}

/* Toggle group */
.toggle-group {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 20px;
  width: fit-content;
}
.toggle-btn {
  padding: 8px 18px;
  border: none;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--tr);
  font-family: var(--font-sans);
}
.toggle-btn.active {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 2px 12px var(--primary-glow);
}

/* End screen */
.end-screen-option { margin-bottom: 20px; }

/* Resolution cards */
.res-cards { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.res-card {
  flex: 1;
  min-width: 120px;
  max-width: 200px;
  cursor: pointer;
  user-select: none;
}
.res-card input { position: absolute; opacity: 0; pointer-events: none; }
.res-card-inner {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  transition: all var(--tr);
  position: relative;
}
.res-card.active .res-card-inner,
.res-card:has(input:checked) .res-card-inner {
  border-color: var(--primary);
  background: var(--primary-glow);
  box-shadow: 0 0 0 1px var(--primary);
}
.res-label    { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 800; margin-bottom: 4px; }
.res-size     { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 10px; }
.res-cost     { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 0.875rem; font-weight: 600; }
.credit-dot   { width: 8px; height: 8px; background: var(--primary); border-radius: 999px; }
.credit-dot--free { background: var(--success, #22c55e); }
.res-note     { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.res-recommended {
  position: absolute;
  top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--gradient);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Option section */
.option-section { margin-bottom: 20px; }
.option-title { font-size: 1rem; font-weight: 600; margin-bottom: 12px; font-family: var(--font-sans); }

/* Review grid */
.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.review-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.review-label { font-size: 0.75rem; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.review-value { font-weight: 600; font-size: 0.9375rem; }

/* Credit info box */
.credit-info-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--primary-glow);
  border: 1px solid rgba(230,126,34,0.2);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
}

/* Generation progress */
.gen-progress-wrap { margin-bottom: 16px; }
.gen-progress-bar {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 10px;
}
.gen-progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 5px;
  transition: width 0.5s ease;
  width: 0%;
}
.gen-progress-label { text-align: center; font-size: 0.875rem; color: var(--text-muted); }

/* Complete / Error areas */
.complete-banner {
  text-align: center;
  padding: 40px 24px;
}
.complete-icon { font-size: 3.5rem; margin-bottom: 16px; color: var(--success); display: flex; justify-content: center; }
.complete-banner h3 { font-size: 1.5rem; margin-bottom: 16px; }
.complete-banner .btn { margin-top: 8px; }

/* Btn row */
.btn-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.btn-row--center { justify-content: center; }
.btn-row .btn:last-child { margin-left: auto; }
.btn-row .btn:first-child:last-child { margin-left: 0; }

/* --- Pricing page --- */
.quality-table { display: flex; flex-direction: column; gap: 2px; }
.quality-row {
  display: grid;
  grid-template-columns: 100px 1fr 100px;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
}
.quality-row--header {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 8px 16px;
}
.quality-row--featured { background: var(--primary-glow); border: 1px solid rgba(230,126,34,0.15); border-radius: var(--radius); }
.quality-name  { font-weight: 700; }
.quality-cost  { font-weight: 600; color: var(--primary); text-align: right; }

.pricing-full-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}
.pricing-full-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  position: relative;
  transition: transform var(--tr), border-color var(--tr);
  box-shadow: var(--shadow);
}
.pricing-full-card:hover { transform: translateY(-4px); border-color: var(--border-light); }
.pricing-full-card--featured { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow-lg); }
.pfc-badge {
  position: absolute;
  top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--gradient);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
  white-space: nowrap;
}
.pfc-header { text-align: center; margin-bottom: 20px; padding-top: 8px; }
.pfc-amount { font-family: var(--font-serif); font-size: 2.5rem; font-weight: 800; }
.pfc-unit   { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.pfc-credits{ color: var(--primary); font-weight: 700; font-size: 1.05rem; margin-top: 4px; }
.pfc-save   { font-size: 0.8rem; color: var(--text-faint); margin-top: 4px; }
.pfc-features { list-style: none; margin-bottom: 24px; display: flex; flex-direction: column; gap: 8px; }
.pfc-features li { font-size: 0.9rem; color: var(--text-muted); padding-left: 20px; position: relative; }
.pfc-features li::before { content: '\2713'; position: absolute; left: 0; color: var(--success); font-weight: 700; }

.qty-selector { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 0.9rem; color: var(--text-muted); }

.balance-display {
  font-family: var(--font-serif);
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  margin: 8px 0;
}

/* --- Admin --- */
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; flex-wrap: wrap; gap: 12px; }
.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-glow);
  border: 1px solid rgba(230,126,34,0.2);
  color: var(--primary);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
}

.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 20px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th, .admin-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.admin-table th { color: var(--text-faint); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.admin-table tr:hover td { background: var(--bg); }

.res-breakdown { display: flex; flex-direction: column; gap: 10px; }
.res-row { display: flex; align-items: center; gap: 12px; }
.res-name { min-width: 50px; font-weight: 700; font-size: 0.875rem; }
.res-bar-wrap { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.res-bar-fill { height: 100%; background: var(--gradient); border-radius: 4px; min-width: 4px; }
.res-count { min-width: 30px; text-align: right; font-size: 0.875rem; color: var(--text-muted); }

.admin-quick-links { display: flex; gap: 12px; flex-wrap: wrap; }

.inline-form { display: inline-flex; gap: 6px; align-items: center; }

.promo-create-form { display: flex; flex-direction: column; gap: 0; }
.code-tag {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.05em;
}

/* --- Legal --- */
.legal-page { padding: 48px 0 80px; }
.legal-page h1 { font-size: 2rem; margin-bottom: 8px; }
.legal-content { margin-top: 36px; }
.legal-content h2 { font-size: 1.2rem; margin: 32px 0 10px; font-family: var(--font-sans); font-weight: 700; color: var(--text); }
.legal-content p, .legal-content ul { color: var(--text-muted); font-size: 0.9375rem; line-height: 1.7; }
.legal-content ul { padding-left: 20px; }
.legal-content li { margin-bottom: 6px; }

/* --- Error pages --- */
.error-page { text-align: center; padding: 80px 24px; }
.error-code { font-family: var(--font-serif); font-size: 6rem; font-weight: 800; color: var(--primary); line-height: 1; margin-bottom: 16px; }
.error-page h1 { font-size: 1.75rem; margin-bottom: 12px; }

/* --- Payment success --- */
.success-page { text-align: center; padding: 80px 24px; }
.success-icon { font-size: 4rem; margin-bottom: 20px; color: var(--success); display: flex; justify-content: center; }
.success-page h1 { font-size: 2rem; margin-bottom: 12px; }

/* --- Toast notifications --- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast-success { border-left: 4px solid var(--success); }
.toast-error   { border-left: 4px solid var(--error); }
.toast-info    { border-left: 4px solid var(--primary); }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s ease;
}
.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}
.modal-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  margin-bottom: 12px;
  color: var(--text);
}
.modal-body {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 24px;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* --- Responsive --- */
/* --- Effects step (Step 7) --- */
.effects-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}
.effects-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fx-option {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.fx-option:has(input[type="checkbox"]:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), 0 2px 12px var(--primary-glow);
}
.fx-option-header {
  display: flex;
  align-items: center;
  gap: 14px;
}
.fx-option-label {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
}
.fx-option-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Toggle switch */
.fx-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.fx-toggle input { opacity: 0; width: 0; height: 0; }
.fx-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--tr);
}
.fx-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 999px;
  transition: transform var(--tr);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.fx-toggle input:checked + .fx-toggle-slider {
  background: var(--primary);
}
.fx-toggle input:checked + .fx-toggle-slider::before {
  transform: translateX(20px);
}
.fx-toggle input:disabled + .fx-toggle-slider {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Sub-options */
.fx-sub-options {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Color row */
.fx-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fx-color-picker {
  width: 40px;
  height: 36px;
  padding: 2px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
}
.fx-color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.fx-color-picker::-webkit-color-swatch { border: none; border-radius: 4px; }

/* Range row */
.fx-range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.fx-range {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}
.fx-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 8px var(--primary-glow);
}
.fx-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--primary);
  cursor: pointer;
  border: none;
}
.fx-range-value {
  font-weight: 600;
  font-size: 0.875rem;
  min-width: 40px;
  color: var(--text);
}

/* Preview */
.effects-preview {
  position: sticky;
  top: 88px;
}
.fx-preview-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.fx-preview-wrap {
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fx-preview-wrap.fx-preview--landscape {
  aspect-ratio: 16/9;
}
.fx-preview-wrap.fx-preview--portrait {
  aspect-ratio: 9/16;
  max-height: 520px;
}
.fx-preview-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* Background image preview */
.fx-bg-img-preview {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  max-height: 120px;
}
.fx-bg-img-preview img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

/* Disabled overlay for free tier */
.effects-controls.fx-disabled {
  position: relative;
  pointer-events: none;
}
.effects-controls.fx-disabled::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.55);
  border-radius: var(--radius);
  z-index: 5;
}

@media (max-width: 768px) {
  .effects-layout { grid-template-columns: 1fr; }
  .effects-preview { position: static; order: -1; }
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px;
    gap: 4px;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all var(--tr);
    z-index: 99;
  }
  .navbar { position: sticky; }
  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }
  .nav-credits { margin-top: 8px; }

  .hero { padding: 60px 0 40px; }
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero-visual { max-width: 420px; margin: 0 auto; }
  .hero-cta { flex-direction: column; }
  .hero-cta .btn { width: 100%; justify-content: center; }

  .steps-row { flex-direction: column; align-items: center; }
  .step-arrow { transform: rotate(90deg); padding: 0; }

  .auth-card { padding: 32px 24px; }
  .card { padding: 20px 18px; }

  .pricing-full-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }

  .btn-row .btn:last-child { margin-left: 0; }

  .toggle-group { width: 100%; }
  .toggle-btn { flex: 1; text-align: center; }

  .res-cards { flex-direction: column; }
  .res-card { max-width: 100%; }
}

@media (max-width: 480px) {
  .stepper { gap: 0; }
  .step-item span { display: none; }
  .step-line { min-width: 12px; }
  .ts-grid { grid-template-columns: repeat(2, 1fr); }
  .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
}

/* ─── Inline credit balance bar (Options step) ─────────────── */
.credit-balance-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--primary-glow);
  border: 1px solid rgba(230,126,34,0.2);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-top: 24px;
  margin-bottom: 8px;
}
.credit-balance-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.credit-balance-label { color: var(--text-muted); font-size: 0.9rem; }
.credit-balance-amount { font-weight: 700; font-size: 1rem; }
.credit-cost-note {
  background: rgba(230,126,34,0.13);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.82rem;
  color: var(--primary);
  font-weight: 600;
}
.credit-balance-actions { display: flex; gap: 8px; align-items: center; }

/* ─── Inline buy credits section ───────────────────────────── */
.inline-buy-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 12px;
  margin-bottom: 4px;
}
.inline-buy-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}
.inline-buy-header .option-title { margin-bottom: 0; }
.inline-pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}
.inline-pkg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  position: relative;
  transition: border-color var(--tr), transform var(--tr);
}
.inline-pkg-card:hover { border-color: var(--border-light); transform: translateY(-2px); }
.inline-pkg-card--featured { border-color: var(--primary); }
.inline-pkg-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.inline-pkg-credits { font-weight: 700; color: var(--primary); font-size: 0.9rem; margin-bottom: 2px; }
.inline-pkg-price { font-size: 1.6rem; font-weight: 800; font-family: var(--font-serif); line-height: 1.1; }
.inline-pkg-note { font-size: 0.73rem; color: var(--text-faint); margin-bottom: 4px; }

