/* ==========================================================================
   Cupid's Complaint Department — cozy, very bright Valentine office
   Palette: hot pink #FF4FA3 · cherry #E3123B · lilac #B79CFF · violet #7B3FE4
            strawberry cream #FFF1F4 · butter #FFE38A · plum shadows #3B1238
   Text is always plum (or white on cherry/violet) for AA contrast.
   ========================================================================== */
:root {
  --pink: #FF4FA3;
  --pink-soft: #FFC2DE;
  --pink-mist: #FFE1EE;
  --cherry: #E3123B;
  --cherry-deep: #B80F31;
  --magenta-deep: #C2105F;
  --lilac: #B79CFF;
  --lilac-mist: #EEE7FF;
  --violet: #7B3FE4;
  --violet-deep: #5E2BC0;
  --cream: #FFF1F4;
  --paper: #FFFDFB;
  --butter: #FFE38A;
  --butter-deep: #F5C842;
  --mint: #1F9D5E;
  --mint-mist: #DDF6E8;
  --plum: #3B1238;
  --plum-2: #5A2A55;
  --plum-3: #7A4A75;
  --line: rgba(59, 18, 56, 0.14);
  --line-pink: rgba(255, 79, 163, 0.28);

  --shadow-xs: 0 1px 2px rgba(59, 18, 56, 0.10);
  --shadow-sm: 0 2px 6px rgba(59, 18, 56, 0.10), 0 1px 2px rgba(59, 18, 56, 0.08);
  --shadow-md: 0 10px 24px -8px rgba(59, 18, 56, 0.22), 0 2px 6px rgba(59, 18, 56, 0.08);
  --shadow-lg: 0 24px 50px -16px rgba(59, 18, 56, 0.32), 0 6px 14px rgba(59, 18, 56, 0.10);
  --shadow-pop: 0 6px 0 rgba(59, 18, 56, 0.16);

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;

  --f-head: 'Fraunces', Georgia, 'Times New Roman', serif;
  --f-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-hand: 'Caveat', 'Comic Sans MS', cursive;
  --f-form: 'Courier Prime', 'Courier New', monospace;

  --focus: 0 0 0 3px #fff, 0 0 0 6px var(--violet);
  --accent: var(--pink);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--plum);
  background:
    radial-gradient(1200px 600px at 10% -10%, #FFD6EA 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #E9DFFF 0%, transparent 55%),
    radial-gradient(800px 600px at 50% 120%, #FFF3C4 0%, transparent 60%),
    var(--cream);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--f-head); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 10px; }
::selection { background: var(--butter); color: var(--plum); }

#hearts-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#fx { position: fixed; inset: 0; z-index: 90; pointer-events: none; width: 100vw; height: 100vh; }
#app { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
#screen { width: 100%; max-width: 1120px; margin: 0 auto; padding: 18px 16px 72px; outline: none; flex: 1; }
#screen.screen-intro { max-width: none; padding: 0; }
.boot-error { padding: 40px; text-align: center; font-weight: 800; }

.kicker {
  display: inline-block;
  font: 900 0.74rem/1.2 var(--f-body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--magenta-deep);
}
.section-heading { font-size: clamp(1.25rem, 2.4vw, 1.6rem); font-weight: 700; margin-bottom: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--butter); color: var(--plum);
  font-size: 0.82rem; font-weight: 800;
}

/* ---------- Buttons ---------- */
.btn {
  --bg: #fff; --fg: var(--plum); --bd: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px;
  border-radius: 999px; border: 2px solid var(--bd);
  background: var(--bg); color: var(--fg);
  font-weight: 800; font-size: 1rem; line-height: 1.2; text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, filter .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: var(--shadow-xs); }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: saturate(.6); }
.btn-primary {
  --fg: #fff; --bd: transparent;
  background: linear-gradient(135deg, var(--cherry) 0%, var(--magenta-deep) 100%);
  box-shadow: 0 6px 0 var(--cherry-deep), var(--shadow-md);
  text-shadow: 0 1px 0 rgba(59, 18, 56, .25);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 8px 0 var(--cherry-deep), var(--shadow-lg); }
.btn-primary:active:not(:disabled) { box-shadow: 0 2px 0 var(--cherry-deep), var(--shadow-xs); transform: translateY(4px); }
.btn-butter { --bg: var(--butter); --bd: #E9C24A; box-shadow: 0 4px 0 #E2B738, var(--shadow-sm); }
.btn-ghost { --bg: rgba(255, 255, 255, .85); --bd: var(--lilac); --fg: var(--violet-deep); }
.btn-ghost:hover:not(:disabled) { --bg: #fff; }
.btn-danger { --bg: #fff; --bd: var(--cherry); --fg: var(--cherry-deep); }
.btn-large { min-height: 56px; padding: 14px 28px; font-size: 1.08rem; }
.btn-small { min-height: 38px; padding: 7px 14px; font-size: .9rem; }
.btn-pulse { animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { filter: none; } 50% { filter: brightness(1.08) drop-shadow(0 0 10px rgba(255, 79, 163, .55)); } }
.btn-icon {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 14px;
  background: rgba(255, 255, 255, .9); border: 2px solid var(--line-pink);
  color: var(--plum); box-shadow: var(--shadow-xs);
  transition: transform .15s, background .15s;
}
.btn-icon:hover { background: #fff; transform: translateY(-1px); }

.lang-pills { display: inline-flex; gap: 6px; padding: 4px; background: rgba(255, 255, 255, .7); border-radius: 999px; border: 2px solid var(--line-pink); }
.lang-pill {
  border: 0; background: transparent; padding: 7px 16px; min-height: 38px; border-radius: 999px;
  font-weight: 800; color: var(--plum-2);
}
.lang-pill.active { background: var(--violet); color: #fff; box-shadow: var(--shadow-sm); }

.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid var(--line-pink); background: #fff; color: var(--plum);
  border-radius: 999px; padding: 9px 16px; font-weight: 700; min-height: 44px;
  box-shadow: var(--shadow-xs); transition: transform .12s, background .12s;
}
.chip:hover { transform: translateY(-1px); background: var(--pink-mist); }
.chip.active { background: var(--pink-mist); border-color: var(--pink); box-shadow: inset 0 0 0 2px var(--pink); }

/* ---------- Forms ---------- */
.form-label { display: flex; flex-direction: column; gap: 6px; font-weight: 800; color: var(--plum); margin: 10px 0 6px; }
.form-input, .memo-textarea {
  width: 100%; border: 2px solid var(--line-pink); background: #fff; color: var(--plum);
  border-radius: var(--r-md); padding: 12px 14px; font-size: 1.05rem; font-weight: 600;
  box-shadow: inset 0 2px 4px rgba(59, 18, 56, .05);
}
.form-input::placeholder, .memo-textarea::placeholder { color: #9A7896; }
.form-input:focus, .memo-textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px rgba(123, 63, 228, .2); }
.custom-label { font-weight: 700; font-size: .92rem; color: var(--plum-2); }

.toggle {
  appearance: none; -webkit-appearance: none; flex-shrink: 0;
  width: 52px; height: 30px; border-radius: 999px; background: #E8D5E3; position: relative;
  border: 2px solid var(--line); transition: background .2s;
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s;
}
.toggle:checked { background: var(--pink); border-color: var(--magenta-deep); }
.toggle:checked::after { transform: translateX(22px); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: rgba(255, 241, 244, .86);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 2px solid var(--line-pink);
  box-shadow: 0 6px 18px -12px rgba(59, 18, 56, .3);
}
.topbar-minimal { display: none; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-brand { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px; font-weight: 900; }
.brand-mark { font-size: 1.5rem; filter: drop-shadow(0 2px 0 rgba(59, 18, 56, .15)); }
.brand-title { font-family: var(--f-head); font-size: 1.1rem; font-weight: 700; white-space: nowrap; }
.topbar-center { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: center; min-width: 0; }
.topbar-meters {
  display: flex; gap: 12px; align-items: center; border: 2px solid var(--line-pink);
  background: #fff; border-radius: 999px; padding: 6px 14px; box-shadow: var(--shadow-xs); min-width: 0;
}
.mini-meter { display: flex; align-items: center; gap: 6px; min-width: 0; }
.meter-ico { font-size: 1.05rem; }
.meter-text { display: flex; flex-direction: column; gap: 2px; min-width: 70px; }
.meter-label { font-size: .66rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--plum-2); white-space: nowrap; }
.meter-num { font-size: .8rem; font-weight: 900; min-width: 22px; text-align: right; }
.meter-track { display: block; height: 8px; border-radius: 999px; background: #F3E3EE; overflow: hidden; box-shadow: inset 0 1px 2px rgba(59, 18, 56, .12); }
.meter-track-lg { height: 12px; margin: 6px 0; }
.meter-fill { display: block; height: 100%; border-radius: inherit; transition: width .6s cubic-bezier(.3, 1.4, .5, 1); }
.meter-romance .meter-fill { background: linear-gradient(90deg, var(--pink), var(--cherry)); }
.meter-sanity .meter-fill { background: linear-gradient(90deg, #7BE0A8, var(--mint)); }
.meter-chaos .meter-fill { background: linear-gradient(90deg, var(--lilac), var(--violet)); }
.topbar-day {
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
  background: var(--butter); border-radius: 999px; padding: 8px 14px; font-weight: 900; font-size: .9rem;
  box-shadow: 0 3px 0 #E2B738;
}

/* ---------- Modals ---------- */
#modal-root { position: relative; z-index: 60; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 16px;
  background: rgba(59, 18, 56, .38); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}
.modal-card {
  width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--paper); border-radius: var(--r-lg); padding: 22px;
  box-shadow: var(--shadow-lg); border: 2px solid var(--line-pink);
  animation: popIn .28s cubic-bezier(.3, 1.5, .5, 1);
}
.modal-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-heading { font-size: 1.4rem; }
.modal-intro { color: var(--plum-2); margin-bottom: 14px; }
.modal-bottom { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }

.meters-help-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.meters-help-row { display: flex; gap: 12px; padding: 12px; border-radius: var(--r-md); background: #fff; border: 2px solid var(--line); }
.meters-help-ico { font-size: 1.6rem; }
.meters-help-row p { font-size: .95rem; color: var(--plum-2); }

.mixer-window {
  position: relative; height: 96px; border-radius: var(--r-md); margin-bottom: 14px; overflow: hidden;
  background: linear-gradient(180deg, #C8B8FF, #FFC2DE); border: 6px solid #fff; box-shadow: var(--shadow-sm);
}
.rain-line { position: absolute; top: -30px; width: 2px; height: 22px; background: rgba(255, 255, 255, .8); border-radius: 2px; animation: rain 1.1s linear infinite; }
.rain-line:nth-child(1) { left: 18%; } .rain-line:nth-child(2) { left: 42%; animation-delay: .4s; }
.rain-line:nth-child(3) { left: 64%; animation-delay: .7s; } .rain-line:nth-child(4) { left: 84%; animation-delay: .2s; }
@keyframes rain { to { transform: translateY(140px); } }
.mixer-mug { position: absolute; right: 12px; bottom: 6px; font-size: 2rem; }
.mixer-list { display: grid; gap: 10px; }
.mixer-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 14px; border-radius: var(--r-md); background: #fff; border: 2px solid var(--line); }
.mixer-info { display: flex; flex-direction: column; cursor: pointer; }
.mixer-info .sub { font-size: .86rem; color: var(--plum-2); font-weight: 600; }
.volume-control { display: flex; align-items: center; gap: 10px; }
.volume-slider { accent-color: var(--pink); width: 140px; }

.settings-section { padding: 14px 0; border-top: 2px dashed var(--line); }
.settings-sec-title { font-size: 1rem; margin-bottom: 10px; font-family: var(--f-body); font-weight: 900; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-about { text-align: center; color: var(--plum-2); font-size: .88rem; padding-top: 14px; border-top: 2px dashed var(--line); }
.settings-made-by { font-weight: 800; margin-top: 4px; }

.howto-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.howto-row { display: flex; gap: 12px; align-items: flex-start; }
.howto-num { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--pink); color: var(--plum); font-weight: 900; }

#toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 95;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  max-width: min(520px, calc(100vw - 32px));
  background: var(--plum); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-weight: 800; box-shadow: var(--shadow-lg); text-align: center;
  transition: transform .3s cubic-bezier(.3, 1.5, .5, 1), opacity .25s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Images / zoom ---------- */
.zoomable-frame { position: relative; overflow: hidden; border-radius: inherit; }
.zoomable-frame img { width: 100%; height: 100%; object-fit: cover; }
.zoom-corner-btn {
  position: absolute; right: 10px; bottom: 10px; height: 38px; padding: 0 14px 0 10px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .95); border: 2px solid var(--pink);
  color: var(--plum); font-weight: 800; font-size: .85rem; line-height: 1; white-space: nowrap;
  box-shadow: var(--shadow-sm); cursor: zoom-in;
}
.zoom-corner-btn:hover, .zoom-corner-btn:focus-visible { background: #FFF1F4; }
.zoom-corner-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.img-viewer-modal { display: flex; flex-direction: column; padding: 0; background: rgba(59, 18, 56, .9); place-items: stretch; }
.img-viewer-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; color: #fff; font-weight: 800; }
.img-viewer-actions { display: flex; gap: 8px; }
.viewer-ctrl-btn { background: rgba(255, 255, 255, .95); font-weight: 900; }
.img-viewer-stage { flex: 1; display: grid; place-items: center; overflow: hidden; padding: 12px; }
.img-viewer-display { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; border-radius: var(--r-md); transition: transform .15s; touch-action: none; }
.img-viewer-caption { color: #fff; text-align: center; padding: 10px 16px 20px; font-weight: 700; }

/* ---------- Intro ---------- */
.intro-screen { position: relative; min-height: 100vh; min-height: 100dvh; overflow: hidden; background: var(--plum); }
.intro-stage, .intro-layer { position: absolute; inset: 0; }
.intro-layer { animation: fadeIn 1s ease; }
.intro-layer-out { opacity: 0; transition: opacity 1s; }
.intro-img { width: 100%; height: 100%; object-fit: cover; animation: pushIn 14s ease-out forwards; }
@keyframes pushIn { from { transform: scale(1.02); } to { transform: scale(1.12); } }
.intro-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(59, 18, 56, .15) 0%, rgba(59, 18, 56, 0) 35%, rgba(59, 18, 56, .72) 100%); }
.intro-top { position: absolute; top: calc(14px + env(safe-area-inset-top)); left: 16px; right: 16px; display: flex; justify-content: space-between; gap: 10px; z-index: 2; }
.intro-caption {
  position: absolute; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(760px, calc(100% - 32px)); z-index: 2;
  background: rgba(255, 253, 251, .95); border-radius: var(--r-xl); padding: 24px 26px;
  box-shadow: var(--shadow-lg); border: 3px solid #fff;
}
.intro-kicker { font: 900 .78rem var(--f-body); letter-spacing: .16em; text-transform: uppercase; color: var(--magenta-deep); }
.intro-title { font-size: clamp(1.8rem, 5vw, 2.8rem); margin: 6px 0 10px; font-weight: 900; }
.intro-text { font-size: 1.1rem; color: var(--plum-2); min-height: 3.2em; }
.intro-in { animation: rise .6s ease both; }
.intro-title.intro-in { animation-delay: .15s; }
.intro-sentence { opacity: 0; animation: rise .6s ease forwards; animation-delay: var(--d); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.intro-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; }
.intro-dots { display: flex; gap: 8px; }
.intro-dots .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pink-soft); transition: width .3s; }
.intro-dots .dot.active { width: 28px; border-radius: 999px; background: var(--pink); }

/* ---------- Title ---------- */
.title-screen { display: grid; gap: 22px; grid-template-columns: 1.15fr 1fr; align-items: center; padding-top: 12px; }
.title-hero { border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-lg); border: 6px solid #fff; aspect-ratio: 16 / 9; transform: rotate(-1.2deg); }
.title-card { text-align: left; display: flex; flex-direction: column; gap: 12px; }
.title-ribbon {
  align-self: flex-start; background: var(--butter); padding: 6px 14px; border-radius: 999px;
  font-weight: 900; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 3px 0 #E2B738;
}
.title-main { display: flex; flex-direction: column; font-weight: 900; line-height: .98; }
.title-line-1 { font-size: clamp(2.2rem, 5.6vw, 3.8rem); }
.title-line-2 {
  font-size: clamp(2.6rem, 6.6vw, 4.6rem); font-style: italic;
  background: linear-gradient(90deg, var(--cherry), var(--magenta-deep) 45%, var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-bottom: .08em;
}
.title-hook { font-family: var(--f-hand); font-size: clamp(1.6rem, 3.6vw, 2.2rem); color: var(--magenta-deep); font-weight: 700; transform: rotate(-1deg); }
.title-tagline { color: var(--plum-2); font-weight: 700; }
.title-actions { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; margin-top: 6px; }
.title-secondary { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Registry / badge ---------- */
.registry-screen { display: flex; flex-direction: column; gap: 18px; }
.registry-header { text-align: center; }
.registry-title { font-size: clamp(1.9rem, 4.5vw, 2.8rem); font-weight: 900; }
.registry-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: start; }
.registry-left { background: var(--paper); border-radius: var(--r-xl); padding: 22px; box-shadow: var(--shadow-md); border: 2px solid var(--line-pink); }
.registry-preview { position: sticky; top: 90px; display: grid; place-items: center; padding: 10px 0 30px; }
.registry-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; align-items: center; }
.registry-progress { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.pdot { width: 8px; height: 8px; border-radius: 50%; background: var(--pink-soft); }
.pdot.active { background: var(--pink); width: 22px; border-radius: 999px; }
.pdot.done { background: var(--violet); }

.doris-say { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; animation: rise .4s ease; }
.doris-avatar { flex-shrink: 0; width: 68px; height: 68px; border-radius: 50%; overflow: hidden; border: 4px solid #fff; box-shadow: var(--shadow-sm); background: var(--lilac-mist); }
.doris-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.doris-bubble { position: relative; background: var(--lilac-mist); border-radius: 4px 20px 20px 20px; padding: 12px 16px; border: 2px solid #D9CBFF; }
.doris-name { display: block; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--violet-deep); font-weight: 900; }
.doris-text { font-weight: 600; }
.doris-large .doris-avatar { width: 96px; height: 96px; }
.doris-large .doris-text { font-family: var(--f-hand); font-size: 1.55rem; line-height: 1.2; font-weight: 700; }

.badge-card {
  position: relative; width: 300px; max-width: 100%;
  background: #fff; border-radius: 22px; overflow: visible;
  box-shadow: var(--shadow-lg); border: 2px solid var(--line-pink);
  transform: rotate(2deg); margin-top: 20px;
}
.badge-clip { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); width: 64px; height: 26px; border-radius: 10px; background: var(--butter); border: 3px solid #E2B738; box-shadow: var(--shadow-sm); }
.badge-clip::before { content: ''; position: absolute; left: 50%; top: -40px; width: 22px; height: 44px; transform: translateX(-50%); background: var(--violet); border-radius: 4px; z-index: -1; }
.badge-head { background: linear-gradient(135deg, var(--pink), var(--magenta-deep)); color: #fff; border-radius: 20px 20px 0 0; padding: 18px 16px 12px; text-align: center; display: flex; flex-direction: column; }
.badge-org { font-weight: 900; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; text-shadow: 0 1px 0 rgba(59, 18, 56, .3); }
.badge-kind { font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .95; }
.badge-body { display: flex; gap: 14px; align-items: center; padding: 16px; }
.badge-photo { position: relative; flex-shrink: 0; width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--cream); border: 4px solid var(--lilac); font: 700 2.2rem var(--f-head); color: var(--cherry); }
.badge-photo-heart { position: absolute; right: -4px; bottom: -4px; font-size: 1rem; background: var(--butter); border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; color: var(--cherry); }
.badge-info { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.badge-name { font-family: var(--f-head); font-size: 1.35rem; line-height: 1.1; overflow-wrap: anywhere; }
.badge-title { font-weight: 800; color: var(--violet-deep); font-size: .9rem; line-height: 1.25; }
.badge-drink { font-size: .85rem; color: var(--plum-2); font-weight: 700; }
.badge-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px 14px; border-top: 2px dashed var(--line); font-size: .72rem; font-weight: 900; color: var(--plum-2); }
.badge-barcode { flex: 1; height: 22px; background: repeating-linear-gradient(90deg, var(--plum) 0 2px, transparent 2px 4px, var(--plum) 4px 5px, transparent 5px 8px); opacity: .8; border-radius: 2px; }
.badge-small { width: 260px; transform: rotate(-2deg); }
.badge-small .badge-photo { width: 60px; height: 60px; font-size: 1.7rem; }
.badge-small .badge-name { font-size: 1.15rem; }

/* ---------- Desk ---------- */
.desk-screen { display: flex; flex-direction: column; gap: 28px; }
.desk-hero {
  position: relative; display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px; align-items: center;
  background: var(--paper); border-radius: var(--r-xl); padding: 18px; box-shadow: var(--shadow-md); border: 2px solid var(--line-pink);
}
.desk-hero-art { border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 16 / 9; box-shadow: var(--shadow-sm); }
.scene-img { width: 100%; height: 100%; object-fit: cover; }
.desk-hero-body { display: flex; flex-direction: column; gap: 14px; padding-right: 8px; }
.desk-title { font-size: clamp(1.7rem, 3.6vw, 2.4rem); font-weight: 900; }
.desk-progress { font-weight: 800; color: var(--plum-2); display: flex; flex-direction: column; gap: 6px; font-size: .95rem; }
.progress-bar { display: block; height: 10px; background: #F3E3EE; border-radius: 999px; overflow: hidden; }
.progress-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--violet)); border-radius: inherit; }
.desk-today { background: var(--cream); border-radius: var(--r-md); padding: 14px 16px; border: 2px dashed var(--pink); display: flex; flex-direction: column; gap: 4px; }
.desk-today-name { font-family: var(--f-head); font-size: 1.3rem; }
.desk-today-complaint { font-family: var(--f-hand); font-size: 1.35rem; line-height: 1.2; color: var(--plum-2); font-weight: 700; }
.desk-badge-slot { position: absolute; right: -10px; top: -30px; display: none; }

.folder-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.folder-grid > li { display: flex; }
.folder {
  position: relative; width: 100%; text-align: left; border: 0; padding: 0; background: none;
  display: flex; flex-direction: column; transition: transform .18s cubic-bezier(.3, 1.5, .5, 1);
}
.folder:hover { transform: translateY(-4px) rotate(-1deg); }
.folder-tab {
  align-self: flex-start; display: inline-flex; gap: 6px; align-items: center;
  background: var(--accent); color: var(--plum); padding: 5px 14px 6px; border-radius: 12px 12px 0 0;
  font-weight: 900; font-size: .8rem; letter-spacing: .04em; margin-left: 12px;
  box-shadow: inset 0 -3px 0 rgba(59, 18, 56, .12);
}
.folder-tab { background: color-mix(in srgb, var(--accent) 55%, #fff); }
.folder-body {
  flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 14px;
  background: #fff; border-radius: 4px var(--r-md) var(--r-md) var(--r-md);
  border: 2px solid color-mix(in srgb, var(--accent) 45%, #fff); box-shadow: var(--shadow-sm);
  min-height: 150px;
}
.folder-icon { font-size: 2rem; line-height: 1; }
.folder-name { font-family: var(--f-head); font-weight: 700; font-size: 1.05rem; line-height: 1.15; }
.folder-trope { font-size: .82rem; font-weight: 700; color: var(--plum-2); }
.folder-status { margin-top: auto; align-self: flex-start; font-size: .75rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; background: var(--lilac-mist); padding: 3px 10px; border-radius: 999px; color: var(--violet-deep); }
.folder-today .folder-body { border-color: var(--pink); box-shadow: 0 0 0 4px rgba(255, 79, 163, .2), var(--shadow-md); }
.folder-today .folder-status, .folder-active .folder-status { background: var(--pink); color: var(--plum); }
.folder-today .folder-body { animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 7px rgba(255, 79, 163, .18), var(--shadow-md); } }
.folder-locked .folder-body { background: repeating-linear-gradient(135deg, #FFF7FA 0 10px, #FFEFF5 10px 20px); border-style: dashed; border-color: var(--pink-soft); }
.folder-locked .folder-name, .folder-locked .folder-trope { color: var(--plum-3); }
.folder-locked:hover { transform: none; }
.folder-special .folder-body { background-image: linear-gradient(135deg, rgba(255, 227, 138, .45), rgba(183, 156, 255, .35)); }
.folder-own .folder-tab { background: var(--butter); }
.folder-own .folder-body { border-color: var(--butter-deep); background: linear-gradient(160deg, #FFFBEA, #fff); }
.folder-lock { display: inline-flex; }

.stamp-mini { margin-top: auto; align-self: flex-start; font-size: .75rem; font-weight: 900; padding: 4px 10px; border-radius: 6px; border: 2px solid; transform: rotate(-3deg); background: #fff; }
.stamp-approve { color: #146B40; border-color: #2BB673; background: var(--mint-mist); }
.stamp-uncrush { color: var(--cherry-deep); border-color: var(--cherry); background: #FFE3E9; }
.stamp-chaos { color: var(--violet-deep); border-color: var(--violet); background: var(--lilac-mist); }
.stamp-wildcard { color: #6B4A00; border-color: var(--butter-deep); background: var(--butter); }

.clue-board { background: #F7E3C8; background-image: radial-gradient(rgba(122, 74, 40, .12) 1px, transparent 1.5px); background-size: 12px 12px; border-radius: var(--r-xl); padding: 20px; border: 8px solid #fff; box-shadow: var(--shadow-md); }
.clue-board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.clue-count { font-weight: 900; background: #fff; padding: 4px 12px; border-radius: 999px; font-size: .85rem; }
.clue-pins { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.clue-pin { position: relative; background: #fff; padding: 18px 14px 14px; box-shadow: var(--shadow-sm); transform: rotate(var(--r)); }
.clue-pin::before { content: ''; position: absolute; top: -7px; left: 50%; width: 16px; height: 16px; border-radius: 50%; background: var(--cherry); box-shadow: 0 2px 0 var(--cherry-deep); transform: translateX(-50%); }
.clue-pin-day { font-size: .72rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--magenta-deep); }
.clue-pin-text { font-family: var(--f-hand); font-size: 1.35rem; line-height: 1.15; font-weight: 700; }
.clue-empty { font-weight: 700; color: var(--plum-2); }
.desk-links { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.revisit-body { display: flex; flex-direction: column; gap: 12px; }
.revisit-complaint { font-family: var(--f-hand); font-size: 1.4rem; line-height: 1.2; font-weight: 700; }
.revisit-stamp-row { display: flex; gap: 8px; align-items: center; }
.revisit-outcome { background: var(--cream); border-radius: var(--r-md); padding: 10px 14px; }

/* ---------- Turn: stepper ---------- */
.turn-screen { display: flex; flex-direction: column; gap: 20px; }
.turn-stepper {
  position: sticky; top: 74px; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
  background: rgba(255, 253, 251, .94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: 6px; border-radius: 999px; box-shadow: var(--shadow-sm); border: 2px solid var(--line-pink);
}
.stepper-item { display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: transparent; padding: 7px 8px; border-radius: 999px; font-weight: 800; font-size: .88rem; min-height: 42px; color: var(--plum); }
.step-num { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--pink-mist); font-weight: 900; font-size: .85rem; }
.stepper-item.active { background: var(--pink); }
.stepper-item.active .step-num { background: #fff; }
.stepper-item.completed .step-num { background: var(--mint); color: #fff; }
.stepper-item.locked { opacity: .5; }
.step-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.step-view { display: flex; flex-direction: column; gap: 22px; animation: rise .35s ease; }
.step-header { text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.step-title { font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 900; }
.step-sub { color: var(--plum-2); font-weight: 600; max-width: 640px; }
.step-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Step 0: complaint form ---------- */
.complaint-form {
  position: relative; background: var(--paper); border-radius: 6px var(--r-lg) var(--r-lg) var(--r-lg);
  padding: 26px 26px 22px 46px; box-shadow: var(--shadow-md); border: 2px solid var(--line);
  background-image:
    linear-gradient(90deg, transparent 30px, rgba(227, 18, 59, .35) 30px, rgba(227, 18, 59, .35) 32px, transparent 32px),
    repeating-linear-gradient(180deg, transparent 0 31px, rgba(183, 156, 255, .28) 31px 32px);
}
.form-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; border-bottom: 3px double var(--line-pink); padding-bottom: 14px; margin-bottom: 16px; }
.form-number { font: 700 .82rem var(--f-form); letter-spacing: .1em; color: var(--magenta-deep); }
.form-title { font-size: clamp(1.3rem, 3vw, 1.9rem); font-weight: 900; margin-top: 2px; }
.form-received {
  flex-shrink: 0; display: flex; flex-direction: column; align-items: center; padding: 6px 12px;
  border: 3px solid var(--cherry); color: var(--cherry-deep); border-radius: 8px; transform: rotate(6deg);
  font: 700 .8rem var(--f-form); text-transform: uppercase; letter-spacing: .1em; background: rgba(255, 255, 255, .7);
}
.form-received strong { font-size: 1.1rem; }
.special-banner { background: linear-gradient(90deg, var(--butter), #FFF2C2); border-radius: var(--r-sm); padding: 10px 14px; font-weight: 900; margin-bottom: 14px; box-shadow: 0 3px 0 #E2B738; }
.form-grid { display: grid; grid-template-columns: 240px 1fr; gap: 20px; }
.form-portrait { border-radius: var(--r-md); overflow: hidden; aspect-ratio: 4 / 3; border: 5px solid #fff; box-shadow: var(--shadow-md); transform: rotate(-2deg); align-self: start; }
.portrait-img { width: 100%; height: 100%; object-fit: cover; }
.form-fields { margin: 0; display: grid; gap: 10px; }
.form-field { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: baseline; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.form-field dt { font: 700 .78rem var(--f-form); text-transform: uppercase; letter-spacing: .06em; color: var(--plum-2); }
.form-field dd { margin: 0; font-weight: 700; }
.field-report dd { font-family: var(--f-form); font-weight: 400; font-size: .95rem; line-height: 1.45; }
.form-section { margin-top: 18px; }
.form-label-row { font: 700 .8rem var(--f-form); text-transform: uppercase; letter-spacing: .08em; color: var(--plum-2); margin-bottom: 6px; }
.form-complaint {
  margin: 0; font-family: var(--f-hand); font-weight: 700; font-size: clamp(1.5rem, 3.4vw, 2rem); line-height: 1.2;
  color: var(--plum); min-height: 2.4em; cursor: default;
}
.form-complaint.is-typing::after { content: '▍'; color: var(--pink); animation: blink .8s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.margin-doodle {
  position: absolute; left: 2px; top: 44%; z-index: 2;
  width: 48px; height: 48px; border-radius: 50%; border: 2px dashed rgba(123, 63, 228, .55);
  background: rgba(255, 227, 138, .55); cursor: pointer;
  font: 700 2rem/1 var(--f-hand); color: var(--pink); transform: rotate(-14deg);
  box-shadow: 0 0 0 0 rgba(255, 79, 163, .45);
  animation: doodle-wiggle 2.4s ease-in-out infinite, doodle-glow 2.4s ease-out infinite;
  transition: color .2s, transform .2s;
}
.margin-doodle:not(.found)::after {
  content: attr(data-hint); position: absolute; left: 50%; top: 100%; transform: translateX(-50%) rotate(8deg);
  font: 700 .95rem/1 var(--f-hand); color: var(--violet-deep); white-space: nowrap; margin-top: 2px;
}
.margin-doodle:hover { color: var(--cherry); transform: rotate(-4deg) scale(1.15); }
.margin-doodle.found { color: var(--violet); background: transparent; border-color: transparent; animation: none; box-shadow: none; }
@keyframes doodle-wiggle { 0%, 70%, 100% { transform: rotate(-14deg); } 76% { transform: rotate(-2deg) scale(1.12); } 82% { transform: rotate(-22deg) scale(1.08); } 88% { transform: rotate(-8deg); } }
@keyframes doodle-glow { 0% { box-shadow: 0 0 0 0 rgba(255, 79, 163, .5); } 70%, 100% { box-shadow: 0 0 0 14px rgba(255, 79, 163, 0); } }
@media (prefers-reduced-motion: reduce) { .margin-doodle { animation: none; } }
.crayon-note { margin-top: 16px; background: #FFFBEA; border: 2px dashed var(--lilac); border-radius: var(--r-md); padding: 12px 16px; transform: rotate(-.6deg); animation: rise .4s ease; }
.crayon-kicker { font-size: .72rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--violet-deep); }
.crayon-text { font-family: var(--f-hand); font-size: 1.55rem; line-height: 1.15; color: var(--violet-deep); font-weight: 700; }

.evidence-section { background: var(--paper); border-radius: var(--r-xl); padding: 20px; box-shadow: var(--shadow-md); border: 2px solid var(--line-pink); }
.ev-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 0; scrollbar-width: thin; }
.ev-tab {
  flex-shrink: 0; border: 2px solid var(--line-pink); border-bottom: 0; background: var(--pink-mist);
  padding: 10px 16px; border-radius: 14px 14px 0 0; font-weight: 800; font-size: .9rem; max-width: 240px;
  display: inline-flex; gap: 4px; align-items: center; min-height: 44px;
}
.ev-tab-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-tab.active { background: #fff; position: relative; top: 2px; }
.ev-tab-doris { background: var(--lilac-mist); }
.ev-panel { background: #fff; border: 2px solid var(--line-pink); border-radius: 0 var(--r-md) var(--r-md) var(--r-md); padding: 18px; }
.ev-content { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.ev-art { border-radius: var(--r-md); overflow: hidden; aspect-ratio: 4 / 3; box-shadow: var(--shadow-sm); }
.ev-art .zoomable-frame { height: 100%; }
.ev-img { width: 100%; height: 100%; object-fit: cover; }
.ev-text { display: flex; flex-direction: column; gap: 8px; }
.ev-title { font-size: 1.35rem; }
.postit { position: relative; background: var(--butter); padding: 12px 14px; box-shadow: var(--shadow-sm); transform: rotate(1.2deg); margin-top: 6px; }
.postit-label { font-size: .7rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: #6B4A00; }
.postit p { font-family: var(--f-hand); font-size: 1.35rem; line-height: 1.15; font-weight: 700; }

/* ---------- Step 1: arrow workshop ---------- */
.workshop { display: flex; flex-direction: column; gap: 18px; }
.recap { background: #fff; border-radius: var(--r-md); border: 2px solid var(--line-pink); padding: 0 16px; box-shadow: var(--shadow-xs); }
.recap summary { cursor: pointer; padding: 12px 0; font-weight: 900; list-style-position: inside; }
.recap-body { display: grid; gap: 8px; padding-bottom: 14px; font-size: .95rem; }
.recap-note { color: var(--plum-2); }
.workshop-bench {
  background: linear-gradient(180deg, #FFF8E1 0%, #FFE9F2 100%); border-radius: var(--r-xl); padding: 18px;
  border: 2px solid var(--line-pink); box-shadow: var(--shadow-md); display: flex; flex-direction: column; gap: 14px;
  background-image: linear-gradient(180deg, rgba(255, 248, 225, .94), rgba(255, 233, 242, .94)), repeating-linear-gradient(90deg, #F1D7B8 0 2px, transparent 2px 60px);
}
.bench-preview { display: flex; align-items: center; gap: 14px; justify-content: center; flex-wrap: wrap; }
.arrow-preview .arrow-svg { width: min(320px, 70vw); height: auto; filter: drop-shadow(0 4px 0 rgba(59, 18, 56, .12)); }
.arrow-pop { animation: arrowPop .35s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes arrowPop { from { transform: scale(.9) rotate(-3deg); } }
.archery-range {
  position: relative; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  min-height: 150px; padding: 12px 18px; border-radius: var(--r-lg); overflow: hidden;
  background: linear-gradient(180deg, #E9DFFF 0%, #FFE1EE 70%, #FFD3E6 100%);
  border: 3px solid #fff; box-shadow: inset 0 2px 8px rgba(59, 18, 56, .08);
}
.bow-wrap { position: relative; display: flex; align-items: center; gap: 2px; z-index: 2; }
.bow { font-size: 2.6rem; transform: scaleX(-1); }
.flyer { will-change: transform; }
.flyer .arrow-svg { width: 160px; height: auto; display: block; }
.flyer.arrow-wobble { animation: wobble .5s ease; }
@keyframes wobble { 25% { rotate: 8deg; } 50% { rotate: -6deg; } 75% { rotate: 3deg; } }
.tension { position: absolute; left: 10px; right: 10px; bottom: -14px; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .7); opacity: 0; transition: opacity .2s; }
.tension.on { opacity: 1; }
.tension-fill { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--butter), var(--pink), var(--cherry)); }
.target-wrap { width: 120px; flex-shrink: 0; }
.target-svg { width: 100%; height: auto; filter: drop-shadow(0 6px 0 rgba(59, 18, 56, .12)); animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.target-hit .target-svg { animation: heartBeat .6s ease 2; }
.target-hit.is-static .target-svg { animation: none; }
@keyframes heartBeat { 30% { transform: scale(1.18); } 60% { transform: scale(.96); } }
.fire-row { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fire-btn { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.fire-hint { font-weight: 700; color: var(--plum-2); font-size: .92rem; text-align: center; }
.workshop-msg { background: #fff; border-radius: var(--r-md); padding: 14px 16px; border: 2px solid var(--line); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.workshop-msg.is-hint { border-color: var(--lilac); background: var(--lilac-mist); }
.workshop-msg.is-success { border-color: #2BB673; background: var(--mint-mist); }
.miss-kind { font-weight: 900; }
.reaction { font-weight: 600; }
.golden-unlocked { font-weight: 900; background: var(--butter); padding: 6px 12px; border-radius: 999px; box-shadow: 0 3px 0 #E2B738; }
.assisted-note { font-weight: 700; color: var(--plum-2); }
.parts { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; }
.part-group { background: var(--paper); border-radius: var(--r-lg); padding: 16px; border: 2px solid var(--line-pink); box-shadow: var(--shadow-sm); }
.part-title { font-family: var(--f-body); font-weight: 900; font-size: 1rem; margin-bottom: 10px; }
.part-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.part-card {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left;
  padding: 12px; border-radius: var(--r-md); background: #fff; border: 2px solid var(--line); min-height: 104px;
  transition: transform .15s cubic-bezier(.3, 1.5, .5, 1), border-color .15s, background .15s;
}
.part-card:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--pink); }
.part-card.selected { border-color: var(--pink); background: var(--pink-mist); box-shadow: 0 0 0 3px rgba(255, 79, 163, .25); }
.part-card.selected::after { content: '✓'; position: absolute; }
.part-card { position: relative; }
.part-card.selected::after { top: 8px; right: 10px; font-weight: 900; color: var(--magenta-deep); }
.part-icon { font-size: 1.7rem; }
.part-name { font-weight: 900; }
.part-desc { font-size: .82rem; color: var(--plum-2); font-weight: 600; line-height: 1.3; }
.part-swatch { width: 36px; height: 22px; border-radius: 6px 14px 6px 14px; border: 2px solid var(--plum); }
.swatch-tender { background: #FFB3D1; }
.swatch-passionate { background: var(--cherry); }
.swatch-playful { background: repeating-linear-gradient(45deg, var(--butter) 0 6px, var(--lilac) 6px 12px); }
.swatch-brave { background: var(--violet); }

/* ---------- Step 2: confession ---------- */
.confession { display: flex; flex-direction: column; gap: 18px; }
.confession-scene { border-radius: var(--r-xl); overflow: hidden; aspect-ratio: 16 / 9; box-shadow: var(--shadow-lg); border: 6px solid #fff; }
.confession-contrast { display: grid; grid-template-columns: 1fr 1.6fr; gap: 16px; }
.contrast-said, .contrast-truth, .slip { background: var(--paper); border-radius: var(--r-lg); padding: 18px; border: 2px solid var(--line); box-shadow: var(--shadow-sm); }
.contrast-truth { border-color: var(--pink); background: linear-gradient(160deg, #fff, var(--pink-mist)); }
.slip { grid-column: 1 / -1; background: #FFFBEA; border: 2px dashed var(--butter-deep); }
.block-label { font-family: var(--f-body); font-weight: 900; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--plum-2); margin-bottom: 8px; }
.struck { font-family: var(--f-hand); font-size: 1.4rem; line-height: 1.2; font-weight: 700; text-decoration: line-through; text-decoration-color: var(--cherry); text-decoration-thickness: 2px; color: var(--plum-3); }
.confession-quote { margin: 0 0 10px; font-family: var(--f-head); font-style: italic; font-size: clamp(1.25rem, 2.6vw, 1.6rem); line-height: 1.3; color: var(--magenta-deep); }
.reply-box { background: var(--paper); border-radius: var(--r-lg); padding: 18px; border: 2px solid var(--line-pink); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 12px; }
.reply-options { display: grid; gap: 10px; }
.reply-option {
  display: flex; gap: 12px; align-items: center; text-align: left; padding: 14px 16px; border-radius: var(--r-md);
  border: 2px solid var(--line-pink); background: #fff; font-weight: 700; min-height: 56px;
  transition: transform .15s, background .15s;
}
.reply-option:hover { transform: translateX(4px); background: var(--pink-mist); }
.reply-you-tag { flex-shrink: 0; font-size: .75rem; font-weight: 900; background: var(--violet); color: #fff; padding: 3px 10px; border-radius: 999px; }
.reply-you { font-weight: 700; }
.reply-client { background: var(--lilac-mist); border-radius: 4px 18px 18px 18px; padding: 12px 16px; }
.reply-response { font-family: var(--f-hand); font-size: 1.45rem; line-height: 1.2; font-weight: 700; }

/* ---------- Step 3: stamps ---------- */
.stamp-step { display: flex; flex-direction: column; gap: 18px; }
.stamp-paper {
  position: relative; background: var(--paper); border-radius: var(--r-md); padding: 18px; min-height: 280px;
  box-shadow: var(--shadow-md); border: 2px solid var(--line);
  background-image: repeating-linear-gradient(180deg, transparent 0 31px, rgba(183, 156, 255, .22) 31px 32px);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.paper-head { align-self: stretch; display: flex; justify-content: space-between; gap: 10px; font-family: var(--f-form); font-size: .9rem; border-bottom: 2px solid var(--line-pink); padding-bottom: 8px; }
.stamp-target { position: relative; min-height: 170px; width: 100%; display: grid; place-items: center; }
.target-placeholder { border: 3px dashed var(--pink-soft); border-radius: var(--r-md); padding: 28px 34px; font-weight: 800; color: var(--plum-3); }
.impression {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 14px 24px; border: 5px double currentColor; border-radius: 14px; transform: rotate(-7deg);
  font-family: var(--f-form); text-transform: uppercase; text-align: center; mix-blend-mode: multiply;
  background: rgba(255, 255, 255, .25);
}
.impression::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at 30% 40%, transparent 60%, rgba(255, 255, 255, .55) 61%, transparent 66%), radial-gradient(circle at 70% 70%, transparent 55%, rgba(255, 255, 255, .4) 56%, transparent 60%); pointer-events: none; }
.imp-kicker { font-size: .68rem; letter-spacing: .14em; font-weight: 700; }
.imp-verdict { font: 900 clamp(1.5rem, 4.5vw, 2.3rem)/1.05 var(--f-body); letter-spacing: .04em; }
.imp-date { font-size: .72rem; letter-spacing: .1em; font-weight: 700; }
.impression-approve { color: #178A4E; }
.impression-uncrush { color: var(--cherry); }
.impression-chaos { color: var(--violet); }
.impression-wildcard { color: #C99300; background: rgba(255, 227, 138, .55); mix-blend-mode: normal; text-shadow: 0 1px 0 #fff; }
.slam { animation: slam .42s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes slam { 0% { transform: rotate(-7deg) scale(2.2); opacity: 0; } 55% { transform: rotate(-7deg) scale(.92); opacity: 1; } 100% { transform: rotate(-7deg) scale(1); } }
.ink-splat { position: absolute; left: 50%; top: 50%; width: var(--s); height: var(--s); border-radius: 50%; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))); opacity: .55; pointer-events: none; }
.ink-approve { background: #2BB673; } .ink-uncrush { background: var(--cherry); } .ink-chaos { background: var(--violet); } .ink-wildcard { background: var(--butter-deep); }
.ink-fresh { animation: splat .45s ease-out both; }
@keyframes splat { from { transform: translate(-50%, -50%) scale(.2); opacity: 0; } }
.stamp-outcome { max-width: 640px; text-align: center; display: grid; gap: 6px; }
.outcome-wild { font-family: var(--f-head); font-size: 1.2rem; font-weight: 700; color: #8A6200; }
.outcome-text { font-weight: 600; }
.stamp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stamp-btn { position: relative; border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; text-align: center; transition: transform .15s cubic-bezier(.3, 1.6, .5, 1); }
.stamp-btn:hover:not(.locked) { transform: translateY(-4px); }
.stamp-btn:active:not(.locked) { transform: translateY(4px) scale(.98); }
.stamp-handle { width: 46px; height: 40px; border-radius: 22px 22px 8px 8px; background: linear-gradient(180deg, #8C5A3C, #5E3A26); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18); margin-bottom: -4px; }
.stamp-face { width: 100%; display: flex; flex-direction: column; gap: 6px; align-items: center; padding: 14px 10px; border-radius: var(--r-md); border: 3px solid; background: #fff; box-shadow: var(--shadow-pop); min-height: 172px; }
.stamp-icon { font-size: 1.6rem; }
.stamp-name { font: 900 .88rem/1.2 var(--f-body); letter-spacing: .04em; }
.stamp-desc { font-size: .82rem; font-weight: 600; color: var(--plum-2); line-height: 1.3; }
.stamp-btn-approve .stamp-face { border-color: #2BB673; background: linear-gradient(180deg, #fff, var(--mint-mist)); }
.stamp-btn-approve .stamp-name { color: #146B40; }
.stamp-btn-uncrush .stamp-face { border-color: var(--cherry); background: linear-gradient(180deg, #fff, #FFE3E9); }
.stamp-btn-uncrush .stamp-name { color: var(--cherry-deep); }
.stamp-btn-chaos .stamp-face { border-color: var(--violet); background: linear-gradient(180deg, #fff, var(--lilac-mist)); }
.stamp-btn-chaos .stamp-name { color: var(--violet-deep); }
.stamp-btn-wildcard .stamp-face { border-color: var(--butter-deep); background: linear-gradient(160deg, #FFF8D6, var(--butter)); position: relative; overflow: hidden; }
.stamp-btn-wildcard .stamp-name { color: #6B4A00; }
.stamp-btn-wildcard:not(.locked) .stamp-face::after { content: ''; position: absolute; inset: -40%; background: linear-gradient(110deg, transparent 40%, rgba(255, 255, 255, .8) 50%, transparent 60%); animation: shine 2.6s ease-in-out infinite; }
@keyframes shine { from { transform: translateX(-60%); } to { transform: translateX(60%); } }
.stamp-btn.locked { cursor: not-allowed; }
.stamp-btn.locked .stamp-face { filter: grayscale(.8); opacity: .65; border-style: dashed; }
.stamp-btn.selected .stamp-face { box-shadow: 0 0 0 4px var(--pink), var(--shadow-md); }
.stamp-lock-note { font-size: .78rem; font-weight: 800; color: var(--plum-2); }
.delta-row { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: auto; }
.delta { font-size: .76rem; font-weight: 900; padding: 2px 7px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); }
.delta.up { color: #146B40; } .delta.down { color: var(--cherry-deep); }

.screen-shake { animation: shake .4s ease; }
@keyframes shake { 20% { transform: translate(-3px, 2px); } 40% { transform: translate(3px, -2px); } 60% { transform: translate(-2px, 1px); } 80% { transform: translate(1px, 0); } }

/* ---------- Step 4: memo ---------- */
.memo-step { display: flex; flex-direction: column; gap: 18px; }
.memo-sheet { background: var(--paper); border-radius: var(--r-md); padding: 22px; box-shadow: var(--shadow-md); border: 2px solid var(--line); border-top: 10px solid var(--pink); display: flex; flex-direction: column; gap: 14px; }
.memo-sheet.filing-away { animation: fileAway .6s ease-in forwards; }
@keyframes fileAway { to { transform: translateY(40px) rotate(4deg) scale(.9); opacity: 0; } }
.memo-head { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-family: var(--f-form); font-size: .95rem; border-bottom: 2px dashed var(--line); padding-bottom: 12px; }
.memo-head div { display: flex; gap: 8px; }
.memo-head dt { font-weight: 700; color: var(--magenta-deep); }
.memo-head dd { margin: 0; overflow-wrap: anywhere; }
.memo-question { display: block; font-family: var(--f-head); font-size: clamp(1.25rem, 2.8vw, 1.6rem); font-weight: 700; line-height: 1.3; }
.memo-write { position: relative; }
.memo-textarea { min-height: 200px; resize: vertical; line-height: 1.8em; padding-top: .3em; padding-bottom: .3em;
  /* ruled lines in em, tied to the text's own line height, so they match at any font or phone text size */
  background: #fff repeating-linear-gradient(180deg, transparent 0 calc(1.8em - 1px), rgba(183, 156, 255, .32) calc(1.8em - 1px) 1.8em);
  background-origin: content-box; background-attachment: local; }
.word-count { position: absolute; right: 12px; bottom: 10px; font-size: .78rem; font-weight: 800; color: var(--plum-2); background: rgba(255, 255, 255, .9); padding: 2px 8px; border-radius: 999px; }
.spark-row { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.spark-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.spark-chip { border: 2px solid var(--butter-deep); background: #FFFBEA; border-radius: 999px; padding: 8px 14px; font-weight: 700; text-align: left; min-height: 44px; animation: rise .35s ease both; }
.spark-list li:nth-child(2) .spark-chip { animation-delay: .08s; } .spark-list li:nth-child(3) .spark-chip { animation-delay: .16s; }
.spark-chip:hover { background: var(--butter); }

/* ---------- Arrival ---------- */
.arrival-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(255, 225, 238, .92); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fadeIn .25s; cursor: pointer; }
.arrival-leaving { opacity: 0; transition: opacity .3s; }
.arrival-stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.arrival-doris { font-size: 4rem; line-height: 1; animation: dorisFly 1s cubic-bezier(.2, .8, .3, 1) both; }
.arrival-doris img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 4px solid #fff; box-shadow: var(--shadow-md); background: var(--lilac-mist); display: block; }
/* Once the envelope opens, Doris flies off completely instead of hiding half behind the letter */
.arrival-open .arrival-doris { animation: dorisAway .6s cubic-bezier(.5, 0, .7, .4) forwards; }
@keyframes dorisAway { to { transform: translate(55vw, -35vh) rotate(18deg) scale(.6); opacity: 0; } }
@keyframes dorisFly { from { transform: translate(-60vw, -30vh) rotate(-20deg); } }
.arrival-envelope { position: relative; width: min(360px, 84vw); aspect-ratio: 1.55; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); border: 3px solid var(--pink-soft); animation: dropIn .7s .3s cubic-bezier(.3, 1.5, .5, 1) both; overflow: visible; }
.arrival-envelope.is-special { border-color: var(--butter-deep); background: #FFFBEA; }
@keyframes dropIn { from { transform: translateY(-40px) scale(.8); opacity: 0; } }
.arrival-flap { position: absolute; inset: 0 0 auto; height: 55%; background: var(--pink-mist); clip-path: polygon(0 0, 100% 0, 50% 100%); border-radius: 12px 12px 0 0; transform-origin: top; transition: transform .5s ease; z-index: 2; }
.arrival-seal { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); z-index: 3; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; background: var(--cherry); box-shadow: 0 3px 0 var(--cherry-deep); transition: transform .4s, opacity .4s; }
.arrival-letter { position: absolute; inset: 14px; overflow: hidden; background: var(--paper); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; padding: 10px; transition: transform .6s cubic-bezier(.3, 1.4, .5, 1); z-index: 1; }
.arrival-day { font-weight: 900; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--magenta-deep); }
.arrival-name { font-family: var(--f-head); font-size: clamp(1rem, 4.4vw, 1.4rem); line-height: 1.15; overflow-wrap: break-word; }
.arrival-trope { font-family: var(--f-hand); font-size: 1.3rem; font-weight: 700; color: var(--violet-deep); }
.arrival-open .arrival-flap { transform: rotateX(180deg); z-index: 0; }
.arrival-open .arrival-seal { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
.arrival-open .arrival-letter { transform: translateY(-46%); z-index: 4; box-shadow: var(--shadow-md); }
.arrival-skip { font-weight: 800; color: var(--plum-2); margin-top: 40px; }

/* ---------- Postcard / twist ---------- */
.postcard-card { width: min(640px, 100%); background: transparent; border: 0; box-shadow: none; padding: 0; }
.postcard { display: grid; grid-template-columns: 1fr 1.2fr; background: #fff; border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-lg); border: 8px solid #fff; transform: rotate(-1deg); }
.postcard-art-wrap { min-height: 240px; }
.postcard-art { width: 100%; height: 100%; object-fit: cover; }
.postcard-back { position: relative; padding: 18px 18px 18px 22px; border-left: 2px dashed var(--line); display: flex; flex-direction: column; gap: 6px; background: repeating-linear-gradient(180deg, transparent 0 30px, rgba(183, 156, 255, .22) 30px 31px); }
.postcard-stamp-corner { position: absolute; top: 12px; right: 12px; width: 52px; height: 60px; display: grid; place-items: center; font-size: 1.6rem; background: var(--pink-mist); border: 3px dotted var(--pink); }
.postcard-kicker { font-size: .72rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: var(--magenta-deep); padding-right: 60px; }
.postcard-from { font-size: 1.25rem; padding-right: 60px; }
.postcard-text { font-family: var(--f-hand); font-size: 1.55rem; line-height: 1.2; font-weight: 700; }
.postcard-sign { font-family: var(--f-hand); font-size: 1.3rem; text-align: right; }
.postcard-postmark { align-self: flex-end; margin-top: auto; font: 700 .75rem var(--f-form); color: var(--violet); border: 2px solid var(--violet); border-radius: 50%; padding: 12px 8px; transform: rotate(-12deg); opacity: .75; }
.postcard-card .modal-bottom { justify-content: center; }
.twist-card { border-top: 10px solid var(--violet); }
.twist-kicker { font-weight: 900; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--violet-deep); }
.twist-title { font-size: 1.6rem; margin: 4px 0 12px; }
.twist-letter { background: #FFFBEA; border-radius: var(--r-md); padding: 16px; display: grid; gap: 10px; font-family: var(--f-head); font-size: 1.1rem; line-height: 1.5; border: 2px dashed var(--butter-deep); }
.twist-from { font-family: var(--f-hand); font-size: 1.4rem; text-align: right; }

/* ---------- Epilogue ---------- */
.epilogue-screen { display: flex; flex-direction: column; gap: 22px; }
.own-form { padding-left: 46px; }
.own-form-grid { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; }
.drawer-envelope { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 8px; border: 3px dashed var(--pink); background: #fff; border-radius: var(--r-xl); padding: 26px 40px; font-weight: 900; font-size: 1.1rem; box-shadow: var(--shadow-md); animation: glow 2.4s ease-in-out infinite; }
.drawer-env-icon { font-size: 3rem; }
.letters { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.letter-card { background: #fff; border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-md); display: grid; grid-template-rows: auto 1fr; animation: rise .6s ease both; transform: rotate(-1deg); }
.letter-cupid { transform: rotate(1.2deg); background: #FFFBEA; }
.letter-art { aspect-ratio: 3 / 2; overflow: hidden; }
.letter-img { width: 100%; height: 100%; object-fit: cover; }
.letter-body { padding: 18px; display: grid; gap: 8px; }
.letter-title { font-size: 1.15rem; }
.letter-text { font-family: var(--f-hand); font-size: 1.6rem; line-height: 1.2; font-weight: 700; }
.letter-cupid .letter-text { color: var(--violet-deep); }
.letter-from { font-family: var(--f-hand); font-size: 1.25rem; text-align: right; color: var(--plum-2); }
.epilogue-answers { position: relative; background: var(--paper); border-radius: var(--r-xl); padding: 22px; box-shadow: var(--shadow-md); border: 2px solid var(--line-pink); display: flex; flex-direction: column; gap: 16px; }
.epilogue-prompt { display: flex; flex-direction: column; gap: 8px; }
.own-stamp { align-self: center; margin-top: 10px; }
.epilogue-closing { text-align: center; font-family: var(--f-hand); font-size: 1.7rem; color: var(--magenta-deep); font-weight: 700; }

/* ---------- Ending ---------- */
.ending-screen { display: flex; flex-direction: column; gap: 24px; }
.ending-tabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.ending-card { background: var(--paper); border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-lg); border: 2px solid var(--line-pink); }
.ending-art { aspect-ratio: 16 / 9; }
.ending-body { padding: 24px; display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; }
.ending-icon { font-size: 3rem; margin-top: -60px; background: #fff; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; box-shadow: var(--shadow-md); border: 4px solid var(--butter); position: relative; }
.ending-title { font-size: clamp(1.8rem, 4.4vw, 2.6rem); font-weight: 900; }
.ending-rank { font-weight: 900; color: var(--violet-deep); text-transform: uppercase; letter-spacing: .1em; font-size: .88rem; }
.ending-summary { font-size: 1.1rem; max-width: 640px; }
.hera-letter { text-align: left; width: 100%; max-width: 680px; background: #FFFBEA; border-radius: var(--r-md); padding: 22px; border: 2px solid var(--butter-deep); display: grid; gap: 10px; font-family: var(--f-head); font-size: 1.06rem; line-height: 1.55; position: relative; margin-top: 10px; }
.hera-crest { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 1.6rem; background: var(--butter); border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; }
.hera-head { font-family: var(--f-body); font-size: .78rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: #6B4A00; text-align: center; }
.hera-sign { font-family: var(--f-hand); font-size: 1.6rem; text-align: right; color: var(--magenta-deep); }
.evaluation { background: var(--paper); border-radius: var(--r-xl); padding: 22px; box-shadow: var(--shadow-md); border: 2px solid var(--line-pink); }
.eval-grid { display: grid; grid-template-columns: auto 1fr 1fr; gap: 24px; align-items: center; }
.eval-bars { display: grid; gap: 10px; }
.eval-bar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; }
.eval-bar-label { font-weight: 800; grid-column: 1 / -1; }
.stats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: #fff; border-radius: var(--r-md); padding: 12px; border: 2px solid var(--line); display: grid; gap: 2px; }
.stat-icon { font-size: 1.3rem; }
.stat-label { font-size: .8rem; font-weight: 800; color: var(--plum-2); }
.stat-value { font-family: var(--f-head); font-size: 1.4rem; }
.ending-actions { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.ending-links { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ---------- Album ---------- */
.album-screen { display: flex; flex-direction: column; gap: 24px; }
.album-section { background: var(--paper); border-radius: var(--r-xl); padding: 20px; box-shadow: var(--shadow-sm); border: 2px solid var(--line-pink); }
.album-cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.album-card { background: #fff; border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm); border: 6px solid #fff; display: flex; flex-direction: column; }
.album-card:nth-child(odd) { transform: rotate(-1deg); } .album-card:nth-child(even) { transform: rotate(1deg); }
.album-photo { position: relative; aspect-ratio: 4 / 3; }
.album-photo img { width: 100%; height: 100%; object-fit: cover; }
.album-day { position: absolute; left: 8px; top: 8px; background: var(--butter); font-weight: 900; font-size: .78rem; padding: 3px 10px; border-radius: 999px; }
.album-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.album-text { font-family: var(--f-hand); font-size: 1.3rem; line-height: 1.15; font-weight: 700; }
.album-card.is-empty { min-height: 220px; display: grid; place-items: center; text-align: center; background: repeating-linear-gradient(135deg, #FFF7FA 0 10px, #FFEFF5 10px 20px); border: 3px dashed var(--pink-soft); position: relative; }
.album-card.is-empty .album-day { position: absolute; }
.album-q { font-size: 2.6rem; opacity: .5; }
.album-empty-text { font-weight: 800; color: var(--plum-2); }
.album-endings, .album-badges { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.album-ending, .album-badge { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--r-md); background: #fff; border: 2px solid var(--line); opacity: .75; }
.album-ending.is-on, .album-badge.is-on { opacity: 1; border-color: var(--pink); background: linear-gradient(160deg, #fff, var(--pink-mist)); }
.album-ending-icon, .album-badge-icon { font-size: 1.8rem; flex-shrink: 0; }
.album-ending p, .album-badge p { font-size: .88rem; color: var(--plum-2); }
.album-badge-state { font-size: .72rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--violet-deep); }
.album-note { color: var(--plum-2); font-weight: 600; margin-bottom: 12px; }

/* ---------- Archive (screen) ---------- */
.archive-screen { display: flex; flex-direction: column; gap: 16px; }
.archive-bar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.archive-tip { background: var(--butter); border-radius: var(--r-md); padding: 10px 14px; font-weight: 700; font-size: .92rem; }
.pdf-doc { display: flex; flex-direction: column; gap: 20px; }
.pdf-page { background: #fff; border-radius: var(--r-md); padding: 32px; box-shadow: var(--shadow-md); border: 2px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.pdf-cover { background: linear-gradient(160deg, #FFE1EE, #fff 50%, #EEE7FF); }
.pdf-cover-frame { border: 3px double var(--pink); border-radius: var(--r-md); padding: 34px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.pdf-title { font-size: clamp(2rem, 5vw, 3rem); font-weight: 900; }
.pdf-sub { font-family: var(--f-head); font-style: italic; font-size: 1.2rem; }
.pdf-hook { font-family: var(--f-hand); font-size: 1.6rem; color: var(--magenta-deep); font-weight: 700; margin-bottom: 52px; }
.pdf-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 26px; margin: 8px 0 0; }
.pdf-meta dt { font-size: .72rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--plum-2); }
.pdf-meta dd { margin: 0; font-weight: 900; font-size: 1.1rem; }
.pdf-bars { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pdf-bar { background: var(--cream); border: 2px solid var(--line-pink); border-radius: 999px; padding: 5px 12px; font-weight: 800; font-size: .88rem; }
.pdf-case-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border-bottom: 3px double var(--line-pink); padding-bottom: 12px; }
.pdf-case-title { font-size: 1.7rem; font-weight: 900; }
.pdf-case-trope { font-weight: 700; color: var(--plum-2); }
.pdf-impression { flex-shrink: 0; padding: 8px 14px; }
.pdf-impression .imp-verdict { font-size: 1.2rem; }
.pdf-case-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.pdf-label { font-family: var(--f-body); font-size: .74rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--magenta-deep); margin: 10px 0 4px; }
.pdf-quote { font-family: var(--f-hand); font-size: 1.35rem; line-height: 1.2; font-weight: 700; }
.pdf-memo { background: var(--cream); border-radius: var(--r-md); padding: 14px 16px; border-left: 6px solid var(--pink); }
.pdf-question { font-family: var(--f-head); font-weight: 700; font-size: 1.1rem; }
.pdf-notes { margin-top: 8px; display: grid; gap: 6px; white-space: pre-wrap; }
.pdf-empty { color: var(--plum-3); font-style: italic; }
.pdf-clue { font-family: var(--f-hand); font-size: 1.25rem; color: var(--violet-deep); font-weight: 700; }
.pdf-from { font-family: var(--f-hand); font-size: 1.2rem; text-align: right; }
.pdf-letter { border: 2px dashed var(--lilac); border-radius: var(--r-md); padding: 12px 14px; }
.pdf-stats { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 0; list-style: none; margin: 0; font-weight: 800; }
.pdf-eval .hera-letter { max-width: none; }

/* ---------- Responsive ---------- */
@media (min-width: 1100px) {
  .desk-badge-slot { display: block; }
  .desk-hero { padding-right: 230px; }
  .desk-badge-slot { right: 18px; top: 50%; transform: translateY(-50%); }
  .desk-badge-slot .badge-card { width: 210px; }
  .desk-badge-slot .badge-body { flex-direction: column; text-align: center; }
  .desk-badge-slot .badge-foot { flex-wrap: wrap; justify-content: center; }
}
@media (max-width: 960px) {
  .title-screen { grid-template-columns: 1fr; text-align: center; }
  .title-card { align-items: center; text-align: center; }
  .title-actions { align-items: center; }
  .title-ribbon { align-self: center; }
  .title-hero { transform: none; }
  .desk-hero { grid-template-columns: 1fr; }
  .parts { grid-template-columns: 1fr; }
  .stamp-grid { grid-template-columns: repeat(2, 1fr); }
  .eval-grid { grid-template-columns: 1fr; justify-items: center; }
  .eval-bars, .stats { width: 100%; }
  .meter-label { display: none; }
  .meter-text { min-width: 56px; }
}
@media (max-width: 760px) {
  body { font-size: 1rem; }
  #screen { padding: 14px 16px 64px; }
  .registry-grid { grid-template-columns: 1fr; }
  .registry-preview { position: static; order: -1; padding-bottom: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-portrait { max-width: 320px; justify-self: center; transform: rotate(-1deg); }
  .form-field { grid-template-columns: 1fr; gap: 2px; }
  .ev-content { grid-template-columns: 1fr; }
  .confession-contrast { grid-template-columns: 1fr; }
  .letters { grid-template-columns: 1fr; }
  .own-form-grid { grid-template-columns: 1fr; justify-items: center; }
  .postcard { grid-template-columns: 1fr; }
  .postcard-art-wrap { min-height: 0; aspect-ratio: 4 / 3; }
  .memo-head { grid-template-columns: 1fr; }
  .pdf-case-grid { grid-template-columns: 1fr; }
  .pdf-page { padding: 20px; }
  .brand-title { display: none; }
  .topbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .topbar-day { display: none; }
  .topbar-meters { gap: 8px; padding: 6px 10px; }
  .meter-text { min-width: 34px; }
  .meter-num { display: none; }
  .btn-icon { width: 40px; height: 40px; }
  .turn-stepper { top: 64px; border-radius: 18px; }
  .stepper-item { flex-direction: column; gap: 2px; padding: 5px 2px; font-size: .68rem; }
  .step-label { max-width: 100%; }
  .complaint-form { padding: 20px 16px 18px 38px; }
  .archery-range { min-height: 120px; padding: 10px; }
  .flyer .arrow-svg { width: 120px; }
  .target-wrap { width: 84px; }
  .bow { font-size: 2rem; }
  .step-actions { flex-direction: column-reverse; align-items: stretch; }
  .step-actions .btn { width: 100%; }
  .intro-caption { padding: 18px; }
  .intro-controls .btn { flex: 1; }
}
@media (max-width: 420px) {
  .stamp-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stamp-face { min-height: 150px; padding: 10px 6px; }
  .stamp-desc { display: none; }
  .folder-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .folder-body { min-height: 130px; padding: 10px; }
  .part-grid { grid-template-columns: 1fr 1fr; }
  .badge-card { width: 270px; }
  .topbar-meters .meter-text { width: 26px; }
}

/* ---------- Motion & contrast preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .intro-sentence { opacity: 1; }
}
@media (forced-colors: active) {
  .btn, .chip, .part-card, .stamp-face, .folder-body { border: 2px solid ButtonText; }
}

/* ---------- Print: Official Case Archive ---------- */
/* ---------- First-run sound choice ---------- */
.sound-pick { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; padding: 16px; background: rgba(59, 18, 56, .45); backdrop-filter: blur(6px); animation: rise .35s ease; }
.sound-pick-out { opacity: 0; transition: opacity .3s; }
.sound-card { width: min(440px, 100%); background: #fff; border-radius: 22px; padding: 26px 22px 18px; text-align: center; box-shadow: 0 18px 50px rgba(59, 18, 56, .35); border: 2px solid var(--line-pink, #ffc9de); }
.sound-lang { display: flex; width: max-content; margin: -6px auto 12px; }
.sound-card .kicker { font-size: .72rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: var(--pink); }
.sound-card h2 { margin: 6px 0 16px; font-size: clamp(1.4rem, 5vw, 1.8rem); color: var(--plum); }
.sound-options { display: grid; gap: 10px; }
.sound-option { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line-pink, #ffc9de); background: #fff; cursor: pointer; transition: transform .15s, border-color .15s, background .15s; font: inherit; color: var(--plum); }
.sound-option:hover, .sound-option:focus-visible { border-color: var(--pink); background: #FFF1F4; transform: translateY(-1px); }
.sound-option:first-child { border-color: var(--pink); background: linear-gradient(120deg, #FFE1EE, #F1EAFF); }
.sound-icon { font-size: 1.7rem; line-height: 1; }
.sound-text { display: flex; flex-direction: column; gap: 2px; }
.sound-text strong { font-size: 1.05rem; }
.sound-text small { font-size: .85rem; color: var(--plum-2, #6b3a63); }
.sound-sub { margin: 14px 0 0; font-size: .8rem; color: var(--plum-2, #6b3a63); }
@media (prefers-reduced-motion: reduce) { .sound-pick { animation: none; } }

@media print {
  @page { size: letter portrait; margin: 12mm; }
  html, body { background: #fff !important; }
  #hearts-bg, #fx, .topbar, .no-print, #toast, #modal-root { display: none !important; }
  #screen { max-width: none; padding: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pdf-doc { gap: 0; }
  .pdf-page { box-shadow: none; border: 0; border-radius: 0; padding: 0; break-after: page; page-break-after: always; }
  .pdf-page:last-child { break-after: auto; page-break-after: auto; }
  .pdf-memo, .pdf-letter, .hera-letter { break-inside: avoid; }
  .badge-card { box-shadow: none; transform: none; }
  .impression { mix-blend-mode: normal; }
  .pdf-page { position: relative; overflow: hidden; }
  .pdf-impression { animation: none !important; }
}

/* ---------- Special days, workbench notes, finale ---------- */
.stamp-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .stamp-grid-3 { grid-template-columns: 1fr; } .stamp-grid-3 .stamp-face { min-height: 0; } .stamp-grid-3 .stamp-desc { display: block; } }
.bench-clues { background: #FFFBEA; border: 2px dashed var(--butter-deep); border-radius: var(--r-md); padding: 14px 16px; display: grid; gap: 8px; }
.bench-clue { font-family: var(--f-hand); font-size: 1.35rem; line-height: 1.2; font-weight: 700; display: flex; gap: 10px; align-items: baseline; }
.bench-clue-tag { flex-shrink: 0; font: 900 .7rem var(--f-body); letter-spacing: .1em; text-transform: uppercase; background: var(--pink); color: var(--plum); padding: 3px 9px; border-radius: 999px; }
.talk-step { display: flex; flex-direction: column; gap: 18px; }
.talk-log { display: grid; gap: 14px; }
.talk-log:empty { display: none; }
.talk-pair { display: grid; gap: 8px; animation: rise .35s ease; }
.finale-letter { text-align: left; background: #FFFBEA; border: 2px solid var(--butter-deep); border-radius: var(--r-md); padding: 18px; display: grid; gap: 10px; font-family: var(--f-head); line-height: 1.55; margin-top: 8px; }
.cupid-note { grid-column: 1 / -1; background: #fff; border: 2px dashed var(--lilac); border-radius: var(--r-md); padding: 14px 18px; transform: rotate(-.5deg); }
.cupid-note p { font-family: var(--f-hand); font-size: 1.45rem; line-height: 1.2; font-weight: 700; color: var(--violet-deep); }
.letter-text { white-space: pre-line; }
.hera-letter p, .twist-letter p, .finale-letter p { white-space: pre-line; }
.desk-today-complaint { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.meter-text { flex: none; width: 96px; min-width: 0; }
.meter-label { overflow: hidden; text-overflow: ellipsis; }
.meter-num { margin-left: 2px; }
@media (max-width: 1100px) { .meter-text { width: 64px; } .meter-label { display: none; } }
@media (max-width: 760px) { .meter-text { width: 34px; } }
.postcard-card { overflow: visible; max-height: none; }
.postcard-backdrop, .modal-backdrop { overflow-y: auto; }
.reply-box > .btn-small { align-self: flex-start; }
.talk-pair { animation: none; }
.talk-pair:last-child { animation: rise .35s ease; }
.impression { max-width: 100%; }
@media (max-width: 760px) {
  .pdf-case-head { flex-direction: column; }
  .pdf-impression { align-self: center; }
  .imp-verdict { font-size: clamp(1.2rem, 7vw, 1.8rem); }
}

/* ---------- Phones (also covers large system text sizes) ---------- */
@media (max-width: 600px) {
  /* Top bar: back / brand / buttons on the first row, the three meters on their own row */
  .topbar { flex-wrap: wrap; row-gap: 6px; }
  .topbar-right { margin-left: auto; }
  .topbar-center { order: 5; flex: 1 1 100%; }
  .topbar-meters { width: 100%; justify-content: space-between; gap: 10px; padding: 5px 12px; }
  .mini-meter { flex: 1 1 0; min-width: 0; }
  .topbar-meters .meter-text, .meter-text { flex: 1 1 auto; width: auto; min-width: 0; }

  /* Step bar: numbers only, the current step shows its name */
  .turn-stepper { position: relative; top: auto; display: flex; justify-content: space-between; gap: 4px; border-radius: 999px; padding: 5px; }
  .stepper-item { flex: 0 0 auto; flex-direction: row; gap: 6px; padding: 5px; min-height: 40px; font-size: .9rem; }
  .stepper-item .step-label { display: none; }
  .stepper-item.active { flex: 1 1 auto; min-width: 0; justify-content: flex-start; padding: 5px 14px 5px 5px; }
  .stepper-item.active .step-label { display: block; }

  /* Doris: her picture first, the comment underneath, full width */
  .doris-say { flex-direction: column; align-items: center; }
  .doris-bubble { width: 100%; border-radius: 20px; }
  .doris-large .doris-avatar { width: 84px; height: 84px; }
  .doris-large .doris-text { font-size: 1.3rem; }

  /* Long words and buttons wrap instead of spilling out */
  h1, h2, h3, .btn, .kicker { overflow-wrap: break-word; }
  .btn { white-space: normal; }

  /* Evidence tabs: a 2-column grid so every tab (Doris's too) is visible without sideways scrolling */
  .ev-tabs { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; gap: 6px; }
  .ev-tab { min-width: 0; max-width: none; width: 100%; border-radius: 14px; border-bottom: 2px solid var(--line-pink); }
  .ev-tab.active { top: 0; border-color: var(--pink); box-shadow: 0 0 0 2px var(--pink) inset; }
  .ev-panel { border-radius: var(--r-md); margin-top: 8px; }
  .ev-tab-label { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.15; }

  /* Evidence pictures are portrait-ish: show them whole on a phone */
  .ev-art { aspect-ratio: 688 / 768; }

  /* Margin doodle sits in the margin, not on the text */
  .complaint-form { padding-left: 48px; }
  .margin-doodle { width: 38px; height: 38px; font-size: 1.5rem; left: 3px; }
  .margin-doodle:not(.found)::after { font-size: .78rem; }
}
