/* FotoRevive Mini App — UI v2: TG-native, light/dark, clear hierarchy */
:root {
  /* Follow Telegram theme (light phones were washed out before) */
  --bg: var(--tg-theme-bg-color, #f4f5f7);
  --text: var(--tg-theme-text-color, #1a1d24);
  --hint: var(--tg-theme-hint-color, #8b93a7);
  --btn: var(--tg-theme-button-color, #2aabee);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --secondary: var(--tg-theme-secondary-bg-color, #e8eaef);
  --link: var(--tg-theme-link-color, #2aabee);
  --card: var(--tg-theme-section-bg-color, #ffffff);
  --border: color-mix(in srgb, var(--hint) 32%, transparent);
  --accent: #7c5cff;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--card));
  --btn-soft: color-mix(in srgb, var(--btn) 14%, var(--card));
  --radius: 18px;
  --radius-sm: 14px;
  --ok: #2fbf71;
  --danger: #e5484d;
  --shadow: 0 4px 20px color-mix(in srgb, var(--text) 8%, transparent);
  --tg-safe-top: 0px;
  --tg-safe-bottom: 0px;
  --tg-main-gap: 20px;
}

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

/*
  Scroll model for Telegram Mini Apps:
  - Do NOT lock overscroll-behavior (breaks finger scroll in TG WebView)
  - Do NOT force html/body height:100% (content can't grow → scroll dies)
  - Document (body) is the scroller; only clip horizontal overflow
*/
html {
  background: var(--bg);
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  height: auto;
  /* allow natural rubber-band / scroll chaining inside Telegram */
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100dvh;
  height: auto;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  touch-action: pan-y;
  padding-top: calc(10px + var(--tg-safe-top));
  padding-bottom: calc(96px + var(--tg-safe-bottom));
  padding-left: 14px;
  padding-right: 14px;
}

#app, .app-shell {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  overflow-x: hidden;
  overflow-y: visible;
  position: relative;
}

/* —— Header —— */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  width: 100%;
  min-width: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.brand-text { min-width: 0; }

.logo {
  width: 44px;
  height: 44px;
  display: block;
  object-fit: cover;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--btn), var(--accent));
  flex-shrink: 0;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--btn) 35%, transparent);
  border: 1px solid #ffffff18;
}

h1 {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub {
  font-size: 12px;
  color: var(--hint);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.chip {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 44vw;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--shadow);
}

.chip-balance {
  background: var(--btn-soft);
  border-color: color-mix(in srgb, var(--btn) 30%, var(--border));
  color: var(--text);
}

.chip-lang {
  min-width: 40px;
  font-size: 14px;
  padding: 8px 10px;
}

/* —— Journey (replaces noisy step pills) —— */
.journey {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  width: 100%;
}

.journey-step {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--hint);
  flex: 0 1 auto;
}

.journey-step .js-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  background: var(--secondary);
  color: var(--hint);
  flex-shrink: 0;
}

.journey-step .js-lab {
  font-size: 12px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journey-step.active { color: var(--text); }
.journey-step.active .js-num {
  background: var(--btn);
  color: var(--btn-text);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--btn) 40%, transparent);
}
.journey-step.done { color: var(--ok); }
.journey-step.done .js-num {
  background: color-mix(in srgb, var(--ok) 22%, var(--secondary));
  color: var(--ok);
}

.journey-line {
  flex: 1;
  height: 2px;
  min-width: 8px;
  border-radius: 2px;
  background: var(--border);
}

/* legacy steps (if any remain) */
.steps { display: none; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: cardIn .28s ease both;
}

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

.card-hero {
  padding: 18px 16px 16px;
}

.section-title, .block-title {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.01em;
  margin-bottom: 0;
}

.block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.block-head-text { min-width: 0; }
.block-sub {
  font-size: 12px;
  color: var(--hint);
  margin-top: 2px;
}
.block-pill {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--btn-soft);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--btn) 28%, transparent);
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-card {
  min-height: 168px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-style: dashed;
  border-width: 1.5px;
  border-color: color-mix(in srgb, var(--btn) 35%, var(--border));
  cursor: pointer;
  background:
    linear-gradient(180deg, var(--btn-soft), var(--card));
}

.upload-card.drag {
  border-color: var(--btn);
  background: color-mix(in srgb, var(--btn) 16%, var(--card));
}

.upload-inner {
  text-align: center;
  padding: 8px 6px;
  width: 100%;
  max-width: 100%;
}

.upload-icon-wrap {
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.upload-icon { font-size: 26px; line-height: 1; }
.upload-title {
  font-weight: 750;
  font-size: 16px;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.upload-hint {
  font-size: 12px;
  color: var(--hint);
  margin-bottom: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
}

.btn-primary {
  min-height: 46px;
  font-size: 14px;
  border-radius: 14px;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--btn) 35%, transparent);
}

.preview-wrap {
  width: 100%;
  max-width: 100%;
  text-align: center;
  overflow: hidden;
}

.preview-stage {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #0a0c10;
  margin-bottom: 8px;
  line-height: 0;
}
.preview-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 10px #0006;
}
.preview-remove:active {
  transform: scale(0.94);
  background: rgba(0, 0, 0, 0.8);
}

.preview-stage > img,
#previewImg {
  width: 100%;
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  background: #0003;
  transition: filter .4s ease, transform .6s ease;
}

/* No scale transform — it jitters layout in Telegram WebView */
.preview-stage {
  /* keep overflow clip so any effect stays inside */
  contain: layout paint;
}
.preview-stage.is-processing #previewImg {
  filter: saturate(0.8) brightness(0.9) contrast(1.04);
  transform: none !important;
  animation: none !important;
}

/* ===== Processing overlay on photo ===== */
.process-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: linear-gradient(180deg, #0a1020aa 0%, #0a102088 40%, #0a1020cc 100%);
}

.process-overlay.hidden { display: none !important; }

.process-glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle at 50% 40%, #2aabee44 0%, transparent 55%),
              radial-gradient(circle at 70% 70%, #7c5cff33 0%, transparent 50%);
  animation: glowShift 3s ease-in-out infinite alternate;
}

@keyframes glowShift {
  from { opacity: 0.6; transform: scale(1); }
  to { opacity: 1; transform: scale(1.08); }
}

.process-scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 28%;
  top: -30%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    #6cb6ff22 30%,
    #ffffff55 50%,
    #6cb6ff22 70%,
    transparent 100%
  );
  animation: scanMove 2.2s ease-in-out infinite;
  mix-blend-mode: screen;
}

@keyframes scanMove {
  0% { top: -30%; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.process-sparkles::before,
.process-sparkles::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px #6cb6ff, 40px 60px 8px #fff, -30px 90px 6px #a78bfa,
    80px 20px 8px #fff, -50px 30px 5px #6cb6ff;
  animation: sparkle 1.8s ease-in-out infinite;
  opacity: 0.7;
  left: 30%;
  top: 25%;
}

.process-sparkles::after {
  left: 55%;
  top: 55%;
  animation-delay: 0.6s;
}

@keyframes sparkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

.process-ui {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 16px 14px 14px;
  border-radius: 16px;
  background: #0f1115cc;
  border: 1px solid #ffffff22;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  /* Fixed size so rotating copy does not resize the card */
  width: min(248px, 88%);
  min-width: 200px;
  max-width: 88%;
  box-sizing: border-box;
  box-shadow: 0 12px 40px #0008;
  line-height: 1.3;
  /* Reserve space for ring + 2-line label + sub + bar */
  min-height: 188px;
}

.process-ring {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 10px;
}

.process-ring-svg {
  width: 72px;
  height: 72px;
  transform: rotate(-90deg);
}

.process-ring-bg {
  fill: none;
  stroke: #ffffff18;
  stroke-width: 3;
}

.process-ring-fg {
  fill: none;
  stroke: url(#none);
  stroke: #2aabee;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray 0.35s ease;
}

.process-pct {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.process-label {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 6px;
  /* Always 2 lines — no layout jump when phrase length changes */
  height: 2.6em;
  min-height: 2.6em;
  max-height: 2.6em;
  line-height: 1.3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 2px;
  word-break: break-word;
  transition: opacity 0.25s ease;
}
.process-label.is-swap {
  opacity: 0.35;
}

.process-sub {
  font-size: 11px;
  color: #8b93a7;
  margin: 0 auto 10px;
  height: 1.25em;
  min-height: 1.25em;
  max-height: 1.25em;
  line-height: 1.25;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 100%;
}

.process-bar {
  height: 5px;
  border-radius: 99px;
  background: #ffffff18;
  overflow: hidden;
}

.process-fill {
  height: 100%;
  width: 8%;
  border-radius: 99px;
  background: linear-gradient(90deg, #2aabee, #7c5cff, #2aabee);
  background-size: 200% 100%;
  animation: barShine 1.2s linear infinite;
  transition: width 0.4s ease;
}

@keyframes barShine {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.preview-meta {
  font-size: 11px;
  color: var(--hint);
  margin-bottom: 6px;
  word-break: break-word;
}

/* Batch result thumbs + gallery */
.result-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 100%;
  margin-bottom: 10px;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.result-thumbs.hidden { display: none !important; }

.result-thumb {
  flex: 0 0 auto;
  width: 64px;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: #0003;
  position: relative;
}

.result-thumb.active {
  border-color: var(--btn);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--btn) 40%, transparent);
}

.result-thumb img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  display: block;
}

.result-thumb .rt-n {
  position: absolute;
  left: 4px;
  bottom: 4px;
  font-size: 9px;
  font-weight: 800;
  background: #000a;
  color: #fff;
  padding: 1px 5px;
  border-radius: 6px;
}

.batch-gallery {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.batch-gallery.hidden { display: none !important; }

.batch-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: color-mix(in srgb, var(--secondary) 80%, transparent);
}

.batch-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.batch-item-head strong {
  font-size: 12px;
}

.batch-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.batch-pair figure {
  margin: 0;
  min-width: 0;
}

.batch-pair img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #0003;
  display: block;
}

.batch-pair figcaption {
  font-size: 10px;
  color: var(--hint);
  text-align: center;
  margin-top: 4px;
  font-weight: 600;
}

/* ── Mode gallery: uniform cards, image fill, text on top ── */
.modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  align-items: stretch;
}

.mode {
  position: relative;
  width: 100%;
  min-width: 0;
  /* same size as user assets 1448×1086 */
  aspect-ratio: 1448 / 1086;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 18px;
  overflow: hidden;
  background: #111;
  color: #fff;
  cursor: pointer;
  display: block;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  transition:
    box-shadow 0.15s ease,
    transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Bright paint drip along top edge of mode cards */
.mode::before {
  content: "";
  position: absolute;
  left: -6%;
  right: -6%;
  top: -2px;
  height: 42%;
  z-index: 3;
  pointer-events: none;
  opacity: 0.92;
  background:
    radial-gradient(ellipse 18px 28px at 12% 0%, #ff4d8d 0%, #ff4d8d 55%, transparent 70%),
    radial-gradient(ellipse 14px 36px at 28% 0%, #7c5cff 0%, #7c5cff 52%, transparent 70%),
    radial-gradient(ellipse 16px 24px at 46% 0%, #ffd166 0%, #ffd166 55%, transparent 70%),
    radial-gradient(ellipse 12px 32px at 62% 0%, #2ee6a6 0%, #2ee6a6 50%, transparent 70%),
    radial-gradient(ellipse 15px 26px at 78% 0%, #2aabee 0%, #2aabee 55%, transparent 70%),
    radial-gradient(ellipse 13px 34px at 92% 0%, #ff6b35 0%, #ff6b35 52%, transparent 70%);
  filter: saturate(1.15);
  animation: paintDrip 4.2s ease-in-out infinite;
  mix-blend-mode: screen;
}
.mode.active::before {
  opacity: 1;
  animation-duration: 3.2s;
  filter: saturate(1.35) brightness(1.05);
}
.mode:nth-child(3n)::before { animation-delay: -0.7s; }
.mode:nth-child(3n+1)::before { animation-delay: -1.4s; }
.mode:nth-child(3n+2)::before { animation-delay: -2.1s; }

.mode:active {
  transform: scale(0.985);
}

/* Dark gradient so white title/price always readable */
.mode::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46%;
  z-index: 1;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.55) 55%,
    rgba(0, 0, 0, 0.88) 100%
  );
  pointer-events: none;
  transition: height 0.18s ease;
}
/* Selected: taller gradient so description on photo is readable */
.mode.active::after {
  height: 72%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.45) 35%,
    rgba(0, 0, 0, 0.82) 70%,
    rgba(0, 0, 0, 0.92) 100%
  );
}

.mode.mode-featured {
  background: #111;
}

/* Preview fills entire button — assets are pre-cropped to card ratio (no bars) */
.mode-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover; /* assets = 1448×1086; cover = fill without letterbox */
  object-position: center center;
  border: none;
  margin: 0;
  padding: 0;
  pointer-events: none;
  background: #0a0a0c; /* only if image fails — not a “stripe” */
}

/* Text overlay on image */
.mode-caption {
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  pointer-events: none;
}

.mode-name {
  position: absolute;
  left: 12px;
  bottom: 12px;
  right: 62px;
  z-index: 2;
  margin: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.15;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
  max-width: none;
}

.mode-cost {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  max-width: 56px;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  opacity: 1;
  text-shadow: none;
}

/* Video full width — 2:1 seamless before|after video composite */
.mode.mode-wide {
  grid-column: 1 / -1;
  aspect-ratio: 2 / 1;
}
.mode.mode-wide .mode-preview {
  object-fit: cover;
  object-position: center center;
}
.mode.mode-wide .mode-meta {
  display: none;
}
.mode.mode-wide .mode-blurb {
  display: none;
}

.mode.active {
  outline: 2px solid color-mix(in srgb, var(--btn) 85%, #fff);
  outline-offset: 0;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--btn) 40%, transparent),
    0 12px 28px color-mix(in srgb, var(--btn) 32%, transparent);
  z-index: 1;
}
.mode.active .mode-name {
  color: #fff;
  font-weight: 800;
}
.mode.active .mode-cost {
  color: #fff;
  background: color-mix(in srgb, var(--btn) 72%, #1a1a1a);
  border-color: color-mix(in srgb, var(--btn) 40%, transparent);
}

/* Description overlay — only on selected mode, on the photo */
.mode-info {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 40px;
  z-index: 2;
  margin: 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.95);
  font-size: 11px;
  font-weight: 550;
  line-height: 1.35;
  text-align: left;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  max-height: 0;
  overflow: hidden;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    max-height 0.18s ease;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
}
.mode.active .mode-info {
  opacity: 1;
  transform: none;
  max-height: 4.8em;
}
.mode-info b,
.mode-info .md-hi,
.mode-info .md-acc {
  color: #fff;
  font-weight: 800;
}
.mode-info .md-cost {
  color: #cfe0ff;
  font-weight: 700;
  white-space: nowrap;
}
.mode.mode-wide .mode-info {
  font-size: 12px;
  bottom: 42px;
  right: 30%;
}
.mode.mode-disabled .mode-info {
  opacity: 0 !important;
}

.mode-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  font-size: 9px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--btn);
  color: var(--btn-text);
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.mode-badge-demo {
  background: color-mix(in srgb, var(--ok) 85%, #111);
  color: #fff;
}
.mode-badge.hidden,
.mode .mode-badge.hidden {
  display: none !important;
}

.mode.mode-disabled .mode-lock {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 4;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
  color: #e8ecf4;
  background: #000a;
  border: 1px solid #ffffff22;
  border-radius: 8px;
  padding: 3px 7px;
  max-width: 70%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(6px);
}
.mode:not(.mode-disabled) .mode-lock {
  display: none !important;
}

.demo-banner {
  font-size: 12px;
  line-height: 1.4;
  color: var(--hint);
  background: var(--btn-soft);
  border: 1px solid color-mix(in srgb, var(--btn) 22%, var(--border));
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 12px;
}

.mode-emoji {
  display: none;
}
.mode-blurb {
  display: none !important;
}
.mode-meta {
  display: none;
}

/* Disabled: dim photo only */
.mode.mode-disabled {
  opacity: 1;
  filter: none;
  cursor: not-allowed;
}
.mode.mode-disabled .mode-preview {
  filter: grayscale(0.55) brightness(0.72);
  opacity: 0.85;
}
.mode.mode-disabled .mode-caption,
.mode.mode-disabled .mode-name,
.mode.mode-disabled .mode-cost {
  opacity: 0.75;
}

/* ── Animate panel: video loop + motion chips + optional prompt ── */
.animate-panel {
  margin: 12px 0 4px;
  padding: 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--card, #141820) 92%, #000);
  border: 1px solid #ffffff12;
}
.animate-panel.hidden {
  display: none !important;
}
.animate-preview-wrap {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: #0a0c10;
  margin-bottom: 12px;
  line-height: 0; /* no gap under img */
}
/* Normal flow img = GIF animates reliably in Telegram WebView */
.animate-preview-gif {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  background: #0a0c10;
  vertical-align: top;
}
.animate-panel-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 750;
  color: var(--text);
}
.motion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.motion-chip {
  appearance: none;
  border: 1px solid #ffffff18;
  background: #ffffff0c;
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  line-height: 1.2;
}
.motion-chip.active {
  border-color: color-mix(in srgb, var(--btn) 55%, #fff);
  background: color-mix(in srgb, var(--btn) 28%, #141820);
  color: #fff;
  font-weight: 750;
}
.animate-prompt-label {
  display: block;
  font-size: 12px;
  color: var(--hint);
  margin: 0 0 6px;
}
.animate-prompt-input {
  width: 100%;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid #ffffff16;
  background: #0e1218;
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
}
.animate-prompt-input:focus {
  border-color: color-mix(in srgb, var(--btn) 50%, #fff);
}
.animate-prompt-input::placeholder {
  color: color-mix(in srgb, var(--hint) 80%, transparent);
}

@media (max-width: 380px) {
  .modes {
    gap: 8px;
  }
  .mode {
    border-radius: 16px;
  }
  .mode-name {
    left: 10px;
    bottom: 10px;
    right: 54px;
    font-size: 14px;
  }
  .mode-cost {
    right: 8px;
    bottom: 8px;
    max-width: 52px;
    padding: 5px 8px;
    font-size: 12px;
  }
  .mode-badge {
    top: 7px;
    right: 7px;
    font-size: 9px;
    padding: 3px 6px;
  }
}

/* Legacy bottom plaque — hidden; text is on the card photo now */
.mode-desc {
  display: none !important;
}

/* Promo banner (seasonal / family album) */
.promo-banner {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent, #e8a838) 22%, var(--card)),
    color-mix(in srgb, var(--btn) 18%, var(--card))
  );
  border: 1px solid color-mix(in srgb, var(--accent, #e8a838) 35%, transparent);
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  font-weight: 550;
}
.promo-banner.hidden { display: none !important; }
.promo-banner b { font-weight: 800; }

/* Wow examples strip */
.wow-strip {
  margin: 0 0 12px;
}
.wow-strip-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--hint);
  letter-spacing: 0.02em;
}
.wow-strip-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.wow-strip-track::-webkit-scrollbar { display: none; }
.wow-card {
  flex: 0 0 auto;
  width: 88px;
  height: 66px;
  padding: 0;
  border: 1px solid #ffffff18;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: #111;
  cursor: pointer;
}
.wow-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.wow-card span {
  position: absolute;
  left: 6px;
  bottom: 4px;
  font-size: 12px;
  text-shadow: 0 1px 3px #000;
}

/* Next mode chips after result */
.next-modes {
  margin: 12px 0 4px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--secondary, #1a1e28);
  border: 1px solid #ffffff10;
}
.next-modes.hidden { display: none !important; }
.next-modes-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--hint);
}
.next-modes-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.next-chip {
  border: 1px solid color-mix(in srgb, var(--btn) 35%, transparent);
  background: color-mix(in srgb, var(--btn) 14%, transparent);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.next-chip:active { transform: scale(0.97); }

.opts { margin-top: 4px; }

.video-result {
  margin-top: 10px;
  border-radius: 14px;
  overflow: hidden;
  background: #0a0c12;
  border: 1px solid var(--border);
}
.video-result.hidden { display: none !important; }
.result-video {
  width: 100%;
  max-height: min(70vh, 480px);
  min-height: 200px;
  display: block;
  background: #000;
  object-fit: contain;
}
/* Growth blocks: series + invite — readable body text, not tiny hint */
.growth-card {
  padding: 16px 14px 14px;
}
.growth-card .growth-title {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 0;
}
.growth-head {
  align-items: center;
  margin-bottom: 10px;
}
.growth-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  opacity: 0.88;
  margin: 0 0 14px;
  font-weight: 450;
  word-wrap: break-word;
}
.streak-card .streak-n {
  font-size: 28px;
  font-weight: 800;
  color: var(--btn);
  min-width: 2ch;
  text-align: right;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.streak-card .btn[disabled] {
  opacity: 0.7;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--hint);
  cursor: pointer;
  max-width: 100%;
}

.check-row span {
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
}

.check-row input {
  accent-color: var(--btn);
  width: 16px;
  height: 16px;
  margin-top: 1px;
  flex-shrink: 0;
}

.progress-card {
  text-align: center;
  padding: 22px 14px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  width: 100%;
  overflow: hidden;
}

.spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 10px;
  border: 3px solid var(--border);
  border-top-color: var(--btn);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

.progress-title {
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 14px;
  height: 2.6em;
  min-height: 2.6em;
  line-height: 1.3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.progress-card .hint {
  min-height: 1.3em;
  height: 1.3em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.progress-bar {
  height: 6px;
  border-radius: 99px;
  background: var(--secondary);
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, #2aabee, #7c5cff);
  border-radius: 99px;
  transition: width .4s ease;
}

/* Buttons */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: var(--btn);
  color: var(--btn-text);
  text-decoration: none;
  max-width: 100%;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.1s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); opacity: 0.95; }

/* Primary / full CTA — paint drip over the button */
.btn.btn-primary,
.btn.full:not(.secondary):not(.ghost) {
  background:
    linear-gradient(135deg, #5b2c6f 0%, #7c5cff 45%, #2aabee 100%);
  color: #fff;
  box-shadow: 0 8px 22px rgba(124, 92, 255, 0.35);
}
.btn.btn-primary::before,
.btn.full:not(.secondary):not(.ghost)::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 70%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 22px 30px at 15% 0%, #ff4d8d 0 60%, transparent 70%),
    radial-gradient(ellipse 18px 38px at 38% 0%, #ffd166 0 55%, transparent 70%),
    radial-gradient(ellipse 20px 28px at 58% 0%, #2ee6a6 0 58%, transparent 70%),
    radial-gradient(ellipse 16px 34px at 78% 0%, #ffffffaa 0 50%, transparent 70%),
    radial-gradient(ellipse 18px 26px at 92% 0%, #ff6b35 0 55%, transparent 70%);
  animation: paintDrip 3.6s ease-in-out infinite;
  opacity: 0.95;
}
.btn.btn-primary > *,
.btn.full:not(.secondary):not(.ghost) > * {
  position: relative;
  z-index: 1;
}
/* text node alone — ensure label sits above paint */
.btn.btn-primary,
.btn.full:not(.secondary):not(.ghost) {
  z-index: 0;
}

@keyframes paintDrip {
  0%, 100% {
    transform: translateY(-6%) scaleY(0.92);
    opacity: 0.85;
  }
  40% {
    transform: translateY(4%) scaleY(1.08);
    opacity: 1;
  }
  70% {
    transform: translateY(10%) scaleY(1.14);
    opacity: 0.95;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mode::before,
  .btn.btn-primary::before,
  .btn.full:not(.secondary):not(.ghost)::before {
    animation: none;
    transform: none;
  }
}

.btn.secondary {
  background: var(--secondary);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.ghost {
  background: transparent;
  color: var(--hint);
  border: 1px solid var(--border);
}

.btn.full { width: 100%; }
.btn.flex1 { flex: 1; min-width: 0; }
.btn.small { padding: 6px 10px; font-size: 12px; }

.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
}

.result-actions .btn {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Slider — pan-x only so page can still scroll vertically around it */
.slider-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #111;
  margin-bottom: 8px;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  line-height: 0;
}

.slider-wrap > .slider-img,
.slider-wrap > #afterImg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 340px;
  object-fit: cover;
  vertical-align: top;
}

.slider-before {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 50%;
  overflow: hidden;
  z-index: 1;
  border-right: 0;
}

.slider-before .slider-img,
.slider-before #beforeImg {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: auto;
  max-width: none;
  object-fit: cover;
  display: block;
}

.slider-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: #fff;
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
  box-shadow: 0 0 8px #0008;
}

.slider-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  color: #111;
  display: grid;
  place-items: center;
  font-size: 13px;
  box-shadow: 0 2px 10px #0008;
}

.slider-tag {
  position: absolute;
  bottom: 10px;
  z-index: 3;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  background: #000a;
  color: #fff;
  padding: 4px 7px;
  border-radius: 6px;
}

.slider-tag.left { left: 8px; }
.slider-tag.right { right: 8px; }

/* Thin strip for horizontal drag only — rest of page scrolls vertically */
#sliderRange {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 44px;
  opacity: 0;
  cursor: ew-resize;
  z-index: 4;
  margin: 0;
  touch-action: pan-x;
}

.compare-img {
  width: 100%;
  max-width: 100%;
  border-radius: 12px;
  margin-top: 6px;
  max-height: 220px;
  object-fit: contain;
  background: #0003;
}

.rate-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  flex-wrap: wrap;
}

.rate-btn {
  border: 1px solid var(--border);
  background: var(--secondary);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 16px;
  cursor: pointer;
}

.rate-btn.active-up { border-color: var(--ok); }
.rate-btn.active-down { border-color: var(--danger); }

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  width: 100%;
  min-width: 0;
}

.row-between .section-title {
  margin-bottom: 0;
  min-width: 0;
}

.hint {
  font-size: 12px;
  color: var(--hint);
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.hidden { display: none !important; }

/* Products */
.products {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.product {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
  min-width: 0;
}

.product.featured {
  border-color: var(--btn);
  background: color-mix(in srgb, var(--btn) 10%, transparent);
}

.product > div { min-width: 0; flex: 1; }
.p-title {
  font-weight: 700;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.p-sub { font-size: 11px; color: var(--hint); margin-top: 2px; }
.p-stars {
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  white-space: nowrap;
}
.p-rub { color: var(--ok) !important; }

.sub-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--hint);
  margin: 12px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pricing-note {
  margin-bottom: 4px;
  line-height: 1.4;
}

/* History */
.history {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  width: 100%;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.history-item {
  position: relative;
  flex: 0 0 auto;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
}

.history-item img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  display: block;
}

.history-item .h-mode {
  position: absolute;
  left: 4px;
  bottom: 4px;
  font-size: 9px;
  font-weight: 700;
  background: #000a;
  color: #fff;
  padding: 2px 5px;
  border-radius: 6px;
}

.batch-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  max-width: 100%;
  margin: 8px 0;
}

.batch-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid transparent;
  flex: 0 0 auto;
}

.batch-thumb.active { border-color: var(--btn); }

/* Referral card */
.ref-card .growth-title { margin-bottom: 10px; }
.ref-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 0 0 14px;
}
.ref-stat {
  text-align: center;
  padding: 12px 6px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--btn) 12%, var(--secondary));
  border: 1px solid color-mix(in srgb, var(--btn) 28%, transparent);
  min-width: 0;
}
.ref-stat-n {
  display: block;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.ref-stat-l {
  display: block;
  font-size: 12px;
  line-height: 1.3;
  color: var(--text);
  opacity: 0.72;
  font-weight: 600;
}

.select {
  margin-top: 6px;
  width: 100%;
  max-width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--secondary);
  color: var(--text);
  font-size: 13px;
}

.lang-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
}

.lang-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang-btn.active {
  border-color: var(--btn);
  background: color-mix(in srgb, var(--btn) 16%, transparent);
}

/* Toast / gate / onboard — fixed, no layout shift */
.toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(18px + var(--tg-safe-bottom) + var(--tg-main-gap));
  margin: 0 auto;
  max-width: 420px;
  width: auto;
  background: #1c1f27ee;
  color: #fff;
  border: 1px solid #ffffff22;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 50;
  box-shadow: 0 8px 30px #0006;
  text-align: center;
  word-wrap: break-word;
}

.toast.ok { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.toast.err { border-color: color-mix(in srgb, var(--danger) 50%, transparent); }

.gate, .onboard {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--tg-safe-top)) 16px calc(16px + var(--tg-safe-bottom));
  background: color-mix(in srgb, var(--bg) 92%, #000);
  backdrop-filter: blur(8px);
  overflow-y: auto;
  overflow-x: hidden;
}

.onboard { z-index: 60; }
.gate.hidden, .onboard.hidden { display: none !important; }

.gate-card, .onboard-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: 0 12px 40px #0005;
}

.gate-icon, .slide-emoji { font-size: 36px; margin-bottom: 8px; }
.gate-card h2, .slide h2 { font-size: 18px; margin-bottom: 8px; }
.gate-card > p, .slide p {
  font-size: 13px;
  color: var(--hint);
  line-height: 1.45;
  margin-bottom: 12px;
  word-wrap: break-word;
}

.gate-steps {
  text-align: left;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 16px 18px;
  color: var(--text);
}

.gate-steps a, .gate-card a.btn { text-decoration: none; color: inherit; }
#app.dimmed { filter: blur(2px); pointer-events: none; }

.onboard-slides { min-height: 140px; }
.slide { display: none; }
.slide.active { display: block; }

.onboard-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 14px 0;
}

.onboard-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}

.onboard-dots span.on { background: var(--btn); }

/* ── Color reveal: REAL B&W on #app (Telegram often ignores backdrop-filter) ── */
body.cr-bw #app {
  filter: grayscale(1) sepia(0.22) contrast(1.12) brightness(0.92);
}
body.cr-bw.cr-colorizing #app {
  animation: cr-app-color 3.4s cubic-bezier(0.35, 0.05, 0.2, 1) forwards;
}
@keyframes cr-app-color {
  0%   { filter: grayscale(1) sepia(0.22) contrast(1.12) brightness(0.92); }
  20%  { filter: grayscale(0.85) sepia(0.18) contrast(1.1) brightness(0.93); }
  45%  { filter: grayscale(0.55) sepia(0.12) contrast(1.08) brightness(0.95); }
  70%  { filter: grayscale(0.25) sepia(0.05) contrast(1.04) brightness(0.98); }
  100% { filter: grayscale(0) sepia(0) contrast(1) brightness(1); }
}
body.cr-bw.cr-done #app {
  filter: none;
  animation: none;
}

.color-reveal {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: auto;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  background: transparent;
}
.color-reveal.hidden {
  display: none !important;
  pointer-events: none;
}

/* Dark aged vignette on edges */
.cr-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0 0 60px 18px rgba(0, 0, 0, 0.55),
    inset 0 0 120px 40px rgba(20, 16, 10, 0.35);
  background:
    radial-gradient(ellipse 120% 80% at 50% 50%, transparent 42%, rgba(0, 0, 0, 0.35) 100%);
  opacity: 1;
}
.color-reveal.cr-play .cr-vignette {
  animation: cr-fade-out 3.4s ease-out forwards;
}

/* Scratches / dust concentrated on edges */
.cr-scratches {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    repeating-linear-gradient(
      108deg,
      transparent 0 22px,
      rgba(255, 255, 255, 0.07) 22px 23px,
      transparent 23px 55px
    ),
    repeating-linear-gradient(
      -18deg,
      transparent 0 40px,
      rgba(0, 0, 0, 0.12) 40px 41px,
      transparent 41px 90px
    ),
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.1) 0 1px, transparent 2px),
    radial-gradient(circle at 88% 22%, rgba(255, 255, 255, 0.08) 0 1px, transparent 2px),
    radial-gradient(circle at 20% 80%, rgba(0, 0, 0, 0.15) 0 1.5px, transparent 3px),
    radial-gradient(circle at 78% 75%, rgba(255, 255, 255, 0.06) 0 1px, transparent 2px);
  /* Only edges — center of UI stays readable */
  -webkit-mask-image:
    linear-gradient(to right, #000 0%, #000 10%, transparent 22%, transparent 78%, #000 90%, #000 100%),
    linear-gradient(to bottom, #000 0%, #000 8%, transparent 18%, transparent 82%, #000 92%, #000 100%);
  mask-image:
    linear-gradient(to right, #000 0%, #000 10%, transparent 22%, transparent 78%, #000 90%, #000 100%),
    linear-gradient(to bottom, #000 0%, #000 8%, transparent 18%, transparent 82%, #000 92%, #000 100%);
  -webkit-mask-composite: source-over;
  mask-composite: add;
}
.color-reveal.cr-play .cr-scratches {
  animation: cr-fade-out 3.4s ease-out forwards;
}

@keyframes cr-fade-out {
  0%   { opacity: 1; }
  40%  { opacity: 0.9; }
  75%  { opacity: 0.45; }
  100% { opacity: 0; }
}

/* Wave front line top → bottom */
.cr-edge {
  position: absolute;
  left: -5%;
  right: -5%;
  height: 36px;
  top: -40px;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 255, 255, 0.22) 35%,
    rgba(140, 190, 255, 0.18) 55%,
    transparent
  );
  box-shadow: 0 0 24px rgba(120, 180, 255, 0.25);
  filter: blur(0.5px);
  opacity: 0;
}
.color-reveal.cr-play .cr-edge {
  animation: cr-edge-move 3.4s cubic-bezier(0.35, 0.05, 0.2, 1) forwards;
}
@keyframes cr-edge-move {
  0%   { top: -6%;  opacity: 0; }
  6%   { opacity: 1; }
  88%  { opacity: 0.65; }
  100% { top: 104%; opacity: 0; }
}

.cr-label {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #f2f2f2;
  background: rgba(20, 22, 28, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 28px #0007;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
}
.color-reveal.cr-play .cr-label {
  animation: cr-label-fade 3.4s ease-out forwards;
}
@keyframes cr-label-fade {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.96); }
  8%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -42%) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  body.cr-bw #app,
  body.cr-bw.cr-colorizing #app {
    filter: none !important;
    animation: none !important;
  }
  .color-reveal {
    display: none !important;
  }
}

/* ── Secondary shortcuts (after main flow) ── */
.secondary-grid,
.menu-hub {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 12px;
  width: 100%;
}
.sec-tile,
.menu-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  min-width: 0;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease;
}
.sec-tile:active,
.menu-tile:active { transform: scale(0.98); }
.sec-tile.active {
  border-color: var(--btn);
  background: var(--btn-soft);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--btn) 18%, transparent);
}
.sec-tile-wide {
  grid-column: 1 / -1;
}
.sec-panel {
  animation: cardIn 0.22s ease both;
}
.sec-panel.hidden { display: none !important; }

.sec-ico,
.menu-tile .mt-ico {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 17px;
  flex-shrink: 0;
  background: var(--btn-soft);
  border: 1px solid color-mix(in srgb, var(--btn) 20%, var(--border));
}
.sec-body,
.menu-tile .mt-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sec-title,
.menu-tile .mt-title {
  font-size: 13px;
  font-weight: 750;
  line-height: 1.15;
}
.sec-sub,
.menu-tile .mt-sub {
  font-size: 11px;
  color: var(--hint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-tile .mt-chev { display: none; }

.acc-card {
  padding: 0;
  overflow: hidden;
}
.acc-card .acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  min-width: 0;
}
.acc-card .acc-ico {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--btn) 14%, var(--secondary));
  border: 1px solid var(--border);
}
.acc-card .acc-titles {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.acc-card .acc-title {
  font-size: 14px;
  font-weight: 750;
  line-height: 1.15;
}
.acc-card .acc-sub {
  font-size: 11px;
  color: var(--hint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acc-card .acc-chev {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--secondary);
  position: relative;
  transition: transform 0.2s ease;
}
.acc-card .acc-chev::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--hint);
  border-bottom: 2px solid var(--hint);
  transform: translate(-50%, -60%) rotate(45deg);
}
.acc-card.open .acc-chev {
  transform: rotate(180deg);
  border-color: color-mix(in srgb, var(--btn) 45%, var(--border));
  background: color-mix(in srgb, var(--btn) 16%, var(--secondary));
}
.acc-card .acc-body {
  display: none;
  padding: 0 14px 14px;
  border-top: 1px solid transparent;
}
.acc-card.open .acc-body {
  display: block;
  border-top-color: var(--border);
  padding-top: 12px;
  animation: accIn 0.22s ease both;
}
@keyframes accIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.acc-card.open {
  border-color: color-mix(in srgb, var(--btn) 35%, var(--border));
  box-shadow: 0 6px 20px #0003;
}
.acc-card .section-title {
  margin-bottom: 0;
}

/* Kill horizontal page scroll from any child */
img, video, canvas, svg {
  max-width: 100%;
  height: auto;
}
