/* minju. — her own, more elegant take on AKASHIC's look: a deep night-rose field with a very faint champagne grid floor,
   a glass bunny companion, and hairline glass windows with two small champagne ticks. Night is the default; dawn is the
   light theme. */
:root {
  --bg: #0F070E; --bg-2: #1C0F1A; --core: rgba(214, 150, 176, .20);
  --surface: rgba(255, 240, 245, .035); --surface-grad: linear-gradient(180deg, rgba(255, 240, 245, .055), rgba(255, 240, 245, .02));
  --surface-solid: #1E111C; --surface-2: rgba(255, 240, 245, .03);
  --ink: #F4E6EB; --ivory: #FBF0F3; --ink-soft: #BFA0AD; --ink-mute: #A88896; --kicker: #D9BFA0;
  --line: rgba(243, 217, 177, .28); --line-soft: rgba(243, 217, 177, .16); --line-strong: rgba(243, 217, 177, .55);
  --accent: #F2C3CF; --accent-2: #C77D97; --accent-ink: #2A1020; --rose: #F2C3CF; --rose-deep: #C77D97; --blush: #F2C3CF; --blush-2: #C77D97;
  --blush-soft: rgba(242, 195, 207, .12); --champagne: #F3D9B1; --gold: #F3D9B1; --grid: rgba(243, 217, 177, .10);
  --ok: #A8E0C2; --danger: #FF9DAE; --paper: #FBF0F3; --paper-ink: #3B2230;
  --g-rose-hi: #FFE7EE; --g-rose-lo: #C77D97; --g-champ-hi: #F3D9B1; --g-champ-lo: #7E3A6C; --halo: #F2C3CF; --glass-line: #FFE7EE; --eye: #FFF4F7;
  --display: 'Cormorant Garamond', 'Noto Serif KR', serif;
  --serif: 'Noto Serif KR', 'Cormorant Garamond', serif;
  --serif-ko: 'Noto Serif KR', 'Cormorant Garamond', serif;
  --sans: 'Noto Sans KR', -apple-system, 'Apple SD Gothic Neo', 'Segoe UI', sans-serif;
  --radius: 10px; --shadow: none; --hair: .5px;
  --nav-h: 56px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F3E7E2; --bg-2: #FBF3EF; --core: rgba(232, 160, 180, .22);
  --surface: rgba(255, 255, 255, .45); --surface-grad: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, .4));
  --surface-solid: #FFF9F6; --surface-2: rgba(110, 46, 79, .04);
  --ink: #3B2230; --ivory: #2E1A26; --ink-soft: #7A5A68; --ink-mute: #8E6E7C; --kicker: #9A6A3A;
  --line: rgba(154, 106, 58, .32); --line-soft: rgba(154, 106, 58, .18); --line-strong: rgba(154, 106, 58, .6);
  --accent: #A8476C; --accent-2: #C77D97; --accent-ink: #FFF4F7; --rose: #A8476C; --rose-deep: #C77D97; --blush: #C77D97; --blush-2: #C77D97;
  --blush-soft: rgba(199, 125, 151, .14); --champagne: #9A6A3A; --gold: #9A6A3A; --grid: rgba(154, 106, 58, .10);
  --ok: #2F6B4F; --danger: #A1283B; --paper: #FFFBF7; --paper-ink: #3B2230;
  --g-rose-hi: #FFFFFF; --g-rose-lo: #E29AB2; --g-champ-hi: #F3D9B1; --g-champ-lo: #E29AB2; --halo: #E8A0B4; --glass-line: #B5577F; --eye: #8E3556;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--sans); overflow-x: hidden; min-height: 100dvh;
  -webkit-font-smoothing: antialiased; word-break: keep-all; overflow-wrap: anywhere; }
body { background: var(--bg); }
.field { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background: radial-gradient(90% 55% at 50% 24%, var(--core) 0%, transparent 60%), linear-gradient(180deg, var(--bg-2) 0%, color-mix(in srgb, var(--bg-2) 50%, var(--bg)) 55%, var(--bg) 100%); }
.field-glow { display: none; }
.field-grid { position: absolute; left: -50%; right: -50%; bottom: -20px; height: 34vh; transform: perspective(300px) rotateX(66deg); transform-origin: bottom;
  background-image: linear-gradient(var(--grid) .5px, transparent .5px), linear-gradient(90deg, var(--grid) .5px, transparent .5px); background-size: 40px 40px;
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 70%); mask-image: linear-gradient(to top, #000 0%, transparent 70%); }
.field-stars { display: none; }

h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0 0 .6em; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { font: italic 500 2rem var(--serif); text-align: center; margin-top: 40vh; color: var(--accent); }

.display { font-family: var(--serif); font-size: clamp(1.7rem, 6vw, 2.2rem); line-height: 1.2; letter-spacing: -.01em; }
:lang(ko) .display, :lang(ko) .card-title, :lang(ko) .frame-title { font-family: var(--serif-ko); letter-spacing: -.02em; }
.display { font-size: clamp(1.55rem, 5.6vw, 2.05rem); }
.lead { color: var(--ink-soft); margin-top: .4rem; }
.kicker { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--kicker); margin: 0 0 .3rem; }
:lang(ko) .kicker { letter-spacing: .04em; }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; }
.fine { font-size: .78rem; color: var(--ink-soft); margin: .4rem 0; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .9rem; }
.ok { color: var(--ok); font-weight: 500; }
.form-error { color: var(--danger); min-height: 1.2em; font-size: .9rem; margin: 0; }
.hint { color: var(--ink-soft); font-size: .85rem; text-align: center; }

/* ---------- inputs and buttons ---------- */
input, select, textarea { width: 100%; min-height: 46px; padding: .65rem .85rem; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); transition: border-color .2s, box-shadow .2s; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--blush-soft); }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); flex: none; margin: .15rem 0 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .55rem 1.1rem; border-radius: 999px;
  border: var(--hair) solid var(--accent); color: var(--accent); background: transparent; font-weight: 500; text-decoration: none; transition: transform .15s, background .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.small { min-height: 36px; padding: .35rem .85rem; font-size: .88rem; }
.btn.wide { width: 100%; margin-top: .6rem; }
.icon-btn { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; color: var(--ink-soft); }
.icon-btn svg, .tab-icon svg, .link-card svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.icon-x { border: 0; background: transparent; color: var(--ink-soft); font-size: 1.3rem; width: 36px; height: 36px; border-radius: 50%; flex: none; }
.lang-switch { border: 1px solid var(--line); background: transparent; border-radius: 999px; font-size: .78rem; padding: .25rem .7rem; min-height: 32px; color: var(--ink-soft); }
.row { display: flex; gap: .5rem; align-items: center; }
.row > input, .row > select { flex: 1; min-width: 0; }
.row.wrap { flex-wrap: wrap; margin: 1rem 0; }
.stack { display: grid; gap: .6rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; }
.check.soft { color: var(--ink-soft); font-size: .9rem; }
.field { display: grid; gap: .3rem; margin-bottom: .8rem; font-size: .9rem; color: var(--ink-soft); }
details > summary { cursor: pointer; color: var(--accent); font-weight: 500; padding: .5rem 0; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '+ '; }
details[open] > summary::before { content: '– '; }

/* ---------- layout ---------- */
.app { min-height: 100dvh; }
.screen { max-width: 520px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 16px 40px; }
.screen.center { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .8rem; justify-content: center; min-height: 100dvh; }
.screen.center form { width: 100%; text-align: left; }
.screen.narrow { max-width: 420px; }
.screen .lang-switch { margin: 1.2rem auto 0; display: block; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.wordmark { border: 0; background: none; font: italic 500 1.7rem/1 var(--serif); color: var(--ink); padding: 0; }
.wordmark em { color: var(--blush-2); font-style: normal; }
.top-actions { display: flex; align-items: center; gap: .15rem; }
.view { max-width: 640px; margin: 0 auto; padding: 18px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px); }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tab { border: 0; background: none; display: grid; justify-items: center; gap: 2px; font-size: .7rem; color: var(--ink-soft); padding: 4px 0; min-height: 48px; position: relative; }
.tab.active { color: var(--accent); }
.tab.active::after { content: ''; position: absolute; top: -6px; width: 18px; height: 2px; border-radius: 2px; background: var(--accent); }

.card { display: block; width: 100%; background: var(--surface); border: var(--hair) solid var(--line); border-radius: var(--radius); padding: 18px; margin: 14px 0;
  box-shadow: var(--shadow); text-align: left; }
.card.plain { box-shadow: none; }
.card.warn { border-color: var(--gold); }
.card-title { font: 600 1.15rem/1.3 var(--serif); margin-bottom: .7rem; }
.link-card { display: flex; gap: .7rem; align-items: center; color: var(--ink); font-weight: 500; }
.link-card span:first-child { color: var(--accent); display: grid; }
.topic { display: inline-block; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--blush);
  border-radius: 999px; padding: .1rem .6rem; margin-bottom: .5rem; }
.prompt { font-size: 1.02rem; }
.tag { display: inline-block; font-size: .7rem; background: var(--blush-soft); color: var(--accent); border-radius: 999px; padding: .1rem .55rem; margin: .2rem 0; }
.badge { margin-left: auto; background: var(--accent); color: var(--accent-ink); font-size: .75rem; border-radius: 999px; min-width: 22px; padding: 0 .4rem; text-align: center; }

/* photo-frame motif */
.frame { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 18px 18px 16px; cursor: pointer; }
.frame::before { content: ''; position: absolute; inset: 6px; border: 1px solid var(--blush); border-radius: 3px; pointer-events: none; }
.frame-title { font: 600 1.2rem/1.3 var(--serif); margin: 0 0 .3rem; }

/* ---------- home ---------- */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: .5rem; }
.hero > div:first-child { min-width: 0; }
.bubble { position: relative; display: inline-block; margin-top: .6rem; background: var(--blush-soft); color: var(--ink); padding: .45rem .9rem;
  border-radius: 16px 16px 16px 4px; font-size: .92rem; }
.progress-wrap { display: flex; align-items: center; gap: .7rem; }
.progress { flex: 1; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit; transition: width .5s ease; }
.progress-label { font-size: .85rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.note-arrival { display: flex; align-items: center; gap: .7rem; border-color: var(--blush); background: var(--blush-soft); color: var(--ink); font-weight: 500; cursor: pointer; }
.mini-env { width: 26px; height: 18px; border-radius: 3px; background: var(--surface); border: 1px solid var(--accent); position: relative; flex: none; }
.mini-env::after { content: ''; position: absolute; left: 50%; top: 5px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--accent); }

/* ---------- the companion ---------- */
.mascot-wrap { width: 112px; flex: none; }
.mascot-wrap.small { width: 120px; margin: 0 auto; }
.mascot-wrap.tiny { width: 52px; }
.mascot { width: 100%; height: auto; overflow: visible; display: block; --lx: 0; --ly: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mascot * { transform-box: view-box; }
.mascot .m-ring { fill: none; stroke: var(--champagne); stroke-opacity: .3; stroke-width: .5; }
.mascot .m-ring-dot { stroke: var(--rose); stroke-opacity: .22; stroke-dasharray: 1 6; }
.mascot .m-shadow { fill: #000; opacity: .32; transform-origin: 110px 227px; }
:root[data-theme="light"] .mascot .m-shadow { opacity: .12; }
.mascot .m-line { stroke: #FFF0F4; stroke-opacity: .85; stroke-width: .8; }
.mascot .m-paw { stroke: #FFF0F4; stroke-opacity: .7; stroke-width: .8; }
.mascot .m-shine { fill: none; stroke: #fff; stroke-opacity: .7; stroke-width: 2; stroke-linecap: round; }
.mascot .m-strap { fill: none; stroke: #F3D9B1; stroke-width: 1.6; }
.mascot .m-cam-body { fill: #3B1D33; stroke: #F3D9B1; stroke-width: 1; } .mascot .m-cam-thin { stroke-width: .8; }
.mascot .m-lens { fill: #1A0A16; stroke: #F3D9B1; stroke-width: 1.1; }
.mascot .m-flash { fill: #FFF8EE; opacity: 0; transform-box: fill-box; transform-origin: center; }
.mascot .m-beret-band { fill: none; stroke: #A2507E; stroke-width: 1.4; }
.mascot .m-beret-stem { stroke: #5A2149; stroke-width: 2.4; stroke-linecap: round; }
.mascot .m-lash { fill: none; stroke: #2E1426; stroke-width: 1.5; stroke-linecap: round; }
.mascot .m-happy path { fill: none; stroke: #2E1426; stroke-width: 2.2; stroke-linecap: round; }
.mascot .m-happy { opacity: 0; }
.mascot .m-nose path { fill: #E07A98; }
.mascot .m-mouth { fill: none; stroke: #8E3D66; stroke-width: 1; stroke-linecap: round; }
.mascot .m-mouth-open { fill: #B0476F; opacity: 0; }
.mascot .m-blush { fill: #F2A6BC; opacity: .5; }
.mascot .m-spark-1, .mascot .m-spark-3 { fill: #F3D9B1; } .mascot .m-spark-2 { fill: #F2C3CF; }
.mascot .m-letter { display: none; fill: #FFFDF8; stroke: #F3D9B1; stroke-width: .9; stroke-linejoin: round; }
.mascot .m-letter .m-seal { fill: #8E3D66; stroke: none; }
.mascot .m-think { opacity: 0; fill: #F3D9B1; fill-opacity: .75; }
.mascot .m-heart { fill: #F2A6BC; opacity: 0; }

/* Parts and the points they move around. */
.mascot .m-figure { transform-origin: 110px 226px; }
.mascot .m-torso { transform-origin: 110px 224px; }
.mascot .m-head { transform-origin: 110px 146px; transform: rotate(calc(var(--lx) * 5deg)) translate(calc(var(--lx) * 2px), calc(var(--ly) * 1.5px)); transition: transform .6s cubic-bezier(.3, 1.2, .5, 1); }
.mascot .m-ear-l { transform-origin: 95px 94px; } .mascot .m-ear-r { transform-origin: 125px 93px; }
.mascot .m-ear { transition: transform .45s cubic-bezier(.3, 1.5, .5, 1); }
.mascot .m-beret { transform-origin: 112px 92px; }
.mascot .m-iris { transform: translate(calc(var(--lx) * 2.6px), calc(var(--ly) * 2.2px)); transition: transform .35s ease-out; }
.mascot .m-lid { transform: translateY(4px); transition: transform .18s ease-in-out; }
.mascot .m-eye-l .m-lid { transform-origin: 96px 112px; } .mascot .m-eye-r .m-lid { transform-origin: 124px 112px; }
.mascot .m-nose { transform-origin: 110px 127px; }
.mascot .m-tail { transform-origin: 150px 204px; }
.mascot .m-camera { transform-origin: 110px 150px; transition: transform .5s cubic-bezier(.3, 1.3, .5, 1); }
.mascot .m-eyes, .mascot .m-happy { transition: opacity .15s; }

/* Moods. */
.mascot.m-blink .m-lid { transform: translateY(12.5px); transition-duration: .08s; }
.mascot.is-curious .m-lid { transform: translateY(0); }
.mascot.is-curious .m-head { transform: rotate(calc(-6deg + var(--lx) * 4deg)); }
.mascot.is-curious .m-ear-l { transform: rotate(-7deg); } .mascot.is-curious .m-ear-r { transform: rotate(7deg); }
.mascot.is-pleased .m-eyes, .mascot.m-hop .m-eyes { opacity: 0; }
.mascot.is-pleased .m-happy, .mascot.m-hop .m-happy { opacity: 1; }
.mascot.is-pleased .m-mouth-open, .mascot.m-hop .m-mouth-open { opacity: 1; }
.mascot.is-pleased .m-blush, .mascot.m-hop .m-blush { opacity: .85; }
.mascot.is-thinking .m-iris { transform: translate(2.4px, -2.6px); }
.mascot.is-thinking .m-lid { transform: translateY(2px); }
.mascot.is-thinking .m-ear-r { transform: rotate(16deg); }
.mascot.is-thinking .m-think { opacity: 1; }
.mascot.is-delivering .m-letter { display: inline; }
.mascot.is-delivering .m-camera { transform: translate(30px, -4px) rotate(16deg); }
.mascot.is-delivering .m-lid { transform: translateY(1px); }
.mascot.is-delivering .m-ear-l { transform: rotate(-5deg); } .mascot.is-delivering .m-ear-r { transform: rotate(5deg); }

@media (prefers-reduced-motion: no-preference) {
  .mascot .m-figure { animation: m-float 6.5s ease-in-out infinite; }
  .mascot .m-shadow { animation: m-shadow 6.5s ease-in-out infinite; }
  .mascot .m-torso { animation: m-breathe 4.2s ease-in-out infinite; }
  .mascot .m-halo { animation: m-glow 5s ease-in-out infinite; transform-origin: 110px 132px; }
  .mascot .m-macaron { animation: m-bob 4.8s ease-in-out infinite; transform-origin: 170px 146px; }
  .mascot .m-beret { animation: m-beret 9s ease-in-out infinite; }
  .mascot .m-camera { animation: m-sway 5.5s ease-in-out infinite; }
  .mascot .m-spark { animation: m-twinkle 3.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  .mascot .m-spark-2 { animation-delay: -1.2s; } .mascot .m-spark-3 { animation-delay: -2.4s; }
  .mascot.m-twitch-l .m-ear-l { animation: m-twitch-l .5s ease-out; }
  .mascot.m-twitch-r .m-ear-r { animation: m-twitch-r .5s ease-out; }
  .mascot.m-sniff .m-nose { animation: m-sniff .7s ease-in-out; }
  .mascot.m-wag .m-tail { animation: m-wag .8s ease-in-out; }
  .mascot.m-hop .m-figure { animation: m-hop .9s cubic-bezier(.3, .9, .4, 1); }
  .mascot.m-hop .m-shadow { animation: m-hop-shadow .9s cubic-bezier(.3, .9, .4, 1); }
  .mascot.m-hop .m-ear-l { animation: m-flop-l .9s ease-out; } .mascot.m-hop .m-ear-r { animation: m-flop-r .9s ease-out; }
  .mascot.m-hop .m-heart { animation: m-heart 1.3s ease-out var(--hd) both; }
  .mascot.is-pleased .m-figure { animation: m-hop .9s cubic-bezier(.3, .9, .4, 1), m-float 6.5s ease-in-out .9s infinite; }
  .mascot.m-snap .m-camera { animation: m-snap 1.6s ease-in-out; }
  .mascot.m-snap .m-flash { animation: m-flash 1.6s ease-out; }
  .mascot.m-snap .m-eye-l .m-lid { transform: translateY(12.5px); } .mascot.m-snap .m-eye-r .m-lid { transform: translateY(1px); }
  .mascot.m-snap .m-strap { animation: m-strap 1.6s ease-in-out; }
  .mascot.m-snap .m-paw-l { animation: m-paw-l 1.6s ease-in-out; } .mascot.m-snap .m-paw-r { animation: m-paw-r 1.6s ease-in-out; }
  .mascot.is-thinking .m-think circle { animation: m-dots 1.4s ease-in-out infinite; }
  .mascot.is-thinking .m-think circle:nth-child(2) { animation-delay: .2s; } .mascot.is-thinking .m-think circle:nth-child(3) { animation-delay: .4s; }
  .mascot.is-thinking .m-head { animation: m-ponder 3s ease-in-out infinite; }
  .mascot.is-delivering .m-letter { animation: m-offer 2.4s ease-in-out infinite; transform-origin: 110px 190px; }
}
@keyframes m-float { 50% { transform: translateY(-4px); } }
@keyframes m-shadow { 50% { transform: scaleX(.92); opacity: .22; } }
@keyframes m-breathe { 50% { transform: scale(1.015, 1.03); } }
@keyframes m-glow { 50% { opacity: .7; transform: scale(.95); } }
@keyframes m-bob { 50% { transform: translate(-2px, -7px) rotate(-6deg); } }
@keyframes m-beret { 0%, 70%, 100% { transform: rotate(0); } 80% { transform: rotate(-3deg); } 90% { transform: rotate(1.5deg); } }
@keyframes m-sway { 50% { transform: rotate(2.5deg); } }
@keyframes m-twinkle { 50% { opacity: .2; transform: scale(.6); } }
@keyframes m-twitch-l { 25% { transform: rotate(-12deg); } 55% { transform: rotate(5deg); } }
@keyframes m-twitch-r { 25% { transform: rotate(12deg); } 55% { transform: rotate(-5deg); } }
@keyframes m-sniff { 15%, 45% { transform: scale(1.2, .85) translateY(.6px); } 30%, 60% { transform: scale(.95, 1.1); } }
@keyframes m-wag { 20% { transform: rotate(14deg); } 45% { transform: rotate(-10deg); } 70% { transform: rotate(8deg); } }
@keyframes m-hop { 0% { transform: none; } 18% { transform: scale(1.06, .92); } 45% { transform: translateY(-22px) scale(.96, 1.05); } 75% { transform: translateY(0) scale(1.05, .94); } 100% { transform: none; } }
@keyframes m-hop-shadow { 45% { transform: scale(.7); opacity: .12; } }
@keyframes m-flop-l { 45% { transform: rotate(-14deg); } 78% { transform: rotate(8deg); } }
@keyframes m-flop-r { 45% { transform: rotate(14deg); } 78% { transform: rotate(-8deg); } }
@keyframes m-heart { 0% { opacity: 0; transform: translate(0, 0) scale(.4); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--hx), var(--hy)) scale(1.3); } }
@keyframes m-snap { 0%, 100% { transform: none; } 22%, 74% { transform: translate(0, -46px) rotate(-3deg) scale(1.06); } 48% { transform: translate(0, -44px) rotate(-3deg) scale(1.03); } }
@keyframes m-strap { 18%, 78% { opacity: 0; } }
@keyframes m-paw-l { 22%, 74% { transform: translate(-1px, -48px); } }
@keyframes m-paw-r { 22%, 74% { transform: translate(1px, -48px); } }
@keyframes m-flash { 0%, 44% { opacity: 0; transform: scale(.4); } 50% { opacity: 1; transform: scale(1.5) rotate(20deg); } 68% { opacity: 0; transform: scale(1.9) rotate(40deg); } 100% { opacity: 0; } }
@keyframes m-dots { 50% { opacity: .25; transform: translateY(-2px); } }
@keyframes m-ponder { 50% { transform: rotate(4deg); } }
@keyframes m-offer { 50% { transform: translateY(-3px) rotate(-2deg); } }
@keyframes float { 50% { transform: translateY(-3px); } }
@keyframes breathe { 50% { opacity: .65; transform: scale(.96); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes twinkle { 50% { opacity: .2; transform: scale(.7); } }
@keyframes hop { 40% { transform: translateY(-5px); } }
@keyframes dots { 50% { opacity: .25; } }

/* ---------- letter / envelope ---------- */
.letter-screen { background: radial-gradient(ellipse at 50% 30%, var(--blush-soft), transparent 70%); }
.envelope-scene { width: 100%; max-width: 380px; display: grid; justify-items: center; gap: .6rem; }
.envelope { position: relative; width: min(100%, 340px); aspect-ratio: 1.45; margin-top: 1rem; perspective: 900px; }
.env-back { position: absolute; inset: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; }
.env-front { position: absolute; inset: 0; border-radius: 6px; z-index: 3; pointer-events: none;
  background: linear-gradient(to top right, var(--surface) 50%, transparent 50.5%) left / 50.5% 100% no-repeat,
              linear-gradient(to top left, var(--surface) 50%, transparent 50.5%) right / 50.5% 100% no-repeat;
  filter: drop-shadow(0 -1px 0 var(--line)); }
.env-flap { position: absolute; left: 0; right: 0; top: 0; height: 58%; z-index: 4; transform-origin: top; transition: transform .7s ease, z-index 0s .35s;
  background: linear-gradient(to bottom right, var(--surface) 50%, transparent 50.5%) left / 50.5% 100% no-repeat,
              linear-gradient(to bottom left, var(--surface) 50%, transparent 50.5%) right / 50.5% 100% no-repeat;
  filter: drop-shadow(0 1px 0 var(--line)) drop-shadow(0 4px 6px rgba(46, 31, 39, .08)); }
.env-seal { position: absolute; left: 50%; top: 58%; z-index: 5; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 35% 30%, #a43a63, var(--ribbon) 55%, #5a1530); color: #f8dfe7; font: italic 600 1.5rem var(--serif);
  box-shadow: 0 3px 8px rgba(90, 21, 48, .35), inset 0 0 0 4px rgba(255, 255, 255, .12); transition: transform .3s, opacity .3s; }
.env-seal:hover { transform: scale(1.05); }
.letter-paper { position: absolute; left: 6%; right: 6%; top: 8%; bottom: 6%; z-index: 2; background: #FFFDF8; color: #2E1F27; border-radius: 4px; padding: 22px 20px;
  font: 500 1.02rem/1.85 var(--serif-ko); text-align: left; overflow: hidden; box-shadow: 0 6px 20px -10px rgba(46, 31, 39, .3);
  transition: transform .8s cubic-bezier(.2, .8, .2, 1); }
.letter-paper .btn { display: none; }
.letter-sign { text-align: right; font-style: italic; margin-top: 1rem; }
.envelope-scene.is-open .env-flap { transform: rotateX(180deg); z-index: 1; }
.envelope-scene.is-open .env-seal { opacity: 0; pointer-events: none; transform: scale(.6); }
.envelope-scene.is-open + .hint, .envelope-scene.is-open .hint { visibility: hidden; }
.envelope-scene.is-read .envelope { aspect-ratio: auto; }
.envelope-scene.is-read .env-back, .envelope-scene.is-read .env-front, .envelope-scene.is-read .env-flap { display: none; }
.envelope-scene.is-read .letter-paper { position: relative; inset: auto; overflow: visible; animation: rise .7s ease both;
  background-image: repeating-linear-gradient(transparent 0 calc(1.85em - 1px), rgba(107, 33, 64, .08) calc(1.85em - 1px) 1.85em); }
.envelope-scene.is-read .letter-paper .btn { display: flex; margin: 1.4rem auto 0; }
.envelope-scene.is-read .letter-paper .btn.primary { color: #6E2E4F; border-color: rgba(110, 46, 79, .55); background: rgba(242, 195, 207, .35); }
@keyframes rise { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .env-flap, .letter-paper { transition: none; } .envelope-scene.is-read .letter-paper { animation: none; } }

/* setup */
.promise { list-style: none; padding: 0; margin: 1rem 0 1.2rem; display: grid; gap: .55rem; }
.promise li { position: relative; padding-left: 1.4rem; color: var(--ink-soft); font-size: .93rem; }
.promise li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 7px; height: 7px; border-radius: 50%; background: var(--blush); }
.promise li.warn { color: var(--ink); font-weight: 500; }
.promise li.warn::before { background: var(--accent); }
.restore { margin-top: 1.2rem; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; min-height: calc(100dvh - 190px); }
.chat-tools { display: flex; align-items: center; gap: .4rem; }
.chat-tools .mascot-wrap { margin-right: auto; }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding: .6rem 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .35rem .85rem; font-size: .85rem; min-height: 36px; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip:disabled { opacity: .4; }
.messages { flex: 1; display: flex; flex-direction: column; gap: .7rem; padding: .5rem 0 1rem; }
.msg { max-width: 88%; padding: .7rem .95rem; border-radius: 18px; line-height: 1.6; }
.msg p:last-child, .msg ul:last-child, .msg ol:last-child { margin-bottom: 0; }
.msg ul, .msg ol { padding-left: 1.2rem; margin: .3rem 0 .6rem; }
.msg pre { background: var(--surface-2); padding: .6rem; border-radius: 8px; overflow-x: auto; font-size: .85rem; }
.msg code { font-size: .88em; background: var(--surface-2); padding: .05rem .3rem; border-radius: 4px; }
.msg pre code { background: none; padding: 0; }
.msg.user { align-self: flex-end; background: var(--bubble-mine); color: var(--bubble-mine-ink); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.typing:empty::after, .msg.typing:not(:has(p))::after { content: '···'; letter-spacing: .2em; color: var(--ink-soft); }
.msg.confirm { border-color: var(--blush); background: var(--blush-soft); }
.confirm-q { font-weight: 500; }
.composer { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); display: flex; gap: .5rem; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 6px 6px 6px 14px; box-shadow: var(--shadow); }
.composer textarea { border: 0; padding: .55rem 0; min-height: 40px; max-height: 160px; resize: none; background: transparent; box-shadow: none; }
.send { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 1.2rem; flex: none; }
.send:disabled { opacity: .5; }
.thread-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; max-height: 60vh; overflow-y: auto; }
.thread-list li { display: flex; align-items: center; }
.thread { flex: 1; min-width: 0; display: flex; justify-content: space-between; gap: .5rem; align-items: center; text-align: left; background: none;
  border: 0; border-bottom: 1px solid var(--line); padding: .7rem .2rem; }
.thread-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* sheets and overlays */
.sheet-backdrop, .delivery { position: fixed; inset: 0; z-index: 50; background: rgba(28, 20, 24, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: .6rem; animation: up .3s ease; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.preview { width: 100%; max-height: 50vh; object-fit: contain; border-radius: 8px; background: var(--surface-2); }
.delivery { align-items: center; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 16px; overflow-y: auto; }
.delivery-intro { display: grid; justify-items: center; gap: .7rem; text-align: center; }
.delivery-intro .mascot-wrap { width: 150px; }
@media (prefers-reduced-motion: no-preference) { .delivery-intro .mascot-wrap { animation: arrive .9s cubic-bezier(.2, 1.2, .4, 1) both; } }
@keyframes arrive { from { transform: translateX(-60vw) rotate(-8deg); } }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg); padding: .5rem 1rem; border-radius: 999px; font-size: .9rem; transition: opacity .4s; max-width: calc(100% - 32px); }
.toast.out { opacity: 0; }

/* sprinkles */
.sprinkles { position: fixed; z-index: 70; width: 0; height: 0; pointer-events: none; }
.sprinkles i { position: absolute; left: 0; top: 0; width: 7px; height: 7px; animation: burst .95s cubic-bezier(.15, .7, .3, 1) forwards; }
.s-dot { border-radius: 50%; background: var(--blush); }
.s-heart { background: var(--accent); clip-path: path('M3.5 7 L0.6 4 A1.8 1.8 0 0 1 3.5 1.4 A1.8 1.8 0 0 1 6.4 4 Z'); }
.s-ribbon { width: 9px !important; height: 4px !important; border-radius: 2px; background: var(--ribbon); }
.s-star { background: var(--gold); clip-path: polygon(50% 0, 61% 38%, 100% 50%, 61% 62%, 50% 100%, 39% 62%, 0 50%, 39% 38%); }
@keyframes burst { 0% { transform: translate(0, 0) scale(.4) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 30px)) scale(1) rotate(var(--r)); opacity: 0; } }

/* ---------- career ---------- */
.stages { display: grid; gap: .5rem; }
.stage { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .3rem 1rem; }
.stage > summary { display: flex; justify-content: space-between; color: var(--ink); font-family: var(--serif-ko); }
.stage > summary::before { content: none; }
.count { color: var(--ink-soft); font-family: var(--sans); font-size: .85rem; font-variant-numeric: tabular-nums; }
.checklist { list-style: none; padding: 0 0 .6rem; margin: 0; display: grid; gap: .55rem; }
.checklist .check span { font-size: .93rem; }
.checklist input:checked + span { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: var(--blush); }
.feedback { margin-top: .8rem; }
.verdict { display: inline-block; font-weight: 700; padding: .1rem .7rem; border-radius: 999px; font-size: .85rem; margin-bottom: .5rem; }
.verdict.small { font-size: .72rem; margin-left: .5rem; }
.v-great, .v-good { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.v-almost { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold); }
.v-not-yet { background: var(--blush-soft); color: var(--accent); }
.history { list-style: none; padding: 0; display: grid; gap: .7rem; }
.clip { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; margin: .2rem 0 0; }
.card textarea { margin: .6rem 0; }

/* ---------- joys ---------- */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; }
.segmented button { border: 0; background: transparent; border-radius: 999px; min-height: 38px; color: var(--ink-soft); font-weight: 500; }
.segmented button.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.segmented.small { margin-bottom: .7rem; }
.segmented.small button { min-height: 32px; font-size: .85rem; }
.card > input, .card > .row { margin-bottom: .5rem; }
.picks, .cards { display: grid; gap: .8rem; margin-top: .8rem; }
.movie-list, .sweet-list, .facts { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .1rem; }
.movie { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.movie-head { display: flex; align-items: center; gap: .3rem; }
.movie-head strong { font-weight: 500; }
.movie-head .icon-x { margin-left: auto; }
.movie-watched { display: grid; gap: .4rem; margin-top: .3rem; }
.stars { display: flex; gap: 2px; }
.stars button { border: 0; background: none; font-size: 1.35rem; color: var(--line); padding: 0 2px; min-width: 32px; min-height: 32px; }
.stars button.on { color: var(--gold); }
.sweet-card { display: grid; grid-template-columns: 96px 1fr; gap: .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.sweet-card img, .sweet-ph { width: 96px; height: 100%; min-height: 110px; object-fit: cover; background: linear-gradient(135deg, var(--blush-soft), var(--surface-2)); }
.sweet-body { padding: .7rem .8rem .7rem 0; min-width: 0; }
.sweet-body p { margin-bottom: .3rem; }
.review { border-left: 2px solid var(--blush); padding-left: .6rem; color: var(--ink-soft); }
.sweet-list li, .fact { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.sweet-list li.muted { border: 0; }
.spot p { margin-bottom: .35rem; }
.polaroids { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin-top: .8rem; }
.polaroid { border: 0; background: #FFFDF8; padding: 8px 8px 30px; box-shadow: 0 6px 16px -8px rgba(46, 31, 39, .35); position: relative; color: #2E1F27; }
.polaroid:nth-child(odd) { transform: rotate(-1.2deg); }
.polaroid:nth-child(even) { transform: rotate(1deg); }
.polaroid img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #eee5df; }
.polaroid .cap { position: absolute; left: 8px; right: 8px; bottom: 6px; font: italic 500 .9rem var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- me ---------- */
.fact-label { font-size: .78rem; color: var(--accent); }
.fact-value { margin: .1rem 0 0; }
.fact > div:first-child { min-width: 0; }
.fact-actions { display: flex; align-items: center; flex: none; }
.fact form { width: 100%; }
.fingerprints { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; margin: .6rem 0; font-size: .88rem; }
.fingerprints dt { color: var(--ink-soft); }
.fingerprints dd { margin: 0; letter-spacing: .06em; }
.danger-zone > summary { color: var(--danger); }

/* ---------- notes ---------- */
.note-thread { display: flex; flex-direction: column; gap: .8rem; margin: 1rem 0; }
.note { max-width: 86%; padding: .9rem 1rem .6rem; border-radius: 4px; background: #FFFDF8; color: #2E1F27; box-shadow: 0 4px 14px -8px rgba(46, 31, 39, .35);
  font-family: var(--serif-ko); white-space: pre-wrap; position: relative; }
.note.theirs { align-self: flex-start; border-left: 3px solid var(--ribbon); transform: rotate(-.4deg); }
.note.mine { align-self: flex-end; background: var(--blush-soft); color: var(--ink); transform: rotate(.4deg); }
.note p { margin-bottom: .3rem; }
.note-meta { font: .72rem var(--sans); color: #8a7680; }
.note.mine .note-meta { color: var(--ink-soft); }
.draft { border: 1px dashed var(--accent); border-radius: 10px; padding: .8rem; background: var(--surface); }

@media (min-width: 760px) {
  .view { padding-top: 28px; }
  .hero .mascot-wrap { width: 140px; }
}

/* envelope pocket: everything below the top V is the front; the letter stays inside until the seal breaks */
.env-front { background: var(--surface); clip-path: polygon(0 0, 50% 58%, 100% 0, 100% 100%, 0 100%); filter: none;
  box-shadow: inset 0 0 0 var(--hair) var(--line); }
.env-flap { background: var(--surface-2); clip-path: polygon(0 0, 100% 0, 50% 100%); filter: none; }
.letter-paper { opacity: 0; transform: translateY(12%); transition: opacity .4s ease .35s, transform .8s cubic-bezier(.2, .8, .2, 1) .35s; }
.envelope-scene.is-open .letter-paper { opacity: 1; transform: translateY(-38%); }
.envelope-scene.is-read .letter-paper { transform: none; }
.delivery-intro .kicker, .envelope-scene .kicker { text-transform: none; letter-spacing: .02em; font: 600 1.1rem var(--serif-ko); color: var(--ink); }
/* Streaming replies scroll clear of the fixed chat bar and bottom navigation. */
.messages > * { scroll-margin-bottom: 160px; }

/* Study tools row on home. */
.study-tools { margin: 14px 20px 0; }
.study-tools .chips { margin-top: 8px; }
.study-tools a.chip { text-decoration: none; }

/* Chat engine switch (Claude / Gemini) beside the companion. */
.chat-tools .mascot-wrap { margin-right: 0; }
.chat-tools .engine { margin-right: auto; display: flex; gap: 6px; }
.chat-tools .engine .chip { padding: 4px 12px; }
