/* ==========================================================================
   desk.css — 书桌 · 笔记本 · 画廊 · 纸张商店
   Tactile warm-craft scene: deep pine cover, bone paper, amber lamp light.
   Motion rule: transform + opacity only (blur only on static bg layers).
   ========================================================================== */

/* ---------- theme tokens ---------- */
:root {
  --line-h: 2.35rem;          /* writing line height (ruled/grid pattern) */
  --grid: 2.35rem;
  --ink: #3A3328;
  --ink-soft: #6B6250;
  --cover: #25402F;           /* pine green default cover */
  --paper: #F6F1E5;           /* bone paper */
  --mood: #E8A33D;
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='180' height='180' filter='url(%23n)' opacity='0.5'/></svg>");
}

/* Paper families: each texture sets its own cover + paper tone + pattern.
   The pattern var re-resolves with the local --line-h, so cards/previews
   get a scaled-down version of the same ruled/grid geometry. */
body[data-texture="plain"]   { --cover:#25402F; --paper:#F6F1E5; --pat:none; --pat-op:0; --pat-size:auto; }
body[data-texture="ruled"]   { --cover:#2A452F; --paper:#F4EFE1; --pat:repeating-linear-gradient(to bottom, transparent 0 calc(var(--line-h) - 1px), rgba(96,110,150,.20) 0 var(--line-h)); --pat-op:.9; --pat-size:auto; }
body[data-texture="grid"]    { --cover:#1F3A4A; --paper:#F3F1EA; --pat:repeating-linear-gradient(to bottom, transparent 0 calc(var(--grid) - 1px), rgba(84,110,150,.13) 0 var(--grid)),repeating-linear-gradient(to right, transparent 0 calc(var(--grid) - 1px), rgba(84,110,150,.13) 0 var(--grid)); --pat-op:.9; --pat-size:auto; }
body[data-texture="dots"]    { --cover:#2C2C3C; --paper:#F5F2EC; --pat:radial-gradient(rgba(96,100,112,.26) 1.1px, transparent 1.6px); --pat-op:1; --pat-size:21px 21px; }
body[data-texture="rice"]    { --cover:#43331F; --paper:#F2E7D2; --pat:radial-gradient(rgba(140,110,70,.16) .5px, transparent 1px); --pat-op:.9; --pat-size:6px 6px; }
body[data-texture="recycle"] { --cover:#3C3A2C; --paper:#EFEDE2; --pat:radial-gradient(rgba(112,96,70,.15) 1px, transparent 1.5px),radial-gradient(rgba(96,86,64,.10) 1.2px, transparent 1.7px); --pat-op:1; --pat-size:30px 30px,16px 16px; }

/* ---------- shared paper surface (.tx) ---------- */
.tx { position: relative; background-color: var(--paper); }
.tx::before { content: ""; position: absolute; inset: 0; z-index: 0; background-image: var(--pat); background-size: var(--pat-size); background-repeat: repeat; opacity: var(--pat-op, 1); pointer-events: none; }
.tx::after  { content: ""; position: absolute; inset: 0; z-index: 0; background-image: var(--noise); opacity: .5; mix-blend-mode: multiply; pointer-events: none; }

/* ==========================================================================
   1. DESK SCENE
   ========================================================================== */
#desk {
  position: relative;
  z-index: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 540px;
  overflow: hidden;
  background: #241D14;
}
#desk[hidden] { display: none; }

/* pre-JS flash guard: scene stays invisible until desk.js positions it */
html._desk_load #desk .desk_room,
html._desk_load #desk .desk_light,
html._desk_load #desk .desk_surface,
html._desk_load #desk .desk_nb_wrap,
html._desk_load #desk .desk_pen,
html._desk_load #desk .desk_ring,
html._desk_load #desk .desk_hint,
html._desk_load #desk .desk_nb__shadow { opacity: 0; }

/* warm dusk room + lamp beam */
.desk_room {
  position: absolute; inset: -3%;
  background:
    radial-gradient(110% 80% at 30% 8%, rgba(255,212,145,.17), transparent 58%),
    radial-gradient(80% 60% at 75% 105%, rgba(122,82,42,.30), transparent 62%),
    linear-gradient(165deg, #2D251B 0%, #241D14 52%, #19130C 100%);
}
.desk_room::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(115% 95% at 50% 42%, transparent 52%, rgba(12,9,5,.55) 100%);
}
.desk_light {
  position: absolute; top: -14%; left: 3%;
  width: 54%; aspect-ratio: 1 / 1;
  background: radial-gradient(closest-side, rgba(255,214,150,.22), transparent 72%);
  filter: blur(16px);
  animation: deskGlow 5.5s ease-in-out infinite alternate;
  will-change: opacity;
}
@keyframes deskGlow { from { opacity: .72; } to { opacity: 1; } }

/* wooden desk plane: centered on the notebook so the camera-dolly scale
   (transform-origin 50% 50%) zooms straight into the notebook */
.desk_surface {
  position: absolute; left: 50%; top: 72vh;
  width: 175vw; height: 86vh; min-height: 620px;
  transform: translate(-50%, -50%);
  transform-origin: 50% 50%;
}
.desk_surface::before {          /* far edge of the desk */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 9px;
  background: linear-gradient(180deg, rgba(255,224,178,.16), rgba(30,18,8,.55));
}
.desk_surface__wood {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.05) 0 2px, transparent 2px 9px, rgba(255,255,255,.028) 9px 11px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.035) 0 3px, transparent 3px 14px, rgba(255,255,255,.02) 14px 17px),
    linear-gradient(180deg, #7C4F2B 0%, #6F4526 34%, #5F3B20 72%, #52301A 100%);
  box-shadow:
    inset 0 10px 22px -8px rgba(0,0,0,.5),
    inset 0 -18px 40px -14px rgba(0,0,0,.55);
}
.desk_surface__wood::after {
  content: ""; position: absolute; inset: 0;
  background-image: var(--noise);
  opacity: .34; mix-blend-mode: soft-light;
}

/* props — offset from the surface centre (where the notebook sits) */
.desk_pen {
  position: absolute; left: 50%; top: 50%; z-index: 2;
  width: clamp(130px, 15vw, 215px); height: 13px;
  transform: translate(-50%, -50%) rotate(-27deg);
  margin-left: clamp(150px, 17vw, 235px); margin-top: clamp(70px, 9vh, 100px);
  background: linear-gradient(180deg, #35553F, #1F3527 55%, #17291D);
  border-radius: 999px;
  box-shadow: 0 8px 14px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.15);
}
.desk_pen::before {            /* gold clip */
  content: ""; position: absolute; left: 7%; top: -8px; width: 36%; height: 10px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #DCB66D, #A8833F);
  box-shadow: 0 2px 3px rgba(0,0,0,.3);
}
.desk_pen::after {             /* nib */
  content: ""; position: absolute; right: -13px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 7px;
  background: linear-gradient(180deg, #CDB48C, #8F7A58);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.desk_ring {
  position: absolute; left: 50%; top: 50%; z-index: 1;
  width: clamp(88px, 8.6vw, 128px); aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  margin-left: clamp(-260px, -20vw, -200px); margin-top: clamp(150px, 17vh, 200px);
  border: 2px solid rgba(96,62,28,.5); border-radius: 50%;
}
.desk_ring::before {
  content: ""; position: absolute; inset: 10%;
  border: 1.5px solid rgba(96,62,28,.28); border-radius: 50%;
}

/* notebook */
.desk_nb_wrap {
  position: absolute; left: 50%; top: 72vh; z-index: 2;
  width: clamp(200px, min(26vw, 30vh), 340px);
  aspect-ratio: 3 / 4.05;
  transform: translate(-50%, -50%);
  transform-origin: 50% 50%;
}
body.desk-zoomed .desk_nb { transform: none !important; transition: none !important; }
.desk_nb {
  position: absolute; inset: 0; border: 0; padding: 0;
  background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.desk_nb__pages {
  position: absolute; inset: 0; right: -7px;
  border-radius: 4px 10px 10px 4px;
  background: repeating-linear-gradient(to right, #EFE8D7 0 2px, #DCD4BE 2px 4px);
  box-shadow: inset -2px 0 3px rgba(60,40,15,.28);
}
.desk_nb__flip {
  position: absolute; inset: 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

/* shared notebook-cover face (desk cover + zoom cover) */
.nbFace {
  position: absolute; inset: 0;
  border-radius: 4px 10px 10px 4px;
  background:
    linear-gradient(115deg, rgba(255,255,255,.055), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,.02), transparent 40%),
    var(--cover);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.08),
    inset -10px 0 14px rgba(0,0,0,.30),
    inset 4px 0 8px rgba(255,255,255,.045),
    0 30px 44px -18px rgba(0,0,0,.6);
  transition: background-color .5s ease;
  overflow: hidden;
}
.nbFace::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.014) 0 2px, transparent 2px 5px),
    var(--noise);
  opacity: .5; mix-blend-mode: overlay;
}
.nbFace__logo {
  position: absolute; top: 13%; left: 50%;
  transform: translateX(-50%);
  width: 32%;
  color: #E9E2CF; opacity: .82;
}
.nbFace__band {
  position: absolute; left: 0; right: 0; top: 45%; height: 13%;
  background: linear-gradient(180deg, rgba(18,12,6,.52), rgba(18,12,6,.34));
  box-shadow: 0 2px 5px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.06);
}
.desk_nb__shadow {
  position: absolute; left: 6%; right: 6%; top: 99%; height: 14%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(5,3,1,.55), transparent 72%);
  filter: blur(9px);
}
.desk_hint {
  position: absolute; left: 50%; bottom: clamp(34px, 6vh, 60px);
  transform: translateX(-50%);
  color: rgba(238,222,196,.62);
  font-size: 13px; letter-spacing: .26em; text-indent: .26em;
  white-space: nowrap;
  animation: hintPulse 3s ease-in-out infinite;
  will-change: opacity;
}
@keyframes hintPulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

@media (hover: hover) and (pointer: fine) {
  .desk_nb { transition: transform .5s cubic-bezier(.23,1,.32,1), filter .5s ease; }
  .desk_nb:hover { transform: translateY(-5px) rotate(-1.2deg); filter: brightness(1.07); }
  .desk_nb:active { transform: translateY(-2px) scale(.985); transition-duration: .15s; }
}

/* ==========================================================================
   2. WRITE OVERLAY (zoomed notebook)
   ========================================================================== */
.write {
  position: fixed; inset: 0; z-index: 980;
  display: grid; place-items: center;
  visibility: hidden;
}
.write._on { visibility: visible; }
.write__backdrop {
  position: absolute; inset: 0;
  background: rgba(24,18,11,.62);
  opacity: 0;
}
.write__stage {
  position: relative;
  width: min(860px, 92vw, calc(86dvh * .7407));
  aspect-ratio: 3 / 4.05;
  perspective: 1500px;
}
.write__cover {               /* the notebook cover, flips open in 3D */
  z-index: 3;
  transform-origin: left center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  opacity: 0;
}
.write__paper {
  position: absolute; inset: 0; z-index: 1;
  border-radius: 6px 10px 10px 6px;
  background-color: var(--paper);
  box-shadow:
    0 44px 90px -22px rgba(0,0,0,.55),
    inset 0 0 0 1px rgba(122,100,66,.2),
    inset 0 0 46px rgba(160,130,80,.05);
  display: flex; flex-direction: column;
  opacity: 0;
}
.write__paper > * { position: relative; z-index: 1; }
.write__tape {
  position: absolute; top: -13px; left: 50%; z-index: 4;
  width: 42%; height: 28px;
  transform: translateX(-50%) rotate(-1.8deg);
  background: var(--mood);
  opacity: 0;
  box-shadow: 0 3px 8px rgba(0,0,0,.2);
  clip-path: polygon(0 0, 100% 0, 96.5% 100%, 3.5% 100%);
  transition: opacity .35s ease, background-color .35s ease;
  pointer-events: none;
}
.write__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(18px, 3.4vh, 30px) clamp(24px, 4vw, 40px) 0;
  color: var(--ink-soft); font-size: 13px; letter-spacing: .06em;
}
.write__close {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(110,96,70,.35); background: transparent;
  color: var(--ink-soft); cursor: pointer;
  display: grid; place-items: center;
  transition: transform 160ms ease-out, background 200ms ease, color 200ms ease;
}
.write__close svg { width: 13px; height: 13px; }
.write__close:hover { background: rgba(110,96,70,.12); transform: rotate(90deg); }
.write__close:active { transform: scale(.9); }
.write__body {
  flex: 1; min-height: 0;
  margin: clamp(10px, 2vh, 18px) clamp(24px, 4vw, 40px) 0;
  padding: 6px 4px 0;
  overflow-y: auto;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "楷体", "DFKai-SB", "Noto Serif SC", serif;
  font-size: clamp(19px, 1.9vw, 23px);
  line-height: var(--line-h);
  color: var(--ink);
  caret-color: #B4552D;
  outline: none;
  word-break: break-word;
}
.write__body:empty::before {
  content: attr(data-placeholder);
  color: rgba(107,98,80,.4);
}
body[data-texture="ruled"] .write__body,
body[data-texture="grid"] .write__body,
body[data-texture="dots"] .write__body {
  background-image: var(--pat);
  background-size: var(--pat-size);
}
.write__body::-webkit-scrollbar { width: 8px; }
.write__body::-webkit-scrollbar-thumb { background: rgba(110,96,70,.25); border-radius: 8px; }
.write__moods {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: clamp(12px, 2.2vh, 20px) clamp(24px, 4vw, 40px) 0;
}
.write__moods__chips { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.write__moods__label {
  font-size: 12px; letter-spacing: .2em; text-indent: .2em;
  color: #8A8069;
}
.write__mood {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid transparent;
  display: grid; place-items: center;
  background: transparent; color: #8A8069; cursor: pointer;
  transition: transform 160ms ease-out, border-color 200ms ease, background 200ms ease, color 200ms ease;
}
.write__mood svg { width: 19px; height: 19px; }
.write__mood:hover { transform: translateY(-2px); }
.write__mood:active { transform: scale(.9); }
.write__mood._sel {
  border-color: var(--mood);
  background: color-mix(in srgb, var(--mood) 13%, transparent);
  color: var(--mood);
}
.write__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: clamp(12px, 2.2vh, 20px) clamp(24px, 4vw, 40px) clamp(20px, 3.4vh, 30px);
}
.write__texture {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 6px 15px 6px 7px;
  border-radius: 999px;
  border: 1px solid rgba(110,96,70,.3); background: rgba(255,255,255,.42);
  font-size: 12.5px; color: #5F5644; cursor: pointer;
  transition: transform 160ms ease-out, border-color 200ms ease;
}
.write__texture:hover { border-color: rgba(110,96,70,.55); }
.write__texture:active { transform: scale(.96); }
.write__texture__swatch {
  width: 26px; height: 26px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.1);
  --line-h: .95rem; --grid: .95rem; --pat-size: 9px 9px;
}
.write__save {
  padding: 11px 26px; border-radius: 999px; border: 0;
  background: var(--cover); color: #F2EDDF;
  font-size: 14.5px; letter-spacing: .12em; text-indent: .12em;
  cursor: pointer;
  box-shadow: 0 10px 22px -8px rgba(30,40,25,.5);
  transition: transform 160ms ease-out, filter 200ms ease;
}
.write__save:hover { filter: brightness(1.12); }
.write__save:active { transform: scale(.96); }
.write__stamp {
  position: absolute; z-index: 5;
  right: clamp(26px, 5vw, 54px); bottom: clamp(84px, 14vh, 140px);
  width: clamp(96px, 10vw, 116px); aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 2px solid rgba(150,86,52,.72);
  color: rgba(150,86,52,.85);
  display: grid; place-items: center;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "楷体", serif;
  font-size: 17px; letter-spacing: .14em; text-indent: .14em;
  opacity: 0;
  transform: rotate(-12deg);
  pointer-events: none;
}

/* ==========================================================================
   3. GALLERY
   ========================================================================== */
#gallery {
  background: #F3EDE1;
  padding: clamp(72px, 10vh, 120px) 0 clamp(84px, 12vh, 140px);
}
.gallery__inner, .store__inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 40px);
}
.gallery__title, .store__title {
  font-size: clamp(2.2rem, 4.6vw, 3.4rem);
  font-weight: 700; letter-spacing: .05em;
  color: #2E2A22;
}
.gallery__sub, .store__sub {
  margin-top: 10px;
  color: #7A7060; font-size: 15px;
}
.gallery__grid {
  margin-top: clamp(36px, 6vh, 56px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: clamp(20px, 2.6vw, 32px);
  perspective: 1200px;
}
.gcard {
  border: 0; padding: 0; background: none; cursor: pointer;
  text-align: left;
  aspect-ratio: 3 / 4.05; position: relative;
  border-radius: 5px 9px 9px 5px;
  transition: transform .45s cubic-bezier(.23,1,.32,1), box-shadow .45s ease;
}
.gcard:hover { transform: translateY(-8px) rotate(-.8deg); }
.gcard:active { transform: translateY(-2px) scale(.98); }
.gcard__tape {
  position: absolute; top: -12px; left: 50%; z-index: 2;
  width: 46%; height: 22px;
  transform: translateX(-50%) rotate(-1.6deg);
  background: var(--mood);
  box-shadow: 0 2px 6px rgba(0,0,0,.16);
  clip-path: polygon(0 0, 100% 0, 96% 100%, 4% 100%);
}
.gcard__page {
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow:
    0 14px 30px -12px rgba(60,45,20,.28),
    inset 0 0 0 1px rgba(122,100,66,.14);
  padding: 20px 18px 16px;
  display: flex; flex-direction: column; overflow: hidden;
  --line-h: 1.5rem; --grid: 1.5rem;
}
.gcard__page > * { position: relative; z-index: 1; }
.gcard__date { font-size: 11.5px; color: #8A8069; letter-spacing: .05em; }
.gcard__text {
  margin-top: 12px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "楷体", serif;
  font-size: 15px; line-height: 1.9; color: #3F382C;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical;
  overflow: hidden;
}
.gcard__mood {
  margin-top: auto; padding-top: 10px;
  display: flex; justify-content: flex-end;
  color: var(--mood);
}
.gcard__mood svg { width: 18px; height: 18px; }
.gcard._new { animation: cardNew 1.5s ease-out 1; }
@keyframes cardNew {
  0%   { box-shadow: 0 0 0 0 rgba(47,128,80,.55); }
  100% { box-shadow: 0 0 0 30px rgba(47,128,80,0); }
}
.gallery__empty {
  margin-top: clamp(36px, 6vh, 56px);
  padding: clamp(48px, 8vh, 80px) 24px;
  border: 1.5px dashed rgba(110,96,70,.3);
  border-radius: 14px;
  text-align: center;
  color: #8A8069;
}
.gallery__empty__text { font-size: 15px; }
.gallery__empty__btn {
  margin-top: 18px;
  padding: 11px 26px; border-radius: 999px;
  border: 0; background: var(--cover); color: #F2EDDF;
  font-size: 14px; letter-spacing: .1em; text-indent: .1em;
  cursor: pointer;
  transition: transform 160ms ease-out, filter 200ms ease;
}
.gallery__empty__btn:hover { filter: brightness(1.12); }
.gallery__empty__btn:active { transform: scale(.96); }

/* ==========================================================================
   4. PAPER STORE
   ========================================================================== */
#store {
  background: #EFE8DA;
  padding: clamp(72px, 10vh, 120px) 0 clamp(96px, 13vh, 150px);
}
.store__grid {
  margin-top: clamp(36px, 6vh, 56px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: clamp(20px, 2.6vw, 30px);
}
.scard {
  border: 0; background: none; cursor: pointer; padding: 0;
  text-align: left; position: relative;
}
.scard__box {
  position: relative; display: block;
  aspect-ratio: 3 / 4.05;
}
.scard__paper {
  position: absolute; inset: 0;
  border-radius: 5px 9px 9px 5px;
  box-shadow:
    0 12px 26px -12px rgba(60,45,20,.3),
    inset 0 0 0 1px rgba(122,100,66,.14);
  overflow: hidden;
  transition: transform 160ms ease-out, box-shadow .3s ease;
  --line-h: 1.35rem; --grid: 1.35rem;
}
.scard__paper > * { position: relative; z-index: 1; }
.scard__cover {          /* a matching cover peeking from behind the paper */
  position: absolute; left: -9%; top: 4%; z-index: 0;
  width: 56%; height: 92%;
  border-radius: 4px 8px 8px 4px;
  background: linear-gradient(115deg, rgba(255,255,255,.05), transparent 30%), var(--cover);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 8px 16px -6px rgba(0,0,0,.35);
}
.scard__check {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  font-size: 11px; color: #F2EDDF;
  background: var(--cover);
  border-radius: 999px; padding: 3px 10px;
  opacity: 0; transform: translateY(-4px);
  transition: opacity .3s ease, transform .3s ease;
}
.scard__meta { margin-top: 12px; display: flex; align-items: baseline; gap: 9px; }
.scard__name { font-size: 16px; font-weight: 700; color: #2E2A22; }
.scard__type { font-size: 11.5px; color: #8A8069; }
.scard:active .scard__paper { transform: scale(.97); }
.scard._sel .scard__paper {
  box-shadow:
    0 0 0 2px var(--cover),
    0 16px 30px -12px rgba(60,45,20,.35);
}
.scard._sel .scard__check { opacity: 1; transform: none; }

/* ==========================================================================
   5. LIGHTBOX + TOAST
   ========================================================================== */
.lightbox {
  position: fixed; inset: 0; z-index: 990;
  display: grid; place-items: center;
  visibility: hidden;
}
.lightbox._on { visibility: visible; }
.lightbox__backdrop {
  position: absolute; inset: 0;
  background: rgba(24,18,11,.66);
  opacity: 0;
}
.lightbox__paper {
  position: relative;
  width: min(620px, 92vw);
  aspect-ratio: 3 / 4.05;
  border-radius: 6px 10px 10px 6px;
  box-shadow:
    0 44px 90px -22px rgba(0,0,0,.6),
    inset 0 0 0 1px rgba(122,100,66,.2);
  display: flex; flex-direction: column;
  padding: clamp(26px, 4vw, 40px);
  opacity: 0;
  transform: scale(.94);
}
.lightbox__paper > * { position: relative; z-index: 1; }
.lightbox__tape {
  position: absolute; top: -13px; left: 50%; z-index: 4;
  width: 42%; height: 26px;
  transform: translateX(-50%) rotate(-1.8deg);
  background: var(--mood);
  box-shadow: 0 3px 8px rgba(0,0,0,.2);
  clip-path: polygon(0 0, 100% 0, 96.5% 100%, 3.5% 100%);
}
.lightbox__close {
  position: absolute; top: 14px; right: 14px; z-index: 5;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(110,96,70,.35); background: transparent;
  color: var(--ink-soft); cursor: pointer;
  display: grid; place-items: center;
  transition: transform 160ms ease-out, background 200ms ease;
}
.lightbox__close:hover { background: rgba(110,96,70,.12); transform: rotate(90deg); }
.lightbox__close:active { transform: scale(.9); }
.lightbox__date { color: #8A8069; font-size: 12.5px; letter-spacing: .05em; }
.lightbox__text {
  flex: 1; min-height: 0; overflow-y: auto;
  margin-top: 18px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "楷体", serif;
  font-size: clamp(17px, 1.8vw, 20px);
  line-height: 2.1; color: #3F382C;
  white-space: pre-wrap; word-break: break-word;
}
.lightbox__foot {
  margin-top: 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.lightbox__mood {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--mood); font-size: 13px; letter-spacing: .06em;
}
.lightbox__mood svg { width: 17px; height: 17px; }
.lightbox__del {
  border: 0; background: none;
  color: #A0604E; font-size: 13px; cursor: pointer;
  padding: 6px 12px; border-radius: 999px;
  transition: background 200ms ease, transform 160ms ease-out;
}
.lightbox__del:hover { background: rgba(160,96,78,.12); }
.lightbox__del:active { transform: scale(.95); }
.lightbox__del._armed { color: #8E3B2A; font-weight: 700; }

.toast {
  position: fixed; left: 50%; bottom: 30px; z-index: 995;
  transform: translate(-50%, 18px);
  display: flex; align-items: center; gap: 16px;
  background: rgba(30,25,18,.93); color: #EDE4D2;
  padding: 12px 12px 12px 22px;
  border-radius: 999px;
  box-shadow: 0 18px 40px -12px rgba(0,0,0,.5);
  opacity: 0; pointer-events: none;
  font-size: 14px; letter-spacing: .04em;
  transition: opacity .4s cubic-bezier(.23,1,.32,1), transform .4s cubic-bezier(.23,1,.32,1);
}
.toast._on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast__action {
  border: 0; background: rgba(255,255,255,.15); color: #F5E9CF;
  border-radius: 999px; padding: 5px 15px;
  font-size: 12.5px; letter-spacing: .06em; cursor: pointer;
  transition: background 200ms ease, transform 160ms ease-out;
}
.toast__action:hover { background: rgba(255,255,255,.26); }
.toast__action:active { transform: scale(.95); }

/* ---------- scroll reveal (armed by JS via html._desk_ready) ---------- */
html._desk_ready [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
}

/* ==========================================================================
   5B. CAT SELFIE — bottom of home page
   ========================================================================== */
#cat {
  display: flex; justify-content: center; align-items: flex-end;
  background-color: #0870CA;
  padding: clamp(28px, 5vh, 64px) 24px clamp(72px, 11vh, 130px);
}
.cat__anim {
  width: clamp(260px, 44vw, 440px);
  height: auto;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, .22));
}

/* ==========================================================================
   6. REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .desk_light { animation: none; }
  .desk_hint { animation: none; }
  html._desk_ready [data-reveal] { opacity: 1 !important; transform: none !important; }
}

/* ==========================================================================
   7. MOBILE
   ========================================================================== */
@media (max-width: 768px) {
  .desk_surface { top: 62vh; height: 82vh; }
  .desk_nb_wrap { top: 62vh; width: clamp(180px, 46vw, 260px); }
  .desk_pen { width: 128px; margin-left: clamp(96px, 26vw, 130px); margin-top: 42px; }
  .desk_ring { display: none; }
  .desk_hint { bottom: 26px; font-size: 12px; }
  .write__stage { width: min(94vw, calc(84dvh * .7407)); }
  .write__moods { gap: 9px; }
  .write__mood { width: 33px; height: 33px; }
  .write__foot { flex-wrap: wrap; }
  .gallery__grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
