@font-face {
  font-family: "Unbounded";
  src: url("/miniapp/fonts/Unbounded-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/miniapp/fonts/Manrope-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #FFF8F5;
  --bg2: #F7ECE8;
  --ink: #2A1A20;
  --muted: #8A6A72;
  --line: #E8D4D6;
  --cta: #8A2942;
  --cta-ink: #FFF8F5;
  --accent: #8A2942;
  --chip: #F3D4D6;
  --chip-on: #8A2942;
  --chip-on-ink: #FFF8F5;
  --warn-bg: #F7ECE8;
  --rec-bg: #FBECEE;
  --radius: 22px;
  --radius-photo: 20px;
  --radius-btn: 999px;
  --display: "Unbounded", "Manrope", "Segoe UI", sans-serif;
  --ui: "Manrope", "Segoe UI", "Helvetica Neue", sans-serif;
  --wordmark-track: 0.14em;
  --wordmark-weight: 600;
  --wordmark-size: 16px;
  --wm-color: rgba(42, 26, 32, 0.07);
  --tab-active: #8A2942;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 52px;
  --tabs-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  background: #f0e4df;
  color: var(--ink);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, a { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.icon-btn[hidden] {
  display: grid !important;
  visibility: hidden;
  pointer-events: none;
}

body {
  display: flex;
  justify-content: center;
  padding: 0;
}
.app {
  width: 100%;
  max-width: 430px;
  min-width: 320px;
  min-height: 100svh;
  height: 100svh;
  max-height: 100svh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line);
}
@media (min-width: 480px) {
  body { padding: 16px 0; background: #e9d6d1; }
  .app {
    min-height: min(844px, calc(100svh - 32px));
    height: min(844px, calc(100svh - 32px));
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(42, 26, 32, 0.16);
  }
}

.top {
  flex: 0 0 auto;
  min-height: var(--header-h);
  padding: calc(6px + var(--safe-top)) 6px 4px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  background: var(--bg);
}
.icon-btn, .icon-spacer {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--ink);
  border-radius: 50%;
}
.icon-btn:hover { background: var(--bg2); }
.top-title { text-align: center; line-height: 1.15; }
.wordmark {
  font-family: var(--display);
  font-weight: var(--wordmark-weight);
  font-size: var(--wordmark-size);
  letter-spacing: var(--wordmark-track);
  text-transform: uppercase;
}
.top-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 1px;
}

.banner {
  margin: 0 16px 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8e4e6;
  color: #7a1d33;
  font-size: 13px;
  line-height: 1.35;
}

#stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  position: relative;
}

.tabs {
  flex: 0 0 auto;
  min-height: var(--tabs-h);
  padding: 4px 8px calc(8px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  display: flex;
  background: var(--bg);
  position: relative;
}
.tab {
  flex: 1;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
}
.tab.on { color: var(--tab-active); }
.tab span { font-size: 10px; font-weight: 600; letter-spacing: 0.01em; }
.home-ind {
  position: absolute;
  left: 50%;
  bottom: calc(6px + var(--safe-bottom));
  width: 118px;
  height: 4px;
  margin-left: -59px;
  border-radius: 4px;
  background: var(--ink);
  opacity: 0.18;
}

.cta, a.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  min-height: 52px;
  padding: 0 18px;
  background: var(--cta);
  color: var(--cta-ink);
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  width: 100%;
  text-decoration: none;
}
.cta:disabled { opacity: 0.45; cursor: default; }
.ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  width: 100%;
  border-radius: var(--radius-btn);
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 15px;
  font-weight: 600;
}
.link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  width: 100%;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.text-link {
  display: inline;
  color: var(--accent);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.pad-view { padding: 10px 20px 28px; }
h1 {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 8px;
}
.lead, .fine, .cat-note, .mock-label, .hypo, .terms {
  color: var(--muted);
  line-height: 1.4;
}
.lead { font-size: 14px; margin-bottom: 14px; }
.fine { font-size: 12px; margin: 8px 0; }
.cat-note { font-size: 12px; margin: 0 4px 12px; }

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.35;
}
.consent input {
  appearance: none;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  margin-top: 1px;
  border: 2px solid var(--accent);
  border-radius: 6px;
  background: #fff;
}
.consent input:checked {
  background: var(--accent) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='%23FFF8F5' stroke-width='2' d='M3 8.2 6.4 12 13 4.5'/></svg>") center / 14px no-repeat;
}

/* HOME */
.home, .home-hero, .look, .look-pic, .waiting, .wait-pic {
  height: 100%;
  min-height: 100%;
}
.home-hero, .look-pic, .wait-pic {
  position: relative;
  overflow: hidden;
}
.home-hero {
  margin: 8px 16px 0;
  border-radius: var(--radius-photo);
  min-height: 520px;
}
.home-hero > img, .look-pic > img, .wait-pic > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.home-grad, .look-grad, .wait-veil {
  position: absolute;
  inset: 28% 0 0;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg) 12%, transparent) 28%, var(--bg) 88%);
}
.home-copy {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.home-offer {
  font-size: 26px;
  margin: 0;
  color: var(--ink);
}
.home-note { font-size: 13px; color: var(--ink); line-height: 1.35; }
.ba {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ba figure {
  background: rgba(255, 248, 245, 0.72);
  border-radius: 14px;
  overflow: hidden;
}
.ba img { height: 88px; width: 100%; object-fit: cover; }
.ba figcaption {
  font-size: 11px;
  font-weight: 600;
  padding: 6px 8px 8px;
  color: var(--ink);
}

/* CATALOG */
.catalog { padding: 10px 12px 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-btn);
  background: var(--chip);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}
.chip.on { background: var(--chip-on); color: var(--chip-on-ink); }
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.card {
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  width: 100%;
  border-radius: var(--radius-photo);
}
.card .pic {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: var(--radius-photo);
  background: var(--bg2);
}
.card .pic img { width: 100%; height: 100%; object-fit: cover; }
.card-grad {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 48%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.62));
  pointer-events: none;
}
.card .meta {
  position: absolute;
  left: 10px; right: 10px; bottom: 10px;
  color: #fff;
}
.card .name { font-size: 15px; font-weight: 650; }
.card .tag { font-size: 11px; color: rgba(255, 255, 255, 0.78); font-weight: 500; }

/* LOOK */
.look-body {
  position: absolute;
  left: 20px; right: 20px; bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.look-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(42, 26, 32, 0.72);
}
.look-name {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0;
}
.look-desc { font-size: 14px; color: var(--ink); line-height: 1.35; }

/* UPLOAD */
.ex-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 4px 0 8px;
}
.examples {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.ex .pic {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg2);
}
.ex img { width: 100%; height: 100%; object-fit: cover; }
.ex .badge {
  position: absolute;
  top: 6px; right: 6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #8A2942;
}
.ex.ok .badge { background: #2F6B4F; }
.ex figcaption {
  font-size: 10px;
  line-height: 1.25;
  color: var(--muted);
  font-weight: 500;
  margin-top: 6px;
  min-height: 26px;
}
.picker {
  position: relative;
  border-radius: var(--radius-photo);
  overflow: hidden;
  background: var(--bg2);
  min-height: 150px;
  margin-bottom: 10px;
}
.picker img { width: 100%; height: 180px; object-fit: cover; }
.picker-empty {
  height: 150px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}
.change {
  position: absolute;
  right: 12px;
  bottom: 12px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-btn);
  background: rgba(255, 248, 245, 0.94);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

/* WAITING */
.wait-body {
  position: absolute;
  left: 20px; right: 20px; bottom: 24px;
}
.wait-body h1 { margin-bottom: 8px; }
.wait-body p { font-size: 14px; line-height: 1.4; max-width: 300px; color: var(--ink); }
.bar {
  margin-top: 16px;
  height: 4px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 36%;
  border-radius: 4px;
  background: var(--accent);
  animation: indeterminate 1.4s ease-in-out infinite;
}
@keyframes indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(380%); }
}

/* PREVIEW / RESULT */
.preview { display: flex; flex-direction: column; min-height: 100%; }
.pv-pic {
  position: relative;
  margin: 8px 16px 0;
  border-radius: var(--radius-photo);
  overflow: hidden;
  background: var(--bg2);
  aspect-ratio: 1 / 1;
}
.pv-pic img { width: 100%; height: 100%; object-fit: cover; }
.wm { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.wm-inner {
  position: absolute;
  left: -40%; top: -20%;
  width: 180%; height: 140%;
  transform: rotate(-24deg);
  display: flex; flex-wrap: wrap; align-content: flex-start;
  gap: 56px 72px;
  color: var(--wm-color);
  font-family: var(--display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.pv-body { padding: 14px 20px 16px; display: flex; flex-direction: column; gap: 8px; }
.pv-body h1 { margin: 0; font-size: 22px; }
.pv-body p { font-size: 13px; color: var(--muted); line-height: 1.4; }
.mock-label { color: var(--ink) !important; font-weight: 600; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* PAYWALL */
.paywall { display: flex; flex-direction: column; }
.pay-hero {
  position: relative;
  margin: 8px 16px 0;
  border-radius: var(--radius-photo);
  overflow: hidden;
  height: 200px;
  background: var(--bg2);
}
.pay-hero img { width: 100%; height: 100%; object-fit: cover; }
.pay-hero-grad {
  position: absolute; inset: 30% 0 0;
  background: linear-gradient(180deg, transparent, rgba(42, 26, 32, 0.72));
}
.pay-hero-copy {
  position: absolute; left: 16px; right: 16px; bottom: 14px;
  color: #fff;
}
.pay-hero-copy h1 { color: #fff; font-size: 22px; margin: 0; }
.pay-hero-copy p { font-size: 12px; color: rgba(255, 255, 255, 0.8); margin-top: 4px; }
.pay-body { padding: 14px 20px 20px; }
.packs { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.pack {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: 10px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: left;
  width: 100%;
}
.pack.on { background: var(--rec-bg); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.pack .nm { font-size: 15px; font-weight: 650; }
.pack .sel {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.pack .per { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.pack .price { font-size: 16px; font-weight: 650; white-space: nowrap; }
.hypo { font-size: 11px; margin-bottom: 6px; }
.terms { font-size: 12px; margin-bottom: 12px; }

/* PROFILE */
.profile h1 { margin-bottom: 14px; }
.bal {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.bal .k {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.bal .v {
  font-family: var(--ui);
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.bal .s { font-size: 13px; color: var(--muted); margin-top: 6px; }
.sec {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 8px 0;
}
.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 16px; }
.thumbs button, .thumbs .t {
  padding: 0;
  border: 0;
  background: var(--bg2);
  border-radius: var(--radius-photo);
  overflow: hidden;
  height: 112px;
}
.thumbs button:first-child, .thumbs .t:first-child {
  grid-column: 1 / -1;
  height: 156px;
}
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.buy { display: flex; flex-direction: column; margin-bottom: 12px; }
.buy .item {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.buy .item span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.empty {
  min-height: 112px;
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin-bottom: 16px;
}
.profile .ghost { margin-bottom: 8px; }

/* ERROR */
.err {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
}
.err-art { flex: 1; display: grid; place-items: center; min-height: 220px; }
.err-frame {
  width: 160px;
  height: 200px;
  border-radius: var(--radius-photo);
  background: var(--bg2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--muted);
}
.err h1 { margin: 0 0 8px; }
.err p { font-size: 14px; color: var(--muted); line-height: 1.4; margin-bottom: 18px; }

.stub-dialog {
  width: min(360px, calc(100% - 32px));
  border: 0;
  border-radius: 22px;
  padding: 22px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 16px 48px rgba(42, 26, 32, 0.2);
}
.stub-dialog::backdrop { background: rgba(42, 26, 32, 0.4); }
.stub-dialog h2 { font-family: var(--display); font-size: 20px; margin-bottom: 10px; }
.stub-dialog p { font-size: 14px; color: var(--muted); line-height: 1.45; margin-bottom: 18px; }


.bind-box {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin: 8px 0 12px;
  display: grid;
  gap: 8px;
}
.bind-box code {
  display: block;
  font-size: 11px;
  word-break: break-all;
  color: var(--ink);
}
.bind-enter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}
.bind-enter input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  background: #fff;
}
#bind-status { min-height: 1em; }
