/* A cozy island: rounded cream speech bubbles, pill name tags, soft shadows, everything bouncy. */
:root {
  --cream: #fff8e7;
  --cream-2: #f7ecd2;
  --brown: #7a5a3a;
  --brown-2: #a07c55;
  --ink: #5b4330;
  --leaf: #6cc24a;
  --leaf-2: #4ea83a;
  --sky: #8fd3f4;
  --orange: #ff9a3c;
  --orange-2: #ff7b1c;
  --pink: #ff8fb1;
  --blue: #5bb4e5;
  --gold: #ffcd4a;
  --paper: #fffaf0;
  --pen-ink: #2c3a6b;
  --red: #e2483d;
  --f: "Fredoka", "Jua", ui-rounded, system-ui, sans-serif;
  --f-ko: "Jua", "Fredoka", sans-serif;
  --f-hand: "Caveat", "Nanum Pen Script", "Bradley Hand", cursive;
  --pop: cubic-bezier(.34, 1.56, .64, 1);
  --out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--sky); color: var(--ink); font-family: var(--f);
  overflow: hidden; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
  -webkit-font-smoothing: antialiased;
}
#app { position: fixed; inset: 0; overflow: hidden; touch-action: none; }

/* sky behind the curved world */
#sky { position: absolute; inset: 0; transition: background 2s; background: linear-gradient(180deg, #5fbcf0 0%, #9fdcf7 55%, #e4f6ff 100%); }
#sky.evening { background: linear-gradient(180deg, #6b6fc4 0%, #f59ab0 50%, #ffd59a 100%); }
#sky.night { background: linear-gradient(180deg, #0e1640 0%, #23306e 55%, #46508f 100%); }
#sky .cloud { position: absolute; opacity: .95; filter: blur(.6px); }
#sky .cloud i { position: absolute; border-radius: 50%; background: radial-gradient(circle at 38% 30%, #ffffff 0%, #fbfdff 38%, #e3edf7 68%, #c9d8e8 100%); }
#sky .cloud b { position: absolute; left: 4%; right: 4%; bottom: 0; height: 34%; border-radius: 0 0 50% 50% / 0 0 100% 100%; background: linear-gradient(180deg, #e8f0f8, #c6d5e6); }
#sky.night .cloud { opacity: .14 !important; }
#sky.fw .cloud { opacity: 0 !important; transition: opacity 1s; }
#sky.evening .cloud i { background: radial-gradient(circle at 38% 30%, #fff6f0 0%, #ffe6e0 45%, #f4b8c0 80%, #d896b0 100%); }
#sky.evening .cloud b { background: linear-gradient(180deg, #f4c6cc, #d896b0); }
@media (prefers-reduced-motion: no-preference) { #sky .cloud { animation: drift linear infinite; } }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(calc(100vw + 300px)); } }
#stars { position: absolute; inset: 0 0 40% 0; opacity: 0; transition: opacity 2s; }
#sky.night #stars { opacity: 1; }
#stars i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff; }
@media (prefers-reduced-motion: no-preference) { #stars i:nth-child(3n) { animation: tw 2.6s ease-in-out infinite; } }
@keyframes tw { 50% { opacity: .2; } }

canvas#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* buttons */
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
.btn {
  font-family: var(--f); font-weight: 600; font-size: 17px; letter-spacing: .01em; color: var(--ink);
  padding: 12px 22px; border-radius: 999px; background: var(--cream);
  box-shadow: 0 4px 0 #d9c7a0, 0 8px 18px rgba(90,60,30,.18); touch-action: manipulation;
  transition: transform .15s var(--pop), box-shadow .15s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #d9c7a0, 0 4px 10px rgba(90,60,30,.18); }
.btn:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
.btn.primary { background: linear-gradient(180deg, #ffb35c, var(--orange-2)); color: #fff; text-shadow: 0 2px 0 rgba(160,70,0,.35); box-shadow: 0 4px 0 #d0600c, 0 8px 18px rgba(200,90,20,.3); }
.btn.primary:active { box-shadow: 0 1px 0 #d0600c, 0 4px 10px rgba(200,90,20,.3); }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; transition: opacity .6s; }
#hud > * { transition: opacity .5s var(--out), transform .6s var(--out); }
#clock {
  position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); left: 14px;
  background: var(--cream); border-radius: 22px; padding: 8px 16px 9px; box-shadow: 0 4px 0 #e2cfa6, 0 10px 20px rgba(80,60,30,.15);
  display: grid; gap: 1px;
}
#clock .t { font-size: 28px; font-weight: 700; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
#clock .t small { font-size: 15px; margin-left: 3px; }
#clock .d { font-size: 13px; font-weight: 600; color: var(--brown-2); }
#clock .sea { font-size: 12px; font-weight: 500; color: #6f9fbf; }
#stats { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 14px; display: grid; gap: 8px; justify-items: end; }
.pill { display: inline-flex; align-items: center; gap: 7px; background: var(--cream); border-radius: 999px; padding: 6px 13px 6px 8px; font-weight: 700; font-size: 16px; box-shadow: 0 3px 0 #e2cfa6, 0 8px 16px rgba(80,60,30,.12); }
.pill .ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; }
.pill.pop { animation: pop .45s var(--pop); }
@keyframes pop { 40% { transform: scale(1.25); } }
#soundBtn { pointer-events: auto; font-size: 13px; padding: 7px 12px; }
#hint { position: absolute; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: rgba(91,67,48,.78); color: #fff8e7; border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 500; white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) { #hint:not([hidden]) { animation: bubIn .6s var(--pop) both; } }

/* toast: AC style notification */
#toast {
  position: absolute; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); transform: translateX(-50%);
  background: var(--cream); border-radius: 22px; padding: 10px 18px 11px 12px; display: flex; gap: 10px; align-items: center;
  box-shadow: 0 4px 0 #e2cfa6, 0 12px 26px rgba(80,60,30,.2); font-weight: 600; font-size: 16px; max-width: min(460px, calc(100% - 28px));
}
#toast .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--orange); flex: none; }
@media (prefers-reduced-motion: no-preference) { #toast:not([hidden]) { animation: toastIn .6s var(--pop) both; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-30px) scale(.9); } }

/* interaction prompt over the world */
.prompt {
  position: absolute; transform: translate(-50%, -100%); pointer-events: none;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: var(--cream); color: var(--ink); border-radius: 999px; padding: 5px 13px 5px 5px; font-weight: 600; font-size: 15px;
  box-shadow: 0 3px 0 #e2cfa6, 0 8px 16px rgba(80,60,30,.18);
}
.prompt b { width: 24px; height: 24px; border-radius: 50%; background: var(--leaf); color: #fff; display: grid; place-items: center; font-size: 13px; }
/* on a computer the badge is a little keycap for the space bar */
.prompt b.space { width: auto; height: 22px; padding: 0 9px; border-radius: 6px; background: #fff; color: var(--ink); font-size: 11px; font-weight: 700; letter-spacing: .04em; border: 1.5px solid #d8c8a8; box-shadow: 0 2px 0 #d8c8a8; }
@media (prefers-reduced-motion: no-preference) { .prompt { animation: bob 1.4s ease-in-out infinite; } }
@keyframes bob { 50% { translate: 0 -4px; } }
.nametag { position: absolute; transform: translate(-50%, -100%); pointer-events: none; font-weight: 700; font-size: 13px; color: #fff; padding: 2px 10px 3px; border-radius: 999px; white-space: nowrap; box-shadow: 0 2px 0 rgba(0,0,0,.12); }
.nametag.ko { font-family: var(--f-ko); font-weight: 400; font-size: 15px; }
.bubble { position: absolute; transform: translate(-50%, -100%); pointer-events: none; font-family: var(--f-ko); font-size: 20px; background: #fff; border-radius: 16px; padding: 3px 12px; box-shadow: 0 3px 0 #e2cfa6; white-space: nowrap; }
.bubble::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; }
@media (prefers-reduced-motion: no-preference) { .bubble:not([hidden]) { animation: bubIn .4s var(--pop) both; } }
@keyframes bubIn { from { opacity: 0; transform: translate(-50%, -60%) scale(.5); } }

/* touch controls */
#touchZone { position: absolute; inset: 0; touch-action: none; pointer-events: auto; }
#joy { position: absolute; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%; background: rgba(255,248,231,.35); box-shadow: inset 0 0 0 3px rgba(255,255,255,.6); pointer-events: none; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; background: var(--cream); box-shadow: 0 4px 0 #e2cfa6, 0 6px 14px rgba(0,0,0,.2); }
#btnA {
  position: absolute; right: 22px; bottom: calc(30px + env(safe-area-inset-bottom, 0px)); width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle at 40% 32%, #8fe06a, var(--leaf-2)); color: #fff; font-weight: 700; font-size: 26px; text-shadow: 0 2px 0 rgba(0,80,0,.3);
  box-shadow: 0 5px 0 #3a8a2a, 0 10px 20px rgba(0,60,0,.25); pointer-events: auto; display: none; touch-action: none; transition: transform .1s;
}
#btnA.pressed { transform: translateY(4px); box-shadow: 0 1px 0 #3a8a2a; }
#btnA.ready { animation: aPulse 1.2s ease-in-out infinite; }
@keyframes aPulse { 50% { box-shadow: 0 5px 0 #3a8a2a, 0 0 0 10px rgba(108,194,74,.25); } }
#btnB {
  position: absolute; right: 108px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); width: 56px; height: 56px; border-radius: 50%;
  background: var(--cream); color: var(--ink); font-family: var(--f-ko); font-size: 19px; box-shadow: 0 4px 0 #e2cfa6, 0 8px 16px rgba(0,0,0,.15); pointer-events: auto; display: none; touch-action: none;
}
.touch #btnA, .touch #btnB { display: block; }
.touch #hint { bottom: calc(118px + env(safe-area-inset-bottom, 0px)); }

/* ---------- dialog: cream bubble with a tilted name pill ---------- */
#dialog {
  position: absolute; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  width: min(620px, calc(100% - 24px)); min-height: 120px; padding: 30px 30px 26px; z-index: 5; cursor: pointer;
  background: var(--cream); border-radius: 46px / 40px; box-shadow: 0 6px 0 #e2cfa6, 0 16px 36px rgba(80,60,30,.25);
}
@media (prefers-reduced-motion: no-preference) { #dialog:not([hidden]) { animation: dlgIn .5s var(--pop) both; } }
@keyframes dlgIn { from { opacity: 0; transform: translateX(-50%) translateY(24px) scale(.92); } }
#dlgWho {
  position: absolute; left: 34px; top: -18px; transform: rotate(-4deg); padding: 6px 18px 7px; border-radius: 999px;
  font-weight: 700; font-size: 17px; color: #fff; background: var(--orange); box-shadow: 0 3px 0 rgba(0,0,0,.12);
}
#dlgWho.ko { font-family: var(--f-ko); font-weight: 400; font-size: 19px; }
#dlgText { font-size: 21px; font-weight: 500; line-height: 1.45; color: var(--ink); min-height: 2.9em; }
#dlgNext { position: absolute; left: 50%; bottom: 8px; width: 0; height: 0; margin-left: -9px; border: 9px solid transparent; border-top: 11px solid var(--orange); border-bottom: 0; }
@media (prefers-reduced-motion: no-preference) { #dlgNext { animation: nb .8s ease-in-out infinite; } }
@keyframes nb { 50% { transform: translateY(4px); } }

/* ---------- iris transition ---------- */
#iris { position: absolute; inset: 0; z-index: 30; pointer-events: none; background: #1b1206; --r: 150vmax; --x: 50%; --y: 50%;
  -webkit-mask: radial-gradient(circle at var(--x) var(--y), transparent var(--r), #000 calc(var(--r) + 1px));
  mask: radial-gradient(circle at var(--x) var(--y), transparent var(--r), #000 calc(var(--r) + 1px)); }

/* ---------- title ---------- */
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; touch-action: pan-y; }
#title { z-index: 8; background: radial-gradient(ellipse at 50% 45%, rgba(255,248,231,0), rgba(60,120,160,.25)); }
.title-card { display: grid; gap: 14px; justify-items: center; text-align: center; }
.title-card > * { opacity: 0; }
.title-card.in > * { animation: rise .9s var(--pop) both; animation-delay: calc(var(--i, 0) * 110ms + 100ms); }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.9); } to { opacity: 1; transform: none; } }
.logo { position: relative; padding: 22px 40px 26px; background: var(--cream); border-radius: 48px; box-shadow: 0 8px 0 #e2cfa6, 0 22px 40px rgba(60,90,120,.25); }
.logo .fruit { position: absolute; left: 50%; top: -40px; margin-left: -34px; width: 68px; height: 68px; }
@media (prefers-reduced-motion: no-preference) { .title-card.in .logo .fruit { animation: sway 2.8s ease-in-out infinite; transform-origin: 50% 90%; } }
@keyframes sway { 50% { transform: rotate(-8deg); } }
.logo h1 { margin: 6px 0 0; font-size: clamp(38px, 9vw, 64px); font-weight: 700; line-height: 1; color: var(--orange-2); letter-spacing: -.01em; text-shadow: 0 3px 0 #ffd9a8; }
.logo h1 .wv { display: inline-block; }
@media (prefers-reduced-motion: no-preference) { .title-card.in .logo h1 .wv { animation: hop 3s ease-in-out infinite; animation-delay: calc(var(--j) * 90ms + 1.2s); } }
@keyframes hop { 0%, 20%, 100% { transform: none; } 10% { transform: translateY(-8px); } }
.logo .ko { font-family: var(--f-ko); font-size: 20px; color: var(--brown-2); margin-top: 4px; }
.for { font-size: 18px; font-weight: 600; color: #fff; text-shadow: 0 2px 0 rgba(40,90,130,.4), 0 0 18px rgba(40,90,130,.4); }
#startBtn { font-size: 21px; padding: 15px 34px; }
#startBtn:disabled { opacity: .6; }
.gate { display: grid; gap: 8px; justify-items: center; }
.gate label { font-size: 17px; padding: 7px 18px; }
.gate input { font-family: var(--f); font-weight: 600; font-size: 20px; text-align: center; letter-spacing: .08em; color: var(--ink); width: 210px; padding: 11px 16px; border: 0; border-radius: 999px; background: var(--cream); box-shadow: inset 0 3px 0 #e8d6b0, 0 6px 16px rgba(90,60,30,.15); }
.gate input::placeholder { color: #c2ab84; letter-spacing: .04em; }
.gate input:focus { outline: 3px solid var(--orange); outline-offset: 2px; }
.gate input.no { animation: qshake .4s; background: #f6d6cc; }
.title-card.locked > :not(.logo):not(.gate) { display: none; }
.gate-msg { color: #c0392b; }
.gate-msg:empty { display: none; }
.title-sub, .gate label, .gate-msg { font-size: 14px; font-weight: 600; color: var(--ink); background: rgba(255,248,231,.92); padding: 6px 14px; border-radius: 999px; box-shadow: 0 4px 12px rgba(40,70,100,.18); }
@media (prefers-reduced-motion: reduce) { .title-card > * { opacity: 1; } }

/* boot */
#boot { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(180deg, #8fd3f4, #e4f6ff); z-index: 40; transition: opacity .6s var(--out); }
#boot.out { opacity: 0; pointer-events: none; }
.boot-in { display: grid; gap: 14px; justify-items: center; }
.boot-leaf { width: 64px; height: 64px; }
@media (prefers-reduced-motion: no-preference) { .boot-leaf { animation: spin 1.4s var(--pop) infinite; } }
@keyframes spin { 50% { transform: rotate(-12deg) scale(1.08); } }
.boot-txt { font-weight: 600; color: var(--brown); }
#nogl { max-width: 32ch; text-align: center; font-size: 17px; line-height: 1.5; color: var(--brown); }

/* ---------- gallery viewer ---------- */
#viewer { position: absolute; inset: 0; z-index: 12; display: grid; grid-template-rows: auto 1fr auto; gap: 12px; padding: calc(14px + env(safe-area-inset-top, 0px)) 14px calc(16px + env(safe-area-inset-bottom, 0px)); background: rgba(40,28,16,.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@media (prefers-reduced-motion: no-preference) { #viewer:not([hidden]) { animation: fade .35s var(--out) both; } }
@keyframes fade { from { opacity: 0; } }
.v-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.v-title { background: var(--cream); border-radius: 999px; padding: 7px 18px 8px; font-weight: 700; font-size: 18px; box-shadow: 0 3px 0 #e2cfa6; }
.v-title .ko { font-family: var(--f-ko); font-weight: 400; color: var(--brown-2); margin-left: 6px; }
#vClose { width: 46px; height: 46px; border-radius: 50%; background: var(--cream); font-size: 22px; font-weight: 700; box-shadow: 0 3px 0 #e2cfa6; }
.v-stage { position: relative; display: grid; place-items: center; min-height: 0; touch-action: pan-y; }
.v-frame { position: relative; max-width: 100%; max-height: 100%; background: #fff; padding: 10px 10px 12px; border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.4); display: grid; }
.v-frame img, .v-frame video { display: block; max-width: calc(100vw - 48px); max-height: calc(100vh - 210px); max-height: calc(100dvh - 210px); object-fit: contain; border-radius: 4px; background: #f2ead8; }
@media (prefers-reduced-motion: no-preference) { .v-frame.in { animation: vIn .45s var(--pop) both; } }
@keyframes vIn { from { opacity: 0; transform: scale(.92) rotate(-1.5deg); } }
.v-empty { width: min(420px, 80vw); aspect-ratio: 4 / 3; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--brown-2); font-weight: 600; line-height: 1.5; background: repeating-linear-gradient(45deg, #fdf4df 0 14px, #f7ecd2 14px 28px); border-radius: 4px; }
.v-nav { position: absolute; top: 50%; width: 52px; height: 52px; margin-top: -26px; border-radius: 50%; background: var(--cream); font-size: 24px; font-weight: 700; box-shadow: 0 3px 0 #e2cfa6, 0 8px 18px rgba(0,0,0,.25); }
#vPrev { left: 4px; } #vNext { right: 4px; }
.v-foot { display: grid; gap: 8px; justify-items: center; }
#vCap { color: #fff8e7; font-size: 17px; font-weight: 500; text-align: center; min-height: 1.2em; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
#vDots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
#vDots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,248,231,.4); }
#vDots i.on { background: var(--cream); transform: scale(1.25); }

/* ---------- message bottle note / info card ---------- */
#note { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 10; background: rgba(40,28,16,.4); }
.note-paper {
  width: min(390px, 100%); padding: 26px 26px 18px; color: #5b3a1c; border-radius: 6px; transform-origin: 50% 0;
  background-image: repeating-linear-gradient(180deg, transparent 0 29px, rgba(150,110,70,.18) 29px 30px), linear-gradient(180deg, #fff6e0, #f3deb4);
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
}
.note-when { font-weight: 700; font-size: 13px; color: var(--orange-2); letter-spacing: .04em; }
.note-text { font-family: var(--f-hand); font-size: 28px; line-height: 30px; margin: 10px 0 6px; }
.note-photo { display: block; width: 72%; max-height: 42vh; object-fit: cover; margin: 12px auto 4px; background: #fff; padding: 7px 7px 22px; box-shadow: 0 8px 18px rgba(0,0,0,.28); transform: rotate(-2.5deg); }
.note-sign { font-family: var(--f-hand); font-size: 25px; text-align: right; color: var(--orange-2); }
.note-tap { font-size: 12px; font-weight: 600; color: #a08a66; text-align: center; margin-top: 12px; }
@media (prefers-reduced-motion: no-preference) {
  #note:not([hidden]) .note-paper { animation: unroll .7s var(--pop) both; }
  #note:not([hidden]) .note-text { animation: inkin 1.1s .4s var(--out) both; }
}
@keyframes unroll { from { transform: scaleY(.05) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes inkin { from { opacity: 0; filter: blur(3px); } }
#card { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 10; background: rgba(40,28,16,.35); }
.card-in { width: min(420px, 100%); background: var(--cream); border-radius: 30px; padding: 24px 24px 20px; box-shadow: 0 6px 0 #e2cfa6, 0 20px 40px rgba(0,0,0,.25); display: grid; gap: 12px; text-align: center; }
@media (prefers-reduced-motion: no-preference) { #card:not([hidden]) .card-in { animation: dlgIn2 .5s var(--pop) both; } }
@keyframes dlgIn2 { from { opacity: 0; transform: translateY(20px) scale(.9); } }
.card-in .eyebrow { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .12em; color: var(--brown-2); opacity: .8; }
/* the door quiz as a digital door lock: brushed dark metal, a glowing screen, keypad buttons, a status light */
.card-in.lock { width: min(340px, 100%); background: linear-gradient(160deg, #3d4048, #24262c 60%, #2e3037); border-radius: 28px; padding: 18px 18px 22px; gap: 14px; box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 6px 0 #15161a, 0 20px 40px rgba(0,0,0,.4); }
.lock .lk-top { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; color: #9aa0ab; font-size: 12px; font-weight: 700; letter-spacing: .12em; }
.lock .lk-led { width: 10px; height: 10px; border-radius: 50%; background: #ff5a4a; box-shadow: 0 0 8px #ff5a4a; }
.lock .lk-led.ok { background: #4fe08a; box-shadow: 0 0 10px #4fe08a; }
.lock .lk-screen { background: linear-gradient(180deg, #0e2a30, #0a1f24); border-radius: 14px; padding: 14px 12px; box-shadow: inset 0 2px 8px rgba(0,0,0,.6); }
.lock .quiz-q { color: #bff6ff; font-size: 17px; text-shadow: 0 0 6px rgba(120,230,255,.45); }
.lock .quiz-msg { color: #7fd8e8; font-size: 13px; margin-top: 8px; min-height: 18px; }
.lock .quiz-opts { gap: 10px; }
.lock .quiz-opts .btn { display: grid; grid-template-columns: 34px 1fr; align-items: center; text-align: left; gap: 10px; background: linear-gradient(180deg, #4a4d56, #383a42); color: #f2f4f7; box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 3px 0 #1a1b1f; border-radius: 14px; padding: 12px 14px; font-size: 16px; }
.lock .quiz-opts .btn .k { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #8fdcec; color: #bff6ff; font-size: 15px; text-shadow: 0 0 6px rgba(120,230,255,.6); }
.lock .quiz-opts .btn.no { background: linear-gradient(180deg, #6a3a3a, #4a2a2a); }
.lock .quiz-opts .btn.yes { background: linear-gradient(180deg, #2f7a52, #23603f); }
.quiz-q { margin: 0; font-size: 19px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.quiz-opts { display: grid; gap: 8px; }
.quiz-opts .btn { background: #fbf1dc; color: var(--ink); box-shadow: 0 3px 0 #e8d6b0; font-size: 17px; }
.quiz-opts .btn.no { background: #f6d6cc; animation: qshake .4s; }
.quiz-opts .btn.yes { background: linear-gradient(180deg, #ffb35c, var(--orange-2)); color: #fff; }
.quiz-msg { min-height: 20px; margin: 0; font-size: 14px; font-weight: 600; color: var(--brown-2); }
@keyframes qshake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
.days { display: grid; gap: 2px; padding: 2px 0 16px; border-bottom: 1.5px solid #f0e2c6; }
.days b { font-size: 64px; line-height: 1; color: var(--orange-2); font-variant-numeric: tabular-nums; }
.days span { font-size: 17px; font-weight: 700; color: var(--ink); }
.days small { font-size: 13px; font-weight: 600; color: var(--brown-2); }
.cd { display: grid; gap: 2px; padding: 2px 0; }
.cd span { font-size: 13px; font-weight: 600; color: var(--brown-2); }
.cd b { font-size: 24px; color: var(--ink); font-variant-numeric: tabular-nums; }
.cd.both b { color: var(--orange-2); }
.card-clocks { display: grid; grid-template-columns: minmax(0, 1fr) 2px minmax(0, 1fr); align-items: center; background: #fbf1dc; border-radius: 18px; padding: 10px 6px; }
.card-clocks::before { content: ""; grid-column: 2; grid-row: 1; height: 70%; background: #f0e4cc; border-radius: 2px; }
.cc { display: grid; gap: 1px; }
.cc.sea { grid-column: 1; grid-row: 1; } .cc.seo { grid-column: 3; grid-row: 1; }
.cc b { font-size: clamp(15px, 4.4vw, 18px); font-variant-numeric: tabular-nums; }
.cc span { font-size: 11px; color: var(--brown-2); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.cc b { color: var(--ink); }

/* house name tags + guidance */
.prompt, .htag, #guide { left: 0; top: 0; will-change: transform; }
.htag { position: absolute; transform: translate(-50%, -100%); pointer-events: none; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap;
  background: var(--cream); color: var(--ink); border-radius: 999px; padding: 4px 12px 5px; font-weight: 700; font-size: 14px;
  box-shadow: 0 3px 0 #e2cfa6, 0 8px 16px rgba(80,60,30,.16); transition: opacity .35s var(--out); }
.htag .k { font-family: var(--f-ko); font-weight: 400; color: var(--brown-2); }
.htag .ck { width: 17px; height: 17px; border-radius: 50%; background: var(--leaf); color: #fff; display: none; place-items: center; font-size: 11px; }
.htag.done .ck { display: grid; }
.htag.target { background: var(--orange); color: #fff; }
.htag.target .k { color: #ffe9cf; }
.htag.target::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -7px; border: 7px solid transparent; border-top-color: var(--orange); }
@media (prefers-reduced-motion: no-preference) { .htag.target { animation: bob 1.2s ease-in-out infinite; } }
#guide { position: absolute; z-index: 4; pointer-events: none; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; transition: opacity .35s; }
#guide .ar { width: 40px; height: 40px; border-radius: 50%; background: var(--orange); color: #fff; display: grid; place-items: center; box-shadow: 0 3px 0 #d0600c, 0 8px 16px rgba(200,90,20,.3); }
#guide .ar svg { width: 20px; height: 20px; }
#guide .lb { background: var(--cream); color: var(--ink); border-radius: 999px; padding: 3px 10px 4px; font-weight: 700; font-size: 12px; white-space: nowrap; box-shadow: 0 2px 0 #e2cfa6; }
@media (prefers-reduced-motion: no-preference) { #guide .ar { animation: gpulse 1.4s ease-in-out infinite; } }
@keyframes gpulse { 50% { box-shadow: 0 3px 0 #d0600c, 0 0 0 9px rgba(255,154,60,.25); } }

/* confetti */
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9; }

/* ---------- the letter ---------- */
#letter { z-index: 11; background: rgba(40,28,16,.55); place-items: start center; }
.letter-wrap { width: min(620px, 100%); display: grid; gap: 18px; padding-block: 12px 28px; }
.polaroids { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; padding-top: 8px; }
.polaroid { margin: 0; background: #fff; padding: 8px 8px 30px; width: clamp(104px, 27vw, 160px); box-shadow: 0 10px 22px rgba(0,0,0,.35); position: relative; transform: rotate(var(--r, 0deg)); }
@media (prefers-reduced-motion: no-preference) { .polaroid { animation: pdrop .8s var(--pop) both; animation-delay: var(--d, 0s); } }
@keyframes pdrop { from { transform: translateY(-40px) rotate(calc(var(--r) * -2)); opacity: 0; } }
.polaroid::before { content: ""; position: absolute; top: -9px; left: 50%; width: 58px; height: 18px; margin-left: -29px; background: rgba(255,154,60,.6); transform: rotate(-4deg); }
.polaroid img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #e8e2d6; }
.polaroid figcaption { position: absolute; left: 4px; right: 4px; bottom: 3px; text-align: center; font-family: var(--f-hand); font-size: 20px; line-height: 1.1; color: var(--pen-ink); }
.sheet {
  position: relative; color: var(--pen-ink); background-color: var(--paper); border-radius: 6px;
  background-image: linear-gradient(90deg, transparent 38px, rgba(255,123,28,.45) 38px 40px, transparent 40px), repeating-linear-gradient(180deg, transparent 0 33px, rgba(91,180,229,.3) 33px 34px);
  background-position: 0 0, 0 24px; padding: 24px 20px 34px 52px; font-family: var(--f-hand); font-size: 25px; line-height: 34px;
  box-shadow: 0 14px 40px rgba(0,0,0,.35); cursor: pointer; -webkit-user-select: text; user-select: text;
}
.sheet::after { content: "🍊"; position: absolute; top: -18px; right: 22px; font-size: 34px; transform: rotate(12deg); }
.hl { min-height: 34px; }
#hand.fadein { animation: fade .9s var(--out) both; }
.hl.title { font-family: "Nanum Pen Script", var(--f-hand); font-size: 44px; line-height: 68px; color: var(--orange-2); }
.w { display: inline-block; white-space: nowrap; }
.c { display: inline-block; clip-path: inset(-30% 100% -30% 0); transform: rotate(var(--r, 0deg)) translateY(var(--y, 0px)); }
.c.on { clip-path: inset(-30% -20% -30% 0); transition: clip-path 120ms linear; }
#pen { position: absolute; left: 0; top: 0; width: 34px; height: 34px; pointer-events: none; transition: transform 70ms linear; z-index: 2; }
#skipHint { position: absolute; right: 14px; bottom: 8px; font-family: var(--f); font-size: 13px; color: #9a8f7a; }
.letter-foot { display: grid; gap: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--cream); border-radius: 20px; padding: 11px 6px; text-align: center; display: grid; gap: 3px; box-shadow: 0 3px 0 #e2cfa6; }
.stat b { font-size: 24px; font-weight: 700; }
.stat span { font-size: 13px; line-height: 1.2; color: var(--brown-2); font-weight: 600; }
.stat:nth-child(1) b { color: var(--orange-2); } .stat:nth-child(2) b { color: var(--pink); } .stat:nth-child(3) b { color: var(--blue); }
.letter-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.voice-btn { justify-self: start; }
.env { position: absolute; left: 50%; top: 46%; width: min(380px, 82vw); aspect-ratio: 1.55 / 1; transform: translate(-50%, -50%); }
.env.drop { animation: envDrop .9s var(--pop) both; }
@keyframes envDrop { from { transform: translate(-50%, -170%) rotate(-10deg); opacity: 0; } }
.env.out { transition: opacity .5s, transform .6s var(--out); opacity: 0; transform: translate(-50%, -50%) scale(1.15); }
.env > div { position: absolute; }
.env-back { inset: 0; background: #f2c27a; border-radius: 8px; box-shadow: 0 18px 40px rgba(0,0,0,.4); }
.env-paper { left: 7%; right: 7%; top: 6%; height: 90%; z-index: 1; background-color: var(--paper); background-image: repeating-linear-gradient(180deg, transparent 0 13px, rgba(91,180,229,.3) 13px 14px); transition: transform 1s var(--out); }
.env-front { inset: 0; z-index: 2; background: #ffd79a; border-radius: 8px; clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%); }
.env-addr { right: 9%; bottom: 16%; z-index: 3; font-family: var(--f-hand); font-size: 26px; line-height: 1; color: var(--pen-ink); transform: rotate(-3deg); }
.env-flap { left: 0; right: 0; top: 0; height: 58%; z-index: 4; background: #ffc56e; clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: 50% 0; transition: transform .7s cubic-bezier(.7,0,.84,0), z-index 0s .35s; }
.env-seal { left: 50%; top: 58%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; background: var(--orange); display: grid; place-items: center; font-size: 26px; z-index: 5; box-shadow: inset 0 0 0 4px #e8781a, 0 3px 6px rgba(0,0,0,.3); transition: transform .4s, opacity .4s; }
.env.open .env-seal { transform: scale(1.7); opacity: 0; }
.env.open .env-flap { transform: perspective(700px) rotateX(180deg); z-index: 0; }
.env.open2 .env-paper { transform: translateY(-64%); }
.letter-photo { margin: 0; background: #fff; padding: 10px 10px 34px; box-shadow: 0 14px 40px rgba(0,0,0,.35); transform: rotate(-1deg); position: relative; cursor: zoom-in; }
.letter-photo img { display: block; width: 100%; -webkit-mask-image: linear-gradient(180deg, #000 0, #000 var(--p, 0%), transparent calc(var(--p, 0%) + 8%)); mask-image: linear-gradient(180deg, #000 0, #000 var(--p, 0%), transparent calc(var(--p, 0%) + 8%)); }
.letter-photo.zoomed { cursor: zoom-out; overflow: auto; max-height: 85vh; touch-action: pan-x pan-y; }
.letter-photo.zoomed img { width: 220%; max-width: none; }
.photo-hint { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-size: 13px; color: #9a8f7a; }
#pen2 { position: absolute; left: 0; top: 0; width: 34px; height: 34px; pointer-events: none; z-index: 2; }

/* phones */
@media (max-width: 560px) {
  #clock .t { font-size: 22px; }
  #clock { padding: 7px 13px 8px; }
  .pill { font-size: 14px; padding: 5px 11px 5px 6px; }
  .pill .ic { width: 22px; height: 22px; font-size: 13px; }
  #dialog { padding: 28px 22px 24px; }
  #dlgText { font-size: 18px; }
  .sheet { font-size: 22px; padding: 22px 14px 34px 46px; }
  .hl.title { font-size: 38px; }
  .stat span { font-size: 11px; }
}
@media (max-height: 500px) {
  #dialog { min-height: 96px; padding: 24px 24px 20px; }
  #dlgText { font-size: 17px; }
  .logo { padding: 16px 28px 18px; }
}
