/* ============================================================
   КОД ВСЕГО AI — Telegram Mini App v2
   Brand: Teal #2D9CBF + Warm Sand #C8935A
   Themes: Dark / Light
   ============================================================ */

/* ── DESIGN TOKENS ───────────────────────────────────────── */
:root {
  /* === BRAND COLORS (from logo) === */
  --teal:        #1E8FE3;
  --teal-bright: #38A5FF;
  --teal-soft:   #6FB5FF;
  --teal-muted:  rgba(30, 143, 227, 0.12);
  --teal-border: rgba(30, 143, 227, 0.22);

  --warm:        #C8935A;
  --warm-bright: #D4A16A;
  --warm-muted:  rgba(200,147,90,0.15);
  --warm-border: rgba(200,147,90,0.28);

  --success: #3DAA7A;
  --danger:  #D95E5E;

  /* === RADIUS === */
  --r-sm:   8px;
  --r-md:   14px;
  --r-lg:   20px;
  --r-xl:   28px;
  --r-full: 9999px;

  /* === TRANSITION === */
  --t: 0.2s cubic-bezier(0.4,0,0.2,1);
  --t-fast: 0.12s ease;

  /* === LAYOUT === */
  --nav-h: 70px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ── DARK THEME (default) ────────────────────────────────── */
[data-theme="dark"] {
  --primary:   var(--teal-bright);
  --accent:    var(--warm-bright);

  --bg:        #080F1E;
  --bg-2:      #0C172E;
  --surface:   #111F3C;
  --surface-2: #16294D;
  --surface-3: #1C335E;

  --border:    rgba(255,255,255,0.07);
  --border-p:  var(--teal-border);

  --text:      #F8FAFC;
  --text-2:    #A9BCCD;
  --text-3:    #6C859B;

  --card-bg:   #111F3C;
  --nav-bg:    #0C172E;
  --input-bg:  #0C172E;
}

/* ── LIGHT THEME ─────────────────────────────────────────── */
[data-theme="light"] {
  --primary:   var(--teal);
  --accent:    var(--warm);

  --bg:        #F0F4F8;
  --bg-2:      #E2E8F0;
  --surface:   #FFFFFF;
  --surface-2: #F5F7FA;
  --surface-3: #EAF0F6;

  --border:    rgba(0,0,0,0.07);
  --border-p:  rgba(30, 143, 227, 0.18);

  --text:      #111E2A;
  --text-2:    #4B6584;
  --text-3:    #8395A7;

  --card-bg:   #FFFFFF;
  --nav-bg:    rgba(255,255,255,0.92);
  --input-bg:  #F5F7FA;
}

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

html, body {
  height: 100%; width: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 16px;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  transition: background var(--t), color var(--t);
}

.maintenance-banner {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 12px;
  right: 12px;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: rgba(17, 31, 60, 0.96);
  border: 1px solid rgba(255, 193, 7, 0.32);
  box-shadow: 0 14px 36px rgba(0,0,0,0.35);
  backdrop-filter: blur(14px);
}

[data-theme="light"] .maintenance-banner {
  background: rgba(255,255,255,0.96);
  box-shadow: 0 14px 36px rgba(30, 41, 59, 0.15);
}

.maintenance-banner-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: rgba(255, 193, 7, 0.13);
  color: #ffc107;
}

.maintenance-banner-copy {
  min-width: 0;
}

.maintenance-banner-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}

.maintenance-banner-text {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

/* ── SCREENS ─────────────────────────────────────────────── */
.screen {
  position: fixed; inset: 0; bottom: var(--nav-h);
  background: var(--bg);
  overflow-y: auto; overflow-x: hidden;
  opacity: 0; pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.4,0,0.2,1), background var(--t);
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen.active { opacity: 1; pointer-events: auto; transform: translateY(0); }
.screen-full { bottom: 0; }

/* ── HEADER ──────────────────────────────────────────────── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 10px;
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: background var(--t);
}
[data-theme="light"] .header { border-bottom-color: var(--border); }

.header-brand { display: flex; align-items: center; gap: 10px; }
.brand-name {
  font-size: 15px; font-weight: 700; line-height: 1.2;
}
.brand-name span { color: var(--primary); }
.brand-sub { font-size: 10px; color: var(--text-3); letter-spacing: 0.04em; }

.header-right { display: flex; align-items: center; gap: 8px; }

/* Theme toggle */
.theme-toggle {
  width: 38px; height: 38px; border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast);
}
.theme-toggle:active { transform: scale(0.88); }
.theme-icon-dark, .theme-icon-light { display: flex; }
[data-theme="dark"]  .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark  { display: none; }

/* Balance pill */
.header-balance-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--teal-border);
  background: var(--teal-muted);
  color: var(--primary);
  font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: all var(--t-fast);
}
.header-balance-pill:active { transform: scale(0.94); }

.header-back { gap: 6px; }
.btn-back {
  width: 38px; height: 38px; border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast), transform var(--t-fast);
  flex-shrink: 0;
}
.btn-back:active { transform: scale(0.9); }
.header-title { font-size: 16px; font-weight: 700; flex: 1; text-align: center; }

.cost-tag {
  padding: 4px 10px;
  background: var(--teal-muted);
  border: 1px solid var(--teal-border);
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 600; color: var(--primary);
}
.cost-warm {
  background: var(--warm-muted);
  border-color: var(--warm-border);
  color: var(--accent);
}
.free-badge {
  padding: 4px 10px;
  background: rgba(61,170,122,0.12);
  border: 1px solid rgba(61,170,122,0.25);
  border-radius: var(--r-full);
  font-size: 12px; font-weight: 600; color: #4DC899;
}

/* ── HOME HERO ───────────────────────────────────────────── */
.hero-section {
  padding: 20px 18px 0;
}
.hero-label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: var(--teal-muted);
  border: 1px solid var(--teal-border);
  border-radius: var(--r-full);
  font-size: 11px; font-weight: 600; color: var(--primary);
  margin-bottom: 12px;
}
.hero-label-dot {
  width: 6px; height: 6px; border-radius: var(--r-full);
  background: var(--primary);
  animation: dot-blink 2s ease-in-out infinite;
}
@keyframes dot-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
.hero-title {
  font-size: 28px; font-weight: 800; line-height: 1.2;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}
[data-theme="light"] .hero-title { color: #0C1820; }

/* Hero prompt card */
.hero-prompt-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  transition: background var(--t), border-color var(--t);
}
[data-theme="light"] .hero-prompt-card {
  box-shadow: 0 4px 24px rgba(45,156,191,0.08);
  border-color: rgba(45,156,191,0.15);
}
.hero-ref-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 0;
  gap: 8px;
}
.ref-img-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  border: 1px dashed var(--teal-border);
  background: transparent;
  color: var(--primary); font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
}
.ref-img-btn:hover { background: var(--teal-muted); }
.ref-img-btn:active { transform: scale(0.95); }
.inline-model-toggle { display: flex; gap: 5px; }
.model-pill {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px; font-weight: 600; color: var(--text-2);
  cursor: pointer;
  transition: all var(--t-fast);
}
.model-pill.active {
  border-color: var(--teal-border);
  background: var(--teal-muted);
  color: var(--primary);
}
.model-pill:active { transform: scale(0.93); }

.hero-textarea {
  width: 100%; padding: 12px 14px;
  background: transparent; border: none; outline: none;
  font-family: 'Inter', sans-serif; font-size: 15px; color: var(--text);
  resize: none; line-height: 1.6;
}
.hero-textarea::placeholder { color: var(--text-3); }

.quick-chips-row {
  display: flex; gap: 6px; padding: 4px 14px 12px;
  overflow-x: auto; scrollbar-width: none;
}
.quick-chips-row::-webkit-scrollbar { display: none; }
.quick-chip {
  padding: 5px 11px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px; font-weight: 500; color: var(--text-2);
  white-space: nowrap; cursor: pointer;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.quick-chip:active {
  background: var(--teal-muted);
  border-color: var(--teal-border);
  color: var(--primary);
}

.hero-cta-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.hero-char-hint { font-size: 11px; color: var(--text-3); }
.btn-generate-hero {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 20px;
  border-radius: var(--r-full);
  border: none;
  background: var(--primary);
  color: white; font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: transform var(--t-fast), filter var(--t-fast);
  box-shadow: 0 4px 16px rgba(45,156,191,0.35);
}
.btn-generate-hero:hover { filter: brightness(1.1); }
.btn-generate-hero:active { transform: scale(0.96); }

/* ── HOME SECONDARY ──────────────────────────────────────── */
.home-secondary { padding: 20px 18px 100px; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.section-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3);
}
.section-more {
  font-size: 12px; font-weight: 600; color: var(--primary);
  background: none; border: none; cursor: pointer;
  padding: 2px 0;
}

/* Gallery */
.gallery-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin-bottom: 0;
}
.gallery-card {
  cursor: pointer; text-align: center;
  transition: transform var(--t-fast);
}
.gallery-card:active { transform: scale(0.94); }
.gallery-img {
  width: 100%; aspect-ratio: 1;
  border-radius: var(--r-md);
  background-size: cover; background-position: center;
  margin-bottom: 5px;
}
.g-img-1 { background-image: url('images/history_sunset.png'); }
.g-img-2 { background-image: url('images/history_neon.png'); }
.g-img-3 { background-image: url('images/history_watercolor.png'); }
.gallery-card-add .gallery-img {
  background: var(--surface-2);
  border: 1.5px dashed var(--border);
}
.gallery-add-icon {
  width: 100%; aspect-ratio: 1;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1.5px dashed var(--teal-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); margin-bottom: 5px;
}
.gallery-caption {
  font-size: 10px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Tools */
.tools-compact { display: flex; flex-direction: column; gap: 4px; }
.tool-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px;
  border-radius: var(--r-md);
  background: var(--card-bg);
  border: 1px solid var(--border);
  cursor: pointer; text-align: left;
  transition: background var(--t-fast), transform var(--t-fast);
}
.tool-row:active { transform: scale(0.99); }
[data-theme="light"] .tool-row:hover { background: var(--surface-2); }
.tool-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tool-icon-warm   { background: var(--warm-muted); color: var(--accent); }
.tool-icon-neutral{ background: var(--surface-2); color: var(--text-2); }
.tool-info { flex: 1; }
.tool-name { font-size: 14px; font-weight: 600; color: var(--text); }
.tool-desc { font-size: 11px; color: var(--text-2); margin-top: 1px; }
.tool-cost {
  font-size: 12px; font-weight: 700; color: var(--text-3);
  padding: 4px 8px;
  background: var(--surface-2);
  border-radius: var(--r-full);
  flex-shrink: 0;
}
.tool-cost.free { color: #4DC899; background: rgba(61,170,122,0.1); }
.tool-arrow { color: var(--text-3); flex-shrink: 0; }

/* ── FORM COMMON ─────────────────────────────────────────── */
.form-wrap { padding: 12px 18px 0; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; }

/* Upload zone */
.upload-zone {
  border: 1.5px dashed var(--teal-border);
  border-radius: var(--r-lg);
  background: var(--teal-muted);
  cursor: pointer; min-height: 100px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t);
}
.upload-zone:active { transform: scale(0.99); }
[data-theme="light"] .upload-zone:hover { background: rgba(45,156,191,0.1); }
.upload-inner {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px; text-align: center;
}
.upload-icon {
  width: 44px; height: 44px; border-radius: var(--r-md);
  background: rgba(45,156,191,0.2);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.upload-text { font-size: 13px; font-weight: 600; color: var(--text-2); }
.upload-hint { font-size: 11px; color: var(--text-3); }
.upload-preview-inner {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px; position: relative;
}
.preview-thumb {
  width: 72px; height: 72px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.preview-clear {
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px; border-radius: var(--r-full);
  background: var(--danger); border: none; color: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform var(--t-fast);
}
.preview-clear:active { transform: scale(0.85); }

/* Textarea */
.textarea-block {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--t);
}
.textarea-block:focus-within { border-color: var(--teal-border); }
.field-textarea {
  width: 100%; padding: 13px 14px;
  background: transparent; border: none; outline: none;
  font-family: 'Inter', sans-serif; font-size: 14px; color: var(--text);
  resize: none; line-height: 1.6;
}
.field-textarea::placeholder { color: var(--text-3); }
.textarea-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 14px;
  border-top: 1px solid var(--border);
}
.char-ct { font-size: 11px; color: var(--text-3); }
.ideas-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px; border: none; border-radius: var(--r-full);
  background: var(--teal-muted); color: var(--primary);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background var(--t-fast);
}
.ideas-btn:hover { background: rgba(45,156,191,0.25); }

/* Model picker (image screen) */
.model-row { display: flex; gap: 8px; }
.model-card {
  flex: 1; display: flex; align-items: center; gap: 10px;
  padding: 13px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  cursor: pointer; text-align: left;
  transition: all var(--t-fast);
}
.model-card.active {
  border-color: var(--teal-border);
  background: var(--teal-muted);
}
.model-card:active { transform: scale(0.98); }
.mc-icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.mc-icon-teal { background: rgba(30, 143, 227, 0.18); color: var(--primary); }
.mc-icon-warm { background: var(--warm-muted); color: var(--accent); }
.mc-name { font-size: 13px; font-weight: 700; display: block; }
.mc-desc { font-size: 11px; color: var(--text-3); }
.mc-check { color: var(--primary); margin-left: auto; transition: opacity var(--t); }

/* Chips */
.chips-wrap { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 6px 13px; border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px; font-weight: 500; color: var(--text-2);
  cursor: pointer; transition: all var(--t-fast);
}
.chip:active {
  background: var(--teal-muted);
  border-color: var(--teal-border);
  color: var(--primary);
}
.chip-warm:active {
  background: var(--warm-muted);
  border-color: var(--warm-border);
  color: var(--accent);
}

/* Sticky CTA */
.sticky-cta {
  position: sticky; bottom: 0;
  padding: 12px 18px calc(14px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 85%, transparent);
  margin-top: 16px;
}
.cta-meta {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-3); margin-bottom: 10px;
}
.cta-meta strong { color: var(--text-2); }
.cta-cost { color: var(--text-3); }

/* Buttons */
.btn-primary {
  width: 100%; padding: 15px;
  border-radius: var(--r-md); border: none;
  background: var(--primary);
  color: white; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(45,156,191,0.35);
  transition: transform var(--t-fast), filter var(--t-fast);
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(0.98); }
.btn-warm {
  background: var(--accent);
  box-shadow: 0 4px 20px rgba(200,147,90,0.35);
}

/* ── MUSIC SCREEN ────────────────────────────────────────── */
.music-vis {
  height: 80px;
  background: var(--card-bg);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.music-glow {
  position: absolute;
  width: 120px; height: 120px;
  border-radius: var(--r-full);
  background: radial-gradient(circle, rgba(200,147,90,0.3), transparent 70%);
  filter: blur(20px);
  animation: glow-pulse 2.5s ease-in-out infinite;
}
@keyframes glow-pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50%       { transform: scale(1.4); opacity: 1; }
}
.music-bars {
  display: flex; align-items: center; gap: 5px;
  position: relative; z-index: 1; height: 40px;
}
.mbar {
  width: 4px; border-radius: 3px;
  background: linear-gradient(to top, var(--accent), rgba(200,147,90,0.4));
  animation: mbar-anim 1.1s ease-in-out infinite;
}
.mbar:nth-child(1) { height: 14px; animation-delay: 0s; }
.mbar:nth-child(2) { height: 26px; animation-delay: 0.12s; }
.mbar:nth-child(3) { height: 38px; animation-delay: 0.24s; }
.mbar:nth-child(4) { height: 20px; animation-delay: 0.36s; }
.mbar:nth-child(5) { height: 32px; animation-delay: 0.48s; }
.mbar:nth-child(6) { height: 18px; animation-delay: 0.60s; }
.mbar:nth-child(7) { height: 28px; animation-delay: 0.72s; }
.mbar:nth-child(8) { height: 12px; animation-delay: 0.84s; }
@keyframes mbar-anim {
  0%, 100% { transform: scaleY(0.5); opacity: 0.5; }
  50%       { transform: scaleY(1);   opacity: 1; }
}

.type-row { display: flex; gap: 8px; }
.type-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 12px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  font-size: 13px; font-weight: 600; color: var(--text-2);
  cursor: pointer; transition: all var(--t-fast);
}
.type-btn.active {
  background: var(--warm-muted);
  border-color: var(--warm-border);
  color: var(--accent);
}
.type-btn:active { transform: scale(0.97); }

/* ── QUEUE SCREEN ────────────────────────────────────────── */
.queue-wrap {
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 22px 40px; gap: 22px; min-height: 100%;
}
.gen-anim {
  position: relative; width: 110px; height: 110px;
}
.gen-ring {
  position: absolute; border-radius: var(--r-full);
  border: 1.5px solid transparent; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.r1 { border-color: rgba(45,156,191,0.35); animation: rspin 3.5s linear infinite; }
.r2 {
  width: 80%; height: 80%; margin: auto;
  border-top-color: rgba(200,147,90,0.5);
  border-right-color: transparent;
  border-bottom-color: rgba(200,147,90,0.5);
  border-left-color: transparent;
  animation: rspin 2s linear infinite reverse;
}
.r3 {
  width: 60%; height: 60%; margin: auto;
  border-color: rgba(45,156,191,0.2);
  animation: rspin 5s linear infinite;
}
@keyframes rspin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.gen-core-icon {
  position: absolute; inset: 0;
  width: 48px; height: 48px; margin: auto;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 28px rgba(45,156,191,0.4);
}
.q-title { font-size: 20px; font-weight: 800; text-align: center; }
.q-sub   { font-size: 13px; color: var(--text-3); }
.q-progress-wrap { width: 100%; }
.q-progress-track {
  width: 100%; height: 5px;
  background: var(--surface-2);
  border-radius: var(--r-full); overflow: hidden;
}
.q-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: var(--r-full);
  transition: width 0.6s ease;
  width: 0%;
}
.q-progress-labels {
  display: flex; justify-content: space-between;
  margin-top: 6px; font-size: 11px; color: var(--text-3);
}
.q-log { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.q-log-item {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-3);
}
.q-log-item.done   { color: var(--text-2); }
.q-log-item.active { color: var(--text); }
.q-dot {
  width: 20px; height: 20px; border-radius: var(--r-full);
  background: var(--surface-2);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.done-dot { background: rgba(61,170,122,0.2); color: #4DC899; }
.spin-dot { background: var(--teal-muted); color: var(--primary); animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.btn-cancel {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--r-full);
  border: 1px solid rgba(217,94,94,0.3);
  background: rgba(217,94,94,0.08);
  color: #D95E5E; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--t-fast);
}
.btn-cancel:active { transform: scale(0.96); }
.q-result { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.result-img-wrap {
  position: relative;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
}
.result-img-preview {
  width: 100%;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-done-badge {
  position: absolute; top: 10px; right: 10px;
  padding: 4px 10px;
  background: rgba(61,170,122,0.9);
  border-radius: var(--r-full);
  font-size: 11px; font-weight: 700; color: white;
}
.result-btns { display: flex; gap: 8px; width: 100%; }
.result-btn-prim, .result-btn-sec {
  flex: 1; padding: 12px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all var(--t-fast);
}
.result-btn-prim { background: var(--primary); border: none; color: white; }
.result-btn-sec  {
  background: var(--card-bg);
  border: 1px solid var(--border); color: var(--text-2);
}
.result-btn-prim:active, .result-btn-sec:active { transform: scale(0.97); }

/* ── BALANCE SCREEN ──────────────────────────────────────── */
.balance-hero-card {
  margin: 8px 18px 20px;
  border-radius: var(--r-xl);
  padding: 24px;
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0D2A3A 0%, #0E3347 60%, #1B4060 100%);
  box-shadow: 0 8px 32px rgba(45,156,191,0.2);
}
[data-theme="light"] .balance-hero-card {
  background: linear-gradient(135deg, #1B4D68, #2D7A9B, #3AAECF);
}
.bhc-orb {
  position: absolute; width: 160px; height: 160px;
  border-radius: var(--r-full);
  background: radial-gradient(circle, rgba(200,147,90,0.25), transparent);
  top: -50px; right: -40px;
  filter: blur(30px); pointer-events: none;
}
.bhc-label { font-size: 12px; opacity: 0.7; margin-bottom: 4px; }
.bhc-num   { font-size: 50px; font-weight: 800; line-height: 1.1; color: white; }
.bhc-sub   { font-size: 12px; opacity: 0.55; color: white; margin-top: 2px; }
.bhc-stats {
  display: flex; align-items: center;
  background: rgba(255,255,255,0.08);
  border-radius: var(--r-md);
  padding: 12px; margin-top: 16px; color: white;
}
.bhc-stat { flex: 1; text-align: center; }
.bhc-sv { font-size: 18px; font-weight: 700; }
.bhc-sk { font-size: 10px; opacity: 0.6; margin-top: 2px; }
.bhc-div { width: 1px; height: 32px; background: rgba(255,255,255,0.15); }

.amount-row {
  display: flex; gap: 8px; padding: 0 18px 16px;
  overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.amount-row::-webkit-scrollbar { display: none; }
.amt-btn {
  flex: 0 0 auto;
  scroll-snap-align: start;
  padding: 9px 18px; border-radius: var(--r-full);
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  font-size: 13px; font-weight: 600; color: var(--text-2);
  white-space: nowrap; cursor: pointer;
  transition: all var(--t-fast);
}
.amt-btn.active {
  border-color: var(--teal-border);
  background: var(--teal-muted);
  color: var(--primary);
}
.amt-btn:active { transform: scale(0.95); }
.tx-empty {
  margin: 0 0 14px;
  padding: 18px;
  border-radius: var(--r-md);
  background: var(--card-bg);
  border: 1px dashed var(--border);
  color: var(--text-3);
  text-align: center;
  font-size: 13px;
}

/* === PAYMENT UI ELEMENTS === */
.pay-init-hint {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}
.pay-status-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 100px;
}
.pay-status-pending {
  background: rgba(255, 193, 7, 0.13);
  color: #ffc107;
}
.pay-status-success {
  background: rgba(34, 197, 94, 0.13);
  color: #22c55e;
}
.pay-status-failed {
  background: rgba(239, 68, 68, 0.13);
  color: #ef4444;
}
.pay-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.pay-qr-real-wrap {
  display: block;
  background: #fff;
  padding: 10px;
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  transition: transform 0.2s;
}
.pay-qr-real-wrap:hover { transform: scale(1.03); }
.pay-qr-real-img {
  display: block;
  width: 170px;
  height: 170px;
  border-radius: 4px;
}

.pay-card {
  margin: 0 18px 20px;
  background: var(--card-bg);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.pay-card-row {
  display: flex; align-items: center; gap: 11px;
  padding: 14px; border-bottom: 1px solid var(--border);
}
.pay-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--teal-muted); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.pay-name { font-size: 13px; font-weight: 700; }
.pay-sub  { font-size: 11px; color: var(--text-3); }
.pay-qr   { padding: 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: center; }
.qr-grid  { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; width: 110px; }
.qc       { width: 100%; aspect-ratio: 1; border-radius: 2px; background: var(--surface-2); }
.qc.d     { background: var(--primary); }
.pay-details { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.pay-row  { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.pk { color: var(--text-3); }
.pv { font-weight: 600; }
.pv-code {
  font-family: monospace;
  background: var(--teal-muted);
  padding: 2px 7px; border-radius: 5px; color: var(--primary);
}
.pay-steps { padding: 14px; display: flex; flex-direction: column; gap: 11px; }
.pay-step  { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.sn {
  width: 20px; height: 20px; border-radius: var(--r-full);
  background: var(--teal-muted); color: var(--primary);
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}

/* === PDF UPLOAD STYLE === */
.pdf-upload-container {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
}
.pdf-upload-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1.5px dashed var(--teal-border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t);
}
.pdf-upload-box:hover {
  background: var(--teal-muted);
  border-color: var(--primary);
}
.pub-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--teal-muted);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--t);
}
.pdf-upload-box:hover .pub-icon {
  background: var(--primary);
  color: var(--bg);
}
.pub-text {
  flex: 1;
}
.pub-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.pub-desc {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
}
.pdf-selected-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-top: 8px;
  animation: fadeIn var(--t) forwards;
}
.psf-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
}
.psf-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.psf-remove {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t);
}
.psf-remove:hover {
  background: rgba(217, 94, 94, 0.15);
  color: var(--danger);
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.tx-list { display: flex; flex-direction: column; gap: 3px; padding: 0 18px 100px; }
.tx-item { display: flex; align-items: center; gap: 11px; padding: 12px; border-radius: var(--r-md); background: var(--card-bg); transition: background var(--t-fast); }
.tx-ic { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tx-plus-ic { background: rgba(61,170,122,0.15); color: #4DC899; }
.tx-minus-ic { background: var(--teal-muted); color: var(--primary); }
.tx-ref-ic  { background: var(--warm-muted); color: var(--accent); }
.tx-info { flex: 1; }
.tx-t { font-size: 13px; font-weight: 600; }
.tx-m { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.tx-v { font-size: 14px; font-weight: 700; }
.tx-v.plus  { color: #4DC899; }
.tx-v.minus { color: var(--primary); }

/* ── PROFILE SCREEN ──────────────────────────────────────── */
.profile-top {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 18px 20px; gap: 8px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.profile-ava-ring {
  width: 68px; height: 68px; border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  padding: 2.5px; display: flex; align-items: center; justify-content: center;
}
.profile-ava {
  width: 100%; height: 100%; border-radius: var(--r-full);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: var(--primary);
}
.profile-name { font-size: 17px; font-weight: 700; }
.profile-user { font-size: 13px; color: var(--text-3); margin-top: 1px; }
.profile-stats {
  display: flex; gap: 0;
  background: var(--surface-2);
  border-radius: var(--r-md); overflow: hidden;
  width: 100%; margin-top: 6px;
  border: 1px solid var(--border);
}
.ps-item { flex: 1; padding: 12px; text-align: center; }
.ps-item + .ps-item { border-left: 1px solid var(--border); }
.ps-v { font-size: 18px; font-weight: 800; color: var(--primary); }
.ps-k { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.ps-div { width: 1px; background: var(--border); }

.ref-card {
  margin: 0 18px 16px;
  background: var(--card-bg);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.ref-header { display: flex; align-items: center; gap: 11px; }
.ref-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--teal-muted); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ref-title { font-size: 14px; font-weight: 700; }
.ref-sub   { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.ref-link-row {
  display: flex; align-items: center;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  overflow: hidden;
}
.ref-link {
  flex: 1; padding: 9px 12px;
  font-size: 11px; color: var(--text-3); font-family: monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ref-copy {
  padding: 9px 12px;
  border: none; border-left: 1px solid var(--border);
  background: var(--teal-muted); color: var(--primary);
  cursor: pointer; transition: background var(--t-fast);
}
.ref-copy:active { transform: scale(0.88); }
.btn-share {
  width: 100%; padding: 11px;
  border-radius: var(--r-md);
  border: 1px solid var(--teal-border);
  background: var(--teal-muted);
  color: var(--primary); font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  cursor: pointer; transition: all var(--t-fast);
}
.btn-share:hover { filter: brightness(1.1); }
.btn-share:active { transform: scale(0.98); }

.promo-section { padding: 0 18px 16px; }
.promo-row { display: flex; gap: 8px; }
.promo-input {
  flex: 1; padding: 12px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: 'Inter', sans-serif; font-size: 14px; color: var(--text);
  outline: none; text-transform: uppercase; letter-spacing: 0.05em;
  transition: border-color var(--t);
}
.promo-input::placeholder { color: var(--text-3); text-transform: none; letter-spacing: 0; }
.promo-input:focus { border-color: var(--teal-border); }
.promo-btn {
  padding: 12px 16px;
  background: var(--primary); border: none;
  border-radius: var(--r-md);
  color: white; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all var(--t-fast);
}
.promo-btn:active { transform: scale(0.96); }

.settings-list { display: flex; flex-direction: column; gap: 3px; padding: 0 18px 100px; }
.settings-item {
  display: flex; align-items: center; gap: 11px;
  padding: 13px; border-radius: var(--r-md);
  background: var(--card-bg);
  border: 1px solid var(--border);
  cursor: pointer; text-decoration: none;
  color: var(--text); font-size: 14px; font-weight: 500;
  transition: background var(--t-fast);
}
.settings-item:active { transform: scale(0.99); }
.si-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--teal-muted); color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.si-arrow { margin-left: auto; color: var(--text-3); }

/* ── CHAT SCREEN ─────────────────────────────────────────── */
.chat-hdr-center {
  display: flex; align-items: center; gap: 9px; flex: 1; justify-content: center;
}
.chat-av {
  width: 30px; height: 30px; border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: white;
}
.chat-online { font-size: 10px; color: #4DC899; }
#screen-chat {
  /* Use default .screen styles with scrolling */
}
.chat-msgs {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-day {
  text-align: center; font-size: 11px; color: var(--text-3);
  padding: 4px 12px; background: var(--surface-2);
  border-radius: var(--r-full); align-self: center;
}
.chat-bubble { display: flex; align-items: flex-end; gap: 8px; }
.user-bub { flex-direction: row-reverse; }
.bot-av {
  width: 26px; height: 26px; border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: white; flex-shrink: 0;
}
.bub-body {
  max-width: 76%; padding: 11px 13px;
  border-radius: 17px; font-size: 14px; line-height: 1.55;
}
.bot-bub .bub-body {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.user-bub .bub-body {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}
.bub-time { font-size: 10px; opacity: 0.45; margin-top: 4px; display: block; }
.chat-typing { display: flex; align-items: flex-end; gap: 8px; }
.typing-dots {
  display: flex; align-items: center; gap: 4px;
  padding: 13px 15px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 17px; border-bottom-left-radius: 4px;
}
.typing-dots span {
  width: 6px; height: 6px; border-radius: var(--r-full);
  background: var(--text-3);
  animation: tdot 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes tdot {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); background: var(--primary); }
}
.chat-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px 24px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 10;
}
.chat-ta {
  flex: 1; padding: 9px 13px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-family: 'Inter', sans-serif; font-size: 14px; color: var(--text);
  outline: none; resize: none; max-height: 110px; line-height: 1.5;
  transition: border-color var(--t);
}
.chat-ta::placeholder { color: var(--text-3); }
.chat-ta:focus { border-color: var(--teal-border); }
.chat-send {
  width: 42px; height: 42px; border-radius: var(--r-full);
  background: var(--primary); border: none; color: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(45,156,191,0.4);
  transition: transform var(--t-fast), filter var(--t-fast);
}
.chat-send:active { transform: scale(0.88); }

/* ── BOTTOM NAV ──────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--nav-bg);
  border-top: 1px solid var(--border);
  display: flex;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100;
  padding-bottom: var(--safe-b);
  transition: background var(--t), border-color var(--t);
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  border: none; background: transparent;
  color: var(--text-3);
  cursor: pointer; padding: 8px 0;
  transition: color var(--t-fast), transform var(--t-fast);
}
.nav-btn.active { color: var(--primary); }
.nav-btn:active { transform: scale(0.88); }
.nav-ic { position: relative; display: flex; align-items: center; justify-content: center; }
.nav-ic-main {
  width: 40px; height: 40px; border-radius: var(--r-full);
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(45,156,191,0.4);
  margin-bottom: 1px;
}
.nav-lbl { font-size: 10px; font-weight: 600; letter-spacing: 0.01em; }

/* ── SCROLLBAR ───────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--teal-border) transparent; }
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-thumb { background: var(--teal-border); border-radius: 2px; }
button {
  font-family: 'Inter', -apple-system, sans-serif;
  color: inherit;
  background: none;
  border: none;
  outline: none;
  cursor: pointer;
}

/* ── HISTORY SCREEN ───────────────────────────────────────── */
.history-content {
  padding: 16px;
  height: calc(100% - var(--nav-h) - 50px);
  overflow-y: auto;
}
.history-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding-bottom: 24px;
}
.history-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--t-fast), border-color var(--t-fast);
}
.history-item:active {
  transform: scale(0.97);
}
.history-item:hover {
  border-color: var(--teal-border);
}
.history-img-box {
  width: 100%;
  aspect-ratio: 1;
  background-size: cover;
  background-position: center;
}
.history-info-box {
  padding: 10px;
}
.history-prompt-summary {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 9px;
  color: var(--text-3);
}
.history-tag-cost {
  padding: 2px 5px;
  background: var(--surface-2);
  border-radius: 4px;
  color: var(--primary);
  font-weight: 700;
}

/* History Modal */
.history-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.25s ease-out;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.hm-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 350px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  animation: modalSlideUp 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
@keyframes modalSlideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.hm-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  border-radius: var(--r-full);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  cursor: pointer;
  transition: background var(--t);
}
.hm-close:hover {
  background: rgba(0, 0, 0, 0.7);
}
.hm-img-container {
  width: 100%;
  max-height: 60vh;
  min-height: 200px;
  overflow: hidden;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hm-img-container img {
  max-width: 100%;
  max-height: 60vh;
  width: auto;
  height: auto;
  object-fit: contain;
}
.hm-details {
  padding: 16px;
}
.hm-prompt-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 700;
  letter-spacing: 0.05em;
}
.hm-prompt-text {
  font-size: 13px;
  color: var(--text);
  margin-top: 4px;
  line-height: 1.4;
  font-weight: 500;
}
.hm-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.hm-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hm-meta-k {
  font-size: 9px;
  color: var(--text-3);
  text-transform: uppercase;
  font-weight: 600;
}
.hm-meta-v {
  font-size: 11px;
  color: var(--text);
  font-weight: 700;
}
.hm-btns {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.hm-btns button {
  flex: 1;
  padding: 11px;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--t-fast);
}
.hm-btns .btn-prim {
  background: var(--primary);
  color: white;
  border: none;
}
.hm-btns .btn-prim:active {
  transform: scale(0.96);
}
.hm-btns .btn-sec {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.hm-btns .btn-sec:hover {
  background: var(--surface-3);
}
.hm-btns .btn-sec:active {
  transform: scale(0.96);
}

/* Gallery Tabs Segmented Control */
.gallery-tabs-wrap {
  padding: 0 16px 12px;
  background: var(--bg);
}
.gallery-tabs {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px;
  border-radius: var(--r-md);
  gap: 2px;
}
.gallery-tab {
  flex: 1;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-align: center;
  transition: all var(--t);
  cursor: pointer;
}
.gallery-tab.active {
  background: var(--card-bg);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
}

/* Likes Badge inside modal image */
.hm-img-container {
  position: relative;
}
.hm-likes-badge {
  position: absolute;
  bottom: 12px; right: 12px;
  background: rgba(8, 15, 30, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 5px 10px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: #D95E5E;
  cursor: pointer;
  transition: all var(--t-fast);
  z-index: 5;
}
.hm-likes-badge:active {
  transform: scale(0.92);
}
.hm-likes-badge.liked {
  background: #D95E5E;
  color: white;
  border-color: #D95E5E;
}

/* Custom amount input styles */
.custom-amount-container {
  padding: 0 18px 16px;
  display: none;
}
.custom-amount-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.custom-amount-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  outline: none;
  font-family: inherit;
  font-size: 14px;
  transition: border-color var(--t-fast);
}
.custom-amount-input:focus {
  border-color: var(--teal-border);
}
/* Hide numeric arrows/spinners */
.custom-amount-input::-webkit-outer-spin-button,
.custom-amount-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.custom-amount-input[type=number] {
  -moz-appearance: textfield;
}
.custom-amount-suffix {
  position: absolute;
  right: 14px;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
}

/* Likes overlay for feed cards */
.history-img-box {
  position: relative;
}
.feed-card-likes {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: var(--r-full);
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: white;
  transition: all var(--t-fast);
  z-index: 2;
}
.feed-card-likes.liked {
  background: rgba(217, 94, 94, 0.9);
  color: white;
}
.feed-card-likes svg {
  flex-shrink: 0;
}

/* Progressive Image Loading classes */
.progressive-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.4s ease;
}
.progressive-img.placeholder {
  filter: blur(12px);
  transform: scale(1.1);
  z-index: 1;
}
.progressive-img.main {
  opacity: 0;
  z-index: 2;
}
.progressive-img.main.loaded {
  opacity: 1;
}

/* Payment methods tabs styling */
.pay-methods-tabs {
  border: 1px solid var(--border);
}
.pay-tab {
  transition: all 0.2s ease-in-out;
}
.pay-tab.active {
  background: var(--surface) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  color: var(--text) !important;
}
