/* ============================================================
   RESET & CUSTOM PROPERTIES
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --blue:    #4A90D9;
  --green:   #5CB85C;
  --yellow:  #F5A623;
  --coral:   #FF6B6B;
  --purple:  #9B59B6;
  --teal:    #1ABC9C;
  --bg:      #FFF9F0;
  --card:    #FFFFFF;
  --text:    #2C3E50;
  --muted:   #7F8C8D;
  --border:  #E8EDF2;
  --shadow:  0 4px 20px rgba(0,0,0,.08);
  --shadow-hover: 0 8px 30px rgba(0,0,0,.15);
  --r:  16px;
  --rs: 10px;
  --tr: all .25s ease;
}
html { scroll-behavior: smooth; }
body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  cursor: default;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; }
input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--rs);
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: var(--tr);
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74,144,217,.12); }
textarea { resize: vertical; min-height: 80px; }
.hidden { display: none !important; }
img { max-width: 100%; border-radius: var(--rs); }

/* ============================================================
   LAYOUT
   ============================================================ */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.section { min-height: 100vh; padding: 90px 0 60px; }
.section-title {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  color: var(--text);
  margin-bottom: 8px;
}
.section-sub { color: var(--muted); margin-bottom: 40px; font-size: 1.05rem; }
.text-gradient {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 64px;
  background: rgba(255,249,240,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.header-inner {
  display: flex; align-items: center; gap: 24px;
  height: 64px; position: relative;
}
.logo {
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  cursor: pointer; white-space: nowrap;
}
/* Centered nav */
.nav {
  display: flex; gap: 4px;
  position: absolute; left: 50%; transform: translateX(-50%);
}
/* Push auth/user to the right */
.header-auth, #headerUser { margin-left: auto; }
.nav-link {
  padding: 6px 14px; border-radius: 20px; font-weight: 600; font-size: .95rem;
  color: var(--muted); transition: var(--tr);
}
.nav-link:hover, .nav-link.active { color: var(--blue); background: rgba(74,144,217,.1); }
.header-auth, .header-user { display: flex; gap: 8px; align-items: center; }
.user-greeting { font-weight: 700; font-size: .9rem; color: var(--text); white-space: nowrap; }
.hamburger {
  display: none; background: none; font-size: 1.5rem;
  color: var(--text); margin-left: auto;
}
.mobile-menu {
  position: fixed; top: 64px; left: 0; right: 0;
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 16px 20px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow); z-index: 99;
}
.mobile-menu a, .mobile-menu button {
  padding: 12px 16px; border-radius: var(--rs);
  font-weight: 600; color: var(--text); text-align: left;
  background: none; font-size: 1rem;
}
.mobile-menu a:hover, .mobile-menu button:hover { background: var(--bg); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 50px; font-weight: 700;
  font-size: 1rem; transition: var(--tr); white-space: nowrap;
  border: 2px solid transparent;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.btn:active { transform: translateY(0); }
.btn-primary  { background: var(--coral); color: #fff; }
.btn-primary:hover { background: #ff5252; }
.btn-secondary { background: transparent; color: var(--blue); border-color: var(--blue); }
.btn-secondary:hover { background: rgba(74,144,217,.08); }
.btn-green    { background: var(--green); color: #fff; }
.btn-green:hover { background: #4cae4c; }
.btn-small    { padding: 8px 16px; font-size: .875rem; border-radius: 50px; }
.btn-block    { width: 100%; justify-content: center; }
.btn-generate {
  padding: 16px 32px; font-size: 1.1rem;
  background: linear-gradient(135deg, var(--coral), #FF8E53);
  color: #fff; border-radius: 50px; font-weight: 800;
  box-shadow: 0 4px 20px rgba(255,107,107,.4);
  width: 100%; justify-content: center; margin-top: 8px;
}
.btn-generate:hover { box-shadow: 0 8px 30px rgba(255,107,107,.5); transform: translateY(-3px); }
.btn-generate:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ============================================================
   TOAST
   ============================================================ */
#toastContainer {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-radius: var(--r);
  font-weight: 600; font-size: .9rem;
  box-shadow: var(--shadow-hover); max-width: 340px;
  transform: translateX(120%); transition: transform .3s ease;
}
.toast.toast-visible { transform: translateX(0); }
.toast-success { background: #d4edda; color: #155724; border-left: 4px solid var(--green); }
.toast-error   { background: #f8d7da; color: #721c24; border-left: 4px solid var(--coral); }
.toast-info    { background: #cce5ff; color: #004085; border-left: 4px solid var(--blue); }

/* ============================================================
   MODAL (Auth + Upgrade)
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.5); display: flex;
  align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
.modal-box {
  background: var(--card); border-radius: var(--r);
  padding: 36px; width: 100%; max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  position: relative;
  animation: slideUp .3s ease;
}
.modal-box.modal-wide { max-width: 760px; }
.debug-modal-box { max-width: 820px; max-height: 85vh; overflow-y: auto; }
.debug-content { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.debug-section { background: var(--bg); border-radius: 10px; padding: 14px 16px; }
.debug-label { font-weight: 700; font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.debug-hint { font-weight: 400; font-size: .78rem; opacity: .7; }
.debug-value { font-size: .9rem; color: var(--text); line-height: 1.6; }
.debug-pre { white-space: pre-wrap; font-family: monospace; font-size: .82rem; background: rgba(0,0,0,.04); padding: 10px 12px; border-radius: 6px; border-left: 3px solid var(--blue); }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: var(--bg); border: none; width: 32px; height: 32px;
  border-radius: 50%; font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--tr);
}
.modal-close:hover { background: var(--border); }
.modal-title {
  font-family: 'Fredoka One', cursive; font-size: 1.6rem;
  margin-bottom: 6px; color: var(--text);
}
.modal-sub { color: var(--muted); margin-bottom: 24px; font-size: .95rem; }
.modal-tabs { display: flex; gap: 0; margin-bottom: 24px; background: var(--bg); border-radius: var(--rs); padding: 4px; }
.modal-tab {
  flex: 1; padding: 10px; border-radius: 8px; font-weight: 700;
  font-size: .95rem; background: none; color: var(--muted);
  transition: var(--tr); border: none;
}
.modal-tab.active { background: var(--card); color: var(--blue); box-shadow: var(--shadow); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 700; font-size: .875rem; margin-bottom: 6px; color: var(--text); }
.form-error { color: var(--coral); font-size: .85rem; margin-top: 4px; display: none; }
.auth-error {
  background: #f8d7da; color: #721c24; padding: 12px 16px;
  border-radius: var(--rs); font-size: .9rem; margin-bottom: 16px;
  display: none;
}
.divider { text-align: center; color: var(--muted); margin: 16px 0; font-size: .85rem; position: relative; }
.divider::before, .divider::after {
  content: ''; position: absolute; top: 50%; width: 42%; height: 1px;
  background: var(--border);
}
.divider::before { left: 0; } .divider::after { right: 0; }
.btn-forgot {
  background: none; border: none; color: var(--muted); font-size: 0.85rem;
  cursor: pointer; text-decoration: underline; padding: 0;
}
.btn-forgot:hover { color: var(--blue); }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px; border: 2px solid var(--border);
  border-radius: var(--rs); background: var(--card); font-weight: 700;
  font-size: .95rem; cursor: pointer; transition: var(--tr);
}
.btn-google:hover { background: var(--bg); border-color: var(--blue); }

/* Upgrade modal plan cards */
.upgrade-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
.upgrade-plan-card {
  border: 2px solid var(--border); border-radius: var(--r);
  padding: 20px; text-align: center;
}
.upgrade-plan-card.highlighted { border-color: var(--blue); background: rgba(74,144,217,.04); }
.upgrade-plan-card h3 { font-family: 'Fredoka One', cursive; font-size: 1.2rem; margin-bottom: 4px; }
.upgrade-plan-price { font-size: 1.6rem; font-weight: 800; color: var(--coral); margin: 8px 0; }
.upgrade-plan-price span { font-size: .9rem; font-weight: 600; color: var(--muted); }
.upgrade-plan-features { list-style: none; text-align: left; margin: 12px 0; font-size: .875rem; }
.upgrade-plan-features li { padding: 3px 0; }
.upgrade-plan-features li::before { content: '✓ '; color: var(--green); font-weight: 700; }

/* ============================================================
   HOME / HERO
   ============================================================ */
.hero {
  background: linear-gradient(135deg, #FFF9F0 0%, #EEF6FF 50%, #F5E6FF 100%);
  padding: 110px 0 60px;
  position: relative; overflow: hidden; text-align: center;
}
.hero h1 {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.2; margin-bottom: 16px;
}
.hero p { font-size: 1.15rem; color: var(--muted); max-width: 560px; margin: 0 auto 32px; }
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.floating-emojis { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.emoji-float {
  position: absolute; font-size: 2rem; opacity: .25;
  animation: floatAnim 6s ease-in-out infinite;
}
@keyframes floatAnim {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

/* Features */
.features { padding: 60px 0; }
.features-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
.feature-card {
  background: var(--card); border-radius: var(--r); padding: 28px 24px;
  box-shadow: var(--shadow); border-top: 4px solid transparent;
  transition: var(--tr);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.feature-card:nth-child(1) { border-top-color: var(--coral); }
.feature-card:nth-child(2) { border-top-color: var(--blue); }
.feature-card:nth-child(3) { border-top-color: var(--green); }
.feature-icon { font-size: 2.2rem; margin-bottom: 12px; }
.feature-card h3 { font-family: 'Fredoka One', cursive; font-size: 1.2rem; margin-bottom: 6px; }
.feature-card p { color: var(--muted); font-size: .95rem; }

/* How it works */
.how-it-works { padding: 60px 0; background: linear-gradient(135deg,#EEF6FF,#F5E6FF); border-radius: 32px; }
.steps-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; margin-top: 32px; }
.step-card { text-align: center; padding: 24px 16px; }
.step-num {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--blue); color: #fff;
  font-family: 'Fredoka One', cursive; font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.step-card:nth-child(2) .step-num { background: var(--coral); }
.step-card:nth-child(3) .step-num { background: var(--green); }
.step-card h3 { font-weight: 800; margin-bottom: 6px; }
.step-card p { color: var(--muted); font-size: .9rem; }

/* Pricing */
.pricing { padding: 60px 0; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 20px; margin-top: 32px; }
.pricing-card {
  background: var(--card); border-radius: var(--r); padding: 32px 24px;
  box-shadow: var(--shadow); border: 2px solid var(--border);
  transition: var(--tr); text-align: center;
}
.pricing-card.highlighted {
  border-color: var(--blue);
  background: linear-gradient(180deg, rgba(74,144,217,.06) 0%, var(--card) 100%);
  transform: scale(1.03);
  box-shadow: 0 8px 40px rgba(74,144,217,.2);
}
.plan-badge {
  display: inline-block; padding: 4px 14px; border-radius: 20px;
  font-size: .75rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 12px;
}
.badge-free   { background: #eee; color: var(--muted); }
.badge-pro    { background: rgba(74,144,217,.15); color: var(--blue); }
.badge-family { background: rgba(155,89,182,.15); color: var(--purple); }
.plan-name { font-family: 'Fredoka One', cursive; font-size: 1.4rem; margin-bottom: 8px; }
.plan-price { font-size: 2.4rem; font-weight: 800; color: var(--coral); line-height: 1; }
.plan-price span { font-size: .9rem; font-weight: 600; color: var(--muted); }
.plan-period { color: var(--muted); font-size: .85rem; margin-bottom: 20px; }
.plan-features { list-style: none; text-align: left; margin-bottom: 24px; }
.plan-features li { padding: 6px 0; font-size: .92rem; border-bottom: 1px solid var(--bg); }
.plan-features li .ok  { color: var(--green); font-weight: 700; }
.plan-features li .no  { color: #bbb; }

/* Testimonials */
.testimonials { padding: 60px 0; }
.testimonials-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; margin-top: 32px; }
.testimonial-card {
  background: var(--card); border-radius: var(--r); padding: 28px;
  box-shadow: var(--shadow); position: relative;
}
.testimonial-card::before {
  content: '"'; position: absolute; top: 16px; left: 20px;
  font-size: 4rem; color: var(--blue); opacity: .15;
  font-family: serif; line-height: 1;
}
.testimonial-text { font-style: italic; color: var(--muted); margin-bottom: 16px; font-size: .95rem; }
.testimonial-author { display: flex; align-items: center; gap: 12px; }
.testimonial-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; color: #fff;
}
.testimonial-name { font-weight: 700; font-size: .9rem; }
.testimonial-role { color: var(--muted); font-size: .8rem; }

/* ============================================================
   GENERATOR
   ============================================================ */
.generator-layout {
  display: flex; justify-content: center;
  min-height: calc(100vh - 64px);
  padding: 32px 16px 80px;
}
.generator-left {
  width: 100%; max-width: 640px;
}

/* Loading overlay */
.gen-loading-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(255,255,255,.92); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
.gen-loading-box {
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 32px; border-radius: 24px;
  background: var(--card-bg); box-shadow: 0 8px 40px rgba(0,0,0,.12);
  text-align: center;
}

/* Stories remaining badge */
.stories-remaining {
  padding: 10px 16px; border-radius: 12px;
  font-size: .875rem; font-weight: 600;
  text-align: center; margin-bottom: 12px;
}
.stories-remaining-ok      { background: #e8f5e9; color: #2e7d32; }
.stories-remaining-warn    { background: #fff3e0; color: #e65100; }
.stories-remaining-danger  { background: #fce4ec; color: #c62828; }
.stories-remaining-founder { background: linear-gradient(135deg,#fff8e1,#ffe082); color: #b8860b; font-weight:700; border:1px solid #ffd54f; }

/* Step indicator */
.step-indicator-wrap { display: flex; gap: 0; margin-bottom: 28px; }
.step-item {
  display: flex; flex-direction: column; align-items: center;
  flex: 1; position: relative;
}
.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: calc(50% + 20px);
  width: calc(100% - 40px);
  height: 2px;
  background: var(--border);
  transition: var(--tr);
  z-index: 0;
}
.step-item.done::after { background: var(--green); }
.step-circle {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .85rem; background: var(--card);
  color: var(--muted); flex-shrink: 0; transition: var(--tr);
  position: relative; z-index: 1;
}
.step-circle.active { border-color: var(--blue); color: var(--blue); background: rgba(74,144,217,.1); }
.step-circle.done   { border-color: var(--green); color: #fff; background: var(--green); }
.step-label {
  font-size: .7rem; font-weight: 700; color: var(--muted);
  margin-top: 6px; text-align: center; white-space: nowrap;
}
.step-label.active { color: var(--blue); }
.step-label.done   { color: var(--green); }

/* Legacy selectors – kept for JS compatibility */
.step-circles-row { display: none; }
.step-labels-row  { display: none; }
.step-line        { display: none; }
.step-content { display: none; }
.step-content.active { display: block; animation: fadeInUp .3s ease; }
.step-title { font-family: 'Fredoka One', cursive; font-size: 1.3rem; margin-bottom: 20px; color: var(--text); }
.step-subtitle { color: var(--muted); margin: -10px 0 20px; font-size: .95rem; line-height: 1.6; }
.character-builder-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.generator-summary-card {
  background: linear-gradient(135deg, rgba(74,144,217,.08), rgba(155,89,182,.06));
  border: 1px solid rgba(74,144,217,.12);
  border-radius: var(--r);
  padding: 16px 18px;
}
.summary-label { font-size: .78rem; font-weight: 800; letter-spacing: .02em; color: var(--blue); margin-bottom: 6px; text-transform: uppercase; }
.summary-value { font-size: .95rem; color: var(--text); line-height: 1.6; }
.summary-list { display: flex; flex-direction: column; gap: 8px; color: var(--text); font-size: .92rem; }
.summary-list strong { color: var(--muted); font-weight: 800; }
.generator-advanced {
  margin: 12px 0 18px; border: 1px solid var(--border); border-radius: var(--r); background: var(--card); padding: 14px 16px;
}
.generator-advanced summary {
  cursor: pointer; font-weight: 800; color: var(--text); list-style: none;
}
.generator-advanced summary::-webkit-details-marker { display: none; }

/* Gender buttons */
.gender-btns { display: flex; gap: 10px; }
.gender-btn {
  flex: 1; padding: 10px 16px; border-radius: var(--rs);
  border: 2px solid var(--border); background: var(--card);
  font-weight: 700; font-size: .95rem; transition: var(--tr);
  color: var(--muted);
}
.gender-btn:hover { border-color: var(--blue); color: var(--blue); }
.gender-btn.selected { border-color: var(--blue); background: rgba(74,144,217,.1); color: var(--blue); }

/* Interest tags */
.tags-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  padding: 7px 14px; border-radius: 20px;
  border: 2px solid var(--border); background: var(--card);
  font-weight: 700; font-size: .875rem; cursor: pointer;
  transition: var(--tr); color: var(--muted); user-select: none;
}
.tag:hover { border-color: var(--coral); color: var(--coral); }
.tag.active { border-color: var(--coral); background: var(--coral); color: #fff; }

/* Content type cards */
.content-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.content-card {
  border: 2px solid var(--border); border-radius: var(--r);
  padding: 14px; cursor: pointer; transition: var(--tr); text-align: center;
  background: var(--card);
}
.content-card:hover { border-color: var(--blue); }
.content-card.selected { border-color: var(--blue); background: rgba(74,144,217,.07); }
.content-card-icon { font-size: 1.8rem; margin-bottom: 6px; }
.content-card-name { font-weight: 800; font-size: .9rem; }
.content-card-desc { font-size: .78rem; color: var(--muted); margin-top: 2px; }

/* Length buttons */
.length-btns { display: flex; gap: 8px; }
.length-btn {
  flex: 1; padding: 12px 8px; border-radius: var(--rs);
  border: 2px solid var(--border); background: var(--card);
  font-weight: 700; cursor: pointer; transition: var(--tr);
  text-align: center; color: var(--muted);
}
.length-btn:hover { border-color: var(--coral); }
.length-btn.selected { border-color: var(--coral); background: rgba(255,107,107,.08); color: var(--coral); }
.length-pages { display: block; font-size: .75rem; font-weight: 600; margin-top: 2px; }

/* Style cards */
.style-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.style-card {
  border: 2px solid var(--border); border-radius: var(--r);
  padding: 14px 10px; cursor: pointer; transition: var(--tr);
  text-align: center; background: var(--card); position: relative;
}
.style-card:hover { border-color: var(--blue); }
.style-card.selected { border-color: var(--blue); background: rgba(74,144,217,.07); }
.style-card-icon { font-size: 1.6rem; margin-bottom: 4px; }
.style-card-name { font-weight: 700; font-size: .875rem; }

.image-model-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.image-model-card {
  border: 2px solid var(--border); border-radius: var(--r);
  padding: 16px 14px; cursor: pointer; transition: var(--tr);
  background: var(--card); position: relative;
}
.image-model-card:hover { border-color: var(--blue); }
.image-model-card.selected { border-color: var(--purple); background: rgba(155,89,182,.08); }
.image-model-card.locked { opacity: .82; }
.image-model-icon { font-size: 1.5rem; margin-bottom: 6px; }
.image-model-name { font-weight: 800; font-size: .95rem; margin-bottom: 4px; }
.image-model-desc { font-size: .8rem; color: var(--muted); line-height: 1.45; }
.image-model-helper {
  margin-top: 10px; padding: 10px 12px; border-radius: var(--rs);
  background: rgba(74,144,217,.08); color: var(--text); font-size: .82rem;
}
.model-test-results { margin-top: 18px; }
.model-test-prompt {
  font-size: .82rem; color: var(--muted); background: var(--bg);
  border-radius: var(--rs); padding: 10px 12px; margin-bottom: 12px;
}
.model-test-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.model-test-card {
  background: var(--card); border: 2px solid var(--border);
  border-radius: var(--r); padding: 12px;
}
.model-test-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
}
.model-test-status {
  font-size: .72rem; font-weight: 800; padding: 4px 8px; border-radius: 999px;
}
.model-test-status.ok { background: #e8f5e9; color: #2e7d32; }
.model-test-status.fail { background: #fdecea; color: #c62828; }
.model-test-image {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 12px; display: block;
}
.model-test-error {
  min-height: 180px; display: flex; align-items: center; justify-content: center;
  text-align: center; color: #c62828; background: #fdecea; border-radius: 12px; padding: 14px;
}
.model-test-loading {
  min-height: 180px; display: flex; align-items: center; justify-content: center;
  text-align: center; color: var(--muted); background: var(--bg); border-radius: 12px; padding: 14px;
}

/* Language buttons */
.lang-btns { display: flex; gap: 8px; }
.lang-btn {
  flex: 1; padding: 10px; border-radius: var(--rs);
  border: 2px solid var(--border); background: var(--card);
  font-weight: 700; cursor: pointer; transition: var(--tr);
  color: var(--muted); text-align: center; font-size: .875rem;
}
.lang-btn.selected { border-color: var(--green); background: rgba(92,184,92,.1); color: var(--green); }

/* Pro badge */
.pro-badge {
  display: inline-block; background: var(--coral); color: #fff;
  font-size: .65rem; font-weight: 800; padding: 2px 6px;
  border-radius: 4px; letter-spacing: .5px; vertical-align: middle;
  margin-left: 6px;
}
.pro-badge-abs {
  position: absolute; top: 8px; right: 8px;
  background: var(--coral); color: #fff;
  font-size: .65rem; font-weight: 800; padding: 2px 6px;
  border-radius: 4px;
}

/* Checkbox rows */
.checkbox-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border: 2px solid var(--border);
  border-radius: var(--rs); margin-bottom: 10px;
  cursor: pointer; transition: var(--tr);
}
.checkbox-row:hover { border-color: var(--blue); }
.checkbox-row input[type=checkbox] { width: 18px; height: 18px; flex-shrink: 0; }
.checkbox-row-label { font-weight: 700; flex: 1; }
.checkbox-row-desc { font-size: .8rem; color: var(--muted); }

/* Step nav buttons */
.step-nav { display: flex; gap: 10px; margin-top: 24px; }

/* Title suggestions */
.title-input-wrap { position: relative; }
.title-suggest-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: var(--blue); color: #fff; border: none; border-radius: var(--rs);
  padding: 6px 12px; font-size: .8rem; font-weight: 700; cursor: pointer;
  transition: var(--tr);
}
.title-suggest-btn:hover { background: #3a7bc8; }
#titleSuggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10;
  background: var(--card); border: 2px solid var(--blue);
  border-radius: var(--rs); box-shadow: var(--shadow); overflow: hidden;
}
.title-suggestion-item {
  padding: 10px 14px; cursor: pointer; font-size: .9rem;
  transition: var(--tr); border-bottom: 1px solid var(--bg);
}
.title-suggestion-item:hover { background: rgba(74,144,217,.08); }
.title-suggestion-item:last-child { border-bottom: none; }

/* Theme chips */
.theme-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.theme-chip {
  padding: 6px 14px; border-radius: 20px; font-size: .85rem; font-weight: 700;
  border: 2px solid var(--border); cursor: pointer; transition: var(--tr);
  background: var(--card); color: var(--muted);
}
.theme-chip:hover, .theme-chip.active { border-color: var(--purple); color: var(--purple); background: rgba(155,89,182,.07); }

/* Upload area */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--r);
  padding: 24px; text-align: center; cursor: pointer;
  transition: var(--tr); background: var(--bg);
}
.upload-area:hover, .upload-area.dragover { border-color: var(--blue); background: rgba(74,144,217,.04); }
.upload-area p { color: var(--muted); font-size: .9rem; }
.upload-preview { max-width: 80px; max-height: 80px; border-radius: 50%; object-fit: cover; margin: 0 auto 8px; display: block; }

/* ============================================================
   PREVIEW PANEL
   ============================================================ */
.preview-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 400px; text-align: center;
  color: var(--muted);
}
.preview-empty-icon { font-size: 5rem; margin-bottom: 16px; opacity: .5; }
.preview-empty p { font-size: 1.05rem; line-height: 1.7; }
.preview-loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 400px; gap: 20px;
}
.spinner {
  width: 52px; height: 52px; border-radius: 50%;
  border: 4px solid var(--border);
  border-top-color: var(--blue);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-status { font-weight: 700; color: var(--text); font-size: 1rem; }
.loading-bar-wrap {
  width: 260px; height: 8px; background: var(--border);
  border-radius: 4px; overflow: hidden;
}
.loading-bar {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  animation: loadingPulse 2s ease-in-out infinite;
}
@keyframes loadingPulse {
  0%   { width: 15%; }
  50%  { width: 80%; }
  100% { width: 15%; }
}

/* Story display */
.story-header {
  text-align: center; margin-bottom: 24px; padding-bottom: 20px;
  border-bottom: 2px solid var(--border);
}
.story-main-title {
  font-family: 'Fredoka One', cursive; font-size: 1.8rem;
  color: var(--text); margin-bottom: 8px;
}
.story-meta-badges { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.meta-badge {
  padding: 4px 12px; border-radius: 20px;
  font-size: .8rem; font-weight: 700;
}
.badge-age    { background: rgba(74,144,217,.12); color: var(--blue); }
.badge-type   { background: rgba(92,184,92,.12); color: var(--green); }
.badge-style  { background: rgba(155,89,182,.12); color: var(--purple); }

/* Book pages */
.book-page {
  background: var(--card); border-radius: var(--r);
  padding: 28px; box-shadow: var(--shadow); margin-bottom: 16px;
  border-top: 4px solid var(--blue);
}
.book-page.cover-page {
  background: linear-gradient(135deg, #4A90D9, #9B59B6);
  color: #fff; text-align: center; padding: 40px 28px;
}
.book-page.cover-page .page-num { color: rgba(255,255,255,.7); }
.cover-title { font-family: 'Fredoka One', cursive; font-size: 1.6rem; margin: 16px 0 12px; }
.page-num { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
.page-text { font-size: 1rem; line-height: 1.75; color: var(--text); }
.cover-page .page-text { color: rgba(255,255,255,.9); }
.page-image { width: 100%; border-radius: var(--rs); margin-bottom: 16px; }
.image-placeholder {
  width: 100%; aspect-ratio: 16/9; border-radius: var(--rs);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px; margin-bottom: 16px;
  position: relative; overflow: hidden;
}
.image-placeholder .lock-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 6px; color: #fff; text-align: center;
  padding: 16px;
}
.lock-overlay .lock-icon { font-size: 2rem; }
.lock-overlay p { font-weight: 700; font-size: .85rem; }
.lock-overlay button { margin-top: 4px; }

/* Pages navigation */
.pages-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 20px 0; }
.pages-nav button {
  padding: 8px 20px; border-radius: 50px; border: 2px solid var(--border);
  background: var(--card); font-weight: 700; font-size: .875rem;
  cursor: pointer; transition: var(--tr);
}
.pages-nav button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.pages-nav button:disabled { opacity: .4; cursor: not-allowed; }
.page-counter { font-weight: 700; color: var(--muted); font-size: .9rem; }

/* Toolbar */
.story-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin: 20px 0 12px; flex-wrap: wrap; gap: 10px;
}
.star-rating { display: flex; gap: 4px; }
.star-rating .star {
  font-size: 1.4rem; cursor: pointer; transition: var(--tr);
  color: #ddd; line-height: 1;
}
.star-rating .star:hover, .star-rating .star.active { color: var(--yellow); }
.export-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   GALLERY
   ============================================================ */
.gallery-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.filter-btn {
  padding: 8px 18px; border-radius: 20px; border: 2px solid var(--border);
  background: var(--card); font-weight: 700; font-size: .875rem;
  cursor: pointer; transition: var(--tr); color: var(--muted);
}
.filter-btn:hover { border-color: var(--blue); color: var(--blue); }
.filter-btn.active { border-color: var(--blue); background: var(--blue); color: #fff; }
.gallery-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.story-card {
  background: var(--card); border-radius: var(--r);
  box-shadow: var(--shadow); overflow: hidden; transition: var(--tr);
}
.story-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.story-cover {
  height: 140px; display: flex; align-items: flex-end;
  padding: 16px; position: relative;
}
.story-cover-title {
  font-family: 'Fredoka One', cursive; font-size: 1rem;
  color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.3); line-height: 1.2;
}
.story-card-body { padding: 16px; }
.story-card-meta { display: flex; gap: 6px; margin-bottom: 8px; }
.age-badge, .date-badge {
  font-size: .72rem; font-weight: 700; padding: 3px 10px;
  border-radius: 20px;
}
.age-badge  { background: rgba(74,144,217,.12); color: var(--blue); }
.date-badge { background: var(--bg); color: var(--muted); }
.story-card-name { font-weight: 700; font-size: .875rem; margin-bottom: 4px; }
.story-card-interests { font-size: .78rem; color: var(--muted); margin-bottom: 12px; }
.story-card-actions { display: flex; gap: 8px; }
.gallery-empty {
  grid-column: 1/-1; text-align: center; padding: 60px 20px; color: var(--muted);
}
.gallery-empty p { font-size: 1.1rem; margin-bottom: 20px; line-height: 1.6; }
.login-prompt-box {
  background: var(--card); border-radius: var(--r); padding: 60px;
  text-align: center; box-shadow: var(--shadow);
}
.login-prompt-box h3 { font-family: 'Fredoka One', cursive; font-size: 1.5rem; margin-bottom: 8px; }
.login-prompt-box p { color: var(--muted); margin-bottom: 20px; }

/* ============================================================
   ACCOUNT
   ============================================================ */
.account-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; }
.profile-card {
  background: var(--card); border-radius: var(--r); padding: 28px;
  box-shadow: var(--shadow); text-align: center; height: fit-content;
}
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fredoka One', cursive; font-size: 1.8rem; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--purple));
}
.profile-name { font-weight: 800; font-size: 1.1rem; }
.profile-email { color: var(--muted); font-size: .875rem; margin-bottom: 12px; }
.plan-display-badge {
  display: inline-block; padding: 6px 18px; border-radius: 20px;
  font-weight: 800; font-size: .875rem; color: #fff; margin-bottom: 16px;
}
.usage-card {
  background: var(--card); border-radius: var(--r); padding: 24px;
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.usage-card h4 { font-weight: 800; margin-bottom: 12px; }
.usage-bar-wrap {
  background: var(--bg); border-radius: 4px; height: 10px;
  overflow: hidden; margin: 8px 0;
}
.usage-bar-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }
.usage-text { font-size: .875rem; color: var(--muted); }
.upgrade-cta-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.manage-sub-card {
  background: var(--card); border-radius: var(--r); padding: 24px;
  box-shadow: var(--shadow);
}
.settings-card { background: var(--card); border-radius: var(--r); padding: 24px; box-shadow: var(--shadow); margin-top: 20px; }
.settings-card h4 { font-weight: 800; margin-bottom: 16px; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--bg);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { font-weight: 600; font-size: .9rem; }
.toggle-switch { position: relative; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: #ccc;
  border-radius: 12px; cursor: pointer; transition: var(--tr);
}
.toggle-slider::before {
  content: ''; position: absolute; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background: #fff;
  border-radius: 50%; transition: var(--tr);
}
.toggle-switch input:checked + .toggle-slider { background: var(--green); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ============================================================
   HELP
   ============================================================ */
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.tutorial-steps { display: flex; flex-direction: column; gap: 20px; margin-bottom: 32px; }
.tutorial-step { display: flex; gap: 16px; align-items: flex-start; }
.tutorial-step-num {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; flex-shrink: 0;
}
.tutorial-step-text h4 { font-weight: 800; margin-bottom: 4px; }
.tutorial-step-text p { color: var(--muted); font-size: .9rem; }
.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.faq-question {
  width: 100%; padding: 16px 20px; background: none; border: none;
  text-align: left; font-weight: 700; font-size: .95rem;
  cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  color: var(--text); transition: var(--tr);
}
.faq-question:hover { color: var(--blue); }
.faq-question.active { color: var(--blue); }
.faq-arrow { transition: var(--tr); font-size: .75rem; }
.faq-question.active .faq-arrow { transform: rotate(180deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.faq-answer-inner { padding: 0 20px 16px; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.contact-form { background: var(--card); border-radius: var(--r); padding: 28px; box-shadow: var(--shadow); }
.contact-form h3 { font-family: 'Fredoka One', cursive; font-size: 1.3rem; margin-bottom: 20px; }

/* ============================================================
   LEGAL
   ============================================================ */
.legal-content { max-width: 760px; }
.legal-content h2 { font-family: 'Fredoka One', cursive; font-size: 1.6rem; margin-bottom: 8px; }
.legal-content h3 { font-weight: 800; margin: 20px 0 8px; }
.legal-content p { color: var(--muted); margin-bottom: 12px; line-height: 1.7; }
.legal-content ul { padding-left: 20px; color: var(--muted); margin-bottom: 12px; }
.legal-content ul li { margin-bottom: 4px; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: #1a1a2e; color: rgba(255,255,255,.7);
  padding: 40px 0 24px; margin-top: 60px;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 32px; }
.footer-brand { font-family: 'Fredoka One', cursive; font-size: 1.3rem; color: #fff; margin-bottom: 8px; }
.footer-tagline { font-size: .875rem; opacity: .6; }
.footer-col h4 { color: #fff; font-weight: 800; margin-bottom: 12px; font-size: .9rem; }
.footer-col a { display: block; color: rgba(255,255,255,.6); font-size: .875rem; margin-bottom: 8px; transition: var(--tr); }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 20px; text-align: center; font-size: .8rem; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp .4s ease; }

/* ============================================================
   MOBILE BOTTOM NAVIGATION
   ============================================================ */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: rgba(255,249,240,.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  grid-template-columns: repeat(4, 1fr);
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; padding: 6px 4px;
  cursor: pointer; transition: var(--tr);
  color: var(--muted);
}
.bottom-nav-item.active { color: var(--blue); }
.bottom-nav-item.active .bottom-nav-icon { transform: scale(1.15); }
.bottom-nav-icon { font-size: 1.35rem; line-height: 1; transition: var(--tr); }
.bottom-nav-label { font-size: .62rem; font-weight: 700; }

/* ============================================================
   LANGUAGE SWITCHER
   ============================================================ */
.lang-switcher {
  position: relative;
  flex-shrink: 0;
}
.lang-switcher-btn {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 20px; padding: 5px 12px;
  font-size: .82rem; font-weight: 700; cursor: pointer;
  color: var(--text); transition: var(--tr);
  white-space: nowrap;
}
.lang-switcher-btn:hover { border-color: var(--blue); color: var(--blue); }
.lang-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-hover);
  overflow: hidden; min-width: 150px; z-index: 500;
  animation: fadeInUp .15s ease;
}
.lang-dropdown button {
  display: block; width: 100%; padding: 10px 16px;
  background: none; border: none; text-align: left;
  font-size: .9rem; font-weight: 600; cursor: pointer;
  color: var(--text); transition: var(--tr);
}
.lang-dropdown button:hover { background: var(--bg); color: var(--blue); }

/* Small lang switcher (inside header-user) */
.lang-switcher-sm .lang-switcher-btn {
  padding: 4px 8px; font-size: .8rem; border-radius: 8px;
  min-width: unset;
}
.lang-switcher-sm .lang-dropdown {
  min-width: 80px;
}
.lang-switcher-sm .lang-dropdown button {
  padding: 7px 12px; font-size: .82rem;
}

/* Mobile language row in mobile menu */
.mobile-lang-row {
  display: flex; gap: 8px; padding: 8px 16px; flex-wrap: wrap;
}
.mobile-lang-btn {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 6px 10px; font-size: 1.2rem;
  cursor: pointer; transition: var(--tr);
}
.mobile-lang-btn:hover { border-color: var(--blue); transform: scale(1.1); }

/* Mobile login icon in header */
.header-login-icon {
  display: none;
  background: none; border: none;
  font-size: 1.4rem; cursor: pointer; padding: 4px;
  color: var(--text);
}

/* ============================================================
   RESPONSIVE — Tablet (≤ 900px)
   ============================================================ */
@media (max-width: 900px) {
  .generator-layout { padding: 16px 12px 80px; }
  .generator-left { max-width: 100%; }
  .features-grid, .steps-grid, .pricing-grid, .testimonials-grid {
    grid-template-columns: 1fr 1fr;
  }
  .pricing-card.highlighted { transform: scale(1); }
  .gallery-grid { grid-template-columns: 1fr 1fr; }
  .account-grid { grid-template-columns: 1fr; }
  .help-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .upgrade-plans { grid-template-columns: 1fr; }
}

/* ============================================================
   RESPONSIVE — Mobile (≤ 640px)
   ============================================================ */
@media (max-width: 640px) {
  /* Body */
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

  /* Header: hide desktop nav & auth, show login icon + lang switcher */
  .nav { display: none; }
  .header-auth { display: none; }
  .header-user { display: none; }
  .hamburger { display: none; }
  .header-login-icon { display: block; margin-left: auto; }
  /* Lang switcher sichtbar auf Mobile */
  .lang-switcher-sm { display: flex; }
  .lang-switcher-sm .lang-switcher-btn { font-size: 1.1rem; padding: 6px 8px; }
  /* Dropdown nach links öffnen damit er nicht aus dem Bildschirm geht */
  .lang-switcher-sm .lang-dropdown { right: 0; left: auto; }

  /* Bottom nav */
  .bottom-nav { display: grid; }

  /* Sections */
  .section { padding: 80px 0 32px; }
  #generator { padding-top: 64px !important; padding-bottom: 0 !important; }
  #home { padding-top: 0; }

  /* Hero */
  .hero { padding: 80px 0 40px; }
  .hero h1 { font-size: 1.7rem; }
  .hero p { font-size: 1rem; }
  .hero-btns { flex-direction: column; align-items: center; gap: 10px; }
  .hero-btns .btn { width: 100%; max-width: 300px; justify-content: center; }

  /* Feature / steps / testimonials → 1 col (pricing + hp-testi via horizontal scroll in hp_new.css) */
  .features-grid, .steps-grid, .testimonials-grid,
  .gallery-grid, .upgrade-cta-cards { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .upgrade-plans { grid-template-columns: 1fr; }

  /* Generator form */
  .generator-left { padding: 0; }
  .step-indicator-wrap { margin-bottom: 16px; }
  .step-label { font-size: .58rem; }
  .step-circle { width: 30px; height: 30px; font-size: .75rem; }
  .step-item:not(:last-child)::after { top: 15px; left: calc(50% + 17px); width: calc(100% - 34px); }
  .content-cards { grid-template-columns: 1fr 1fr; }
  .style-cards { grid-template-columns: 1fr 1fr; }
  .image-model-cards { grid-template-columns: 1fr; }
  .character-builder-grid { grid-template-columns: 1fr; }
  .model-test-grid { grid-template-columns: 1fr; }
  .length-btns { gap: 6px; }
  .length-btn { padding: 10px 4px; font-size: .78rem; }
  .lang-btns { flex-wrap: wrap; gap: 6px; }
  .lang-btn { flex: none; width: calc(50% - 3px); }

  /* Story preview */
  .story-main-title { font-size: 1.4rem; }
  .pages-nav { gap: 8px; }
  .pages-nav button { padding: 6px 14px; font-size: .8rem; }
  .export-row { justify-content: center; flex-wrap: wrap; }
  .story-toolbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .book-page { padding: 20px 16px; }

  /* Gallery */
  .gallery-filters { gap: 6px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .filter-btn { padding: 6px 14px; font-size: .8rem; white-space: nowrap; flex-shrink: 0; }

  /* Account */
  .upgrade-cta-cards { grid-template-columns: 1fr; }
  .login-prompt-box { padding: 32px 16px; }

  /* Modals – slide up from bottom */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box {
    padding: 24px 16px 32px;
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
  }
  .modal-box.modal-wide {
    max-height: 88vh;
    overflow-y: auto;
  }
  .upgrade-plans { grid-template-columns: 1fr; gap: 10px; }

  /* Toast: above bottom nav */
  #toastContainer {
    bottom: calc(72px + env(safe-area-inset-bottom));
    right: 12px; left: 12px;
    align-items: center;
  }
  .toast { max-width: 100%; width: 100%; }

  /* Footer: hidden on mobile (bottom nav replaces it) */
  .footer { display: none; }
}

/* Mobile sticky generate CTA (shown only on mobile when on step 4) */
.mobile-generate-cta {
  display: none;
}
@media (max-width: 640px) {
  .mobile-generate-cta {
    display: block;
    position: sticky; bottom: calc(64px + env(safe-area-inset-bottom));
    z-index: 50;
    padding: 10px 14px;
    background: rgba(255,249,240,.97);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(0,0,0,.08);
  }
  .mobile-generate-cta .btn-generate {
    margin-top: 0;
  }
}

/* ============================================================
   RTL SUPPORT (Arabic)
   ============================================================ */
body.rtl {
  direction: rtl;
  text-align: right;
}
body.rtl .nav { margin-left: 0; margin-right: auto; }
body.rtl .header-auth,
body.rtl .header-user { margin-left: 0; }
body.rtl .lang-switcher { order: -1; }
body.rtl .lang-dropdown { right: auto; left: 0; }
body.rtl .lang-dropdown button { text-align: right; }
body.rtl .step-item:not(:last-child)::after {
  left: auto;
  right: calc(50% + 20px);
}
body.rtl .step-nav { flex-direction: row-reverse; }
body.rtl .modal-close { right: auto; left: 16px; }
body.rtl .title-suggest-btn { right: auto; left: 10px; }
body.rtl #titleSuggestions { left: 0; right: 0; }
body.rtl .pro-badge-abs { right: auto; left: 8px; }
body.rtl .footer-grid { direction: rtl; }
body.rtl .plan-features li::before { margin-right: 0; margin-left: 4px; }
body.rtl .faq-question { flex-direction: row-reverse; }
body.rtl .testimonial-card::before { left: auto; right: 20px; }
body.rtl .bottom-nav { direction: rtl; }
body.rtl .header-inner { flex-direction: row-reverse; }
body.rtl .mobile-menu a,
body.rtl .mobile-menu button { text-align: right; }
@media (max-width: 640px) {
  body.rtl .header-login-icon { margin-left: 0; margin-right: auto; }
}

/* ============================================================
   RESPONSIVE — Small phones (≤ 390px)
   ============================================================ */
@media (max-width: 390px) {
  .hero h1 { font-size: 1.45rem; }
  .container { padding: 0 12px; }
  .content-cards { grid-template-columns: 1fr; }
  .btn-generate { font-size: .95rem; padding: 14px 16px; }
  .section-title { font-size: 1.6rem; }
}

/* ============================================================
   BOOK READER
   ============================================================ */

/* Overlay */
.book-reader {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  background: #1a0f08;
  overflow: hidden;
}
.book-reader.hidden { display: none; }

/* Header */
.br-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
  gap: 12px;
  flex-shrink: 0;
  z-index: 10;
}
.br-header-right {
  display: flex; align-items: center; gap: 12px;
}
.br-debug-panel {
  display: flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
  padding: 3px 8px 3px 10px;
}
.br-debug-label {
  font-size: .72rem; color: rgba(255,255,255,.6); white-space: nowrap;
}
.br-debug-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.6);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: .72rem;
  cursor: pointer;
  transition: all .2s;
  font-family: 'Nunito', sans-serif;
}
.br-debug-btn.active {
  background: rgba(255,255,255,.2);
  color: #fff;
  border-color: rgba(255,255,255,.5);
  font-weight: 700;
}
.br-close {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: .85rem;
  font-family: 'Nunito', sans-serif;
  white-space: nowrap;
  transition: background .2s;
}
.br-close:hover { background: rgba(255,255,255,.22); }
.br-title {
  flex: 1;
  text-align: center;
  color: #f5e6cc;
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Fredoka One', sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.br-progress-text {
  color: rgba(255,255,255,.6);
  font-size: .8rem;
  white-space: nowrap;
}

/* Progress bar */
.br-progress-bar {
  height: 3px;
  background: rgba(255,255,255,.1);
  flex-shrink: 0;
}
.br-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #F5A623, #FF6B6B);
  transition: width .4s ease;
}

/* Main body */
.br-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 16px 0;
  min-height: 0;
}

/* Navigation arrows */
.br-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.8);
  width: 48px;
  height: 80px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all .2s;
  font-family: inherit;
}
.br-nav:hover:not(:disabled) {
  background: rgba(255,255,255,.18);
  color: #fff;
  transform: translateY(-50%) scale(1.05);
}
.br-nav:disabled { opacity: .15; cursor: default; }
.br-nav-left  { left: 10px; }
.br-nav-right { right: 10px; }

/* Page wrapper */
.br-page-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  position: relative;
  overflow: hidden;
  max-width: 600px;
  width: 100%;
  margin: 0 64px;
}

/* THE BOOK PAGE */
.br-page {
  border-radius: 4px 12px 12px 4px;
  box-shadow:
    -4px 0 8px rgba(0,0,0,.3),
    0 0 0 1px rgba(0,0,0,.15),
    8px 8px 30px rgba(0,0,0,.5),
    inset -3px 0 12px rgba(0,0,0,.06);
  width: 100%;
  max-width: 520px;
  height: 100%;
  max-height: calc(100vh - 160px);
  overflow: hidden;
  position: absolute;
  background: #1a1a2e;
}

/* Full-bleed image background layer */
.br-full-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 4px 12px 12px 4px;
}
.br-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.br-bg-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.br-img-placeholder-icon { font-size: 4rem; opacity: .5; }

/* Cover overlay — title info at bottom */
.br-cover-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 28px 28px 32px;
  text-align: center;
  background: linear-gradient(to top, rgba(20,10,5,.85) 60%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.br-cover-label {
  font-size: .75rem;
  color: #ffd580;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
}
.br-cover-child {
  font-size: 1.1rem;
  color: #ffe8a0;
  font-weight: 700;
}
.br-cover-title {
  font-family: 'Fredoka One', sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  color: #fff;
  line-height: 1.2;
  margin: 6px 0;
  text-shadow: 0 2px 12px rgba(0,0,0,.6);
}
.br-cover-subtitle {
  font-size: .9rem;
  color: rgba(255,255,255,.8);
  line-height: 1.6;
  font-style: italic;
  max-width: 340px;
}
.br-cover-badge {
  margin-top: 10px;
  background: linear-gradient(135deg, #F5A623, #FF6B6B);
  color: #fff;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .05em;
}

.br-text {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  line-height: 1.9;
  color: #2C1810;
  font-weight: 500;
  text-align: justify;
  hyphens: auto;
}
.br-page-num {
  text-align: center;
  color: #b8a070;
  font-size: .8rem;
  letter-spacing: .1em;
  margin-top: 12px;
}

/* Page animations */
.br-page.br-enter-right {
  transform: translateX(60px) scale(.97);
  opacity: 0;
}
.br-page.br-enter-left {
  transform: translateX(-60px) scale(.97);
  opacity: 0;
}
.br-page.br-enter-none {
  opacity: 0;
}
.br-page.br-active {
  transform: translateX(0) scale(1);
  opacity: 1;
  transition: transform .35s cubic-bezier(.25,.46,.45,.94), opacity .3s ease;
}
.br-page.br-exit-left {
  transform: translateX(-60px) scale(.97);
  opacity: 0;
  transition: transform .15s ease, opacity .15s ease;
  pointer-events: none;
}
.br-page.br-exit-right {
  transform: translateX(60px) scale(.97);
  opacity: 0;
  transition: transform .15s ease, opacity .15s ease;
  pointer-events: none;
}

/* Dots */
.br-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  flex-shrink: 0;
  flex-wrap: wrap;
  max-height: 60px;
  overflow: hidden;
}
.br-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all .2s;
  flex-shrink: 0;
}
.br-dot.active {
  background: #F5A623;
  transform: scale(1.4);
}
.br-dot:hover:not(.active) { background: rgba(255,255,255,.5); }

/* Dot bar (for many pages) */
.br-dot-bar {
  width: 200px;
  height: 4px;
  background: rgba(255,255,255,.15);
  border-radius: 4px;
  overflow: hidden;
}
.br-dot-fill {
  height: 100%;
  background: #F5A623;
  border-radius: 4px;
  transition: width .35s ease;
}

/* Mobile */
@media (max-width: 600px) {
  .br-nav { width: 36px; height: 60px; font-size: 1.5rem; }
  .br-nav-left  { left: 4px; }
  .br-nav-right { right: 4px; }
  .br-page-wrap { margin: 0 46px; }
  .br-page-inner { padding: 18px 20px 28px; }
  .br-text { font-size: 1rem; line-height: 1.8; }
  .br-cover-title { font-size: 1.4rem; }
  .br-header { padding: 8px 12px; }
  .br-title { font-size: .85rem; }
}

/* Image buttons in reader */
.br-gen-btn {
  margin-top: 12px;
  background: linear-gradient(135deg, #4A90D9, #9B59B6);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 24px;
  font-size: .9rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 4px 14px rgba(74,144,217,.4);
}
.br-gen-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(74,144,217,.5); }
.br-gen-btn:disabled { opacity: .6; cursor: default; transform: none; }

/* Cover regen button — above the overlay, always accessible */
.br-cover-regen {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: .9rem;
  cursor: pointer;
  z-index: 10;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.5;
  transition: opacity .2s;
}
.br-cover-regen:hover { opacity: 1; }

/* Font sizes for text */
.br-text.br-text-sm { font-size: .85rem; }
.br-text.br-text-md { font-size: 1.05rem; }
.br-text.br-text-lg { font-size: 1.25rem; }
.br-text.br-text-xl { font-size: 1.5rem; }
.br-classic-text.br-text-sm .br-text,
.br-compact-text .br-text.br-text-sm { font-size: .85rem; }
.br-classic-text.br-text-lg .br-text,
.br-compact-text .br-text.br-text-lg { font-size: 1.25rem; }
.br-classic-text.br-text-xl .br-text,
.br-compact-text .br-text.br-text-xl { font-size: 1.5rem; }

/* Regen button — always slightly visible, full on hover/touch */
.br-regen-btn {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(0,0,0,.5);
  color: #fff;
  border: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: .85rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.35;
  transition: opacity .2s;
  z-index: 2;
}
.br-full-bg:hover .br-regen-btn,
.br-regen-btn:focus { opacity: 1; }

/* Controls bar — position & swap buttons */
.br-page-controls {
  position: absolute;
  top: 10px; left: 10px;
  display: flex; gap: 6px;
  z-index: 3;
}
.br-pos-btn, .br-swap-btn {
  background: rgba(0,0,0,.5);
  color: #fff;
  border: none;
  height: 30px;
  border-radius: 15px;
  font-size: .75rem;
  padding: 0 10px;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity .2s;
  white-space: nowrap;
}
.br-page:hover .br-pos-btn,
.br-page:hover .br-swap-btn,
.br-pos-btn:focus,
.br-swap-btn:focus { opacity: 1; }

/* Text overlay positions */
.br-text-overlay {
  position: absolute;
  left: 0; right: 0;
  background: rgba(253, 246, 232, 0.93);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(180,140,80,.25);
  padding: 20px 28px 28px;
  max-height: 42%;
  overflow-y: auto;
  transition: transform .3s ease, opacity .3s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.15) transparent;
  z-index: 2;
}
.br-text-overlay::-webkit-scrollbar { width: 3px; }
.br-text-overlay::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 3px; }
.br-text-bottom { bottom: 0; border-top: 1px solid rgba(180,140,80,.25); border-bottom: none; }
.br-text-top    { top: 0; bottom: auto; border-bottom: 1px solid rgba(180,140,80,.25); border-top: none; }
.br-text-hidden { opacity: 0; pointer-events: none; transform: translateY(20px); }

/* Draggable fullpage overlay */
.br-text-overlay.br-draggable {
  left: 50%;
  top: 78%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  max-width: 85%;
  width: max-content;
  max-height: 50%;
  border: none;
  border-radius: 14px;
  padding: 10px 20px 18px;
  box-shadow: 0 6px 28px rgba(0,0,0,.55);
  cursor: grab;
  touch-action: none;
  user-select: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.7);
  transition: none; /* no transition while dragging */
}
.br-drag-handle {
  text-align: center;
  font-size: 20px;
  color: rgba(255,255,255,0.45);
  margin-bottom: 4px;
  line-height: 1;
  letter-spacing: 2px;
  cursor: grab;
}
.br-text-overlay.br-draggable .br-text { color: #fff; }
.br-text-overlay.br-draggable .br-page-num { color: rgba(255,255,255,0.6); }

/* ── Classic layout: image left | text right ──────────────── */
.br-classic {
  display: flex;
  width: 100%; height: 100%;
  background: #fdf6e8;
}
.br-classic-img {
  width: 45%; height: 100%;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border-right: 2px solid rgba(180,140,80,.2);
}
.br-classic-img .br-bg-img {
  width: 100%; height: 100%; object-fit: cover;
}
.br-classic-img .br-bg-placeholder {
  width: 100%; height: 100%;
}
.br-classic-img .br-regen-btn { opacity: 0.4; }
.br-classic-img:hover .br-regen-btn { opacity: 1; }
.br-classic-text {
  flex: 1;
  padding: 28px 24px 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fdf6e8;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 31px, rgba(180,140,80,.06) 31px, rgba(180,140,80,.06) 32px);
}

/* ── Compact layout: small image top | large text below ───── */
.br-compact {
  display: flex;
  flex-direction: column;
  width: 100%; height: 100%;
  background: #fdf6e8;
  overflow: hidden;
}
.br-compact-img {
  height: 38%;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid rgba(180,140,80,.2);
}
.br-compact-img .br-bg-img {
  width: 100%; height: 100%; object-fit: cover;
}
.br-compact-img .br-bg-placeholder {
  width: 100%; height: 100%;
}
.br-compact-img .br-regen-btn { opacity: 0.4; }
.br-compact-img:hover .br-regen-btn { opacity: 1; }
.br-compact-text {
  flex: 1;
  padding: 24px 32px 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 31px, rgba(180,140,80,.06) 31px, rgba(180,140,80,.06) 32px);
}

/* Layout toggle buttons */
.br-layout-panel {
  display: flex;
  gap: 3px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
  padding: 3px;
}
.br-layout-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.5);
  width: 28px; height: 24px;
  border-radius: 12px;
  font-size: .9rem;
  cursor: pointer;
  transition: all .2s;
  display: flex; align-items: center; justify-content: center;
}
.br-layout-btn.active {
  background: rgba(255,255,255,.2);
  color: #fff;
}

.br-gen-hint {
  margin-top: 8px;
  font-size: .8rem;
  color: rgba(0,0,0,.4);
}

.br-cover-subtitle {
  font-size: .85rem;
  color: #8B6914;
  font-style: italic;
  margin-top: 4px;
  opacity: .8;
}

/* Gallery card with cover image */
.story-cover-img {
  position: relative;
  overflow: hidden;
  padding: 0;
}
.story-cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.story-card:hover .story-cover-image {
  transform: scale(1.04);
}
.story-cover-title-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 28px 14px 12px;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, transparent 100%);
  color: #fff;
  font-family: 'Fredoka One', sans-serif;
  font-size: 1rem;
  line-height: 1.2;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}

/* ── Image generation loading state ─────────────────────── */
.br-img-generating {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

/* Shimmer sweep */
.br-gen-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255,255,255,.35) 50%,
    transparent 60%
  );
  background-size: 200% 100%;
  animation: brShimmer 1.6s infinite ease-in-out;
}
@keyframes brShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Loading content */
.br-gen-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 1;
}

/* Spinner ring */
.br-gen-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(0,0,0,.08);
  border-top-color: #F5A623;
  border-radius: 50%;
  animation: brSpin .9s linear infinite;
}
@keyframes brSpin {
  to { transform: rotate(360deg); }
}

.br-gen-label {
  font-size: .95rem;
  font-weight: 700;
  color: rgba(0,0,0,.6);
}
.br-gen-sublabel {
  font-size: .78rem;
  color: rgba(0,0,0,.35);
}

/* Animated dots after label */
.br-gen-dots::after {
  content: '';
  animation: brDots 1.5s steps(4, end) infinite;
}
@keyframes brDots {
  0%  { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* Image reveal on load */
@keyframes brReveal {
  from { opacity: 0; filter: blur(12px); transform: scale(1.04); }
  to   { opacity: 1; filter: blur(0);    transform: scale(1); }
}
.br-img-reveal {
  animation: brReveal .6s ease forwards;
}

/* Dot pulse when page is generating */
.br-dot.generating {
  background: #F5A623;
  animation: brDotPulse 1s ease-in-out infinite;
}
@keyframes brDotPulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(1.6); opacity: .6; }
}

/* ═══════════════════════════════════════════════════════
   COMMUNITY / ENTDECKEN PAGE
═══════════════════════════════════════════════════════ */

/* Banner */
.cm-banner {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  padding: 2rem 0;
  margin-bottom: 0;
}
.cm-banner-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.cm-title { font-size: 1.8rem; font-weight: 800; color: #fff; margin: 0 0 .25rem; }
.cm-sub   { color: rgba(255,255,255,.85); font-size: .95rem; margin: 0; }
.cm-banner .btn-primary {
  background: rgba(255,255,255,.2); border: 2px solid rgba(255,255,255,.5);
  color: #fff; backdrop-filter: blur(4px); white-space: nowrap;
}
.cm-banner .btn-primary:hover { background: rgba(255,255,255,.3); }

/* Filter Row */
.cm-filter-wrap { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.cm-filter-label { font-size: .8rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.cm-filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.cm-filter-btn {
  padding: .35rem .9rem; border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);          /* ← dunkel, immer lesbar */
  font-size: .82rem; font-weight: 600; cursor: pointer; transition: all .2s;
}
.cm-filter-btn:hover  { border-color: #6366f1; color: #6366f1; }
.cm-filter-btn.active {
  background: #6366f1; color: #fff !important;   /* ← weiße Schrift auf lila */
  border-color: #6366f1;
}

/* Section Headers */
.cm-section-header { display: flex; align-items: baseline; gap: .75rem; margin-bottom: .75rem; }
.cm-section-label  {
  font-size: .8rem; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-primary);
}
.cm-section-hint { font-size: .78rem; color: var(--text-secondary); }

/* ── FEATURED HERO ───────────────────────────────────── */
.cm-featured {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 240px 240px;
  gap: .75rem; margin-bottom: .5rem;
}
.cm-hero-card {
  position: relative; border-radius: 18px; overflow: hidden;
  cursor: pointer; background: var(--bg-card);
  transition: transform .25s, box-shadow .25s;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}
.cm-hero-card:hover { transform: scale(1.025); box-shadow: 0 16px 40px rgba(0,0,0,.2); }
.cm-hero-main { grid-row: span 2; }
.cm-hero-img  { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-hero-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 4rem; background: linear-gradient(135deg,#f3e8ff,#dbeafe);
}
.cm-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.8) 0%, rgba(0,0,0,.1) 55%, transparent 100%);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 1rem; color: #fff;
}
.cm-style-tag {
  display: inline-block; background: rgba(255,255,255,.25); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px; padding: .15rem .65rem; font-size: .68rem;
  font-weight: 700; letter-spacing: .04em; margin-bottom: .4rem; color: #fff;
  text-transform: uppercase; align-self: flex-start;
}
.cm-style-tag-card {
  position: absolute; top: .6rem; left: .6rem;
  background: rgba(0,0,0,.55); color: #fff;
}
.cm-hero-title  { font-size: 1rem; font-weight: 800; line-height: 1.3; margin-bottom: .5rem; }
.cm-hero-footer { display: flex; justify-content: space-between; align-items: center; }
.cm-creator     { font-size: .75rem; opacity: .85; }

/* ── LIKE BUTTON ─────────────────────────────────────── */
.cm-like-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  background: rgba(255,255,255,.15); backdrop-filter: blur(6px);
  border: 1.5px solid rgba(255,255,255,.35); border-radius: 999px;
  padding: .3rem .7rem; cursor: pointer; color: #fff;
  font-size: .85rem; font-weight: 700;
  transition: transform .15s, background .2s, border-color .2s;
  user-select: none;
}
.cm-like-btn:hover    { transform: scale(1.1); background: rgba(255,255,255,.25); }
.cm-like-btn.liked    { background: rgba(255,80,100,.35); border-color: rgba(255,100,120,.6); }
.cm-like-btn-sm {
  background: var(--bg-secondary); border-color: var(--border);
  color: var(--text-secondary); font-size: .8rem; padding: .25rem .6rem;
}
.cm-like-btn-sm:hover  { border-color: #f43f5e; color: #f43f5e; }
.cm-like-btn-sm.liked  { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }

/* ── CARD GRID ───────────────────────────────────────── */
.cm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}
.cm-card {
  border-radius: 16px; overflow: hidden; background: var(--bg-card);
  border: 1px solid var(--border);
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.cm-card:hover { transform: translateY(-5px); box-shadow: 0 12px 28px rgba(0,0,0,.13); }
.cm-card-img-wrap { position: relative; overflow: hidden; }
.cm-card-img   { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; transition: transform .3s; }
.cm-card:hover .cm-card-img { transform: scale(1.04); }
.cm-card-placeholder { aspect-ratio:1; display:flex; align-items:center; justify-content:center; font-size:2.5rem; background: linear-gradient(135deg,#f3e8ff,#dbeafe); }
.cm-card-body   { padding: .8rem; }
.cm-card-title  { font-size: .9rem; font-weight: 700; color: var(--text-primary); margin-bottom: .25rem; line-height: 1.35; cursor: pointer; }
.cm-card-title:hover { color: #6366f1; }
.cm-card-creator{ font-size: .73rem; color: var(--text-secondary); margin-bottom: .5rem; }
.cm-card-footer { display: flex; justify-content: flex-end; }

/* Empty state */
.cm-empty { grid-column: 1/-1; text-align: center; padding: 3rem 1rem; color: var(--text-secondary); font-size: 1rem; }

/* ── BOTTOM CONTROLS ─────────────────────────────────── */
.cm-bottom  { display: flex; justify-content: center; padding: 2rem 0; }
.cm-spinner { display: flex; justify-content: center; }

/* ── GALLERY SHARE BUTTON ───────────────────────────── */
.cm-share-btn { font-size: 1rem !important; padding: .3rem .65rem !important; min-width: 2.2rem; }
.cm-share-active { background: #d1fae5 !important; color: #065f46 !important; border-color: #6ee7b7 !important; }

/* ── MOBILE ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .cm-banner-inner { flex-direction: column; align-items: flex-start; }
  .cm-title { font-size: 1.4rem; }
  .cm-featured {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 170px 170px;
  }
  .cm-hero-main { grid-column: span 2; grid-row: span 1; }
  .cm-grid { grid-template-columns: repeat(2, 1fr); }
  .cm-filter-wrap { flex-direction: column; align-items: flex-start; }
}
