/* The Tale Weaver v3 — pastel rose atelier. Mobile first. Minimum text 14px, reading 16–17px. */
:root {
  --bg: #fdf5f6; --bg-2: #fbeaef; --paper: #fffaf8; --card: #ffffff; --card-2: #fff4f6;
  --ink: #4a2838; --ink-2: #6f4a5c; --muted: #8e6f7e; --line: #f0d4dd; --line-2: #e7bfcc;
  --rose: #e0789a; --rose-d: #b9506f; --rose-l: #fcdbe5; --blush: #fde9ee;
  --lav: #a98bdc; --lav-l: #efe6fb; --gold: #c39a4e; --gold-l: #f8ecd0; --sage: #6fa98a; --sage-l: #e3f2ea;
  --shadow: 0 10px 30px rgba(185, 80, 111, .12); --shadow-sm: 0 3px 10px rgba(185, 80, 111, .10);
  --r: 22px; --r-sm: 14px; --tap: 48px;
  --font-ui: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-title: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  --font-script: 'Great Vibes', 'Snell Roundhand', cursive;
  --top-h: 64px; --tab-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
:root[data-theme="plum"] {
  --bg: #23141f; --bg-2: #2d1a28; --paper: #34202f; --card: #3a2435; --card-2: #432a3e;
  --ink: #fbeaf1; --ink-2: #ecc9d8; --muted: #c9a3b6; --line: #5a3a50; --line-2: #6d4862;
  --rose: #f095b3; --rose-d: #f6b3c8; --rose-l: #5b2f45; --blush: #3f2236;
  --lav: #c4aaf0; --lav-l: #3d2d55; --gold: #e2c37e; --gold-l: #4a3a24; --sage: #8fd0ad; --sage-l: #24402f;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35); --shadow-sm: 0 3px 10px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; font-family: var(--font-ui); font-size: 1.0625rem; line-height: 1.55;
  color: var(--ink); background: var(--bg);
  background-image: radial-gradient(circle at 12% 0%, var(--bg-2) 0, transparent 42%), radial-gradient(circle at 100% 30%, var(--lav-l) 0, transparent 38%);
  background-attachment: fixed; overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}
img, svg { max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--rose); outline-offset: 2px; border-radius: 10px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-title); font-weight: 700; line-height: 1.15; margin: 0; color: var(--ink); }
h1 { font-size: clamp(2rem, 6vw, 3rem); } h2 { font-size: clamp(1.55rem, 4vw, 2rem); } h3 { font-size: 1.35rem; }
p { margin: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 10px 14px; border-radius: 10px; z-index: 100; }
.skip-link:focus { left: 8px; }
.script { font-family: var(--font-script); font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: .9375rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 12px 22px;
  border-radius: 999px; border: 1.5px solid transparent; font-weight: 800; font-size: 1rem; letter-spacing: .01em;
  transition: transform .15s ease, box-shadow .2s ease, background .2s; text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--rose), var(--rose-d)); color: #fff; box-shadow: 0 8px 20px rgba(185, 80, 111, .3); }
:root[data-theme="plum"] .btn-primary { color: #2b1422; }
.btn-primary:hover { box-shadow: 0 10px 26px rgba(185, 80, 111, .4); }
.btn-soft { background: var(--card); border-color: var(--line-2); color: var(--rose-d); }
.btn-soft:hover { background: var(--blush); }
.btn-ghost { background: transparent; color: var(--rose-d); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-block { width: 100%; }
.icon-btn {
  width: var(--tap); height: var(--tap); border-radius: 50%; border: 1.5px solid var(--line); background: var(--card);
  display: inline-grid; place-items: center; color: var(--rose-d); flex: 0 0 auto;
}
.icon-btn svg { width: 22px; height: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--card); font-size: .9375rem; font-weight: 700; color: var(--ink-2);
}
button.chip { min-height: var(--tap); }
.chip-coins { color: #8a6418; background: var(--gold-l); border-color: #ecd59f; }
:root[data-theme="plum"] .chip-coins { color: var(--gold); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--lav-l); color: var(--ink-2); font-size: .875rem; font-weight: 700; }
.tag.is-hit { background: var(--rose-l); color: var(--rose-d); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.stars { color: #e6a93a; letter-spacing: 2px; font-size: 1.15rem; }
.stars .off { color: var(--line-2); }

/* ---------- top bar & tab bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; padding-top: var(--safe-t);
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1320px; margin: 0 auto; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 16px; }
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; min-width: 0; text-align: left; }
.brand-mark { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--rose-l); border: 2px solid #fff; box-shadow: var(--shadow-sm); flex: 0 0 auto; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-script { font-family: var(--font-script); font-size: 1.7rem; line-height: 1; color: var(--rose-d); white-space: nowrap; }
.brand-sub { font-size: .875rem; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { display: none; gap: 4px; margin: 0 auto; background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; padding: 4px; }
.topnav-btn { min-height: 44px; padding: 8px 18px; border: 0; border-radius: 999px; background: none; font-weight: 800; color: var(--ink-2); display: inline-flex; align-items: center; gap: 8px; }
.topnav-btn svg { width: 20px; height: 20px; }
.topnav-btn.is-active { background: var(--rose-l); color: var(--rose-d); }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar-actions #menuBtn { display: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + var(--safe-b)); background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(185, 80, 111, .08);
}
.tabbar button { min-height: 56px; border: 0; background: none; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .875rem; font-weight: 800; color: var(--muted); }
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button.is-active { color: var(--rose-d); background: var(--rose-l); }

.app { max-width: 1320px; margin: 0 auto; padding: 16px 16px calc(var(--tab-h) + 28px + var(--safe-b)); outline: none; }
.view { animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.eyebrow { font-size: .875rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--rose-d); }
.quote { font-family: var(--font-title); font-style: italic; font-size: 1.3rem; line-height: 1.45; color: var(--ink); }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }
.stack-sm > * + * { margin-top: 8px; }

/* ---------- welcome & character creator ---------- */
.welcome { display: grid; gap: 20px; align-items: center; }
.welcome-hero { text-align: center; padding: 8px 0; }
.welcome-hero .script { font-size: clamp(3rem, 12vw, 5rem); color: var(--rose-d); line-height: 1; display: block; }
.welcome-hero h1 { font-size: clamp(1.4rem, 4.6vw, 2rem); font-style: italic; font-weight: 600; color: var(--ink-2); }
.welcome-figure { width: min(260px, 64vw); margin: 8px auto 0; filter: drop-shadow(0 18px 24px rgba(185, 80, 111, .18)); }
.welcome-figure svg { width: 100%; height: auto; display: block; }
.creator { display: grid; gap: 16px; }
.creator-preview { position: relative; text-align: center; }
.creator-preview .figure { width: min(240px, 60vw); margin: 0 auto; }
.creator-preview .figure svg { width: 100%; height: auto; display: block; }
.field-label { display: block; font-weight: 800; font-size: .9375rem; color: var(--ink-2); margin-bottom: 8px; }
.input {
  width: 100%; min-height: var(--tap); padding: 12px 16px; border-radius: var(--r-sm); border: 1.5px solid var(--line-2);
  background: var(--paper); font-size: 1.0625rem; outline: none;
}
.input:focus { border-color: var(--rose); box-shadow: 0 0 0 4px var(--rose-l); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch-dot { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--line-2); }
.swatch-dot[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--rose); }
.choice-chip { min-height: var(--tap); padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--card); font-weight: 700; font-size: .9375rem; }
.choice-chip[aria-pressed="true"] { background: var(--rose-l); border-color: var(--rose); color: var(--rose-d); }

/* ---------- atelier layout ---------- */
.day-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.day-head h2 { font-size: clamp(1.4rem, 4vw, 1.9rem); }
.steps { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: 6px; font-size: .875rem; font-weight: 800; color: var(--muted); }
.steps .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 1.5px solid var(--line-2); font-size: .875rem; }
.steps li.is-done .dot { background: var(--sage-l); border-color: var(--sage); color: var(--sage); }
.steps li.is-now .dot { background: var(--rose); border-color: var(--rose); color: #fff; }
.steps li.is-now { color: var(--rose-d); }
.steps .lbl { display: none; }
.steps .bar { width: 14px; height: 2px; background: var(--line-2); border-radius: 2px; }

.atelier { display: grid; gap: 16px; grid-template-areas: "client" "stage" "panel"; }
.atelier > .client { grid-area: client; }
.atelier > .stage { grid-area: stage; }
.atelier > .panel { grid-area: panel; }
.atelier[data-step="1"] > .stage, .atelier[data-step="5"] > .stage { display: none; }

.client-card { display: grid; grid-template-columns: 84px 1fr; gap: 14px; align-items: center; }
.portrait { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; background: linear-gradient(160deg, var(--rose-l), var(--lav-l)); border: 3px solid #fff; box-shadow: var(--shadow-sm); }
.portrait svg { width: 100%; height: 100%; display: block; }
.portrait-lg { width: 120px; height: 120px; }
.client-name { font-family: var(--font-title); font-size: 1.45rem; font-weight: 700; line-height: 1.15; }
.client-role { font-size: .9375rem; color: var(--muted); font-style: italic; }
.client-extra { grid-column: 1 / -1; }
.atelier[data-step="2"] .client-extra, .atelier[data-step="3"] .client-extra, .atelier[data-step="4"] .client-extra { display: none; }
.wish { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--blush); border: 1px dashed var(--line-2); }

.stage {
  position: relative; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 18%, #fff 0, var(--blush) 55%, var(--rose-l) 100%); box-shadow: var(--shadow);
}
:root[data-theme="plum"] .stage { background: radial-gradient(ellipse at 50% 18%, #5a3550 0, #3a2236 60%, #2a1826 100%); }
.stage::before { content: ""; position: absolute; inset: 0; background: url("../assets/atelier.webp") center / cover; opacity: .14; filter: sepia(.4) hue-rotate(-30deg) saturate(.7); pointer-events: none; }
.stage-figure { position: relative; display: block; width: 100%; max-width: 360px; margin: 0 auto; aspect-ratio: 300 / 520; }
.stage-figure > svg { width: 100%; height: 100%; display: block; }
.stage-tools { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 8px; z-index: 2; }
.stage-badge { position: relative; z-index: 2; display: flex; justify-content: center; padding: 10px 60px 0; }
.stage-badge .heart-meter { min-height: 40px; padding: 4px 14px; }
.heart-meter { display: flex; align-items: center; gap: 8px; }
.heart-meter .hearts { font-size: 1.2rem; letter-spacing: 1px; }
.heart-meter .lbl { font-size: .875rem; font-weight: 800; color: var(--rose-d); }

.panel { min-width: 0; }
.panel h3 { margin-bottom: 4px; }
.stance { display: grid; gap: 10px; }
.stance-btn {
  text-align: left; padding: 14px 16px; border-radius: var(--r-sm); border: 1.5px solid var(--line-2); background: var(--card);
  min-height: var(--tap); font-size: 1rem; line-height: 1.45; display: grid; gap: 4px;
}
.stance-btn .kind { font-size: .875rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--lav); }
.stance-btn[aria-pressed="true"] { border-color: var(--rose); background: var(--blush); box-shadow: 0 0 0 3px var(--rose-l); }
.reply { padding: 14px 16px; border-radius: var(--r-sm); background: var(--lav-l); font-family: var(--font-title); font-style: italic; font-size: 1.15rem; }
.reply .feel { display: block; font-family: var(--font-ui); font-style: normal; font-weight: 800; font-size: .9375rem; color: var(--rose-d); margin-top: 6px; }

/* design tabs & option grid */
.cat-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; scroll-snap-type: x proximity; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab { flex: 0 0 auto; min-height: var(--tap); padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--card); font-weight: 800; font-size: .9375rem; color: var(--ink-2); scroll-snap-align: start; display: inline-flex; gap: 6px; align-items: center; }
.cat-tab[aria-selected="true"] { background: var(--rose); border-color: var(--rose); color: #fff; }
:root[data-theme="plum"] .cat-tab[aria-selected="true"] { color: #2b1422; }
.cat-tab .ok { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; background: rgba(255, 255, 255, .35); font-size: .8rem; }
.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.opt {
  position: relative; display: grid; gap: 6px; justify-items: center; text-align: center; padding: 12px 10px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line); background: var(--card); min-height: 132px; transition: transform .15s, box-shadow .2s, border-color .2s;
}
.opt:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.opt[aria-pressed="true"] { border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-l); background: var(--card-2); }
.opt .art { width: 64px; height: 64px; display: grid; place-items: center; }
.opt .art svg { width: 100%; height: 100%; }
.opt.opt-pattern .art { width: 76px; height: 120px; }
.opt .name { font-weight: 800; font-size: .9375rem; line-height: 1.25; }
.opt .tags { justify-content: center; }
.opt .badge { position: absolute; top: 8px; left: 8px; font-size: .875rem; }
.opt .lock { position: absolute; inset: 0; border-radius: inherit; background: color-mix(in srgb, var(--card) 70%, transparent); display: grid; place-items: center; font-weight: 800; color: #8a6418; font-size: .9375rem; }
.req-ribbon { position: absolute; top: 8px; right: 8px; background: var(--rose); color: #fff; border-radius: 999px; padding: 2px 8px; font-size: .875rem; font-weight: 800; }
.opt-desc { font-size: .9375rem; color: var(--ink-2); margin: 10px 0 0; min-height: 1.5em; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-top: 18px; }

/* minigames */
.mini { padding: 16px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--paper); }
.mini + .mini { margin-top: 14px; }
.cut-track {
  position: relative; height: 92px; margin-top: 10px; border-radius: 16px; overflow: hidden; touch-action: none; user-select: none;
  background: repeating-linear-gradient(90deg, var(--card) 0 22px, var(--blush) 22px 24px); border: 1.5px dashed var(--line-2);
}
.cut-fabric { position: absolute; inset: 14px 0; width: 0; border-radius: 0 10px 10px 0; transition: width .12s; }
.cut-line { position: absolute; left: 0; right: 0; top: 50%; height: 0; border-top: 2.5px dashed rgba(74, 40, 56, .45); }
.cut-band { position: absolute; left: 0; right: 0; top: calc(50% - 16px); height: 32px; background: rgba(224, 120, 154, .08); }
.shears { position: absolute; top: 50%; left: 0; width: 64px; height: 64px; transform: translate(-18px, -50%); pointer-events: none; transition: left .12s; }
.cut-track.is-done { border-style: solid; border-color: var(--sage); }
.progress { height: 12px; border-radius: 99px; background: var(--rose-l); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--rose), var(--lav)); border-radius: inherit; transition: width .2s; }
.tw-node { cursor: pointer; }
.tw-node.is-next circle:nth-child(2) { animation: pulse 1.3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 50% { transform: scale(1.18); } }
.tw-glow { filter: drop-shadow(0 0 4px rgba(255, 200, 220, .9)); }
.tw-garment.is-breeze { animation: breeze 4s ease-in-out infinite alternate; transform-origin: 150px 110px; }
@keyframes breeze { 0% { transform: skewX(0deg); } 50% { transform: skewX(1.2deg) translateY(-1px); } 100% { transform: skewX(-1.2deg); } }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* mirror reveal */
.mirror { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; cursor: pointer; touch-action: none; border: 0; padding: 0; width: 100%; background: transparent; }
.mirror canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.mirror-hint { position: relative; z-index: 2; padding: 10px 18px; border-radius: 999px; background: rgba(255, 255, 255, .85); color: var(--rose-d); font-weight: 800; box-shadow: var(--shadow-sm); }
.reveal-stars { font-size: 2.1rem; letter-spacing: 6px; text-align: center; }
.reveal-stars span { display: inline-block; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.reveal-stars span:nth-child(2) { animation-delay: .25s; } .reveal-stars span:nth-child(3) { animation-delay: .5s; }
@keyframes pop { from { transform: scale(0) rotate(-30deg); opacity: 0; } to { transform: none; opacity: 1; } }
.breakdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.breakdown .b { padding: 10px 12px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); font-size: .9375rem; }
.breakdown .b strong { display: block; font-size: .875rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tip { padding: 12px 14px; border-radius: 12px; background: var(--gold-l); color: #6e5016; font-size: .9375rem; }
:root[data-theme="plum"] .tip { color: var(--gold); }
.coins-won { font-weight: 800; color: #8a6418; }
:root[data-theme="plum"] .coins-won { color: var(--gold); }

/* journal */
.journal-page {
  background: linear-gradient(var(--paper), var(--paper)) padding-box; border-radius: var(--r); border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 20px; background-image: repeating-linear-gradient(transparent 0 33px, rgba(224, 120, 154, .12) 33px 34px);
}
.prompt { padding: 14px 16px; border-radius: var(--r-sm); background: var(--blush); border-left: 4px solid var(--rose); font-family: var(--font-title); font-style: italic; font-size: 1.2rem; }
.textarea {
  width: 100%; min-height: 150px; padding: 14px 16px; border-radius: var(--r-sm); border: 1.5px solid var(--line-2); background: var(--card);
  font-size: 1.0625rem; line-height: 1.7; resize: vertical; outline: none;
}
.textarea:focus { border-color: var(--rose); box-shadow: 0 0 0 4px var(--rose-l); }
.moods { display: flex; flex-wrap: wrap; gap: 8px; }
.mood { min-height: var(--tap); padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--card); font-weight: 700; font-size: .9375rem; display: inline-flex; gap: 6px; align-items: center; }
.mood[aria-pressed="true"] { background: var(--lav-l); border-color: var(--lav); }
.oracle { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 14px; border-radius: var(--r-sm); background: var(--lav-l); }
.die { width: 64px; height: 64px; border-radius: 16px; border: 0; background: linear-gradient(145deg, #fff, var(--rose-l)); box-shadow: var(--shadow-sm), inset 0 -3px 0 rgba(185, 80, 111, .2); font-size: 2rem; display: grid; place-items: center; color: var(--rose-d); font-weight: 800; }
.die.is-rolling { animation: roll .6s ease; }
@keyframes roll { 30% { transform: rotate(160deg) scale(.9); } 70% { transform: rotate(320deg) scale(1.08); } 100% { transform: rotate(360deg); } }
.starters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.starters .chip { flex: 0 0 auto; }
.saved-note { font-size: .875rem; color: var(--sage); font-weight: 800; }

/* lookbook */
.look-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.look-card { display: grid; grid-template-rows: auto 1fr; overflow: hidden; padding: 0; }
.look-card .art { background: radial-gradient(ellipse at 50% 20%, #fff, var(--blush) 60%, var(--rose-l)); aspect-ratio: 3 / 4; display: grid; place-items: center; overflow: hidden; }
:root[data-theme="plum"] .look-card .art { background: radial-gradient(ellipse at 50% 20%, #5a3550, #3a2236); }
.look-card .art svg { height: 100%; width: auto; }
.look-card .body { padding: 14px 16px 16px; display: grid; gap: 8px; align-content: start; }
.look-card .t { font-family: var(--font-title); font-size: 1.3rem; font-weight: 700; line-height: 1.15; }
.look-card .act { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.look-card .act .btn { min-height: 44px; padding: 8px 14px; font-size: .9375rem; }
.empty { text-align: center; padding: 36px 20px; }
.empty .big { font-size: 3rem; }

/* chronicle */
.entry { display: grid; gap: 10px; }
.entry .when { font-size: .875rem; font-weight: 800; color: var(--rose-d); text-transform: uppercase; letter-spacing: .06em; }
.entry .txt { white-space: pre-wrap; font-size: 1.0625rem; line-height: 1.7; }
.relics { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.relic { text-align: center; padding: 14px 10px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--card-2); }
.relic .ico { font-size: 2.2rem; }
.relic.is-locked { opacity: .45; filter: grayscale(1); }

/* finale */
.runway { display: flex; gap: 12px; overflow-x: auto; padding: 8px 4px 16px; scroll-snap-type: x mandatory; }
.runway .model { flex: 0 0 150px; scroll-snap-align: center; text-align: center; animation: walkIn .7s ease both; }
.runway .model svg { width: 150px; height: 260px; }
.runway .model .n { font-weight: 800; font-size: .9375rem; }
@keyframes walkIn { from { opacity: 0; transform: translateY(30px) scale(.94); } to { opacity: 1; transform: none; } }
.diploma {
  position: relative; text-align: center; padding: 28px 22px; border-radius: var(--r); background: var(--paper);
  border: 2px solid var(--gold); box-shadow: inset 0 0 0 6px var(--paper), inset 0 0 0 7px var(--gold-l), var(--shadow);
}
.diploma .script { font-size: clamp(2.2rem, 8vw, 3.2rem); color: var(--rose-d); line-height: 1.1; }
.diploma .title { font-family: var(--font-title); font-size: 1.6rem; font-weight: 700; }
.seal { width: 74px; height: 74px; border-radius: 50%; margin: 10px auto 0; display: grid; place-items: center; color: #fff; font-size: 1.8rem; background: radial-gradient(circle at 35% 30%, #f3a3bb, #c2557a 60%, #8d3456); box-shadow: 0 8px 16px rgba(141, 52, 86, .35), inset 0 2px 4px rgba(255, 255, 255, .5); }

/* ---------- sheet (bottom sheet on mobile, dialog on desktop) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(74, 40, 56, .35); backdrop-filter: blur(2px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 26px 26px 0 0; box-shadow: 0 -10px 40px rgba(74, 40, 56, .25); animation: up .28s cubic-bezier(.2, .9, .3, 1);
  padding-bottom: var(--safe-b);
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 10px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 1.6rem; }
.sheet-body { overflow-y: auto; padding: 16px 18px 22px; overscroll-behavior: contain; }
.menu-list { display: grid; gap: 8px; }
.menu-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 58px; padding: 10px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--card); text-align: left; font-weight: 700; }
.menu-item .ico { font-size: 1.4rem; width: 32px; text-align: center; }
.menu-item small { display: block; font-weight: 600; color: var(--muted); font-size: .875rem; }
.slider { display: grid; gap: 4px; }
.slider input { width: 100%; accent-color: var(--rose); min-height: 44px; }
.shop-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--card); }
.shop-item + .shop-item { margin-top: 10px; }
.shop-item .ico { font-size: 2rem; text-align: center; }
.shop-item .art { width: 56px; height: 24px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 16px + var(--safe-b)); transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 12px 18px; border-radius: 16px; background: var(--ink); color: var(--bg); font-weight: 700; font-size: .9375rem; box-shadow: var(--shadow); animation: up .25s ease; text-align: center; }

/* ---------- responsive ---------- */
@media (min-width: 560px) {
  .options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .breakdown { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .atelier[data-step="2"] > .stage, .atelier[data-step="3"] > .stage { position: sticky; top: calc(var(--top-h) + var(--safe-t) + 6px); z-index: 5; }
  .atelier[data-step="2"] .stage-figure, .atelier[data-step="3"] .stage-figure { height: 38vh; height: 38dvh; width: auto; max-width: 100%; }
  .atelier[data-step="2"] .stage-figure { height: 33vh; height: 33dvh; }
  .heart-meter .hearts { font-size: 1.05rem; }
  .brand-script { font-size: 1.45rem; }
  .topbar-actions #soundBtn { display: none; }
  .client-card .client-extra .quote { font-size: 1.2rem; }
}
@media (max-width: 380px) {
  .brand-text { display: none; }
  .options { gap: 8px; }
}
@media (min-width: 768px) {
  .tabbar { display: none; }
  .topnav { display: flex; }
  .topbar-actions #menuBtn { display: inline-grid; }
  .app { padding: 22px 22px 40px; }
  .toasts { bottom: 24px; }
  .steps .lbl { display: inline; }
  .atelier { grid-template-columns: minmax(280px, 40%) minmax(0, 1fr); grid-template-areas: "client panel" "stage panel"; align-items: start; }
  .atelier[data-step="1"], .atelier[data-step="5"] { grid-template-areas: "client panel"; }
  .atelier > .client, .atelier > .stage { position: sticky; }
  .atelier > .stage { top: calc(var(--top-h) + 16px); }
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(620px, 92vw); max-height: 86vh; border-radius: 26px; transform: translate(-50%, -50%); animation: fade .2s; }
  .welcome { grid-template-columns: 1fr 1fr; }
  .creator { grid-template-columns: minmax(240px, 1fr) 1.3fr; align-items: start; }
  .creator-preview { position: sticky; top: 90px; }
}
@media (min-width: 1200px) {
  .atelier { grid-template-columns: 300px minmax(0, 1fr) 420px; grid-template-areas: "client stage panel"; }
  .atelier[data-step="1"], .atelier[data-step="5"] { grid-template-columns: 340px minmax(0, 1fr); grid-template-areas: "client panel"; }
  .atelier > .client { top: calc(var(--top-h) + 16px); }
  .stage-figure { max-width: 420px; }
  .options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1200px) and (max-height: 820px) { .stage-figure { max-width: 340px; } }
@media (orientation: landscape) and (max-height: 520px) {
  .atelier[data-step="2"] .stage-figure, .atelier[data-step="3"] .stage-figure { height: 70vh; }
  .atelier { grid-template-columns: 40% 1fr; grid-template-areas: "stage panel" "client panel"; }
  .atelier > .stage { position: sticky; top: calc(var(--top-h) + 8px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- print (chronicle & diploma) ---------- */
.print-root { display: none; }
@media print {
  body { background: #fff; }
  body > *:not(.print-root) { display: none !important; }
  .print-root { display: block !important; color: #2b1822; font-family: Georgia, serif; }
  .print-root .page { break-after: page; padding: 24px; }
  .print-root .page:last-child { break-after: auto; }
  .print-root h1, .print-root h2 { font-family: 'Cormorant Garamond', Georgia, serif; }
  .print-root .diploma { box-shadow: none; }
  .print-root svg { max-height: 360px; }
}

/* ---------- storybook intro ---------- */
.view-intro { position: fixed; inset: 0; z-index: 90; }
.intro {
  position: absolute; inset: 0; overflow: hidden; cursor: pointer; user-select: none; -webkit-user-select: none; color: #4a2838;
  display: grid; grid-template-rows: auto 1fr auto; padding: calc(14px + var(--safe-t)) 18px calc(18px + var(--safe-b));
  background: radial-gradient(ellipse at 50% 28%, #fffaf8 0, #fde6ee 42%, #f5e2f4 70%, #e8dbf7 100%);
}
.intro-glow { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .55; pointer-events: none; animation: glow 9s ease-in-out infinite alternate; }
.intro-glow.g1 { width: 46vmax; height: 46vmax; left: -14vmax; top: -12vmax; background: #fbd0de; }
.intro-glow.g2 { width: 40vmax; height: 40vmax; right: -12vmax; bottom: -14vmax; background: #e4d3fb; animation-delay: -4s; }
@keyframes glow { to { transform: translate(4vmax, 3vmax) scale(1.1); } }
.petal { position: absolute; top: -40px; border-radius: 70% 0 70% 0; opacity: .85; pointer-events: none; animation: petalFall linear infinite; box-shadow: inset -2px -2px 4px rgba(194, 90, 124, .18); }
@keyframes petalFall { 0% { transform: translate3d(0, -40px, 0) rotate(0deg); } 50% { transform: translate3d(calc(var(--dx) * -.6), 55vh, 0) rotate(220deg); } 100% { transform: translate3d(var(--dx), 112vh, 0) rotate(520deg); } }
.intro-top { position: relative; z-index: 3; display: flex; justify-content: space-between; gap: 10px; }
.intro-btn { min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 1.5px solid rgba(194, 90, 124, .35); background: rgba(255, 255, 255, .7); color: #b9506f; font-weight: 800; font-size: .9375rem; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.intro-stage { position: relative; z-index: 2; display: grid; place-items: center; min-height: 0; }
.intro-scene { display: none; width: 100%; max-width: 760px; text-align: center; }
.intro-scene.is-on { display: block; animation: sceneIn 1s ease both; }
@keyframes sceneIn { from { opacity: 0; transform: translateY(16px) scale(.98); filter: blur(4px); } }
.intro-foot { position: relative; z-index: 3; display: grid; justify-items: center; gap: 8px; }
.intro-dots { display: flex; gap: 8px; }
.intro-dots span { width: 9px; height: 9px; border-radius: 50%; background: rgba(194, 90, 124, .25); transition: all .3s; }
.intro-dots span.on { width: 26px; border-radius: 9px; background: #e0789a; }
.intro-hint { font-size: .9375rem; font-weight: 700; color: #a07888; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }

/* scene 1: the needle writes the title */
.intro-kicker { font-family: var(--font-title); font-style: italic; font-size: clamp(1.3rem, 4.4vw, 1.8rem); color: #8e6f7e; opacity: 0; animation: fadeIn 1.2s .2s ease forwards; }
@keyframes fadeIn { to { opacity: 1; } }
.intro-write { position: relative; display: inline-block; margin: 6px 0 0; }
.intro-title { display: block; font-family: var(--font-script); font-size: clamp(2.7rem, 12.5vw, 7.2rem); line-height: 1.3; white-space: nowrap; color: #c25a7c; padding: 0 .15em; clip-path: inset(-20% 100% -20% 0); animation: write 2.8s .9s cubic-bezier(.45, .1, .3, 1) forwards; text-shadow: 0 6px 20px rgba(224, 120, 154, .25); }
@keyframes write { to { clip-path: inset(-20% -5% -20% 0); } }
.intro-needle { position: absolute; top: 46%; left: 0; width: clamp(56px, 12vw, 90px); transform: translate(-30%, -50%) rotate(-12deg); animation: needleRun 2.8s .9s cubic-bezier(.45, .1, .3, 1) forwards, needleOut .6s 3.8s ease forwards; }
@keyframes needleRun { to { left: 100%; } }
@keyframes needleOut { to { opacity: 0; transform: translate(10%, -90%) rotate(-30deg); } }
.intro-thread { display: block; width: min(560px, 86vw); height: 26px; margin: 0 auto; }
.intro-thread path { stroke-dasharray: 700; stroke-dashoffset: 700; animation: thread 2.6s 1.1s ease forwards; }
@keyframes thread { to { stroke-dashoffset: 0; } }
.intro-sub { margin-top: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; font-size: .9375rem; color: #b9506f; opacity: 0; animation: fadeIn 1s 3.6s ease forwards; }

/* scene 2: the velvet journal opens */
.book { position: relative; width: min(300px, 68vw, 46vh); aspect-ratio: 3 / 4; margin: 0 auto; perspective: 1600px; }
.book-page {
  position: absolute; inset: 0; border-radius: 6px 16px 16px 6px; padding: 9% 9% 8%; text-align: left; overflow: hidden;
  background: #fffaf6 repeating-linear-gradient(transparent 0 27px, rgba(224, 120, 154, .16) 27px 28px);
  box-shadow: 0 24px 50px rgba(120, 50, 80, .22), inset 10px 0 18px -10px rgba(120, 50, 80, .25);
}
.hand { font-family: var(--font-title); font-style: italic; font-size: clamp(1.02rem, 3.6vw, 1.2rem); line-height: 1.5; color: #5a3044; margin: 0 0 8px; clip-path: inset(0 100% 0 0); animation: write 1.3s ease forwards; }
.hand.h0 { font-family: var(--font-script); font-style: normal; font-size: clamp(1.7rem, 6vw, 2.1rem); color: #c25a7c; animation-delay: 2.7s; }
.hand.h1 { animation-delay: 3.5s; } .hand.h2 { animation-delay: 4.9s; } .hand.h3 { animation-delay: 6s; }
.page-flower { position: absolute; right: 9%; bottom: 6%; font-size: 1.6rem; opacity: 0; animation: fadeIn 1s 7.1s forwards; }
.book-cover {
  position: absolute; inset: 0; z-index: 2; border-radius: 6px 16px 16px 6px; transform-origin: left center; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .22), transparent 45%), repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .05) 0 2px, transparent 2px 9px), linear-gradient(150deg, #e58aa8, #c25a7c 55%, #9c3d5f);
  box-shadow: 0 24px 50px rgba(120, 50, 80, .3), inset 14px 0 18px -8px rgba(60, 10, 30, .35), inset 0 0 0 1px rgba(255, 255, 255, .2);
  animation: coverOpen 1.7s 1.2s cubic-bezier(.6, .05, .3, 1) forwards;
}
@keyframes coverOpen { 0% { transform: rotateY(0); } 100% { transform: rotateY(-168deg); } }
.cover-frame { position: absolute; inset: 9%; border: 2px solid #f3d68f; border-radius: 8px; box-shadow: inset 0 0 0 6px rgba(243, 214, 143, .25); display: grid; place-items: center; align-content: center; gap: 8px; padding: 10px; text-align: center; }
.cover-title { font-family: var(--font-script); font-size: clamp(2rem, 9vw, 2.7rem); color: #fbe7b3; line-height: 1.1; text-shadow: 0 2px 0 rgba(120, 40, 70, .35); }
.cover-sub { font-family: var(--font-title); font-size: clamp(.95rem, 3.4vw, 1.1rem); color: #fff1d6; font-style: italic; }
.cover-seal { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; margin-top: 6px; background: radial-gradient(circle at 35% 30%, #fbe7b3, #e0b55c 60%, #a87b2c); box-shadow: 0 4px 10px rgba(80, 30, 50, .35); }
.corner { position: absolute; width: 34px; height: 34px; }
.corner.c1 { left: 5%; top: 4%; } .corner.c2 { right: 5%; top: 4%; transform: scaleX(-1); }
.corner.c3 { left: 5%; bottom: 4%; transform: scaleY(-1); } .corner.c4 { right: 5%; bottom: 4%; transform: scale(-1, -1); }
.ribbon { position: absolute; left: 62%; bottom: -46px; width: 16px; height: 66px; background: linear-gradient(90deg, #f4c0cf, #e58aa8); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%); }

/* scene 3: three promises */
.intro-trio { display: grid; gap: 14px; width: min(560px, 100%); margin: 0 auto; text-align: left; }
.vg { display: grid; grid-template-columns: 86px 1fr; gap: 14px; align-items: center; padding: 12px 16px; border-radius: 20px; background: rgba(255, 255, 255, .72); box-shadow: 0 10px 26px rgba(185, 80, 111, .12); opacity: 0; animation: vgIn .9s ease forwards; }
@keyframes vgIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.vg.v0 { animation-delay: .3s; } .vg.v1 { animation-delay: 1.6s; } .vg.v2 { animation-delay: 2.9s; }
.vg-art { width: 86px; height: 86px; border-radius: 50%; overflow: hidden; background: linear-gradient(160deg, #fcdbe5, #efe6fb); display: grid; place-items: center; border: 3px solid #fff; }
.vg-art svg { width: 100%; height: 100%; }
.vg.v1 .vg-art svg, .vg.v2 .vg-art svg { width: 78%; height: 78%; }
.vg h3 { font-size: clamp(1.25rem, 4.2vw, 1.5rem); color: #4a2838; }
.vg p { font-size: 1rem; color: #7a5466; }

/* scene 4: the invitation */
.end-spark { font-size: 2.6rem; color: #e0b55c; animation: twinkle 2s ease-in-out infinite; }
@keyframes twinkle { 50% { transform: scale(1.25) rotate(20deg); opacity: .7; } }
.intro-end { font-family: var(--font-title); font-size: clamp(2.2rem, 8vw, 3.6rem); font-weight: 700; color: #4a2838; margin-top: 6px; }
.intro-endsub { font-family: var(--font-title); font-style: italic; font-size: clamp(1.15rem, 4vw, 1.4rem); color: #7a5466; max-width: 460px; margin: 10px auto 22px; }
.intro-open { font-size: 1.1rem; padding: 14px 30px; min-height: 54px; }

@media (min-width: 900px) {
  .intro-trio { grid-template-columns: repeat(3, 1fr); width: min(900px, 100%); text-align: center; }
  .vg { grid-template-columns: 1fr; justify-items: center; padding: 22px 18px; }
  .vg-art { width: 120px; height: 120px; }
}
@media (max-height: 560px) {
  .book { width: min(220px, 40vh); }
  .intro-trio { gap: 8px; }
  .vg { padding: 8px 12px; grid-template-columns: 64px 1fr; }
  .vg-art { width: 64px; height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .petal, .intro-glow, .intro-needle { display: none; }
  .intro-title, .hand { clip-path: none; }
  .book-cover { display: none; }
  .intro-kicker, .intro-sub, .vg, .page-flower { opacity: 1; }
}
