:root {
  --ink: #15121f; --muted: #615d78; --bg: #f7f6fb; --card: #fff; --line: #ebe7f6;
  --accent: #6c4cff; --accent-2: #ff5fa2; --soft: #efeaff; --mint: #12b88f; --red: #e5484d;
  --shadow: 0 24px 60px -24px rgba(40, 20, 120, .28), 0 2px 6px rgba(20, 10, 60, .05);
}
* { box-sizing: border-box; }
html, body { overflow-x: clip; }
body { margin: 0; font-family: "Plus Jakarta Sans", system-ui, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h2 { font-size: 17px; margin: 0 0 12px; letter-spacing: -.01em; }
.sub { color: var(--muted); font-weight: 600; font-size: 14px; }
.hidden-v { position: absolute; width: 2px; height: 2px; opacity: 0; pointer-events: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 700 14px/1.1 inherit; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 20px -10px rgba(40, 20, 120, .4); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary { background: linear-gradient(100deg, var(--accent), #9068ff); color: #fff; border: 0; }
.btn.big { padding: 15px 20px; font-size: 15px; flex: 1; flex-direction: column; gap: 2px; }
.btn.big small { font-size: 11px; font-weight: 600; opacity: .8; }
.msg { min-height: 18px; font-size: 13px; color: var(--red); margin-top: 6px; }
.msg.ok { color: var(--mint); }

/* header */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: rgba(255, 255, 255, .85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; text-decoration: none; color: var(--ink); }
.logo svg { width: 32px; height: 32px; }
.acct { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.acct[hidden] { display: none; }
.tries-chip { border: 0; background: var(--soft); color: #3d2a99; font: 700 13px/1 inherit; padding: 9px 12px; border-radius: 999px; cursor: pointer; }
.tries-chip.zero { background: #fff1e6; color: #8a3b00; }
.buy-btn { padding: 8px 14px; font-size: 13px; background: var(--ink); color: #fff; border-color: var(--ink); }
.me { position: relative; }
.me-chip { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px 4px 4px; font: 600 13px/1 inherit; cursor: pointer; }
.me-chip img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: #ddd; }
.me-menu { position: absolute; right: 0; top: 44px; width: 240px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 10px; }
.me-menu[hidden] { display: none; }
.mm-email { font-weight: 700; font-size: 13px; padding: 4px 8px 8px; word-break: break-all; }
.me-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 8px; border-radius: 8px; font: 600 13.5px/1 inherit; cursor: pointer; }
.me-menu button:hover { background: var(--soft); }
.me-menu .danger { color: var(--red); }

/* gate */
.gate { min-height: calc(100vh - 58px); display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(70% 60% at 0% 0%, #e6dfff, transparent 60%), radial-gradient(60% 50% at 100% 100%, #ffe0ee, transparent 60%), var(--bg); }
.gate[hidden], .app[hidden] { display: none; }
.gate-card { max-width: 460px; text-align: center; }
.badge { display: inline-block; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.gate h1 { font-size: clamp(36px, 7vw, 54px); line-height: 1.02; letter-spacing: -.04em; margin: 16px 0 12px; }
.gate h1 em { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; background: linear-gradient(100deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gate p { color: var(--muted); }
.perks { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 16px 0 22px; }
.perks span { font-size: 12.5px; font-weight: 700; padding: 6px 11px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: #3d2a99; }
.gbtn-box { display: flex; justify-content: center; min-height: 44px; }
.legal { font-size: 12px; }

/* app layout */
.app { display: grid; grid-template-columns: 340px 1fr; gap: 22px; max-width: 1280px; margin: 0 auto; padding: 22px 20px 40px; }
.wardrobe, .stage-col { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 18px; }
.add-tabs { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 12px; margin-bottom: 10px; }
.tab { flex: 1; border: 0; background: none; padding: 9px; border-radius: 9px; font: 700 13px/1 inherit; color: var(--muted); cursor: pointer; }
.tab.on { background: #fff; color: var(--ink); box-shadow: 0 2px 8px -4px rgba(0, 0, 0, .2); }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 12px; border: 2px dashed #d8d3e8; border-radius: 16px; cursor: pointer; text-align: center; transition: border-color .2s, background .2s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--soft); }
.drop[hidden], .link-box[hidden] { display: none; }
.drop-ic { font-size: 22px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--soft); color: var(--accent); }
.drop small, .link-box small { color: var(--muted); font-size: 12px; }
.link-box { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.link-box small { grid-column: 1 / -1; }
.link-box input { padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); font: 14px inherit; min-width: 0; }
.dresses { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.empty { grid-column: 1 / -1; color: var(--muted); font-size: 13px; text-align: center; margin: 14px 0; }
.dress { position: relative; border: 2px solid transparent; border-radius: 14px; overflow: hidden; background: var(--bg); cursor: pointer; transition: border-color .15s, transform .15s; }
.dress:hover { transform: translateY(-2px); }
.dress.on { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(108, 76, 255, .15); }
.dress img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: #fff; }
.dress .t { font-size: 11.5px; font-weight: 700; padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dress .rm { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); cursor: pointer; font-size: 12px; }
.dress.busy::after { content: "Preparing…"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .75); font-weight: 700; font-size: 12px; }

.stage { position: relative; aspect-ratio: 16 / 10; border-radius: 18px; overflow: hidden; background: #1b1830; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#cam { transform: scaleX(-1); }
.pill { position: absolute; left: 12px; top: 12px; z-index: 4; padding: 6px 11px; border-radius: 999px; background: rgba(20, 16, 34, .72); color: #fff; font-size: 12px; font-weight: 700; }
.timer { position: absolute; right: 12px; top: 12px; z-index: 4; padding: 6px 11px; border-radius: 10px; background: rgba(229, 72, 77, .9); color: #fff; font: 800 14px/1 ui-monospace, monospace; }
.timer[hidden], .snap[hidden] { display: none; }
.snap { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 5; border: 0; padding: 12px 20px; border-radius: 999px; background: #fff; font: 800 14px/1 inherit; cursor: pointer; box-shadow: 0 8px 22px -6px rgba(0, 0, 0, .45); }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 6; }
.flash.go { animation: flash .45s ease-out; }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }
.consent { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #2a2160, #15121f); color: #fff; }
.consent[hidden] { display: none; }
.consent-in { max-width: 440px; text-align: center; }
.c-ic { font-size: 32px; }
.consent h3 { margin: 6px 0 12px; font-size: 20px; }
.consent ul { list-style: none; padding: 0; margin: 0 0 16px; text-align: left; display: grid; gap: 7px; }
.consent li { font-size: 13px; color: #d9d4f2; padding: 8px 11px; border-radius: 10px; background: rgba(255, 255, 255, .07); }
.consent .btn.dark { background: #fff; color: var(--ink); }
.controls { display: flex; gap: 10px; margin-top: 14px; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(21, 18, 31, .55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; overflow: auto; }
.overlay[hidden] { display: none; }
.sheet { width: 100%; max-width: 560px; background: #fff; border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); max-height: calc(100vh - 32px); overflow: auto; }
.sheet-head { display: flex; gap: 10px; align-items: flex-start; }
.sheet-head > div { flex: 1; min-width: 0; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.sheet-title { font-weight: 700; color: var(--muted); font-size: 14px; }
.x { border: 0; background: var(--bg); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; }
#clip { width: 100%; border-radius: 14px; background: #000; max-height: 44vh; }
.sec { font-weight: 800; font-size: 14px; margin-top: 4px; }
.sec span { color: var(--muted); font-weight: 600; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ph { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--bg); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .cap { position: absolute; left: 0; right: 0; top: 0; padding: 5px 7px; font-size: 10.5px; font-weight: 700; color: #fff; background: linear-gradient(rgba(0, 0, 0, .55), transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph button { position: absolute; right: 6px; bottom: 6px; border: 0; border-radius: 8px; padding: 5px 8px; font: 700 11px/1 inherit; background: rgba(255, 255, 255, .92); cursor: pointer; }
.ph.empty { display: grid; place-items: center; border: 1.5px dashed #d8d3e8; color: #a8a4bb; font-size: 12px; text-align: center; padding: 8px; background: none; }
.pass { padding: 10px 12px; border-radius: 12px; background: var(--soft); color: #3d2a99; font-size: 13px; }
.note { font-size: 12px; color: var(--muted); margin: 0; }

.test-banner { padding: 9px 12px; border-radius: 10px; background: #fff4e6; color: #8a4b00; font-size: 12.5px; }
.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px; }
.pack { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 18px 8px 14px; border-radius: 16px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-family: inherit; transition: transform .15s, border-color .15s, box-shadow .15s; }
.pack:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.pack b { font-size: 26px; letter-spacing: -.03em; }
.pack span { font-weight: 700; font-size: 13px; }
.pack i { font-style: normal; font-size: 11.5px; color: var(--muted); }
.pack.hot { background: var(--ink); color: #fff; border-color: var(--ink); }
.pack.hot i { color: #cbc5e6; }
.pack em { position: absolute; top: -10px; font-style: normal; font-size: 10.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: var(--accent-2); color: #fff; }
.incl { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); z-index: 80; padding: 11px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; padding: 14px 12px 30px; }
  .stage { aspect-ratio: 3 / 4; }
  .dresses { grid-template-columns: repeat(3, 1fr); }
  .buy-btn { display: none; }
  .me-chip span { display: none; }
}
@media (max-width: 520px) { .packs { grid-template-columns: 1fr; } .controls { flex-direction: column; } .dresses { grid-template-columns: repeat(2, 1fr); } }
