:root {
  /* === Sentry-inspired palette === */
  --bg-dark: #1f1633;          /* primary background */
  --bg-darker: #150f23;        /* deeper sections / footer */
  --bg-panel: #2a1f47;         /* panel surface */
  --bg-elevated: #362d59;      /* border-purple, also used as raised surface */

  --accent: #79628c;           /* muted purple — primary CTA */
  --accent-hover: #6a5fc1;     /* sentry purple — links/hover */
  --accent-bright: #c2ef4e;    /* lime — special highlights, max 1× per section */
  --accent-coral: #ffb287;     /* coral focus */
  --accent-pink: #fa7faa;      /* pink decorative */
  --accent-deep: #422082;      /* deep violet — selects/active */

  --text-main: #ffffff;
  --text-muted: #cfcfdb;
  --text-dim: #9b94b3;
  --text-code: #dcdcaa;

  --border-color: #362d59;
  --border-strong: #584674;
  --border-light: #cfcfdb;

  /* legacy aliases retained for cascade compatibility */
  --accent-primary: var(--accent);
  --text-primary: var(--text-main);

  /* Glass / overlays */
  --glass-white: rgba(255, 255, 255, 0.18);
  --glass-dark: rgba(54, 22, 107, 0.14);

  /* Shadows */
  --shadow-inset-btn: rgba(0, 0, 0, 0.10) 0px 1px 3px 0px inset;
  --shadow-glass: rgba(0, 0, 0, 0.08) 0px 2px 8px;
  --shadow-card: rgba(0, 0, 0, 0.10) 0px 10px 15px -3px;
  --shadow-prominent: rgba(0, 0, 0, 0.18) 0px 0.5rem 1.5rem;
  --shadow-ambient: rgba(22, 15, 36, 0.9) 0px 4px 4px 9px;

  /* Spacing */
  --gap: 16px;
  --radius: 12px;
  --radius-btn: 13px;
  --radius-input: 6px;
  --radius-pill: 18px;

  /* Typography */
  --ff-display: "Dammit Sans", "Archivo Black", "Bricolage Grotesque", "Rubik", sans-serif;
  --ff-ui: "Rubik", -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  --ff-mono: Monaco, Menlo, "Ubuntu Mono", monospace;

  /* Modern Easing (2026) */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Durations */
  --duration-fast: 200ms;
  --duration-normal: 300ms;
  --duration-transition: 400ms;
}

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

body {
  font-family: var(--ff-ui);
  background: var(--bg-dark);
  color: var(--text-main);
  overflow-x: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

code, kbd, pre, samp { font-family: var(--ff-mono); }

/* === App Container === */
.app-container {
  position: relative;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* === Top Bar === */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 50px;
  background: rgba(31, 22, 51, 0.85);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--ff-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.2px;
}

.logo i {
  color: var(--accent-bright);
  font-size: 1.5rem;
}

.btn-clear-cache {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--glass-white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-smooth), box-shadow var(--duration-fast) var(--ease-smooth);
  box-shadow: var(--shadow-glass);
}

.btn-clear-cache:hover {
  background: var(--glass-dark);
  box-shadow: var(--shadow-prominent);
}

.btn-clear-cache:active {
  transform: translateY(0);
}

.btn-clear-cache i {
  font-size: 1rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* === Buttons (Sentry-style) === */
.btn-primary {
  padding: 12px 20px;
  background: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  color: #fff;
  font-family: var(--ff-ui);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-inset-btn);
  transition: box-shadow var(--duration-fast) var(--ease-smooth), background var(--duration-fast) var(--ease-smooth);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-prominent);
}

.btn-primary.btn-large {
  padding: 16px 36px;
  font-size: 0.94rem;
}

.btn-secondary {
  padding: 10px 16px;
  background: var(--glass-white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-main);
  font-family: var(--ff-ui);
  font-weight: 500;
  font-size: 0.88rem;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  transition: background var(--duration-fast) var(--ease-smooth), box-shadow var(--duration-fast) var(--ease-smooth);
}

.btn-secondary:hover {
  background: var(--glass-dark);
  box-shadow: var(--shadow-prominent);
}

.nav-btn {
  width: 56px;
  height: 56px;
  background: var(--glass-white);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text-main);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  transition: background var(--duration-fast) var(--ease-smooth), color var(--duration-fast) var(--ease-smooth), box-shadow var(--duration-fast) var(--ease-smooth);
}

.nav-btn:hover {
  background: var(--glass-dark);
  color: var(--accent-bright);
  box-shadow: var(--shadow-prominent);
}

/* === BROWSE MODE === */
.browse-mode {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 24px 20px 24px;
  padding-top: 50px;
  overflow: hidden;
  z-index: 1;
}

/* Hero Title */
.hero-title {
  text-align: center;
  padding: 20px 20px 24px;
}

.hero-title h1 {
  font-family: var(--ff-display);
  font-size: clamp(2.5rem, 5vw, 3.75rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-main);
  margin-bottom: 8px;
}

.hero-title p {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.5;
}

.browse-header {
  text-align: center;
  margin-bottom: 32px;
}

.browse-header h2 {
  font-size: 2rem;
  margin-bottom: 16px;
}

.template-filter {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.filter-btn {
  padding: 5px 14px;
  background: var(--glass-white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-family: var(--ff-ui);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--shadow-glass);
  transition: background var(--duration-fast) var(--ease-smooth), color var(--duration-fast) var(--ease-smooth);
}

.filter-btn:hover {
  background: var(--glass-dark);
  color: var(--text-main);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--border-strong);
  color: #fff;
  box-shadow: var(--shadow-inset-btn);
}

/* === Carousel === */
.carousel-container {
  width: 100%;
  max-width: 1600px;
  height: 700px;
  position: relative;
  perspective: 1000px;
  margin-bottom: 24px;
}

.carousel-track {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  position: relative;
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.template-card {
  position: absolute;
  width: 360px;
  height: 640px;
  background: var(--bg-panel);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transition: all var(--duration-normal) var(--ease-smooth);
  cursor: pointer;
}

/* Center card */
.template-card[data-position="center"] {
  transform: scale(1) translateX(0);
  opacity: 1;
  filter: blur(0);
  z-index: 10;
}

/* Side 1 - Left */
.template-card[data-position="left"] {
  transform: scale(0.85) translateX(-420px);
  opacity: 0.5;
  filter: blur(1px);
  z-index: 8;
}

.template-card[data-position="left"]:hover {
  opacity: 0.7;
  filter: blur(0);
}

/* Side 1 - Right */
.template-card[data-position="right"] {
  transform: scale(0.85) translateX(420px);
  opacity: 0.5;
  filter: blur(1px);
  z-index: 8;
}

.template-card[data-position="right"]:hover {
  opacity: 0.7;
  filter: blur(0);
}

/* Side 2 - Far Left */
.template-card[data-position="far-left"] {
  transform: scale(0.7) translateX(-800px);
  opacity: 0.3;
  filter: blur(2px);
  z-index: 5;
}

/* Side 2 - Far Right */
.template-card[data-position="far-right"] {
  transform: scale(0.7) translateX(800px);
  opacity: 0.3;
  filter: blur(2px);
  z-index: 5;
}

/* Hidden cards */
.template-card[data-position="hidden"] {
  transform: scale(0.5);
  opacity: 0;
  filter: blur(10px);
  z-index: 1;
  pointer-events: none;
}

/* Exit positions for infinite scroll (no transition jump points) */
.template-card[data-position="exit-left"] {
  transform: scale(0.6) translateX(-1200px);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}

.template-card[data-position="exit-right"] {
  transform: scale(0.6) translateX(1200px);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}

.template-preview {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  pointer-events: none;
}

.template-info {
  display: none;
}

/* Browse Navigation */
.browse-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.btn-clear-cache-corner {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  padding: 0;
}

.btn-clear-cache-corner:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
}

/* === EDIT MODE === */
.edit-mode {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  overflow: hidden;
  z-index: 2;
}

.edit-container {
  display: grid;
  grid-template-columns: 340px 1fr 340px;
  width: 100%;
  height: 100%;
  gap: 30px;
  padding: 20px;
  background: var(--bg-darker);
  max-width: 1500px;
  margin: 0 auto;
}

/* Side Panels */
.edit-panel {
  background: var(--bg-dark);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
}

.left-panel {
  animation: slideInFromLeft 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.15s forwards;
}

.right-panel {
  animation: slideInFromRight 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.15s forwards;
}

@keyframes slideInFromLeft {
  0% {
    opacity: 0;
    transform: translateX(-80px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInFromRight {
  0% {
    opacity: 0;
    transform: translateX(80px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Custom scrollbar for panels */
.panel-scroll::-webkit-scrollbar {
  width: 6px;
}

.panel-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

.panel-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.panel-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Center Preview */
.edit-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  animation: fadeInCenter 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  opacity: 0;
  position: relative;
  z-index: 100;
}

@keyframes fadeInCenter {
  0% {
    opacity: 0;
    transform: scale(1.2);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.preview-container {
  width: 360px;
  height: 640px;
  background: #000;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.edit-preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Preview container wrapper (for theme switcher positioning) */
.preview-container-wrap {
  position: relative;
}

/* Theme Switcher (desktop) */
.theme-switcher {
  position: absolute;
  right: -40px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.theme-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all 0.2s;
  position: relative;
}

.theme-circle[data-theme="default"] {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.theme-circle[data-theme="alt1"] {
  background: linear-gradient(135deg, #14B8A6, #0EA5E9);
}

.theme-circle[data-theme="alt2"] {
  background: linear-gradient(135deg, #F59E0B, #EF4444);
}

.theme-circle[data-theme="alt3"] {
  background: linear-gradient(135deg, #8B5CF6, #EC4899);
}

.theme-circle:hover {
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.15);
}

.theme-circle.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

/* Buttons in Center */
.btn-back,
.btn-download {
  padding: 12px 32px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s;
}

.btn-back {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-back:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.btn-download {
  background: var(--accent);
  color: white;
}

.btn-download:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(244, 63, 94, 0.4);
}

/* Settings Sections - keep existing styles but update for new layout */
.settings-section {
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--border-color);
}

.section-title i {
  color: var(--accent);
  font-size: 1rem;
}

.section-title.collapsible {
  cursor: pointer;
  user-select: none;
}

.section-title.collapsible:hover {
  background: rgba(255, 255, 255, 0.08);
}

.toggle-icon {
  margin-left: auto;
  transition: transform 0.3s;
  font-size: 0.85rem;
}

.settings-section.expanded .toggle-icon {
  transform: rotate(180deg);
}

.section-content {
  padding: 14px;
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.settings-section.collapsed .section-content {
  max-height: 0;
  opacity: 0;
  padding: 0 14px;
}

/* Form Elements */
.field-group {
  margin-bottom: 14px;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field-group input[type="text"],
.field-group select {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 0.9rem;
  transition: all 0.3s;
  height: 42px;
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.field-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.field-group input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Mortgage Tabs */
.mortgage-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 3px;
}

.mortgage-tab {
  flex: 1;
  padding: 7px 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.mortgage-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.mortgage-tab.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* Image Upload */
.image-upload {
  text-align: center;
}

.btn-upload {
  width: 100%;
  padding: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s;
  font-size: 0.9rem;
}

.btn-upload:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

/* Image Tools */
.image-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.btn-tool {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  font-size: 0.85rem;
}

.btn-tool:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.btn-tool:active {
  transform: translateY(0);
}

/* Snake animation for premium buttons */
@property --snake-angle {
  syntax: '<angle>';
  initial-value: 180deg;
  inherits: false;
}

@keyframes snakeRotate {
  to { --snake-angle: 540deg; }
}

.btn-tool-premium {
  --red: #FF6565;
  --pink: #FF64F9;
  --purple: #6B5FFF;
  --blue: #4D8AFF;
  --green: #5BFF89;
  --yellow: #FFEE55;
  --orange: #FF6D1B;

  position: relative;
  padding: 12px 20px;
  border-radius: 14px;
  background: #0a0a0a;
  cursor: pointer;
  color: var(--text-main) !important;
  font-weight: 600;
  font-size: 0.85rem;
  transition: transform 0.3s ease;
  z-index: 1;
  /* Solid inner background to cover any gradient bleed */
  box-shadow: inset 0 0 0 100px #0a0a0a;
}

/* Animated snake border */
.btn-tool-premium::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 17px;
  background: conic-gradient(
    from var(--snake-angle) at 50% 50%,
    transparent 0deg,
    transparent 30deg,
    var(--red) 60deg,
    var(--orange) 90deg,
    var(--yellow) 120deg,
    var(--green) 150deg,
    var(--blue) 180deg,
    var(--purple) 210deg,
    var(--pink) 240deg,
    transparent 270deg,
    transparent 360deg
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 3px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Glow effect underneath */
.btn-tool-premium::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 15%;
  width: 70%;
  height: 16px;
  background: linear-gradient(90deg, var(--orange), var(--yellow), var(--green), var(--blue), var(--purple), var(--pink), var(--red));
  background-size: 200% 100%;
  filter: blur(12px);
  opacity: 0;
  z-index: -2;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.btn-tool-premium:hover {
  transform: translateY(-2px) scale(1.02);
  color: #ffffff !important;
  border-color: transparent !important;
}

/* On hover - snake comes alive */
.btn-tool-premium:hover::before {
  opacity: 1;
  animation: snakeRotate 2s linear infinite;
}

.btn-tool-premium:hover::after {
  opacity: 0.8;
  filter: blur(18px);
  bottom: -12px;
  height: 24px;
}

.btn-tool-premium:active {
  transform: translateY(0) scale(1);
  color: #ffffff !important;
}

.premium-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #FFEE55, #FF6D1B);
  color: #1a1a1a;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 10px rgba(255, 109, 27, 0.5);
  z-index: 10;
}

/* Tools Groups */
.tools-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.tools-group.ai-tools {
  margin-top: 20px;
  padding-top: 16px;
  padding-bottom: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  gap: 20px;
}

.ai-info-block {
  margin-top: 4px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-info-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ai-info-remaining {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
}

.ai-info-remaining span {
  color: #4ade80;
  font-weight: 700;
}

.ai-remaining-warning {
  color: #fbbf24 !important;
}

.ai-remaining-critical {
  color: #f43f5e !important;
}

/* Locked AI buttons for non-logged users */
.ai-locked {
  opacity: 0.5;
  cursor: not-allowed !important;
  position: relative;
}

.ai-locked::after {
  content: '🔒';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
}

.group-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.group-label i {
  color: var(--accent);
}

/* Large premium buttons for AI tools */
.btn-tool-large {
  padding: 16px 24px;
  font-size: 1rem;
  font-weight: 600;
  min-height: 54px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-tool-large i {
  font-size: 1.2rem;
}

.image-preview {
  position: relative;
  margin-top: 12px;
  border-radius: 8px;
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  height: auto;
  display: block;
}

.btn-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  font-size: 0.75rem;
}

.btn-remove:hover {
  background: var(--accent);
  transform: scale(1.1);
}

/* CTA Chips */
.cta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.cta-chip {
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s;
}

.cta-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
  color: var(--text-main);
}

.cta-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ============================================
   SIMPLE CROSSFADE TRANSITIONS
   ============================================ */

/* Browse mode fades out */
.browse-mode.leaving {
  opacity: 0;
  transition: opacity var(--duration-transition) var(--ease-smooth);
  pointer-events: none;
}

/* Edit mode fades in */
.edit-mode.entering {
  opacity: 1;
  transition: opacity var(--duration-transition) var(--ease-smooth);
}

/* Edit mode fades out */
.edit-mode.leaving {
  opacity: 0;
  transition: opacity var(--duration-transition) var(--ease-smooth);
  pointer-events: none;
}

/* Browse mode fades in */
.browse-mode.entering {
  opacity: 1;
  transition: opacity var(--duration-transition) var(--ease-smooth);
}

/* === Crop Modal === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-content {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 25px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

/* === CTA and Badge Tabs === */
.cta-tabs, .cta-tab, .badge-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 4px;
  overflow: hidden;
}

.cta-tab, .badge-tab {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cta-tab, .badge-tab:hover:not(.active):not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.cta-tab.active, .badge-tab.active {
  background: var(--accent);
  color: white;
}

.cta-tab:disabled, .badge-tab:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.cta-content, .badge-content {
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Simple Badge UI (Grandma-friendly) === */
.badge-simple {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.badge-simple.active {
  border-color: var(--accent);
  background: rgba(244, 63, 94, 0.05);
}

.badge-simple-header {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Apply style button - hidden by default */
.btn-apply-style {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-apply-style:hover {
  background: var(--accent);
  color: #fff;
}

/* Show button only when multiple badges are active */
.badges-multi-active .badge-simple.active .btn-apply-style {
  display: flex;
}

/* Checkbox with label */
.badge-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.badge-checkbox input {
  display: none;
}

.badge-checkbox .checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.badge-checkbox .checkmark::after {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0;
  transform: scale(0);
  transition: all 0.2s;
}

.badge-checkbox input:checked + .checkmark {
  border-color: var(--accent);
}

.badge-checkbox input:checked + .checkmark::after {
  opacity: 1;
  transform: scale(1);
}

.badge-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

/* Badge body - shown when active */
.badge-simple-body {
  display: none;
  padding: 12px;
  flex-direction: column;
  gap: 12px;
}

.badge-simple.active .badge-simple-body {
  display: flex;
}

/* Text input */
.badge-text-input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 14px;
}

.badge-text-input:focus {
  outline: none;
  border-color: var(--accent);
}

.badge-text-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* Controls row */
.badge-controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.control-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.control-group input[type="color"] {
  width: 36px;
  height: 28px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
}

.control-group input[type="color"]:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

/* Size buttons */
.size-buttons {
  display: flex;
  gap: 4px;
}

.size-buttons .sz {
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.size-buttons .sz:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
}

.size-buttons .sz.active {
  background: var(--accent);
  color: #fff;
}

/* Compact toggle */
.badge-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}

.badge-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.badge-toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  transition: all 0.25s ease;
}

.badge-toggle-track::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transition: all 0.25s ease;
}

.badge-toggle input:checked + .badge-toggle-track {
  background: var(--accent);
}

.badge-toggle input:checked + .badge-toggle-track::before {
  transform: translateX(16px);
  background: #fff;
}

/* Inline color pickers */
.badge-colors-inline {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.badge-colors-inline input[type="color"] {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  transition: all 0.2s ease;
}

.badge-colors-inline input[type="color"]:hover {
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.badge-colors-inline input[type="color"]:first-child {
  border-radius: 6px 2px 2px 6px;
}

.badge-colors-inline input[type="color"]:last-child {
  border-radius: 2px 6px 6px 2px;
}

/* Badge text input - Large version */
.badge-text-large {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 14px;
  transition: all 0.2s ease;
}

.badge-text-large:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.1);
}

.badge-text-large::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* Size pills */
.badge-sizes-inline {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 2px;
}

.size-pill {
  width: 26px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.size-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.size-pill.active {
  background: var(--accent);
  color: #fff;
}

/* Apply to all row */
.badge-apply-all {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-top: 4px;
  background: rgba(244, 63, 94, 0.05);
  border: 1px dashed rgba(244, 63, 94, 0.2);
  border-radius: 10px;
}

.apply-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.btn-apply-colors {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 6px 14px;
  background: rgba(244, 63, 94, 0.15);
  border: none;
  border-radius: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-apply-colors:hover {
  background: var(--accent);
  color: #fff;
}

.btn-apply-colors i {
  font-size: 11px;
}

/* Mini Toggle Switch */
.toggle-switch-mini {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-switch-mini input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider-mini {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  transition: all 0.2s;
}

.toggle-slider-mini::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  bottom: 2px;
  background: white;
  border-radius: 50%;
  transition: all 0.2s;
}

.toggle-switch-mini input:checked + .toggle-slider-mini {
  background: var(--accent);
}

.toggle-switch-mini input:checked + .toggle-slider-mini::before {
  transform: translateX(14px);
}

/* Compact Badge Input */
.badge-input-compact {
  flex: 1;
  min-width: 80px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 13px;
}

.badge-input-compact:focus {
  outline: none;
  border-color: var(--accent);
}

.badge-input-compact::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* Size Buttons */
.badge-size-btns {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 2px;
  flex-shrink: 0;
}

.size-btn {
  width: 26px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.size-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.size-btn.active {
  background: var(--accent);
  color: white;
}

/* Mini Color Picker */
.color-mini {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  flex-shrink: 0;
}

.color-mini::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.color-mini::-webkit-color-swatch {
  border-radius: 3px;
  border: none;
}

/* Color picker for global settings */
.color-picker-mini {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.color-picker-mini span {
  font-size: 12px;
  color: var(--text-muted);
}

.color-picker-mini input[type="color"] {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
}

.color-picker-mini input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.color-picker-mini input[type="color"]::-webkit-color-swatch {
  border-radius: 4px;
  border: none;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  transition: all 0.3s ease;
}

.toggle-slider:before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* === Toast === */
.toast {
  animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}



/* === Select Field Styling === */
.field-group select:hover {
    border-color: var(--accent);
}

.field-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.1);
}

select option {
    padding: 10px;
    background: var(--bg-dark);
    color: var(--text-main);
}

/* === Carousel Responsive (smaller screens) === */
/* For 1080p screens with browser chrome (~950px viewport) */
@media (max-height: 1000px) {
  .carousel-container {
    height: 550px;
  }
  .template-card {
    width: 280px;
    height: 500px;
  }
  .template-card[data-position="left"] {
    transform: scale(0.85) translateX(-330px);
  }
  .template-card[data-position="right"] {
    transform: scale(0.85) translateX(330px);
  }
  .template-card[data-position="far-left"] {
    transform: scale(0.7) translateX(-620px);
  }
  .template-card[data-position="far-right"] {
    transform: scale(0.7) translateX(620px);
  }
  .template-card[data-position="exit-left"] {
    transform: scale(0.6) translateX(-950px);
  }
  .template-card[data-position="exit-right"] {
    transform: scale(0.6) translateX(950px);
  }
}

/* For smaller viewports */
@media (max-height: 850px) {
  .carousel-container {
    height: 450px;
  }
  .template-card {
    width: 230px;
    height: 410px;
  }
  .template-card[data-position="left"] {
    transform: scale(0.85) translateX(-270px);
  }
  .template-card[data-position="right"] {
    transform: scale(0.85) translateX(270px);
  }
  .template-card[data-position="far-left"] {
    transform: scale(0.7) translateX(-510px);
  }
  .template-card[data-position="far-right"] {
    transform: scale(0.7) translateX(510px);
  }
  .template-card[data-position="exit-left"] {
    transform: scale(0.6) translateX(-780px);
  }
  .template-card[data-position="exit-right"] {
    transform: scale(0.6) translateX(780px);
  }
}

/* === Auth Section === */
.browse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.auth-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-auth {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.btn-auth:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(var(--accent-primary-rgb), 0.4);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-size: 14px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 15px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-logout:hover {
  border-color: #ff4444;
  color: #ff4444;
}

/* === Limits Widget === */
.limits-widget {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin: 15px auto;
  max-width: fit-content;
}

.limits-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.limits-label {
  color: var(--text-muted);
  font-size: 13px;
}

.limits-value {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
}

.limits-value.warning {
  color: #ffa500;
}

.limits-value.critical {
  color: #ff4444;
}

.btn-upgrade-small {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #1a1a2e;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
}

.btn-upgrade-small:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

/* === Auth Modal === */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  padding: 20px;
}

.auth-modal-content {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 40px 32px 32px;
  max-width: 400px;
  width: calc(100% - 32px);
  position: relative;
  box-sizing: border-box;
  overflow-y: auto;
  max-height: 90vh;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.3s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.modal-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.auth-logo {
  text-align: center;
  margin-bottom: 16px;
}

.brand-logo {
  font-family: var(--ff-display);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.brand-logo .brand-accent {
  color: var(--accent-bright);
  font-weight: 700;
}

.brand-logo-sm {
  font-family: var(--ff-display);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-main);
}

.brand-logo-sm .brand-accent {
  color: var(--accent-bright);
  font-weight: 700;
}

.modal-title {
  text-align: center;
  margin-bottom: 6px;
  font-size: 1.5rem;
  color: var(--text-primary);
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 28px;
}

.auth-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.auth-tab:hover {
  background: rgba(255, 255, 255, 0.1);
}

.auth-tab.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: #f8fafc;
}

/* Auth Message (inline error/success) */
.auth-message {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: authMsgIn 0.3s ease;
}

.auth-message.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.auth-message.success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.auth-message i {
  font-size: 16px;
  flex-shrink: 0;
}

@keyframes authMsgIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
}

.auth-form .form-group + .form-group {
  margin-top: 12px;
}

.form-group label {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.label-optional {
  color: rgba(255, 255, 255, 0.25);
  font-weight: 400;
}

.form-group input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb, 99, 102, 241), 0.15);
}

.form-group input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.auth-forgot {
  text-align: left;
  margin-top: 10px;
  width: 100%;
}

.auth-forgot a {
  color: var(--text-muted);
  font-size: 12px;
  text-decoration: none;
  transition: color 0.2s;
}

.auth-forgot a:hover {
  color: var(--accent-primary);
}

.btn-full {
  width: 100%;
}

.auth-form .btn-primary.btn-full {
  margin: 20px auto 0;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  width: 50%;
  justify-content: center;
  text-align: center;
}

.auth-form .btn-primary.btn-full:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Telegram Login */
.telegram-login-section {
  margin-bottom: 10px;
}

.btn-telegram-login {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #0088cc, #00a8e8);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-telegram-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 136, 204, 0.4);
}

.btn-telegram-login:active {
  transform: translateY(0);
}

.btn-telegram-login i {
  font-size: 20px;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.auth-divider span {
  padding: 0 15px;
}

.auth-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 10px;
}

.auth-hint a {
  color: var(--accent-primary);
  text-decoration: none;
}

.auth-hint a:hover {
  text-decoration: underline;
}

/* === Limit Modal === */
.limit-modal-content {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 30px;
  max-width: 550px;
  width: 100%;
  position: relative;
  text-align: center;
}

.limit-modal-icon {
  font-size: 48px;
  color: #ffa500;
  margin-bottom: 20px;
}

.limit-modal-text {
  color: var(--text-muted);
  margin-bottom: 25px;
  font-size: 15px;
}

.btn-limit-profile {
  display: inline-block;
  padding: 10px 28px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: all 0.3s;
}

.btn-limit-profile:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.4);
}

.limit-modal-plans {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
}

.plan-card {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.plan-card.featured {
  border-color: var(--accent-primary);
  background: rgba(var(--accent-primary-rgb), 0.1);
}

.plan-card h3 {
  margin-bottom: 10px;
  color: var(--text-primary);
}

.plan-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 15px;
}

.plan-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
}

.plan-card li {
  color: var(--text-muted);
  font-size: 13px;
  padding: 5px 0;
  padding-left: 20px;
  position: relative;
}

.plan-card li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #4ade80;
}

.btn-large {
  padding: 15px 30px;
  font-size: 16px;
}

/* ============================================
   NEW TOP BAR & AUTH OVERRIDES
   ============================================ */

/* Browse mode: slim top bar */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 50px;
  background: rgba(15, 17, 23, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-sizing: border-box;
  z-index: 1000;
}

.top-bar-logo {
  font-family: var(--ff-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-main);
  flex-shrink: 0;
}

.top-bar-logo .brand-accent {
  color: var(--accent-bright);
  font-weight: 700;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Limits bar — inline */
.limits-bar {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Auth button */
.btn-auth {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--border-strong);
  padding: 10px 18px;
  border-radius: var(--radius-btn);
  font-family: var(--ff-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow: var(--shadow-inset-btn);
  transition: background var(--duration-fast) var(--ease-smooth), box-shadow var(--duration-fast) var(--ease-smooth);
}

.btn-auth:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-prominent);
}

.btn-auth-outline {
  background: var(--glass-white);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: var(--ff-ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  transition: background var(--duration-fast) var(--ease-smooth), box-shadow var(--duration-fast) var(--ease-smooth);
}

.btn-auth-outline:hover {
  background: var(--glass-dark);
  box-shadow: var(--shadow-prominent);
}

#authSection {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-auth-sm {
  padding: 7px 14px;
  font-size: 11px;
  border-radius: var(--radius-input);
}

/* Edit mode: user bar under preview */
.edit-user-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 12px 0 4px;
}

/* Edit mode: action buttons side by side at bottom */
.edit-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

/* Profile dropdown menu */
.profile-dropdown {
  position: relative;
}

.profile-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--bg-dark, #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow: hidden;
}

.profile-menu.open {
  display: block;
}

.profile-menu-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-menu-name {
  font-weight: 600;
  font-size: 14px;
  color: #f8fafc;
  margin-bottom: 2px;
}

.profile-menu-email {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 8px;
}

.profile-menu-tier {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}

.profile-menu-tier strong {
  color: #f8fafc;
}

.profile-menu-limits {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-menu-limits-title {
  font-size: 11px;
  color: #52525b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.profile-menu-limits-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
  font-size: 13px;
}

.profile-menu-limits-label {
  color: #71717a;
}

.profile-menu-limits-value {
  color: #f8fafc;
  font-weight: 700;
}

.profile-menu-upgrade {
  display: block;
  margin-top: 8px;
  padding: 6px 0;
  text-align: center;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  text-decoration: none;
  transition: filter 0.2s;
}

.profile-menu-upgrade:hover {
  filter: brightness(1.15);
}

.profile-menu-actions {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-menu-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted, #94a3b8);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  width: 100%;
  text-align: left;
}

.profile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
}

.profile-menu-btn i {
  width: 16px;
  text-align: center;
}

.profile-menu-logout:hover {
  color: #ff4444;
}

/* === Favorite Heart Buttons === */
.btn-favorite,
.btn-favorite-edit {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  line-height: 0;
}

.btn-favorite svg,
.btn-favorite-edit svg {
  width: 28px;
  height: 28px;
  stroke: #EF4444;
  stroke-width: 2;
  fill: none;
  transition: fill 0.2s, transform 0.2s;
}

.btn-favorite.active svg,
.btn-favorite-edit.active svg {
  fill: #EF4444;
}

.btn-favorite:active svg,
.btn-favorite-edit:active svg {
  transform: scale(1.2);
}

/* Edit mode heart — left of preview */
.btn-favorite-edit {
  position: absolute;
  left: -40px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}
