:root {
  --ink: #1f1a24;
  --paper: #fbf8f6;
  --card: #ffffff;
  --line: #ebe3df;
  --muted: #847a86;
  --plum: #6d3b5e;
  --plum-2: #8e5480;
  --blush: #f4e3e5;
  --gold: #b8935a;
  --good: #3f7d5c;
  --bad: #b2404f;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', system-ui, sans-serif;
  --radius: 14px;
  --shadow: 0 10px 30px -18px rgba(40, 20, 40, .45);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--sans); font-weight: 400; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: .01em; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px;
  padding: 12px 28px; background: rgba(251, 248, 246, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--serif); font-size: 28px; font-weight: 700; letter-spacing: .32em; color: var(--ink); text-decoration: none; display: flex; flex-direction: column; line-height: 1; }
.brand small { font-family: var(--sans); font-size: 9px; letter-spacing: .5em; color: var(--muted); font-weight: 500; margin-top: 4px; text-transform: uppercase; }
.tabs { display: flex; gap: 4px; margin: 0 auto; }
.tabs button { background: none; border: 0; padding: 10px 16px; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--ink); }
.wallet { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.gift { background: var(--blush); border: 1px solid #ead0d4; color: var(--plum); border-radius: 99px; padding: 6px 12px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin-right: 6px; }
.gift:disabled { opacity: .45; cursor: default; }
.coin { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f8e3a6, #c9a24f 60%, #94722f); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); display: inline-block; vertical-align: -3px; }
.coin.sm { width: 13px; height: 13px; vertical-align: -2px; }

main { max-width: 1240px; margin: 0 auto; padding: 28px 28px 80px; }

/* ---------- shared ---------- */
.eyebrow { font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.btn { border: 1px solid var(--ink); background: var(--ink); color: #fff; padding: 11px 22px; border-radius: 99px; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; font-weight: 500; transition: transform .15s, background .15s; }
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.plum { background: var(--plum); border-color: var(--plum); }
.btn.sm { padding: 7px 14px; font-size: 10.5px; }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; padding: 4px 10px; border-radius: 99px; background: var(--blush); color: var(--plum); }
.stage { position: relative; aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; background: #eee; box-shadow: var(--shadow); }
.stage .backdrop { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .avatar { position: absolute; left: 50%; bottom: 3%; height: 90%; transform: translateX(-50%); filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .25)); }
.stage .snap { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s; }
.stage .snap.ready { opacity: 1; }
.stage .viewer3d { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; cursor: grab; touch-action: none; }
.stage .viewer3d:active { cursor: grabbing; }
.stage .viewer3d.pixel { image-rendering: pixelated; }
.viewer-ui { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.viewer-ui .hint { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); opacity: .85; }
.viewer-btns { display: flex; gap: 4px; background: rgba(255, 255, 255, .82); backdrop-filter: blur(8px); border-radius: 99px; padding: 4px; pointer-events: auto; }
.viewer-btns button { border: 0; background: none; border-radius: 99px; padding: 6px 11px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); }
.viewer-btns button.on { background: var(--ink); color: #fff; }
.card .thumb img, .hairopt img { width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .3s; }
.card .thumb img.ready, .hairopt img.ready { opacity: 1; }
.hairopt img { aspect-ratio: 1; background: linear-gradient(180deg, #faf5f3, #f2eae7); border-radius: 8px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 0 0 18px; }
.section-head h2 { font-size: 34px; }
.empty { color: var(--muted); font-style: italic; font-family: var(--serif); font-size: 18px; }

/* ---------- events ---------- */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; align-items: center; background: linear-gradient(120deg, #2a1838, #6d3b5e 70%, #b07a8e); color: #fff; border-radius: 22px; padding: 36px 40px; margin-bottom: 36px; overflow: hidden; }
.hero h1 { font-size: 52px; line-height: 1.02; }
.hero p { color: #f1dce6; max-width: 440px; line-height: 1.6; }
.hero .eyebrow { color: #e6c7d6; }
.hero .stage { max-width: 230px; justify-self: end; width: 100%; box-shadow: 0 20px 40px -20px #000; }
.events { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 22px; }
.event { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.event:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.ev-art { position: relative; height: 150px; overflow: hidden; }
.ev-art .backdrop { width: 100%; height: 100%; display: block; }
.ev-art .badge { position: absolute; top: 10px; right: 10px; background: rgba(255, 255, 255, .92); border-radius: 99px; padding: 4px 10px; font-size: 11px; font-weight: 600; letter-spacing: .08em; }
.ev-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.ev-body h3 { font-size: 24px; }
.ev-body p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.reqs { list-style: none; margin: 0; padding: 0; font-size: 13px; display: grid; gap: 4px; }
.reqs li::before { content: '◇'; margin-right: 8px; color: var(--gold); }
.reqs li.met::before { content: '✓'; color: var(--good); font-weight: 700; }
.reqs li.unmet { color: var(--muted); }
.ev-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; }
.reward { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stars { color: var(--gold); letter-spacing: 2px; }

/* ---------- dressing room ---------- */
.dressing { display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); gap: 28px; align-items: start; }
.stage-col { position: sticky; top: 86px; display: grid; gap: 12px; }
.stage-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stage-tools select { flex: 1; min-width: 140px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 99px; background: #fff; font: inherit; font-size: 13px; }
.wearing { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 8px; }
.wearing h4 { margin: 0; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.worn-list { display: flex; flex-wrap: wrap; gap: 6px; }
.worn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 4px 4px 10px; border-radius: 99px; border: 1px solid var(--line); }
.worn .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); }
.worn.unowned { border-color: var(--gold); background: #fbf4e6; }
.worn button { border: 0; background: #f1ebe8; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; line-height: 1; }
.buybar { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; padding-top: 6px; border-top: 1px dashed var(--line); }

.ev-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; display: grid; grid-template-columns: 1fr auto; gap: 10px 18px; align-items: center; }
.ev-panel h2 { font-size: 28px; }
.ev-panel p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.ev-panel .reqs { grid-column: 1 / -1; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: thin; }
.cats button { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 8px 14px; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.cats button.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.cats button .n { opacity: .6; margin-left: 4px; }
.closet-tools { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.closet-tools label { display: flex; gap: 6px; align-items: center; cursor: pointer; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.card { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card.worn { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.card .thumb { aspect-ratio: 1; border-radius: 8px; background: linear-gradient(180deg, #faf5f3, #f2eae7); display: grid; place-items: center; overflow: hidden; }
.card .thumb svg { width: 86%; height: 86%; }
.card .brand-name { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.card .name { font-family: var(--serif); font-size: 17px; font-weight: 600; line-height: 1.1; }
.card .price { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.card .price.owned { color: var(--good); font-weight: 500; letter-spacing: .1em; text-transform: uppercase; font-size: 10.5px; }
.card .tag-worn { position: absolute; top: 14px; left: 14px; background: var(--ink); color: #fff; font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; padding: 3px 7px; border-radius: 99px; }
.card .lock { position: absolute; top: 14px; right: 14px; background: #fbf4e6; color: #8a6a2a; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; padding: 3px 7px; border-radius: 99px; border: 1px solid #ecd9b0; }
.swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.sw { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; background: var(--c); box-shadow: 0 0 0 1px #d8cfcc; padding: 0; }
.sw.on { box-shadow: 0 0 0 2px var(--ink); }
.sw.none { background: repeating-linear-gradient(45deg, #fff 0 3px, #e4dcd9 3px 6px); }
.card .actions { display: flex; gap: 6px; margin-top: auto; }
.card .actions .btn { flex: 1; padding: 7px 8px; letter-spacing: .1em; white-space: nowrap; }

/* beauty */
.beauty { display: grid; gap: 22px; }
.beauty h4 { margin: 0 0 10px; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.beauty .swatches { gap: 8px; }
.beauty .sw { width: 30px; height: 30px; border-width: 3px; }
.hairgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.hairopt { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 6px 6px 8px; display: grid; gap: 4px; font-size: 12px; text-align: center; }
.hairopt.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.hairopt svg { width: 100%; aspect-ratio: 1; background: linear-gradient(180deg, #faf5f3, #f2eae7); border-radius: 8px; }
.toggle { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }

/* ---------- shop ---------- */
.shop-head { background: linear-gradient(120deg, #f4e3e5, #fbf8f6); border: 1px solid var(--line); border-radius: 22px; padding: 30px 34px; margin-bottom: 24px; }
.shop-head h1 { font-size: 46px; }
.shop-head p { color: var(--muted); margin: 6px 0 0; }

/* ---------- me ---------- */
.me { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 32px; align-items: start; }
.me .stage-col { top: 86px; }
.namefield { display: grid; gap: 6px; }
.namefield input { font: inherit; font-family: var(--serif); font-size: 26px; font-weight: 600; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 4px 0; outline: none; }
.stats { display: flex; gap: 12px; }
.stat { flex: 1; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-family: var(--serif); font-size: 26px; }
.stat span { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.look { display: grid; gap: 6px; }
.look .stage { box-shadow: none; border: 1px solid var(--line); }
.look .title { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.look .sub { font-size: 12px; color: var(--muted); }
.look .actions { display: flex; gap: 6px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(25, 14, 28, .6); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; }
.modal-card { background: var(--paper); border-radius: 22px; width: min(760px, 100%); max-height: 92vh; overflow: auto; display: grid; grid-template-columns: 260px 1fr; box-shadow: 0 30px 80px -30px #000; }
.modal-card .stage { border-radius: 22px 0 0 22px; box-shadow: none; aspect-ratio: auto; height: 100%; min-height: 420px; }
.modal-body { padding: 30px 32px; display: flex; flex-direction: column; gap: 14px; }
.modal-body h2 { font-size: 34px; }
.big-stars { position: relative; font-size: 38px; letter-spacing: 6px; color: #e6dcd6; line-height: 1; width: max-content; }
.big-stars .fill { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: var(--gold); white-space: nowrap; width: 0; transition: width 1.6s cubic-bezier(.2, .8, .2, 1); }
.score-line { display: flex; gap: 22px; align-items: baseline; }
.score-line b { font-family: var(--serif); font-size: 46px; line-height: 1; }
.medal { display: inline-block; padding: 5px 12px; border-radius: 99px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; font-weight: 600; }
.medal.gold { background: #f6e7bd; color: #7a5a14; }
.medal.silver { background: #e8e8ee; color: #50505e; }
.medal.bronze { background: #f1d9c6; color: #7a4a2a; }
.medal.none { background: #eee; color: #777; }
.breakdown { font-size: 13px; color: var(--muted); display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.breakdown li { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 4px 0; }
.judging { font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--plum); }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 99px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 8px 14px; padding: 10px 16px; }
  .tabs { order: 3; width: 100%; justify-content: space-between; margin: 0; }
  .tabs button { padding: 8px 6px; font-size: 11px; letter-spacing: .14em; }
  .wallet { margin-left: auto; }
  main { padding: 18px 16px 60px; }
  .hero { grid-template-columns: 1fr; padding: 26px; }
  .hero h1 { font-size: 38px; }
  .hero .stage { justify-self: center; max-width: 200px; }
  .dressing, .me { grid-template-columns: minmax(0, 1fr); }
  .gift { padding: 5px 10px; font-size: 10px; }
  .stage-col { position: static; }
  .dressing .stage { max-width: 320px; width: 100%; margin: 0 auto; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .modal-card { grid-template-columns: 1fr; }
  .modal-card .stage { border-radius: 22px 22px 0 0; max-height: 46vh; min-height: 0; aspect-ratio: auto; height: 46vh; }
  .ev-panel { grid-template-columns: 1fr; }
}
