/* ============================================================
   В магазин — premium layer
   Спокойные поверхности, крупная типографика, пилюли, 3D-тилт.
   ============================================================ */

:root {
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Unbounded', 'Manrope', -apple-system, sans-serif;

  --bg: #07060b;
  --surface: #0e0c15;
  --field: #15121e;
  --text: #f3f0f7;
  --muted: #8e889b;
  --border: rgba(255, 255, 255, 0.09);
  --on-primary: #0b0710;

  --card-top: rgba(255, 255, 255, 0.035);
  --card-bottom: rgba(255, 255, 255, 0.015);
  --card-border: rgba(255, 255, 255, 0.07);
  --card-shadow: none;
  --nav-bg: rgba(12, 10, 18, 0.82);
  --overlay: rgba(4, 3, 8, 0.78);
  --radius: 26px;
}

html[data-theme="light"] {
  --bg: #f4f1f8;
  --surface: #ffffff;
  --field: #ece7f3;
  --text: #181320;
  --muted: #6f697c;
  --border: rgba(20, 10, 40, 0.10);
  --on-primary: #ffffff;

  --card-top: rgba(255, 255, 255, 0.95);
  --card-bottom: rgba(255, 255, 255, 0.86);
  --card-border: rgba(20, 10, 40, 0.08);
  --card-shadow: 0 10px 30px rgba(30, 20, 50, 0.06);
  --nav-bg: rgba(255, 255, 255, 0.86);
  --overlay: rgba(28, 18, 40, 0.42);
}

html, body {
  background: var(--bg);
}

body {
  font-family: var(--font-body);
  letter-spacing: -0.01em;
}

.app {
  background:
    radial-gradient(120% 60% at 50% -20%, rgba(var(--primary-rgb), 0.055), transparent 62%),
    var(--bg);
}

/* ------------------------------ typography ------------------------------ */

h1, h2, h3,
.welcome-title,
.sheet-title,
.progress-title,
.finish-title,
.add-title,
.section-title,
.brand-copy h1 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  font-weight: 600;
}

h1 { font-size: 23px; }
h2 { letter-spacing: -0.02em; }

.eyebrow {
  font-family: var(--font-body);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.24em;
  opacity: 0.92;
}

.welcome-title { font-size: 32px; }
.welcome-sub { font-size: 13px; line-height: 1.6; }

/* ------------------------------ surfaces ------------------------------ */

.glass {
  background: var(--card-top);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: 26px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.add-card,
.product,
.finish-card,
.batch,
.stat-card {
  background: var(--card-top);
  border: 1px solid var(--card-border);
  box-shadow: none;
  border-radius: 24px;
}

.bg-glow {
  background: radial-gradient(circle, rgba(var(--primary-rgb), 0.13), transparent 70%);
  filter: blur(40px);
  opacity: 0.65;
}

.glow-box {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
}
html[data-theme="light"] .glow-box {
  background: rgba(20, 10, 40, 0.04);
  border-color: rgba(20, 10, 40, 0.08);
}

.brand-mark {
  width: 50px;
  height: 50px;
  flex-basis: 50px;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: none;
}

html[data-theme="light"] .brand-mark {
  background: rgba(20, 10, 40, 0.03);
  border-color: rgba(20, 10, 40, 0.08);
}

/* ------------------------------ buttons ------------------------------ */

.primary-btn,
.finish-btn,
.outline-btn,
.link-btn,
.seg,
.chip,
.list-pill,
.data-row,
.list-rename,
.template-apply,
.batch-repeat {
  font-family: var(--font-body);
}

.primary-btn {
  height: 54px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: 0 14px 34px rgba(var(--primary-rgb), 0.20);
}
.primary-btn:active { transform: scale(0.975); filter: brightness(1.05); }

.outline-btn {
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: var(--text);
  font-weight: 600;
}
html[data-theme="light"] .outline-btn { border-color: rgba(20, 10, 40, 0.14); }

.finish-btn {
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
}

/* remove arrows / chevrons from rows and cards */
.option-arrow,
.list-pill-chev,
.data-row > svg:last-child,
.sheet .data-row > svg:last-child {
  display: none !important;
}

.data-row {
  border-radius: 14px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 14px 2px;
}
.data-row:last-of-type { border-bottom: 0; }

.option-card {
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: none;
  padding: 16px;
}
.option-card.featured {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-color: rgba(var(--primary-rgb), 0.32);
  box-shadow: none;
}
html[data-theme="light"] .option-card {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(20, 10, 40, 0.08);
}

.option-icon {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ------------------------------ chips / inputs ------------------------------ */

.search-wrap {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
html[data-theme="light"] .search-wrap {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(20, 10, 40, 0.08);
}

.chip {
  border-radius: 999px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  padding: 8px 14px;
}
.chip.active {
  background: var(--primary);
  border-color: transparent;
  color: var(--on-primary);
}
html[data-theme="light"] .chip { border-color: rgba(20, 10, 40, 0.12); }

.field input,
.field select,
.auth-field input {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
html[data-theme="light"] .field input,
html[data-theme="light"] .field select {
  background: #fff;
  border-color: rgba(20, 10, 40, 0.10);
}

.segmented {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.seg {
  border-radius: 999px;
  font-weight: 600;
}
.seg.active {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: none;
}

/* ------------------------------ list pill / products ------------------------------ */

.list-pill {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 9px 14px;
  font-weight: 600;
}
html[data-theme="light"] .list-pill {
  background: rgba(20, 10, 40, 0.035);
  border-color: rgba(20, 10, 40, 0.08);
}

.product {
  padding: 14px 16px;
}
.product-name { font-weight: 650; letter-spacing: -0.01em; }
.badge {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.price-line b { font-weight: 700; }

.check { border-radius: 999px; }

/* ------------------------------ bottom nav ------------------------------ */

.bottom-nav {
  border-radius: 999px;
  background: var(--nav-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}
html[data-theme="light"] .bottom-nav {
  border-color: rgba(20, 10, 40, 0.08);
  box-shadow: 0 16px 36px rgba(40, 20, 70, 0.12);
}

.nav-btn {
  border-radius: 999px;
  font-weight: 600;
}
.nav-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: none;
}
html[data-theme="light"] .nav-btn.active {
  background: rgba(20, 10, 40, 0.06);
}

/* ------------------------------ sheet ------------------------------ */

.modal-root {
  background: var(--overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.sheet {
  position: relative;
  border-radius: 30px 30px 0 0;
  background: var(--surface);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.45);
}

.sheet-wave {
  position: absolute;
  left: -2%;
  right: -2%;
  top: -20px;
  height: 22px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.6;
}
.sheet-wave svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: var(--surface);
}

.sheet-grab {
  background: rgba(255, 255, 255, 0.18);
}

/* ------------------------------ welcome ------------------------------ */

.welcome {
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(var(--primary-rgb), 0.09), transparent 60%),
    var(--bg);
}

.welcome-logo {
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

 .welcome-note,
.welcome-credit {
  color: color-mix(in srgb, var(--muted) 88%, transparent);
}
.welcome-credit a { text-decoration: none; }

/* ------------------------------ garland ------------------------------ */

.garland {
  top: calc(env(safe-area-inset-top) + 4px);
  height: 26px;
  z-index: 106;
}

.garland::before { display: none; }

.garland .bulb {
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  animation: bulbGlow 3.6s ease-in-out infinite;
  box-shadow: none;
}
.garland .bulb::after {
  inset: -6px;
  opacity: 0.22;
  filter: blur(6px);
}
.garland .bulb.c0 { background: #f7e9d0; box-shadow: 0 0 10px rgba(247, 233, 208, 0.55); }
.garland .bulb.c1 { background: var(--primary); box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.55); }
.garland .bulb.c2 { background: var(--accent); box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.45); }

@keyframes bulbGlow {
  0%, 100% { opacity: 0.38; }
  50% { opacity: 0.95; }
}

/* ------------------------------ 3D / motion ------------------------------ */

.brand-mark,
.welcome-logo,
.option-card,
.progress-card {
  transform-style: preserve-3d;
  will-change: transform;
}

.sheet .sheet-inner { transform: translateZ(0); }

@media (prefers-reduced-motion: reduce) {
  .garland .bulb { animation: none; opacity: 0.6; }
}

/* refinements */
body { overflow-x: hidden; }
.sheet { overflow-x: hidden; }
.sheet-wave { left: 0; right: 0; }

.check {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
}
.check.on {
  background: var(--primary);
  border-color: transparent;
  color: var(--on-primary);
}
html[data-theme="light"] .check { border-color: rgba(20, 10, 40, 0.16); }

.welcome-note {
  font-size: 11.5px;
  line-height: 1.6;
  color: color-mix(in srgb, var(--muted) 96%, transparent);
}
.welcome-credit { font-size: 11px; }
.accent-opt { font-size: 10px; }

/* surface depth */
.glass {
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}
.add-card,
.product,
.finish-card,
.batch,
.stat-card {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.check { border-color: rgba(255, 255, 255, 0.22); }
.qty-btn { border-color: rgba(var(--primary-rgb), 0.35); }
html[data-theme="light"] .glass,
html[data-theme="light"] .product,
html[data-theme="light"] .add-card {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(20, 10, 40, 0.09);
  box-shadow: 0 10px 26px rgba(40, 20, 70, 0.06);
}

/* refined garland */
.garland {
  top: calc(env(safe-area-inset-top) + 6px);
  height: 24px;
  overflow: visible;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.garland::before { display: none; }
.garland svg { width: 100%; height: 24px; display: block; overflow: visible; }
.garland .core {
  animation: bulbGlow 4.2s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.garland .bulb { display: none; }

/* softer app atmosphere */
.app::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0.35), transparent 18%, transparent 82%, rgba(0,0,0,0.45));
  z-index: 0;
}

/* final polish */
.add-card .chev { display: none; }
.nav-btn.active {
  background: rgba(var(--primary-rgb), 0.14);
  color: var(--primary);
}
.nav-btn.active svg { color: var(--primary); }
.check { background: rgba(255, 255, 255, 0.02); }
html[data-theme="light"] .check { background: rgba(20, 10, 40, 0.02); }

/* fir branch */
.branch {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 102px;
  z-index: 2;
  pointer-events: none;
  background: transparent;
  opacity: 0.96;
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
}
.branch svg { width: 100%; height: 102px; display: block; overflow: visible; background: transparent; }
.branch .lamp { animation: bulbGlow 4s ease-in-out infinite; }

html[data-branch="1"] .view { padding-top: calc(env(safe-area-inset-top) + 114px); }

/* branch: kill inherited white outline from base svg rule */
.branch svg { stroke: none; }
.branch svg path { stroke-linecap: round; }

/* glowing lamps */
.branch .glow { animation: lampPulse 4.2s ease-in-out infinite; }
.branch .lamp { animation: lampCore 4.2s ease-in-out infinite; }

@keyframes lampPulse {
  0%, 100% { opacity: 0.28; }
  50% { opacity: 0.92; }
}
@keyframes lampCore {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

.branch .glow { mix-blend-mode: screen; }
.branch .lamp {
  filter: drop-shadow(0 0 3px rgba(255, 233, 196, 0.95)) drop-shadow(0 0 9px rgba(255, 233, 196, 0.55));
}

/* motion layer */
.motion-spot {
  position: fixed;
  left: 0;
  top: 0;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, rgba(var(--primary-rgb), 0.08), transparent 66%);
  filter: blur(8px);
  mix-blend-mode: screen;
}

@media (hover: hover) {
  .primary-btn, .outline-btn, .chip, .nav-btn, .product, .data-row {
    transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), color 0.2s var(--ease);
  }
  .chip:hover { border-color: rgba(var(--primary-rgb), 0.5); color: var(--text); }
  .product:hover { border-color: rgba(255, 255, 255, 0.16); }
  .data-row:hover { background: rgba(255, 255, 255, 0.03); }
  .nav-btn:hover { background: rgba(255, 255, 255, 0.05); }
}
