:root {
  --bg: #d9d4cc;
  --ink: #3b3630;
  --ink-soft: rgba(59, 54, 48, 0.62);
  --chip: rgba(250, 247, 242, 0.72);
  --chip-border: rgba(59, 54, 48, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#stage {
  position: fixed;
  inset: 0;
  touch-action: none;
}

#stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  cursor: grab;
}
#stage canvas:active { cursor: grabbing; }

.ui {
  position: fixed;
  z-index: 2;
  font-size: 12px;
  letter-spacing: 0.04em;
  user-select: none;
  -webkit-user-select: none;
}

#hint {
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid var(--chip-border);
  color: var(--ink-soft);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.8s ease;
}
#hint.dim { opacity: 0.35; }
.hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .hint-desktop { display: none; }
  .hint-touch { display: inline; }
}

#reset {
  right: calc(20px + env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px 8px 11px;
  border-radius: 999px;
  border: 1px solid var(--chip-border);
  background: var(--chip);
  color: var(--ink);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  transition: background 0.2s ease, transform 0.15s ease;
}
#reset:hover { background: rgba(255, 252, 247, 0.92); }
#reset:active { transform: scale(0.96); }
#reset:focus-visible { outline: 2px solid #6f7d5f; outline-offset: 2px; }

@media (max-width: 560px) {
  #hint { bottom: calc(68px + env(safe-area-inset-bottom)); font-size: 11px; white-space: normal; text-align: center; width: max-content; max-width: calc(100vw - 32px); border-radius: 16px; }
  #reset { right: 50%; transform: translateX(50%); }
  #reset:active { transform: translateX(50%) scale(0.96); }
}

#loader {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 0.9s ease;
}
#loader.done { opacity: 0; pointer-events: none; }
.loader-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8e9a7c;
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(0.7); opacity: 0.4; }
  50% { transform: scale(1.3); opacity: 1; }
}

/* ------------------------------------------------------------------ wardrobe close-up */
#hint, #reset { transition: opacity 0.5s ease, background 0.2s ease, transform 0.15s ease; }
body.closet-mode #hint, body.closet-mode #reset { opacity: 0; pointer-events: none; }

.closet-ui {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease 0.5s, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.4s;
}
body.closet-mode .closet-ui { opacity: 1; pointer-events: auto; }

#closet-back {
  left: calc(18px + env(safe-area-inset-left));
  top: calc(16px + env(safe-area-inset-top));
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--chip-border);
  background: var(--chip);
  color: var(--ink);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
#closet-back:hover { background: rgba(255, 252, 247, 0.94); }
#closet-back:focus-visible, #item-detail button:focus-visible { outline: 2px solid #6f7d5f; outline-offset: 2px; }

#closet-tip {
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translate(-50%, 6px);
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--chip-border);
  background: var(--chip);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  white-space: nowrap;
  pointer-events: none !important;
}
body.closet-mode #closet-tip { transform: translate(-50%, 0); }
body.detail-open #closet-tip { opacity: 0; transition-delay: 0s; }

/* item detail: two sheets of tracing paper beside the wardrobe (desktop) / a bottom sheet (phones).
   top sheet = the fixed artwork from the approved design; bottom sheet = this piece's photo + name + story */
#item-detail {
  --vl-ink: #5b5886;        /* muted blue-violet ink (title) */
  --vl-ink-body: #4c4966;   /* a touch darker so the story stays easy to read */
  --vl-edge: rgba(232, 231, 238, 0.7);
  position: fixed;
  z-index: 3;
  top: 16px;
  right: 16px;
  bottom: 16px;
  /* both sheets (each 986:638) must fit the viewport height without scrolling */
  width: min(max(34vw, 400px), 540px, calc((100vh - 70px) * 0.74));
  width: min(max(34vw, 400px), 540px, calc((100dvh - 70px) * 0.74));
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  opacity: 0;
  transform: translateX(28px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.5s;
}
#item-detail::-webkit-scrollbar { display: none; }
body.closet-mode.detail-open #item-detail {
  opacity: 1; transform: none; pointer-events: auto; visibility: visible;
  transition: opacity 0.35s ease 0.15s, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.1s, visibility 0s;
}
/* ---- one folded sheet: a cover hinged on the crease (the bottom half's top edge) over the bottom half ---- */
.vl-stack { position: relative; margin-block: auto; display: flex; flex-direction: column; gap: 0; width: 100%; padding: 6px 4px 14px; box-sizing: border-box; }
.vl-cover {
  position: relative; z-index: 2;            /* always the sheet nearest the viewer: it swings out toward us */
  aspect-ratio: 986 / 638;
  transform-origin: 50% 100%;                /* the crease */
  transform-style: preserve-3d;
  transform: perspective(1500px) rotateX(-180deg);   /* folded down over the bottom half */
  transition: transform 0.5s cubic-bezier(0.5, 0, 0.3, 1);   /* folding back */
  will-change: transform;
}
.vl-face {
  position: absolute; inset: 0; overflow: hidden;
  border-radius: 3px 3px 0 0;
  border: 1px solid var(--vl-edge); border-bottom-color: transparent;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 -6px 22px rgba(38, 34, 52, 0.1);
}
/* the face we see while folded is turned over once more so the artwork reads upright lying on the bottom half */
.vl-back { transform: rotateX(180deg); }
/* tracing paper darkens a little as it turns edge-on to the light */
.vl-face::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(44, 40, 64, 0.5), rgba(44, 40, 64, 0.32)); opacity: 0; pointer-events: none; }
.vl-art { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }

.vl-card {
  position: relative; z-index: 1; overflow: hidden; border-radius: 0 0 3px 3px;
  border: 1px solid var(--vl-edge); border-top: 0;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 16px 34px rgba(38, 34, 52, 0.2),
    0 3px 8px rgba(38, 34, 52, 0.1);
}
/* the soft shadow the lifted cover throws across the crease */
.vl-shade {
  position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, rgba(46, 40, 68, 0.34), rgba(46, 40, 68, 0.12) 20%, transparent 46%);
}
/* the bottom half's contents stay hidden under the cover until it has swung past upright */
#item-detail .idt-photo, #item-detail .vl-text { opacity: 0; transition: opacity 0.16s ease; }
#item-detail .idt-close { opacity: 0; pointer-events: none; }

/* opening: a short beat once the folded letter has arrived, then the cover lifts and settles softly */
#item-detail.vl-open .vl-cover { transform: perspective(1500px) rotateX(0deg); transition: transform 0.52s cubic-bezier(0.45, 0.05, 0.2, 1) 0.55s; }
#item-detail.vl-open .vl-face::after { animation: vl-face 0.52s ease-in-out 0.55s both; }
#item-detail.vl-open .vl-shade { animation: vl-shade-open 0.52s ease-out 0.55s both; }
#item-detail.vl-open .idt-photo, #item-detail.vl-open .vl-text { opacity: 1; transition: opacity 0.42s ease 0.82s; }
#item-detail.vl-open .idt-close { opacity: 1; pointer-events: auto; transition: opacity 0.3s ease 1s, background 0.2s ease, color 0.2s ease; }
/* closing: the same crease, the other way */
#item-detail.vl-closing .vl-face::after { animation: vl-face 0.5s ease-in-out both; }
#item-detail.vl-closing .vl-shade { animation: vl-shade-close 0.5s ease-in both; }
@keyframes vl-face { 0% { opacity: 0; } 50% { opacity: 0.32; } 100% { opacity: 0; } }
@keyframes vl-shade-open { 0% { opacity: 0; } 32% { opacity: 1; } 70% { opacity: 0.35; } 100% { opacity: 0; } }
@keyframes vl-shade-close { 0% { opacity: 0; } 30% { opacity: 0.35; } 68% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .vl-cover, #item-detail .idt-photo, #item-detail .vl-text, #item-detail .idt-close { transition: none !important; }
  .vl-face::after, .vl-shade { animation: none !important; }
}

.vl-bottom {
  aspect-ratio: 986 / 638;          /* at least as tall as the top sheet; grows with a long story */
  overflow: visible;                /* (overflow:hidden would let the aspect ratio clip the content instead of growing) */
  display: grid;
  grid-template-columns: 40% 1fr;
  column-gap: 5%;
  align-items: center;
  padding: 7% 7% 6.5% 4.5%;
  box-sizing: border-box;
  background:
    radial-gradient(120% 70% at 30% 0%, rgba(214, 208, 212, 0.55), transparent 60%),
    linear-gradient(180deg, #c9c2c3 0%, #bfb8ba 38%, #b5aeb1 70%, #aaa4a7 100%);
  color: var(--vl-ink-body);
}
/* paper fog (fine grain) and the crease */
.vl-bottom::before, .vl-bottom::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; }
.vl-bottom::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .8  0 0 0 0 .79  0 0 0 0 .84  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.32; mix-blend-mode: soft-light;
}
.vl-bottom::after {
  /* the crease: a hairline of shadow with a brighter lip just under it, and faint silver side edges */
  background: linear-gradient(180deg, rgba(70, 64, 92, 0.13) 0, rgba(70, 64, 92, 0.13) 1px, rgba(255, 255, 255, 0.2) 1px, rgba(255, 255, 255, 0.2) 2px, rgba(255, 255, 255, 0.06) 2px, transparent 7px),
              linear-gradient(90deg, rgba(255, 255, 255, 0.07), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.05));
}

/* photo: whole silhouette, its background melting into the paper, seen through a thin sheet */
/* the photo never sets the card's height: it is fitted (whole, uncropped) into the space beside the text,
   so the bottom sheet stays the top sheet's proportion and only grows for a long story */
#item-detail .idt-photo { position: relative; margin: 0; align-self: stretch; min-height: 0; }
#item-detail .idt-photo img, #item-detail .vl-cut {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; object-position: center;
  border-radius: 0; background: none; user-select: none; pointer-events: none;
  /* seen through a thin sheet: less saturation and contrast, a whisper of warmth, a little paper showing through */
  filter: saturate(0.62) contrast(0.86) brightness(1.02) sepia(0.06);
}
/* fallback (before / without the cutout): the photo's ground multiplies into the paper and its edges fade */
#item-detail .idt-photo img {
  mix-blend-mode: multiply; transition: opacity 0.35s ease;
  -webkit-mask-image: radial-gradient(ellipse 72% 76% at 50% 50%, #000 62%, transparent 100%);
          mask-image: radial-gradient(ellipse 72% 76% at 50% 50%, #000 62%, transparent 100%);
}
#item-detail .vl-cut { display: none; animation: vl-in 0.4s ease; opacity: 0.94; }
#item-detail .idt-photo.cut .vl-cut { display: block; }
#item-detail .idt-photo.cut img { display: none; }
@keyframes vl-in { from { opacity: 0; } }
.idt-photo.empty img { visibility: hidden; }

.vl-text { position: relative; z-index: 1; display: flex; flex-direction: column; gap: calc(14px * var(--fit, 1)); min-width: 0; align-self: center; }
#item-detail .idt-name {
  margin: 0;
  font-family: 'Baskervville', 'LXGW WenKai', 'Kaiti SC', 'STKaiti', serif;
  font-style: italic;
  font-weight: 400;
  font-size: calc(clamp(21px, 1.9vw, 28px) * var(--title-k, 1) * (0.4 + 0.6 * var(--fit, 1)));
  line-height: 1.22;
  letter-spacing: 0.01em;
  text-transform: none;            /* the name as written, never all caps */
  font-variant: normal;
  font-kerning: normal;
  color: var(--vl-ink);
  /* blue-violet ink sinking into tracing paper: a hair of bleed around each stroke */
  text-shadow: 0 0 0.7px rgba(91, 88, 134, 0.5), 0 0 2.5px rgba(91, 88, 134, 0.12);
  overflow-wrap: break-word;
  text-wrap: balance;              /* two even lines rather than a lonely last word */
}
#item-detail .idt-story {
  margin: 0;
  font-family: 'LXGW WenKai', 'Kaiti SC', 'STKaiti', 'KaiTi', serif;
  font-weight: 300;
  font-size: calc(15.5px * var(--fit, 1));
  line-height: calc(1.55 + 0.5 * var(--fit, 1));
  -webkit-text-stroke: 0.25px currentColor;  /* the light cut is a touch thin for paper: thicken the pen slightly */
  letter-spacing: 0.05em;
  color: var(--vl-ink-body);
}
#item-detail ::selection { background: rgba(108, 102, 160, 0.24); color: #3f3c5c; }
#item-detail .idt-actions { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 2px; }
#item-detail .idt-try {
  font-family: 'LXGW WenKai', 'Kaiti SC', 'STKaiti', serif; font-weight: 300; font-size: 13.5px; letter-spacing: 0.12em;
  padding: 2px 0; border: 0; border-bottom: 1px dashed rgba(91, 88, 134, 0.55); border-radius: 0;
  background: none; color: var(--vl-ink); cursor: pointer; transition: color 0.2s ease, border-color 0.2s ease;
}
#item-detail .idt-try:hover:not(:disabled) { background: none; color: #403d6a; border-bottom-style: solid; }
#item-detail .idt-try:disabled { opacity: 0.45; cursor: not-allowed; }
#item-detail .idt-note { font-family: 'LXGW WenKai', 'Kaiti SC', serif; font-size: 12px; color: rgba(85, 82, 109, 0.8); }

.idt-close {
  position: absolute; top: 14px; right: 12px; z-index: 4;
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: rgba(236, 235, 241, 0.28); color: #66638a; cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.idt-close:hover { background: rgba(236, 235, 241, 0.6); color: #3f3c5c; }

body.closet-portrait #item-detail {
  top: auto; left: 0; right: 0; bottom: 0; width: auto;
  max-height: 88vh; max-height: 88dvh;
  padding: 0 12px env(safe-area-inset-bottom);
  transform: translateY(30px);
}
body.closet-portrait.closet-mode.detail-open #item-detail { transform: none; }
body.closet-portrait .vl-stack { max-width: min(520px, calc((88dvh - 60px) * 0.74)); margin-inline: auto; gap: 0; padding-top: 10px; }
body.closet-portrait .vl-bottom { grid-template-columns: 40% 1fr; column-gap: 4.5%; padding: 6% 6% 6% 4%; }
/* phones: one fixed sheet size for every piece (closet.js fitPanel sets the height and steps the type to fit) */
.vl-bottom.vl-fixed { aspect-ratio: auto; overflow: hidden; }
body.closet-portrait #item-detail .idt-name { font-size: calc(19px * var(--title-k, 1) * (0.4 + 0.6 * var(--fit, 1))); }
body.closet-portrait #item-detail .idt-story { font-size: calc(13.5px * var(--fit, 1)); line-height: calc(1.5 + 0.45 * var(--fit, 1)); letter-spacing: 0.04em; }

.av-stage {
  position: relative; width: 100%; aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 92%, rgba(120, 100, 76, 0.18), transparent 42%), linear-gradient(#efe9df, #e4dccf);
}
.av-stage img, .av-layers img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  image-rendering: pixelated; image-rendering: crisp-edges; pointer-events: none; user-select: none;
}
.av-stage img[hidden] { display: none; }
.av-layers img { animation: av-on 0.35s ease; }
@keyframes av-on { from { opacity: 0; transform: translateY(-3%); } }
.av-missing { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; font-size: 12px; color: var(--ink-soft); }
.av-missing:empty { display: none; }
.av-temp {
  position: absolute; left: 6px; top: 6px; padding: 2px 7px; border-radius: 999px;
  background: rgba(176, 120, 52, 0.9); color: #fffaf2; font-size: 10.5px; letter-spacing: 0.06em;
}
.av-temp[hidden] { display: none; }
.av-switch { display: flex; gap: 6px; justify-content: center; }
.av-switch button {
  font: inherit; font-size: 12px; padding: 4px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--chip-border); background: rgba(255, 255, 255, 0.5); color: var(--ink);
}
.av-switch button.on { background: var(--ink); color: #faf6ef; border-color: var(--ink); }
.av-switch button:disabled { cursor: not-allowed; opacity: 0.55; }
.av-switch small { margin-left: 4px; font-size: 10px; }
body.closet-portrait #closet-back { left: calc(10px + env(safe-area-inset-left)); top: calc(10px + env(safe-area-inset-top)); padding: 6px 12px 6px 8px; font-size: 12px; }
@media (prefers-reduced-motion: reduce) { #item-detail, .av-layers img { transition: none !important; animation: none !important; } }

/* 「随机搭一套」: follows the pointer while it is on the clothes heap at the foot of the bed */
#pile-tip, #cat-tip {
  left: 0; top: 0; z-index: 3; pointer-events: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 9px; border-radius: 999px;
  border: 1px solid var(--chip-border); background: var(--chip); color: var(--ink-soft);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px rgba(60, 36, 20, 0.16);
  white-space: nowrap;
  opacity: 0; transform: translate(14px, 18px) scale(0.96); transform-origin: 0 0;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
#pile-tip.on, #cat-tip.on { opacity: 1; transform: translate(14px, 18px); }
#pile-tip svg, #cat-tip svg { width: 14px; height: 14px; flex: none; }
#cat-tip .ct-name { font-weight: 700; color: var(--ink); letter-spacing: 0.02em; }
#cat-tip .ct-say { font-size: 0.92em; }
#cat-tip .ct-say::before { content: '·'; margin-right: 6px; opacity: 0.5; }
@media (hover: none) { #pile-tip, #cat-tip { display: none; } }

/* ------------------------------------------------------------------ 像素试衣间 */
:root {
  --ft-paper: #f7f1e6;
  --ft-paper-2: #fbf7f0;
  --ft-line: #9a7656;
  --ft-line-soft: rgba(154, 118, 86, 0.32);
  --ft-ink: #4a3a2c;
  --ft-ink-soft: rgba(74, 58, 44, 0.66);
}
/* entry: the little doll and a whisper in the bottom-left corner of the wardrobe view */
#fit-entry {
  left: calc(18px + env(safe-area-inset-left));
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ft-ink);
  cursor: pointer;
  transform: translateY(6px);
}
body.closet-mode #fit-entry { transform: none; }
body.closet-portrait.detail-open #fit-entry, body.fitting-open #fit-entry { opacity: 0; pointer-events: none; transition-delay: 0s; }
.fe-doll {
  position: relative;
  width: 80px; height: 146px;
  overflow: hidden;
  filter: drop-shadow(0 3px 2px rgba(60, 40, 24, 0.25));
  animation: fe-idle 3.2s steps(2, jump-none) infinite;
}
.fe-doll img {
  position: absolute;
  height: 170px; width: auto;
  left: -16px; top: -13px;
  image-rendering: pixelated;
}
.fe-say {
  position: relative;
  margin: 0 0 96px 0;
  padding: 6px 11px;
  border: 1px solid var(--ft-line-soft);
  border-radius: 10px 10px 10px 2px;
  background: rgba(251, 247, 240, 0.86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 12px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: var(--ft-ink);
  transition: background 0.2s ease, transform 0.2s ease;
}
#fit-entry:hover .fe-say { background: #fffaf2; transform: translateY(-1px); }
#fit-entry:hover .fe-doll { animation-duration: 0.9s; }
#fit-entry:focus-visible { outline: 2px solid #6f7d5f; outline-offset: 4px; border-radius: 8px; }
@keyframes fe-idle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }

/* the room itself: a lilac retro desktop window, the same family as the Lookbook (.lb-win tokens + bevels) */
#fitting {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid; place-items: center;
  padding: calc(20px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
  background: rgba(40, 34, 64, 0.42);
  opacity: 0;
  transition: opacity 0.28s ease;
  user-select: none;
  -webkit-user-select: none;
}
#fitting[hidden] { display: none; }
body.fitting-open #fitting { opacity: 1; }
.ft-win {
  --ft-title: #7d76bd; --ft-press: #5a5296; --ft-press-lo: #3d3772; --ft-canvas: #c6d0f3; --ft-photo: #fdfbf6; --ft-label: #e6e2f6;
  position: relative;
  width: min(1240px, 100%); height: min(900px, 100%);
  font-size: 15px;
  border-radius: 0;
  transform: scale(0.985); transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
body.fitting-open .ft-win { transform: none; }
.lb-win.ft-win::after { background: none; }   /* no CRT scanlines here: names and photos stay crisp */

/* title bar: deeper lilac, hanger + name on the left, 中 / EN and 返回衣柜 on the right */
.ft-top.lb-title { background: var(--ft-title); padding: 0.4em 0.45em 0.4em 0.7em; gap: 0.6em; }
.ft-ico { display: grid; place-items: center; width: 1.9em; height: 1.9em; background: var(--lb-btn); color: var(--lb-ink);
  border: 0.12em solid; border-color: var(--lb-hi) var(--lb-lo) var(--lb-lo) var(--lb-hi); }
.ft-ico svg { width: 1.35em; height: 1.35em; }
.ft-title { margin: 0; font-size: 1.35em; font-weight: 700; letter-spacing: 0.12em; color: #fbfaff; text-shadow: 0 1px 0 rgba(40, 34, 90, 0.45); white-space: nowrap; }
.ft-actions { margin-left: auto; display: flex; gap: 0.45em; }

/* every button: square, thin raised bevel (light top-left, deep purple bottom-right); pressed = bevel flips */
.ft-btn, .ft-win .ft-lang {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35em;
  padding: 0.4em 0.95em; border-radius: 0;
  font: inherit; font-size: 1em; letter-spacing: 0.06em; color: var(--lb-ink);
  background: var(--lb-btn);
  border: 0.13em solid; border-color: var(--lb-hi) var(--lb-lo) var(--lb-lo) var(--lb-hi);
  box-shadow: 0.08em 0.08em 0 rgba(40, 34, 90, 0.35);
  cursor: pointer; backdrop-filter: none; -webkit-backdrop-filter: none;
  transition: background 0.12s ease;
}
.ft-btn:hover, .ft-win .ft-lang:hover { background: #f2f0fb; }
.ft-btn:active:not(:disabled), .ft-win .ft-lang:active { border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); box-shadow: none; transform: translate(0.06em, 0.06em); }
.ft-win .ft-lang .lg-opt.on { color: var(--lb-ink); }
.ft-win button:focus-visible { outline: 0.14em dotted var(--lb-ink); outline-offset: -0.42em; box-shadow: 0 0 0 0.16em #fbfaff, 0 0 0 0.3em var(--ft-press); }

.ft-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(250px, 1fr) minmax(0, 2fr); gap: 0.8em; padding: 0.8em 0.8em 0; }

/* left: the try-on canvas — pale blue with a fine white dot grid, the doll whole and pixel-sharp */
.ft-stage { margin: 0; min-height: 0; display: flex; flex-direction: column; gap: 0.45em; padding: 0.45em; background: var(--lb-panel);
  border: 0.13em solid; border-color: var(--lb-hi) var(--lb-lo) var(--lb-lo) var(--lb-hi); }
.ft-canvas { flex: 1; min-height: 0; display: flex; justify-content: center; padding: 1.2em 0.8em;
  background-color: var(--ft-canvas);
  background-image: radial-gradient(rgba(255, 255, 255, 0.85) 0.09em, transparent 0.1em);
  background-size: 1.15em 1.15em;
  border: 0.13em solid; border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); }
.ft-doll { height: 100%; max-width: 100%; display: flex; justify-content: center; }
.ft-crop { position: relative; height: 100%; max-width: 100%; overflow: hidden; }
.ft-crop img { position: absolute; width: var(--cw); left: var(--cl); top: var(--ct); height: auto; image-rendering: pixelated; image-rendering: crisp-edges; pointer-events: none; }
.ft-crop img { image-rendering: pixelated; }
.ft-layers img.pop { animation: ft-pop 0.3s steps(3, jump-end); }
@keyframes ft-pop { from { opacity: 0; transform: translateY(-1.2%); } to { opacity: 1; transform: none; } }
/* random look: a tilted sticky-note banner at the top of the canvas (the doll moves down to make room) */
.ft-canvas { position: relative; transition: padding-top 0.25s ease; }
.ft-canvas.rand { padding-top: 5.4em; }
.ft-rand { position: absolute; top: 0.75em; left: 50%; z-index: 1; width: max-content; max-width: calc(100% - 1.4em);
  display: flex; flex-direction: column; align-items: center; gap: 0.25em;
  padding: 0.95em 1em 0.5em; background: #fff2b8; color: #3a2f12;
  border: 0.13em solid; border-color: #fffbe6 #c9a94e #c9a94e #fffbe6;
  box-shadow: 0.22em 0.22em 0 rgba(61, 55, 114, 0.35);
  transform: translateX(-50%) rotate(-2deg); }
.ft-rand[hidden] { display: none; }
.ft-rand.in { animation: ft-rand-in 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes ft-rand-in { 0% { opacity: 0; transform: translateX(-50%) translateY(-0.6em) scale(0.6) rotate(-9deg); } 100% { opacity: 1; transform: translateX(-50%) rotate(-2deg); } }
.ft-rand-tag { position: absolute; top: -0.85em; left: 0.7em; display: inline-flex; align-items: center; gap: 0.35em;
  padding: 0.18em 0.6em; background: var(--ft-press); color: #fbfaff; font-size: 0.86em; letter-spacing: 0.1em;
  border: 0.1em solid; border-color: #8f88cf var(--ft-press-lo) var(--ft-press-lo) #8f88cf; transform: rotate(-3deg); }
.ft-rand-say { margin: 0; font-size: 1.12em; font-weight: 600; line-height: 1.4; letter-spacing: 0.04em; text-align: center; }
/* the status bar under the canvas: what's on right now */
.ft-wearing { margin: 0; padding: 0.45em 0.8em; min-height: 1.5em; font-size: 0.98em; line-height: 1.5; color: var(--lb-ink); background: #ece9f8;
  border: 0.13em solid; border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); }
.ft-wearing-t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* right: square category tabs over an independently scrolling grid of pieces */
.ft-shop { min-height: 0; display: flex; flex-direction: column; gap: 0.6em; container-type: inline-size; }
.ft-filters { display: flex; flex-wrap: wrap; gap: 0.4em; }
.ft-chip {
  padding: 0.42em 1em; border-radius: 0;
  font: inherit; font-size: 1.02em; letter-spacing: 0.06em; white-space: nowrap; color: var(--lb-ink);
  background: var(--lb-btn);
  border: 0.13em solid; border-color: var(--lb-hi) var(--lb-lo) var(--lb-lo) var(--lb-hi);
  cursor: pointer;
}
.ft-chip:hover { background: #f2f0fb; }
.ft-chip:active { border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); }
.ft-chip.on { background: var(--ft-press); color: #fbfaff; border-color: var(--ft-press-lo) #9d97d6 #9d97d6 var(--ft-press-lo); text-shadow: 0 1px 0 rgba(20, 16, 50, 0.4); }
.ft-well { flex: 1; min-height: 0; display: flex; background: var(--lb-panel); padding: 0.4em 0.2em 0.4em 0.4em;
  border: 0.13em solid; border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); }
.ft-list {
  flex: 1; min-height: 0;
  margin: 0; padding: 0 0.35em 0 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 0.55em;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: auto; scrollbar-color: var(--lb-btn) #cfcaea;
}
@container (min-width: 430px) { .ft-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (min-width: 620px) { .ft-list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* a retro scrollbar: raised thumb and arrow buttons on a dotted lilac track */
.ft-list::-webkit-scrollbar { width: 1.15em; }
.ft-list::-webkit-scrollbar-track { background: #cfcaea; background-image: radial-gradient(rgba(106, 100, 153, 0.25) 0.06em, transparent 0.07em); background-size: 0.3em 0.3em;
  border: 0.1em solid; border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); }
.ft-list::-webkit-scrollbar-thumb { background: var(--lb-btn); border: 0.13em solid; border-color: var(--lb-hi) var(--lb-lo) var(--lb-lo) var(--lb-hi); min-height: 2.5em; }
.ft-list::-webkit-scrollbar-button:single-button { display: block; height: 1.15em; background-color: var(--lb-btn);
  border: 0.13em solid; border-color: var(--lb-hi) var(--lb-lo) var(--lb-lo) var(--lb-hi); background-repeat: no-repeat; background-position: center; background-size: 0.6em; }
.ft-list::-webkit-scrollbar-button:single-button:vertical:decrement { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 6 5 0l5 6z' fill='%232f2b52'/%3E%3C/svg%3E"); }
.ft-list::-webkit-scrollbar-button:single-button:vertical:increment { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0h10L5 6z' fill='%232f2b52'/%3E%3C/svg%3E"); }
.ft-list::-webkit-scrollbar-button:vertical:start:increment, .ft-list::-webkit-scrollbar-button:vertical:end:decrement { display: none; }

/* a piece: warm-white photo frame over a pale lilac name plate */
.ft-item {
  position: relative;
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  padding: 0; border-radius: 0;
  font: inherit; text-align: left; color: var(--lb-ink);
  background: var(--ft-label);
  border: 0.13em solid; border-color: var(--lb-hi) var(--lb-lo) var(--lb-lo) var(--lb-hi);
  cursor: pointer;
}
.ft-item:hover { background: #f1eefb; }
.ft-item:active { border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); }
.ft-item.on { border-color: var(--ft-press); box-shadow: inset 0 0 0 0.07em var(--ft-press), inset 0 0 0 0.17em #d9d4f2; }
.ft-thumb { display: block; aspect-ratio: 1 / 0.95; margin: 0.3em 0.3em 0; background: var(--ft-photo); overflow: hidden;
  border: 0.1em solid; border-color: #e3dccd #fffefb #fffefb #e3dccd; }
.ft-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ft-name { flex: 1; padding: 0.4em 0.55em 0.5em; font-size: 0.96em; line-height: 1.35; letter-spacing: 0.02em; color: #2a2648; }
.ft-name > span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ft-tag { position: absolute; top: 0.45em; left: 0.45em; padding: 0.12em 0.5em; border-radius: 0; background: var(--ft-press); color: #fbfaff; font-size: 0.85em; letter-spacing: 0.08em;
  border: 0.1em solid; border-color: #8f88cf var(--ft-press-lo) var(--ft-press-lo) #8f88cf; }
.ft-tag.ft-todo { background: #efecf9; color: var(--lb-ink); border: 0.1em dashed var(--lb-lo); }
.ft-item.missing { cursor: default; }
.ft-item.missing .ft-thumb { opacity: 0.6; }
.ft-item.nudge { animation: ft-nudge 0.3s ease; }
@keyframes ft-nudge { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.ft-empty { grid-column: 1 / -1; padding: 24px; text-align: center; color: var(--lb-ink); opacity: 0.75; }

/* the bottom bar: 重置搭配 (light) and 完成穿搭 (deep purple, primary) on the right */
.ft-foot { display: flex; justify-content: flex-end; gap: 0.7em; padding: 0.75em 0.8em; margin-top: 0.8em; background: var(--lb-face);
  border-top: 0.13em solid var(--lb-hi); box-shadow: 0 -0.13em 0 var(--lb-lo); }
.ft-foot .ft-btn { min-width: 8.5em; padding: 0.55em 1.4em; font-size: 1.12em; letter-spacing: 0.14em; }
.ft-reset { background: var(--lb-btn); }
.ft-shuffle { margin-right: auto; background: var(--ft-label); }   /* 再搭一套: a new random look, on the left */
.ft-shuffle:hover { background: #efebfb; }
.ft-shuffle svg { flex: none; }
.ft-done { background: var(--ft-press); color: #fbfaff; border-color: #9d97d6 var(--ft-press-lo) var(--ft-press-lo) #9d97d6; text-shadow: 0 1px 0 rgba(20, 16, 50, 0.4); }
.ft-done:hover { background: #4f4889; }
.ft-done:active:not(:disabled) { border-color: var(--ft-press-lo) #9d97d6 #9d97d6 var(--ft-press-lo); background: #4a4382; }
.ft-done:disabled { opacity: 0.65; cursor: progress; }
.ft-done.nudge { animation: ft-nudge 0.3s ease; }
.ft-win .ft-done:focus-visible { outline-color: #fbfaff; }

/* narrow screens: the canvas on top, the pieces below, fewer columns as the width allows */
@media (max-width: 760px), (orientation: portrait) and (max-width: 1024px) {
  #fitting { padding: 0; }
  .ft-win { width: 100%; height: 100%; font-size: 13px; border-width: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .ft-top.lb-title { padding: 0.35em 0.4em 0.35em 0.5em; gap: 0.45em; margin: 0; }
  .ft-ico { width: 1.7em; height: 1.7em; }
  .ft-title { font-size: 1.2em; letter-spacing: 0.06em; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .ft-actions { gap: 0.35em; flex: none; }
  .ft-btn, .ft-win .ft-lang { padding: 0.38em 0.65em; letter-spacing: 0.02em; }
  .ft-body { display: flex; flex-direction: column; gap: 0.55em; padding: 0.55em 0.55em 0; }
  .ft-stage { flex: 0 0 auto; height: 40vh; height: 40dvh; padding: 0.35em; gap: 0.35em; }
  .ft-canvas { padding: 0.6em 0.5em; }
  .ft-canvas.rand { padding-top: 3.7em; }
  .ft-rand { top: 0.75em; padding: 0.7em 0.7em 0.3em; font-size: 0.86em; }
  .ft-wearing { padding: 0.35em 0.6em; }
  .ft-wearing-t { -webkit-line-clamp: 1; }
  .ft-shop { flex: 1; gap: 0.45em; }
  .ft-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 0.15em; }
  .ft-filters::-webkit-scrollbar { display: none; }
  .ft-chip { padding: 0.4em 0.8em; }
  /* phones: smaller cards, three to a row, names on two lines, so whole cards show instead of halves */
  .ft-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.45em; }
  .ft-thumb { margin: 0.25em 0.25em 0; }
  .ft-name { padding: 0.3em 0.4em 0.4em; font-size: 0.84em; line-height: 1.3; }
  .ft-name > span { -webkit-line-clamp: 2; }
  .ft-foot { padding: 0.55em; margin-top: 0.55em; }
  .ft-foot .ft-btn { flex: 1; min-width: 0; padding: 0.6em 0.5em; font-size: 1.08em; letter-spacing: 0.04em; }
  .ft-shuffle { margin-right: 0; }
  #fit-entry { left: calc(10px + env(safe-area-inset-left)); bottom: calc(10px + env(safe-area-inset-bottom)); }
  .fe-doll { width: 60px; height: 112px; }
  .fe-doll img { height: 130px; left: -13px; top: -10px; }
  .fe-say { margin-bottom: 80px; font-size: 11px; padding: 5px 9px; }
}
@media (prefers-reduced-motion: reduce) { #fitting, .ft-win, .fe-doll, .ft-layers img.pop, .ft-rand.in, .ft-canvas { animation: none !important; transition: none !important; } }

/* ---------------------------------------------------------------- 完成穿搭 → sticker reward */

.ft-reward {
  position: absolute; inset: 0; z-index: 5;
  display: grid; place-items: center;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  background: rgba(58, 54, 74, 0.34);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 0.25s ease;
}
.ft-reward[hidden] { display: none; }
.ft-reward.on { opacity: 1; }
/* the same cool grey-violet tracing paper as the wardrobe's story card */
.rw-card {
  --rw-ink: #5b5886;
  position: relative; overflow: hidden;
  width: min(380px, 100%);
  padding: 26px 26px 22px;
  border-radius: 3px;
  border: 1px solid rgba(232, 231, 238, 0.7);
  background:
    radial-gradient(120% 70% at 30% 0%, rgba(214, 208, 212, 0.55), transparent 60%),
    linear-gradient(180deg, #cbc4c5 0%, #bfb8ba 45%, #b1abae 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 18px 44px rgba(38, 34, 52, 0.32), 0 3px 8px rgba(38, 34, 52, 0.14);
  color: #4c4966;
  text-align: center;
  transform: translateY(14px) scale(0.97);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  user-select: text; -webkit-user-select: text;
}
.ft-reward.on .rw-card { transform: none; }
.rw-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.32; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .8  0 0 0 0 .79  0 0 0 0 .84  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
/* the sticker is the focus: big, crisp pixels, peeled up off the sheet a little */
.rw-sticker {
  position: relative; display: grid; place-items: center;
  height: min(46vh, 330px); height: min(46dvh, 330px);
  margin: 0 auto 16px;
}
.rw-sticker::after { /* a faint shine sweeping across as it arrives */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.45) 48%, transparent 60%);
  transform: translateX(-120%); opacity: 0;
}
.ft-reward.on .rw-sticker::after { animation: rw-shine 0.9s ease 0.45s; }
.rw-sticker img {
  height: 100%; width: auto; max-width: 100%;
  image-rendering: pixelated; image-rendering: crisp-edges;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.5)) drop-shadow(2px 4px 0 rgba(58, 54, 86, 0.22)) drop-shadow(0 10px 14px rgba(40, 36, 60, 0.22));
  transform: rotate(-3deg);
}
.ft-reward.on .rw-sticker img { animation: rw-pop 0.62s cubic-bezier(0.3, 1.5, 0.5, 1) both; }
@keyframes rw-pop { from { transform: rotate(-14deg) scale(0.55); opacity: 0; } 60% { opacity: 1; } to { transform: rotate(-3deg) scale(1); opacity: 1; } }
@keyframes rw-shine { 0% { transform: translateX(-120%); opacity: 1; } 100% { transform: translateX(120%); opacity: 1; } }
.rw-title {
  position: relative; margin: 0 0 8px;
  font-family: 'LXGW WenKai', 'Kaiti SC', 'STKaiti', serif; font-weight: 400; font-size: 20px; letter-spacing: 0.06em;
  color: var(--rw-ink); -webkit-text-stroke: 0.3px currentColor;
}
.rw-text {
  position: relative; margin: 0 0 20px;
  font-family: 'LXGW WenKai', 'Kaiti SC', 'STKaiti', serif; font-weight: 300; font-size: 15px; line-height: 1.85; letter-spacing: 0.04em;
  color: #4c4966; -webkit-text-stroke: 0.25px currentColor;
}
.rw-actions { position: relative; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.rw-btn {
  font-family: 'LXGW WenKai', 'Kaiti SC', 'STKaiti', serif; font-size: 15px; letter-spacing: 0.1em;
  padding: 9px 20px; border-radius: 3px; cursor: pointer;
  border: 1px solid var(--rw-ink); background: rgba(240, 238, 244, 0.35); color: var(--rw-ink);
  transition: background 0.2s ease, transform 0.1s ease;
}
.rw-btn:hover { background: rgba(240, 238, 244, 0.65); }
.rw-btn:active { transform: translateY(1px); }
.rw-stick { background: var(--rw-ink); color: #f4f1f8; }
.rw-stick:hover { background: #4a4774; }
.rw-btn:focus-visible { outline: 2px solid #f4f1f8; outline-offset: 2px; box-shadow: 0 0 0 4px var(--rw-ink); }

/* placing a sticker on the mirror: a small note at the bottom of the room view */
#stick-bar {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 4;
  display: flex; align-items: center; gap: 12px;
  width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box;
  padding: 8px 10px 8px 12px; border-radius: 3px;
  border: 1px solid rgba(232, 231, 238, 0.75);
  background: linear-gradient(180deg, rgba(203, 196, 197, 0.94), rgba(185, 178, 181, 0.94));
  box-shadow: 0 10px 28px rgba(38, 34, 52, 0.25);
  color: #4c4966; font-family: 'LXGW WenKai', 'Kaiti SC', 'STKaiti', serif; font-size: 14px; letter-spacing: 0.05em;
  transform: translate(-50%, 12px); opacity: 0; transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#stick-bar[hidden] { display: none; }
#stick-bar.on { opacity: 1; transform: translate(-50%, 0); }
#stick-bar.toast { padding-right: 16px; }
.sb-thumb { height: 40px; width: auto; image-rendering: pixelated; filter: drop-shadow(1px 2px 0 rgba(58, 54, 86, 0.25)); }
.sb-thumb[hidden] { display: none; }
.sb-text { line-height: 1.5; }
.sb-cancel {
  flex: none; font: inherit; font-size: 13px; padding: 5px 10px; border-radius: 3px; cursor: pointer;
  border: 1px solid rgba(91, 88, 134, 0.6); background: rgba(240, 238, 244, 0.35); color: #5b5886;
}
#stick-bar.toast .sb-cancel { display: none; }
body.placing-sticker #hint, body.placing-sticker #fit-entry { opacity: 0; pointer-events: none; }
@media (max-width: 560px) {
  #stick-bar { bottom: calc(76px + env(safe-area-inset-bottom)); font-size: 13px; gap: 8px; }
  .sb-thumb { height: 34px; }
  .rw-card { padding: 20px 18px 18px; }
  .rw-title { font-size: 18px; }
  .rw-text { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { .ft-reward, .rw-card, .rw-sticker img, .rw-sticker::after, #stick-bar { animation: none !important; transition: none !important; } }

/* ---------------------------------------------------------------- 我的贴纸 */
#stk-open {
  position: fixed; z-index: 2;
  left: calc(20px + env(safe-area-inset-left)); bottom: calc(18px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 12px 4px 6px; border-radius: 999px;
  border: 1px solid rgba(232, 231, 238, 0.8);
  background: linear-gradient(180deg, rgba(203, 196, 197, 0.92), rgba(185, 178, 181, 0.92));
  box-shadow: 0 6px 18px rgba(38, 34, 52, 0.18);
  color: #4c4966; font-family: 'LXGW WenKai', 'Kaiti SC', 'STKaiti', serif; font-size: 13px; letter-spacing: 0.05em;
  cursor: pointer; transition: transform 0.15s ease, background 0.2s ease, opacity 0.3s ease;
}
#stk-open[hidden] { display: none; }
#stk-open:hover { background: linear-gradient(180deg, rgba(213, 206, 207, 0.96), rgba(195, 188, 191, 0.96)); }
#stk-open:active { transform: scale(0.96); }
#stk-open:focus-visible { outline: 2px solid #5b5886; outline-offset: 2px; }
.so-thumb { height: 30px; width: auto; image-rendering: pixelated; filter: drop-shadow(1px 1px 0 rgba(58, 54, 86, 0.25)); }
.so-n { min-width: 18px; padding: 0 5px; border-radius: 999px; background: #5b5886; color: #f4f1f8; font-size: 11px; line-height: 18px; text-align: center; }
body.closet-mode #stk-open, body.placing-sticker #stk-open, body.fitting-open #stk-open { opacity: 0; pointer-events: none; }

#stk-shelf {
  position: fixed; inset: 0; z-index: 7;
  display: grid; place-items: center;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  background: rgba(58, 54, 74, 0.34);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity 0.22s ease;
}
#stk-shelf[hidden] { display: none; }
#stk-shelf.on { opacity: 1; }
.ss-card {
  position: relative; overflow: hidden;
  width: min(620px, 100%); max-height: min(80vh, 640px); max-height: min(80dvh, 640px);
  display: flex; flex-direction: column;
  padding: 20px 22px 18px; border-radius: 3px;
  border: 1px solid rgba(232, 231, 238, 0.7);
  background:
    radial-gradient(120% 70% at 30% 0%, rgba(214, 208, 212, 0.55), transparent 60%),
    linear-gradient(180deg, #cbc4c5 0%, #bfb8ba 45%, #b1abae 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 18px 44px rgba(38, 34, 52, 0.32);
  color: #4c4966; font-family: 'LXGW WenKai', 'Kaiti SC', 'STKaiti', serif;
  transform: translateY(12px) scale(0.98); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#stk-shelf.on .ss-card { transform: none; }
.ss-head { display: flex; align-items: center; justify-content: space-between; }
.ss-title { margin: 0; font-size: 20px; font-weight: 400; letter-spacing: 0.08em; color: #5b5886; -webkit-text-stroke: 0.3px currentColor; }
.ss-close { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(236, 235, 241, 0.3); color: #66638a; cursor: pointer; }
.ss-close:hover { background: rgba(236, 235, 241, 0.65); }
.ss-sub { margin: 6px 0 14px; font-size: 13.5px; line-height: 1.7; letter-spacing: 0.03em; color: #55526d; }
.ss-grid {
  margin: 0; padding: 2px 2px 4px; list-style: none;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px;
  overflow-y: auto; overscroll-behavior: contain; min-height: 0;
}
.ss-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 8px 10px; border-radius: 3px;
  border: 1px solid rgba(232, 231, 238, 0.55); background: rgba(236, 234, 240, 0.22);
}
.ss-item.on { background: rgba(236, 234, 240, 0.38); }
.ss-item { position: relative; }
/* delete: a small bin in the card's corner; the first tap turns it into 「再点一次删除」, the second deletes */
.ss-del {
  position: absolute; top: 4px; right: 4px; z-index: 1; height: 26px; min-width: 26px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  border: 0; border-radius: 13px; background: transparent; color: rgba(91, 88, 134, 0.6); cursor: pointer;
  font: inherit; font-size: 12px; letter-spacing: 0.04em; transition: background 0.15s, color 0.15s;
}
.ss-del:hover { color: #5b5886; background: rgba(240, 238, 244, 0.6); }
.ss-del-ask { display: none; white-space: nowrap; }
.ss-del.ask { color: #f6eef0; background: #a2485a; }
.ss-del.ask .ss-del-ask { display: inline; }
.ss-del:focus-visible { outline: 2px solid #f4f1f8; outline-offset: 1px; box-shadow: 0 0 0 3px #5b5886; }
.ss-pic { height: 132px; display: grid; place-items: center; }
.ss-pic img { height: 132px; max-width: 100%; width: auto; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(1px 2px 0 rgba(58, 54, 86, 0.22)) drop-shadow(0 6px 8px rgba(40, 36, 60, 0.16)); transform: rotate(-2deg); }
.ss-meta { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ss-tag { font-size: 12px; color: #5b5886; }
.ss-item.on .ss-tag::before { content: '● '; font-size: 9px; vertical-align: 1px; }
.ss-date { font-size: 11px; color: rgba(76, 73, 102, 0.75); }
.ss-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.ss-btn {
  font: inherit; font-size: 13px; letter-spacing: 0.06em; padding: 5px 10px; border-radius: 3px; cursor: pointer;
  border: 1px solid #5b5886; background: rgba(240, 238, 244, 0.35); color: #5b5886;
}
.ss-btn:hover { background: rgba(240, 238, 244, 0.7); }
.ss-main { background: #5b5886; color: #f4f1f8; }
.ss-main:hover { background: #4a4774; }
.ss-ghost { border-color: rgba(91, 88, 134, 0.5); }
.ss-btn:focus-visible, .ss-close:focus-visible { outline: 2px solid #f4f1f8; outline-offset: 1px; box-shadow: 0 0 0 3px #5b5886; }
.ss-empty { grid-column: 1 / -1; padding: 20px 0; text-align: center; font-size: 14px; color: #55526d; }
@media (max-width: 560px) {
  #stk-open { left: calc(12px + env(safe-area-inset-left)); padding-right: 8px; }
  #stk-open .so-label { display: none; }
  .ss-card { padding: 16px 14px 14px; }
  .ss-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .ss-pic, .ss-pic img { height: 112px; }
}
@media (prefers-reduced-motion: reduce) { #stk-shelf, .ss-card { transition: none !important; } }

/* ---- confirm bar on the mirror */
.sb-text { display: flex; flex-direction: column; gap: 1px; }
.sb-note { font-size: 12px; color: #5b5886; letter-spacing: 0.04em; display: flex; align-items: center; gap: 4px; }
.sb-note[hidden] { display: none; }
.sb-btns { display: flex; gap: 6px; flex: none; }
.sb-ok {
  flex: none; font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 3px; cursor: pointer;
  border: 1px solid #5b5886; background: #5b5886; color: #f4f1f8;
}
.sb-ok[hidden] { display: none; }
.sb-ok:disabled, .sb-cancel:disabled { opacity: 0.6; cursor: progress; }
#stick-bar.toast .sb-btns { display: none; }
.ss-look { background: rgba(91, 88, 134, 0.14); }
@media (max-width: 560px) {
  #stick-bar { flex-wrap: wrap; justify-content: center; }
  .sb-text { flex: 1 1 60%; }
}

/* ================================================================ Lookbook (the desk computer) */
/* ---- the 完成穿搭 flow overlay inside the fitting room: one card at a time */
.ft-reward { overflow-y: auto; }
.ft-reward > .rw-card, .ft-reward > .lk-edit { display: none; }
.ft-reward[data-view="ask"] > .lk-ask,
.ft-reward[data-view="done"] > .rw-done,
.ft-reward[data-view="edit"] > .lk-edit { display: block; }
.ft-reward .rw-card.in, .ft-reward .lk-edit.in { animation: lk-in 0.38s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes lk-in { from { transform: translateY(14px) scale(0.97); opacity: 0.4; } to { transform: none; opacity: 1; } }
.lk-ask-pic { display: grid; place-items: center; height: min(26vh, 190px); height: min(26dvh, 190px); margin: 0 auto 14px; position: relative; }
.lk-ask-pic img { height: 100%; width: auto; image-rendering: pixelated; transform: rotate(-3deg);
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.5)) drop-shadow(2px 4px 0 rgba(58, 54, 86, 0.22)); }
.lk-ask .rw-text { font-size: 14px; }
.lk-edit { width: min(1040px, 100%); }
.lk-edit .lb-win { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: calc(100dvh - 40px); box-sizing: border-box; }
.lk-edit .lb-win.lb-narrow { aspect-ratio: auto; max-height: none; }

/* ---- the window: lilac 90s paint program */
#lookbook { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
#lookbook[hidden] { display: none; }
#lookbook .lb-win { position: absolute; box-sizing: border-box; pointer-events: auto; border-radius: 0.5em; }
#lookbook.lb-full { pointer-events: auto; background: rgba(36, 32, 52, 0.5); }
#lookbook.lb-full .lb-win { left: 10px; right: 10px; top: calc(10px + env(safe-area-inset-top)); bottom: calc(10px + env(safe-area-inset-bottom)); width: auto; height: auto; border-radius: 6px; }
.lb-win.lb-maxed { position: fixed !important; inset: 12px !important; width: auto !important; height: auto !important; z-index: 40; }
body.lookbook-open #hint, body.lookbook-open #reset, body.lookbook-open #stk-open, body.lookbook-open #fit-entry,
body.magazine-open #hint, body.magazine-open #reset, body.magazine-open #stk-open, body.magazine-open #fit-entry { opacity: 0; pointer-events: none; }

.lb-win {
  --lb-face: #b7b0dc; --lb-panel: #a9a2d3; --lb-hi: #f4f2fc; --lb-lo: #6a6499; --lb-ink: #2f2b52; --lb-btn: #e5e2f4;
  display: flex; flex-direction: column; overflow: hidden; font-size: 14px;
  background: var(--lb-face); color: var(--lb-ink);
  border: 0.16em solid; border-color: var(--lb-hi) var(--lb-lo) var(--lb-lo) var(--lb-hi);
  box-shadow: 0 0.6em 2em rgba(26, 22, 44, 0.35);
  font-family: Tahoma, Verdana, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  text-align: left; user-select: none; -webkit-user-select: none;
}
.lb-win::after { /* the CRT glass: faint scanlines and a soft edge */
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; z-index: 3;
  background: repeating-linear-gradient(180deg, rgba(30, 24, 70, 0.045) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 62%, rgba(30, 24, 60, 0.16) 100%);
}
.lk-edit .lb-win::after { background: none; }
.lb-win.power { animation: lb-on 0.45s ease-out; }
.lb-win.off { animation: lb-off 0.26s ease-in forwards; }
@keyframes lb-on { 0% { transform: scale(1, 0.006); filter: brightness(3); } 45% { transform: scale(1, 0.03); filter: brightness(2.4); } 75% { transform: none; filter: brightness(1.35); } 100% { transform: none; filter: none; } }
@keyframes lb-off { 0% { transform: none; } 60% { transform: scale(1, 0.01); filter: brightness(2.5); opacity: 1; } 100% { transform: scale(0.02, 0.006); filter: brightness(3); opacity: 0; } }

.lb-raised, .lb-bevel { background: var(--lb-btn); border: 0.12em solid; border-color: var(--lb-hi) var(--lb-lo) var(--lb-lo) var(--lb-hi); }
.lb-inset { border: 0.12em solid; border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); }
.lb-bevel { font: inherit; color: var(--lb-ink); cursor: pointer; display: inline-grid; place-items: center; padding: 0; }
.lb-bevel:active:not(:disabled) { border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); }
.lb-bevel:disabled { color: rgba(47, 43, 82, 0.35); cursor: default; }
.lb-win button:focus-visible { outline: 0.14em dotted var(--lb-ink); outline-offset: -0.35em; }

.lb-title { display: flex; align-items: center; gap: 0.5em; padding: 0.3em 0.35em 0.3em 0.55em; margin: 0.18em 0.18em 0;
  background: linear-gradient(180deg, #9b94d0, #8a83c4); color: #fbfaff; }
.lb-appico svg { width: 1.45em; height: 1.45em; display: block; }
.lb-name { font-size: 1.25em; font-weight: 700; letter-spacing: 0.02em; text-shadow: 0 1px 0 rgba(40, 34, 90, 0.4); }
.lb-ctrls { margin-left: auto; display: flex; gap: 0.25em; }
.lb-cb { width: 1.65em; height: 1.45em; padding: 0; cursor: pointer; color: var(--lb-ink); background: var(--lb-btn); border: 0.12em solid; border-color: var(--lb-hi) var(--lb-lo) var(--lb-lo) var(--lb-hi); display: grid; place-items: center; }
.lb-cb svg { width: 0.85em; height: 0.85em; }
.lb-cb:active { border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); }
.lb-menu { display: flex; gap: 1.5em; padding: 0.3em 0.9em 0.35em; font-size: 0.98em; }
.lb-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 0.45em 0.45em; gap: 0.4em; }
.lb-empty { margin: auto; font-size: 1.05em; opacity: 0.75; }

/* ---- Candace's photo pages */
.lb-owner { flex: 1; min-height: 0; display: grid; grid-template-columns: 9.4em minmax(0, 1fr); gap: 0.45em; }
.lb-side { display: flex; flex-direction: column; gap: 0.6em; padding: 0.6em; background: var(--lb-panel); min-height: 0; }
.lb-thumbs { list-style: none; margin: 0; padding: 0.1em; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 0.6em; scrollbar-width: thin; }
.lb-th { width: 100%; padding: 0.35em 0.35em 0.15em; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0.1em; font: inherit; color: var(--lb-ink);
  background: var(--lb-btn); border: 0.12em solid; border-color: var(--lb-hi) var(--lb-lo) var(--lb-lo) var(--lb-hi); }
.lb-th.on { background: #f4f2fb; box-shadow: 0 0 0 0.13em #4f4994; }
.lb-th img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }
.lb-th-doll { width: 100%; aspect-ratio: 3 / 4; display: grid; place-items: center; background-color: var(--bg); background-image: radial-gradient(rgba(255, 255, 255, 0.55) 0.07em, transparent 0.08em); background-size: 0.7em 0.7em; }
.lb-th-doll { position: relative; overflow: hidden; }
.lb-th-doll img { position: absolute; inset: 6%; width: 88%; height: 88%; object-fit: contain; image-rendering: pixelated; }   /* never sizes the thumb by the picture */
.lb-th-n { font-size: 1.05em; font-weight: 600; }
.lb-tools4 { display: grid; grid-template-columns: repeat(2, 2.3em); gap: 0.3em; justify-content: center; }
.lb-tool { display: grid; place-items: center; width: 2.3em; height: 2.3em; box-sizing: border-box; background: var(--lb-btn); border: 0.12em solid; border-color: var(--lb-hi) var(--lb-lo) var(--lb-lo) var(--lb-hi); }
.lb-tool svg { width: 1.35em; height: 1.35em; }
.lb-tool.hot { background: #f6f4fd; box-shadow: inset 0 0 0 0.1em #4f4994; }
.lb-mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.2em; padding: 0.3em; background: #bdb7e0; border: 0.12em solid; border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); }
.lb-mini span { aspect-ratio: 1; background: var(--c); border: 0.1em solid; border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); }
.lb-photo-canvas { background: #c9d0f2; display: flex; flex-direction: column; align-items: center; padding: 1em 1em 0.6em; min-height: 0; position: relative; }
.lb-photo { flex: 1; min-height: 0; width: 100%; margin: 0; display: flex; justify-content: center; align-items: center; }
.lb-photo img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; box-sizing: border-box;
  border: 0.22em solid #fbfaff; box-shadow: 0 0.15em 0.5em rgba(40, 34, 90, 0.25); background: #fff; }
.lb-caption { margin: 0.5em 0 0.45em; font-size: 1.2em; letter-spacing: 0.08em; text-align: center; color: #26223f; }
.lb-offline { margin: -0.2em 0 0.4em; font-size: 0.8em; opacity: 0.75; }
.lb-nav { position: relative; display: flex; align-items: center; gap: 0.7em; width: 100%; }
.lb-prev, .lb-next { width: 2.8em; height: 1.75em; flex: none; }
.lb-prev svg, .lb-next svg { width: 0.95em; height: 0.95em; }
.lb-track { flex: 1; height: 1.45em; background: #b8b1de; border: 0.12em solid; border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); position: relative; overflow: hidden; }
.lb-fill { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(90deg, #8e87c8 0 0.7em, transparent 0.7em 0.85em); opacity: 0.5; }
.lb-pageno { position: absolute; right: 4.1em; top: 50%; transform: translateY(-50%); font-size: 0.95em; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; pointer-events: none; }

/* ---- visitor pixel pages */
.lb-visitor { flex: 1; min-height: 0; display: grid; grid-template-columns: 6.6em 7.8em 1fr; gap: 0.45em; }
.lb-tools { display: flex; flex-direction: column; gap: 0.5em; padding: 0.35em; background: var(--lb-panel); min-height: 0; }
.lb-toolgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.15em; }
.lb-toolgrid .lb-tool { width: 100%; height: auto; aspect-ratio: 1; }
.lb-well { flex: 1; min-height: 1.5em; background: #b9b3de; border: 0.12em solid; border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); }
.lb-items { list-style: none; margin: 0; padding: 0.35em; display: flex; flex-direction: column; gap: 0.35em; overflow-y: auto; background: var(--lb-panel); min-height: 0; scrollbar-width: thin; }
.lb-item { flex: none; aspect-ratio: 1.3; display: grid; place-items: center; background: #f2ede1; }
.lb-item img { width: 78%; height: 78%; object-fit: contain; image-rendering: pixelated; }
.lb-item-empty { text-align: center; opacity: 0.5; }
.lb-canvas.lb-dots { position: relative; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  background-color: var(--bg); background-image: radial-gradient(rgba(255, 255, 255, 0.5) 0.08em, transparent 0.09em); background-size: 1.05em 1.05em; transition: background-color 0.2s ease; }
.lb-stage { height: 100%; min-height: 0; display: grid; place-items: center; padding: 4% 0; box-sizing: border-box; }
.lb-doll { height: 100%; max-height: 100%; width: auto; max-width: 100%; image-rendering: pixelated; filter: drop-shadow(0.1em 0.2em 0 rgba(40, 34, 90, 0.18)); }
.lb-stamp { position: absolute; width: 4.4em; transform: translate(-50%, -50%) rotate(-8deg); filter: drop-shadow(0.08em 0.12em 0 rgba(40, 34, 90, 0.25)); pointer-events: none; z-index: 1; }
.lb-stamp svg { width: 100%; height: auto; display: block; }
.lb-stamp.thunk { animation: lb-thunk 0.32s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes lb-thunk { 0% { transform: translate(-50%, -50%) rotate(-8deg) scale(1.5); opacity: 0.4; } 100% { transform: translate(-50%, -50%) rotate(-8deg) scale(1); opacity: 1; } }
.lb-editing.stamping { cursor: crosshair; }
.lb-editing.stamping .lb-stamp { opacity: 0.65; animation: lb-bob 1s ease-in-out infinite; }
@keyframes lb-bob { 50% { transform: translate(-50%, -58%) rotate(-8deg); } }
.lb-textbox { /* Paint's text tool: a square lilac box with the same bevel as the tool buttons */
  position: relative; z-index: 2; align-self: center; margin: 0 2.2em 9% 0.4em; padding: 0.75em 1.1em 0.7em; min-width: 13em; max-width: 22em; box-sizing: border-box;
  background: #dcd8f1; color: #2f2b52; text-align: left;
  border: 0.12em solid; border-color: var(--lb-hi) var(--lb-lo) var(--lb-lo) var(--lb-hi);
  box-shadow: inset 0.08em 0.08em 0 rgba(106, 100, 153, 0.45), inset -0.08em -0.08em 0 rgba(255, 255, 255, 0.7);
  font-family: Tahoma, Verdana, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}
.lb-tb-a { position: absolute; left: -0.12em; top: -1.45em; width: 1.35em; height: 1.35em; display: grid; place-items: center;
  background: var(--lb-btn); border: 0.12em solid; border-color: var(--lb-hi) var(--lb-lo) var(--lb-lo) var(--lb-hi);
  font-size: 0.95em; line-height: 1; color: var(--lb-ink); }
.lb-tb-line, .lb-tb-sign { display: block; margin: 0; font-size: 1.05em; line-height: 1.6; letter-spacing: 0.02em; }
.lb-tb-sign { margin-top: 0.15em; font-size: 0.95em; display: flex; align-items: baseline; gap: 0.35em; }
.lb-textbox input { font: inherit; color: #2f2b52; caret-color: #2f2b52; background: transparent; border: 0; border-radius: 0; outline: none; margin: 0 0.3em;
  padding: 0 0.3em 0.05em; min-width: 0; text-align: center; user-select: text; -webkit-user-select: text;
  border-bottom: 0.1em solid rgba(47, 43, 82, 0.7); } /* a clear blank line to write on, like 「______」 */
.lb-textbox .lb-wish { width: 7em; }
.lb-textbox .lb-nick { width: 5em; text-align: left; margin-left: 0.1em; }
@supports (field-sizing: content) { .lb-textbox input { field-sizing: content; } .lb-textbox .lb-wish { width: auto; min-width: 7em; } .lb-textbox .lb-nick { width: auto; min-width: 5em; } }
.lb-textbox input:focus { border-bottom-color: #2f2b52; background: rgba(255, 255, 255, 0.4); }
.lb-nick::placeholder { color: rgba(47, 43, 82, 0.42); }
.lb-bar { display: flex; align-items: center; gap: 0.75em; padding: 0.15em 0.1em 0; }
.lb-fgbg { position: relative; width: 2.7em; height: 2.5em; flex: none; }
.lb-fgbg i { position: absolute; width: 1.65em; height: 1.65em; background: var(--c); border: 0.12em solid; border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); }
.lb-fgbg i:first-child { left: 0; top: 0; z-index: 1; }
.lb-fgbg i:last-child { right: 0; bottom: 0; }
.lb-pal { display: grid; grid-template-columns: repeat(12, 1.5em); grid-auto-rows: 1.5em; gap: 0.15em; padding: 0.2em; background: #bdb7e0; border: 0.12em solid; border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); }
.lb-sw { display: block; padding: 0; margin: 0; background: var(--c); border: 0.1em solid; border-color: var(--lb-lo) var(--lb-hi) var(--lb-hi) var(--lb-lo); cursor: pointer; }
.lb-pal.ro .lb-sw { cursor: default; }
.lb-sw.on { box-shadow: 0 0 0 0.13em #fbfaff, 0 0 0 0.25em var(--lb-ink); position: relative; z-index: 1; }
.lb-stampwrap { position: relative; display: inline-grid; place-items: center; width: 2.4em; flex: none; }
.lb-stampwrap > svg { width: 1.9em; height: 1.9em; }
.lb-stampbtn { width: 2.6em; height: 2.6em; }
.lb-stampbtn svg { width: 1.8em; height: 1.8em; }
.lb-stamps { position: absolute; bottom: calc(100% + 0.4em); left: 50%; transform: translateX(-50%); z-index: 5; display: grid; grid-template-columns: repeat(4, 2.5em); gap: 0.25em; padding: 0.35em; }
.lb-stamps[hidden] { display: none; }
.lb-st { width: 2.5em; height: 2.5em; padding: 0.25em; cursor: pointer; background: #f6f4fd; border: 0.1em solid transparent; display: grid; place-items: center; font: inherit; font-size: 0.85em; color: var(--lb-ink); }
.lb-st svg { width: 100%; height: 100%; }
.lb-st:hover, .lb-st.on { border-color: var(--lb-ink); }
.lb-st-none { font-size: 0.8em; }
.lb-big { margin-left: auto; padding: 0.45em 1.4em; font-size: 1.15em; font-weight: 700; letter-spacing: 0.02em; min-width: 8em; }
.lb-publish { background: #f4f2fb; }
.lb-status { display: flex; align-items: center; gap: 1em; flex-wrap: wrap; padding: 0.3em 0.4em 0; margin-top: 0.1em; border-top: 0.1em solid rgba(106, 100, 153, 0.45); font-size: 0.86em; min-height: 1.9em; }
.lb-status .lb-nav { width: auto; flex: 1; font-size: 1.1em; }
.lb-by { opacity: 0.8; }
.lb-warn { color: #4c3a78; }
.lb-warn::before { content: "◉ "; font-size: 0.8em; }
.lb-err { color: #8a3a5a; }
.lb-err:empty { display: none; }
.lb-skip { margin-left: auto; font: inherit; color: var(--lb-ink); background: none; border: 0; padding: 0.2em 0.3em; cursor: pointer; text-decoration: underline; text-underline-offset: 0.2em; }

/* ---- small screens: the window stacks */
.lb-win.lb-narrow { font-size: 13px; }
.lb-narrow .lb-menu { gap: 1em; font-size: 0.9em; }
.lb-narrow .lb-owner { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
.lb-narrow .lb-side { order: 2; flex-direction: row; align-items: center; padding: 0.4em; }
.lb-narrow .lb-thumbs { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
.lb-narrow .lb-th { width: 3.8em; flex: none; }
.lb-narrow .lb-tools4 { display: none; }
.lb-narrow .lb-mini { width: 4.6em; flex: none; }
.lb-narrow .lb-photo-canvas { padding: 0.7em 0.6em 0.5em; }
.lb-narrow .lb-visitor { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
.lb-narrow .lb-tools { display: none; }
.lb-narrow .lb-items { flex-direction: row; overflow-x: auto; padding: 0.3em; }
.lb-narrow .lb-item { width: 3.2em; }
.lb-narrow .lb-canvas.lb-dots { grid-template-columns: 1fr; grid-template-rows: minmax(15em, 1fr) auto; padding-bottom: 0.8em; }
.lk-edit .lb-narrow .lb-canvas.lb-dots { grid-template-rows: 20em auto; }
.lb-narrow .lb-textbox { margin: 1.6em 0.8em 0; }
.lb-narrow .lb-bar { flex-wrap: wrap; justify-content: center; }
.lb-narrow .lb-fgbg { display: none; }
.lb-narrow .lb-pal { grid-template-columns: repeat(12, 1.45em); grid-auto-rows: 1.45em; }
.lb-narrow .lb-big { margin-left: 0; }
.lb-narrow .lb-status { gap: 0.5em; }
@media (prefers-reduced-motion: reduce) { .lb-win.power, .lb-win.off, .lb-stamp, .ft-reward .rw-card.in, .ft-reward .lk-edit.in { animation: none !important; } }

/* after publishing: where to find the Lookbook (the desk computer) */
.rw-pc {
  position: relative; display: flex; align-items: center; gap: 12px; margin: -6px 0 18px; padding: 11px 14px; text-align: left;
  background: #e9e6f6; color: #2f2b52; border: 1.5px solid #5b5886; border-radius: 3px;
  box-shadow: 2px 2px 0 rgba(91, 88, 134, 0.45);
  font-family: 'LXGW WenKai', 'Kaiti SC', 'STKaiti', serif; font-size: 14.5px; line-height: 1.6; letter-spacing: 0.03em;
  animation: rw-pc-in 0.5s ease 0.35s both;
}
.rw-pc[hidden] { display: none; }
.rw-pc svg { flex: none; width: 38px; height: 38px; color: #3b3760; }
.rw-pc b { display: block; font-weight: 600; font-size: 15.5px; color: #3b3760; }
.rw-pc em { font-style: normal; font-weight: 600; color: #5b3a9a; background: linear-gradient(transparent 58%, rgba(240, 214, 120, 0.75) 58%); padding: 0 2px; }
@keyframes rw-pc-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rw-pc { animation: none; } }

.lk-ask .rw-title { margin-bottom: 22px; }

/* opening the computer: "your own page, or everyone's?" (a little system dialog over the window) */
.lb-ask-wrap { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 1em; background: rgba(60, 54, 104, 0.28); animation: lb-ask-in 0.22s ease-out 0.25s both; }
.lb-ask { width: min(25em, 100%); padding: 0.18em; box-shadow: 0.25em 0.25em 0 rgba(40, 34, 80, 0.35); background: var(--lb-face); }
.lb-ask-title { padding: 0.28em 0.6em; font-weight: 700; color: #fbfaff; background: linear-gradient(180deg, #9b94d0, #8a83c4); text-shadow: 0 1px 0 rgba(40, 34, 90, 0.4); }
.lb-ask-main { display: flex; align-items: center; gap: 1em; padding: 1em 1.1em 0.7em; }
.lb-ask-doll { flex: none; width: 4.2em; height: 5.4em; display: grid; place-items: center; background: var(--bg); }
.lb-ask-doll { overflow: hidden; position: relative; }
.lb-ask-doll img { position: absolute; inset: 6%; width: 88%; height: 88%; object-fit: contain; image-rendering: pixelated; }
/* keep the short Chinese phrase on one line; English wraps normally (it is much longer) */
:root[data-lang="zh"] .lb-ask-main b { white-space: nowrap; }
.lb-ask-main > div { min-width: 0; overflow-wrap: break-word; }
.lb-ask-main p { margin: 0; font-size: 1.05em; line-height: 1.6; }
.lb-ask-main b { color: #4a3a8c; }
.lb-ask-btns { display: flex; justify-content: center; gap: 0.7em; padding: 0.3em 1em 1em; }
.lb-ask-btns .lb-bevel { padding: 0.45em 1.1em; min-width: 7em; font-size: 1em; }
.lb-ask-btns .lb-default { font-weight: 700; outline: 0.1em solid var(--lb-ink); outline-offset: 0.05em; }
.lb-ask-note { margin: 0.45em 0 0 !important; font-size: 0.85em !important; opacity: 0.75; line-height: 1.5 !important; }
.lb-ask-err:empty { display: none; }
.lb-ask-err { margin: 0.4em 0 0 !important; font-size: 0.85em !important; color: #a3324a; }
.lb-warnbox .lb-ask-title { background: linear-gradient(180deg, #c58aa8, #b07494); }
.lb-del-yes { color: #9a2a45 !important; }
/* delete my own page (browse mode, only on pages this browser published) */
.lb-del { display: inline-flex; gap: 0.35em; align-items: center; padding: 0.35em 0.7em; font-size: 0.9em; color: #8f2a44; white-space: nowrap; }
.lb-del svg { width: 1.1em; height: 1.1em; }
.lb-minetag { display: inline-block; margin-right: 0.45em; padding: 0 0.4em; font-size: 0.85em; font-weight: 700; color: #fbfaff; background: #7a72b8; }
.lb-toast { margin-right: auto; padding: 0.1em 0.6em; font-weight: 700; background: #fff6c8; color: #5a4a10; border: 0.1em solid #c9b34a; }
.lb-narrow .lb-ask { font-size: 13px; }
@keyframes lb-ask-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

/* 《Candace in Fashion》 close-up: back button + a quiet caption under the cover */
#mag-ui { position: fixed; inset: 0; pointer-events: none; z-index: 20; opacity: 0; transition: opacity 0.22s ease; }
#mag-ui.on { opacity: 1; }
#mag-ui[hidden] { display: none; }
.mag-back { pointer-events: auto; position: absolute; left: calc(20px + env(safe-area-inset-left)); top: calc(18px + env(safe-area-inset-top));
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 15px 8px 11px; border-radius: 999px;
  border: 1px solid var(--chip-border); background: var(--chip); color: var(--ink); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font: inherit; font-size: 13px; cursor: pointer; transition: background 0.2s ease, transform 0.15s ease; }
.mag-back svg { width: 15px; height: 15px; }
.mag-back:hover { background: rgba(255, 252, 247, 0.92); }
.mag-back:active { transform: scale(0.96); }
.mag-back:focus-visible { outline: 2px solid #6f7d5f; outline-offset: 2px; }
.mag-cap { position: absolute; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 18px; border-radius: 14px; white-space: nowrap;
  background: var(--chip); border: 1px solid var(--chip-border); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--ink); }
.mag-cap b { font-family: 'Didot', 'Bodoni 72', 'Playfair Display', Georgia, serif; font-size: 16px; font-weight: 400; letter-spacing: 0.06em; }
.mag-cap span { font-size: 11px; opacity: 0.7; letter-spacing: 0.04em; }

.mag-sub { max-width: min(80vw, 560px); overflow: hidden; text-overflow: ellipsis; }
.mag-turn, .mag-zoom button { pointer-events: auto; display: grid; place-items: center; cursor: pointer; color: var(--ink); font: inherit;
  border: 1px solid var(--chip-border); background: var(--chip); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s ease, transform 0.15s ease; }
.mag-turn:hover, .mag-zoom button:hover { background: rgba(255, 252, 247, 0.92); }
.mag-turn:active, .mag-zoom button:active { transform: scale(0.94); }
.mag-turn:focus-visible, .mag-zoom button:focus-visible { outline: 2px solid #6f7d5f; outline-offset: 2px; }
.mag-turn { position: absolute; top: 50%; width: 44px; height: 44px; margin-top: -22px; border-radius: 50%; }
.mag-turn[hidden] { display: none; }
.mag-turn svg { width: 18px; height: 18px; }
.mag-prev { left: calc(14px + env(safe-area-inset-left)); }
.mag-next { right: calc(14px + env(safe-area-inset-right)); }
.mag-zoom { position: absolute; right: calc(20px + env(safe-area-inset-right)); bottom: calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; }
.mag-zoom button { width: 38px; height: 38px; border-radius: 12px; font-size: 18px; line-height: 1; padding: 0; }
.mag-zoom svg { width: 16px; height: 16px; }
.mag-tip { position: absolute; left: 50%; top: calc(20px + env(safe-area-inset-top)); transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 999px;
  font-size: 12px; color: var(--ink); background: var(--chip); border: 1px solid var(--chip-border); opacity: 0; transition: opacity 0.5s ease; white-space: nowrap; }
#mag-ui.tip-on .mag-tip { opacity: 1; }
@media (max-width: 699px) {
  .mag-tip { top: calc(70px + env(safe-area-inset-top)); }
  .mag-cap { bottom: calc(18px + env(safe-area-inset-bottom)); max-width: calc(100vw - 100px); left: calc(16px + env(safe-area-inset-left)); transform: none; align-items: flex-start; white-space: normal; }
  .mag-sub { max-width: 100%; }
}

/* the magazine close up: printed paper laid exactly over the 3D magazine (pointer events go through to the canvas).
   #mag-book spans the open spread; the spine is at its centre. Pages keep the PDF colours; paper grain, gutter shading,
   page-block edges and a soft drop shadow make it read as paper. The turning page is 14 strips (see magazine.js). */
#mag-book { position: fixed; z-index: 15; pointer-events: none; opacity: 0; transition: opacity 0.25s ease; --paper: #f6f1e8;
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .38  0 0 0 0 .3  0 0 0 .55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"); --fibre: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='f'><feTurbulence type='fractalNoise' baseFrequency='.012 .09' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .42  0 0 0 0 .34  0 0 0 .35 0'/></filter><rect width='100%25' height='100%25' filter='url(%23f)'/></svg>"); }
#mag-book.on { opacity: 1; }
#mag-book.quick { transition-duration: 0.1s; }
#mag-book[hidden] { display: none; }
#mag-book .bk-page, #mag-book .bk-stack, #mag-book .bk-drop { position: absolute; top: 0; width: 50%; height: 100%; }
#mag-book .bk-l, #mag-book .bk-stack-l, #mag-book .bk-drop-l { left: 0; }
#mag-book .bk-r, #mag-book .bk-stack-r, #mag-book .bk-drop-r { left: 50%; }
/* soft shadow on the desk, a little more under the outer edges where the paper lifts */
#mag-book .bk-drop { border-radius: 2px; box-shadow: 0 1px 2px rgba(45, 28, 20, 0.28), 0 8px 22px -4px rgba(45, 28, 20, 0.34), 0 22px 48px -12px rgba(45, 28, 20, 0.28); }
/* the page block: thin stacked paper edges peeking out at the outer side and the bottom */
#mag-book .bk-stack { background: #e9e2d6; }
#mag-book .bk-stack-r { transform: translate(2.5px, 2px); border-radius: 0 2px 2px 0;
  box-shadow: inset -1px 0 0 #fbf8f2, inset -2px 0 0 #d8cfc1, inset 0 -1px 0 #fbf8f2, inset 0 -2px 0 #d8cfc1, 0.6px 0.6px 0 #cfc5b6; }
#mag-book .bk-stack-l { transform: translate(-2.5px, 2px); border-radius: 2px 0 0 2px;
  box-shadow: inset 1px 0 0 #fbf8f2, inset 2px 0 0 #d8cfc1, inset 0 -1px 0 #fbf8f2, inset 0 -2px 0 #d8cfc1, -0.6px 0.6px 0 #cfc5b6; }
#mag-book .bk-page { background-color: var(--paper); background-size: 100% 100%; background-repeat: no-repeat; overflow: hidden; }
/* paper: fine grain + faint fibres, and the curve into the spine (each page darkens and dips toward the gutter) */
#mag-book .bk-page::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: var(--grain), var(--fibre); background-size: 220px 220px, 300px 300px; mix-blend-mode: multiply; opacity: 0.24; }
#mag-book .bk-page::after { content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply; }
#mag-book .bk-l::after { background: linear-gradient(to left, rgba(70, 45, 35, 0.30) 0, rgba(70, 45, 35, 0.12) 2.2%, rgba(70, 45, 35, 0.04) 6%, rgba(0, 0, 0, 0) 13%),
  linear-gradient(to right, rgba(255, 255, 255, 0) 92%, rgba(70, 45, 35, 0.05)); }
#mag-book .bk-r::after { background: linear-gradient(to right, rgba(70, 45, 35, 0.30) 0, rgba(70, 45, 35, 0.12) 2.2%, rgba(70, 45, 35, 0.04) 6%, rgba(0, 0, 0, 0) 13%),
  linear-gradient(to left, rgba(255, 255, 255, 0) 92%, rgba(70, 45, 35, 0.05)); }
/* "finish": "magazine" (pages.json, per spread): coated magazine stock. Smoother paper (less grain, a faint sheen), and a
   spine that reads like a real perfect-bound magazine: a fine dark crease line, a tight deep shadow where the page
   dives into the binding, a soft wide fall-off as the page curves down to it, a light catch on the crest of that
   curve, and a whisper of shade at the outer edge. Layer order: ::after multiplies the shade, ::before soft-lights the
   highlights + sheen. */
#mag-book .bk-page[data-finish="magazine"]::before {
  background-image: var(--grain),
    linear-gradient(118deg, rgba(255,255,255,0) 30%, rgba(255,255,255,0.22) 46%, rgba(255,255,255,0.05) 58%, rgba(255,255,255,0) 70%);
  background-size: 220px 220px, 100% 100%; mix-blend-mode: soft-light; opacity: 0.55; }
#mag-book .bk-l[data-finish="magazine"]::before { background-image: var(--grain),
    linear-gradient(to left, rgba(255,255,255,0) 4%, rgba(255,255,255,0.3) 8%, rgba(255,255,255,0.5) 11%, rgba(255,255,255,0.14) 15.5%, rgba(255,255,255,0) 21%),
    linear-gradient(118deg, rgba(255,255,255,0) 30%, rgba(255,255,255,0.22) 46%, rgba(255,255,255,0.05) 58%, rgba(255,255,255,0) 70%);
  background-size: 220px 220px, 100% 100%, 100% 100%; }
#mag-book .bk-r[data-finish="magazine"]::before { background-image: var(--grain),
    linear-gradient(to right, rgba(255,255,255,0) 4%, rgba(255,255,255,0.3) 8%, rgba(255,255,255,0.5) 11%, rgba(255,255,255,0.14) 15.5%, rgba(255,255,255,0) 21%),
    linear-gradient(118deg, rgba(255,255,255,0) 30%, rgba(255,255,255,0.22) 46%, rgba(255,255,255,0.05) 58%, rgba(255,255,255,0) 70%);
  background-size: 220px 220px, 100% 100%, 100% 100%; }
#mag-book .bk-l[data-finish="magazine"]::after { background:
    linear-gradient(to left, rgba(24, 13, 8, 0.72) 0, rgba(30, 17, 11, 0.55) 0.6%, rgba(40, 24, 16, 0.4) 1.8%, rgba(50, 31, 21, 0.27) 4%, rgba(58, 37, 26, 0.16) 7.5%, rgba(60, 40, 28, 0.08) 11.5%, rgba(60, 40, 28, 0.03) 16%, rgba(0, 0, 0, 0) 21%),
    linear-gradient(to left, rgba(60, 40, 28, 0.15) 0, rgba(60, 40, 28, 0.07) 18%, rgba(60, 40, 28, 0.02) 34%, rgba(0, 0, 0, 0) 46%),
    linear-gradient(to right, rgba(60, 40, 28, 0.07) 0, rgba(0, 0, 0, 0) 3.5%),
    linear-gradient(to bottom, rgba(60, 40, 28, 0.035), rgba(0, 0, 0, 0) 6%, rgba(0, 0, 0, 0) 94%, rgba(60, 40, 28, 0.05)); }
#mag-book .bk-r[data-finish="magazine"]::after { background:
    linear-gradient(to right, rgba(24, 13, 8, 0.72) 0, rgba(30, 17, 11, 0.55) 0.6%, rgba(40, 24, 16, 0.4) 1.8%, rgba(50, 31, 21, 0.27) 4%, rgba(58, 37, 26, 0.16) 7.5%, rgba(60, 40, 28, 0.08) 11.5%, rgba(60, 40, 28, 0.03) 16%, rgba(0, 0, 0, 0) 21%),
    linear-gradient(to right, rgba(60, 40, 28, 0.15) 0, rgba(60, 40, 28, 0.07) 18%, rgba(60, 40, 28, 0.02) 34%, rgba(0, 0, 0, 0) 46%),
    linear-gradient(to left, rgba(60, 40, 28, 0.07) 0, rgba(0, 0, 0, 0) 3.5%),
    linear-gradient(to bottom, rgba(60, 40, 28, 0.035), rgba(0, 0, 0, 0) 6%, rgba(0, 0, 0, 0) 94%, rgba(60, 40, 28, 0.05)); }
/* the crease itself: a hairline dark fold with a paler lip beside it, on each page's spine edge */
#mag-book .bk-l[data-finish="magazine"] { box-shadow: inset -1px 0 0 rgba(22, 12, 8, 0.55), inset -2px 0 0 rgba(255, 248, 238, 0.12); }
#mag-book .bk-r[data-finish="magazine"] { box-shadow: inset 1px 0 0 rgba(22, 12, 8, 0.55), inset 2px 0 0 rgba(255, 248, 238, 0.12); }
/* the binding's curve: the page edges bow down into the spine (top and bottom dip a little near the gutter) */
#mag-book .bk-l[data-finish="magazine"] { clip-path: polygon(0.00% 0.000%, 86.00% 0.000%, 87.40% 0.001%, 88.80% 0.009%, 90.20% 0.033%, 91.60% 0.081%, 93.00% 0.161%, 94.40% 0.279%, 95.80% 0.437%, 97.20% 0.637%, 98.60% 0.876%, 100.00% 1.150%, 100.00% 98.850%, 98.60% 99.124%, 97.20% 99.363%, 95.80% 99.563%, 94.40% 99.721%, 93.00% 99.839%, 91.60% 99.919%, 90.20% 99.967%, 88.80% 99.991%, 87.40% 99.999%, 86.00% 100.000%, 0.00% 100.000%); }
#mag-book .bk-r[data-finish="magazine"] { clip-path: polygon(0.00% 1.150%, 1.40% 0.876%, 2.80% 0.637%, 4.20% 0.437%, 5.60% 0.279%, 7.00% 0.161%, 8.40% 0.081%, 9.80% 0.033%, 11.20% 0.009%, 12.60% 0.001%, 14.00% 0.000%, 100.00% 0.000%, 100.00% 100.000%, 14.00% 100.000%, 12.60% 99.999%, 11.20% 99.991%, 9.80% 99.967%, 8.40% 99.919%, 7.00% 99.839%, 5.60% 99.721%, 4.20% 99.563%, 2.80% 99.363%, 1.40% 99.124%, 0.00% 98.850%); }
/* the shadow a turning page throws on the page beneath it (opacity set while turning) */
#mag-book .bk-cast { position: absolute; inset: 0; z-index: 1; opacity: 0; pointer-events: none; }
#mag-book .bk-r .bk-cast { background: linear-gradient(to right, rgba(40, 25, 18, 0.55), rgba(40, 25, 18, 0.18) 35%, rgba(40, 25, 18, 0) 75%); }
#mag-book .bk-l .bk-cast { background: linear-gradient(to left, rgba(40, 25, 18, 0.55), rgba(40, 25, 18, 0.18) 35%, rgba(40, 25, 18, 0) 75%); }
/* hover on a page that can be turned: its outer corner lifts a little */
#mag-book .bk-page > .bk-cast::after { content: ""; position: absolute; bottom: 0; width: 0; height: 0; transition: width 0.22s ease, height 0.22s ease; }
#mag-book .bk-r > .bk-cast::after { right: 0; background: linear-gradient(315deg, rgba(0,0,0,0) 49%, #e7e0d4 50%, #fbf8f2 66%, #ddd4c6 100%); box-shadow: -2px -2px 5px -1px rgba(40,25,18,.25); }
#mag-book .bk-l > .bk-cast::after { left: 0; background: linear-gradient(45deg, rgba(0,0,0,0) 49%, #e7e0d4 50%, #fbf8f2 66%, #ddd4c6 100%); box-shadow: 2px -2px 5px -1px rgba(40,25,18,.25); }
#mag-book.hover-r .bk-r > .bk-cast, #mag-book.hover-l .bk-l > .bk-cast { opacity: 1 !important; background: none; }
#mag-book.hover-r .bk-r > .bk-cast::after, #mag-book.hover-l .bk-l > .bk-cast::after { width: calc(var(--pw) * 0.075); height: calc(var(--pw) * 0.075); }
#mag-book[data-mode="opening"] .bk-cast::after { display: none; }
/* closed (the cover close-up) and while the cover turns: only the right half exists; the left page arrives on the cover's back */
#mag-book[data-mode="closed"] .bk-l, #mag-book[data-mode="closed"] .bk-stack-l, #mag-book[data-mode="closed"] .bk-drop-l,
#mag-book[data-mode="opening"] .bk-l, #mag-book[data-mode="opening"] .bk-stack-l { visibility: hidden; }
#mag-book[data-mode="opening"] .bk-drop-l { opacity: 0.5; }
/* the turning page: a WebGL canvas centred on the spine (magazine.js draws one bent sheet in it while a page moves) */
#mag-book .bk-turn { position: absolute; left: 50%; top: 0; width: 0; height: 100%; }
#mag-book .bk-leafcv { position: absolute; display: block; pointer-events: none; }
/* the closed cover lying flat: glossier than the pages, with a thin fold at the spine */
#mag-book .bk-r.is-cover::before { opacity: 0.1; }
#mag-book .bk-r.is-cover::after { mix-blend-mode: normal;
  background: linear-gradient(118deg, rgba(255,255,255,0) 28%, rgba(255,255,255,0.13) 44%, rgba(255,255,255,0.04) 55%, rgba(255,255,255,0) 66%),
    linear-gradient(to right, rgba(40,25,18,0.22), rgba(40,25,18,0) 1.6%); }
#mag-ui .mag-cap { transition: opacity 0.25s ease; }
#mag-ui.zoomed .mag-cap { opacity: 0; }
/* magazine: cover close-up (1st click) shows only 「回到房间」 + 「翻开杂志」; the reading view shows zoom / turn controls */
.mag-openbtn { pointer-events: auto; position: absolute; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 10px 22px; border-radius: 999px; border: 1px solid var(--chip-border); background: var(--chip); color: var(--ink);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font: inherit; font-size: 14px; letter-spacing: 0.08em; cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease; }
.mag-openbtn:hover { background: rgba(255, 252, 247, 0.95); }
.mag-openbtn:active { transform: translateX(-50%) scale(0.96); }
.mag-openbtn:focus-visible { outline: 2px solid #6f7d5f; outline-offset: 2px; }
#mag-ui:not([data-mode="cover"]) .mag-openbtn { display: none; }
#mag-ui[data-mode="cover"] .mag-zoom, #mag-ui[data-mode="cover"] .mag-turn, #mag-ui[data-mode="cover"] .mag-tip { display: none; }
@media (max-width: 699px) { .mag-openbtn { bottom: calc(96px + env(safe-area-inset-bottom)); } }

/* 中 / EN switch: top right of the room (#lang), and in the fitting room's header */
.lang-sw { display: inline-flex; align-items: center; gap: 4px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--chip-border);
  background: var(--chip); color: var(--ink-soft); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font: inherit; font-size: 12px; letter-spacing: 0.04em; cursor: pointer; transition: background 0.2s ease, transform 0.15s ease, opacity 0.3s ease; }
.lang-sw:hover { background: rgba(255, 252, 247, 0.94); }
.lang-sw:active { transform: scale(0.96); }
.lang-sw:focus-visible { outline: 2px solid #6f7d5f; outline-offset: 2px; }
.lang-sw .lg-opt { opacity: 0.45; }
.lang-sw .lg-opt.on { opacity: 1; font-weight: 600; color: var(--ink); }
.lang-sw .lg-sep { opacity: 0.35; }
#lang { position: fixed; z-index: 30; top: calc(16px + env(safe-area-inset-top)); right: calc(56px + env(safe-area-inset-right)); }
/* sound on / off: a small round chip at the very top right, the 中 / EN switch beside it */
#mute { position: fixed; z-index: 30; top: calc(16px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right));
  width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--chip-border);
  background: var(--chip); color: var(--ink-soft); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, opacity 0.3s ease; }
#mute:hover { background: rgba(255, 252, 247, 0.94); }
#mute:active { transform: scale(0.94); }
#mute:focus-visible { outline: 2px solid #6f7d5f; outline-offset: 2px; }
#mute[aria-pressed="true"] { color: var(--ink-soft); opacity: 0.75; }
body.fitting-open #lang, body.fitting-open #closet-back, body.placing-sticker #lang, body.closet-portrait.detail-open #lang,
body.fitting-open #mute, body.placing-sticker #mute, body.closet-portrait.detail-open #mute { opacity: 0; pointer-events: none; }
/* on a phone the computer's Lookbook fills the screen (.lb-full, lookbook.js: under 700px wide) and its title bar with
   the close button sits right under 中/EN and the speaker: step those aside while it is open */
@media (max-width: 699.98px) {
  body.lookbook-open #lang, body.lookbook-open #mute { opacity: 0; pointer-events: none; }
}
.ft-lang { padding: 5px 10px; }

/* ------------------------------------------------------------------ outside, on the hill (before stepping in) */
#outside-hint {
  left: 50%; bottom: calc(30px + env(safe-area-inset-bottom)); transform: translate(-50%, 8px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; opacity: 0; transition: opacity 0.7s ease, transform 0.7s ease;
  text-align: center; width: max-content; max-width: calc(100vw - 32px);
}
.oh-title { font-size: 26px; color: #f4f1e6; }   /* lettering: .ink-stamp--lg (its filter carries the soft shadow) */
.oh-say {
  padding: 7px 16px; border-radius: 999px; font-size: 12px; letter-spacing: 0.08em;
  color: #f7f5ea; background: rgba(24, 44, 100, 0.38); border: 1px solid rgba(240, 240, 255, 0.35);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: oh-breathe 2.6s ease-in-out infinite;
}
/* ------------------------------------------------------------------ ink-stamp lettering (shared component)
   Wide, heavy, upper-case letters with blunt, slightly melted strokes, a little ink spread and a few drop-outs, like
   a rubber stamp on paper. Put it on the TEXT element (a span inside a pill button, not the pill itself: a CSS filter
   would melt the pill's background and border too). Needs the SVG filters #ink-stamp / #ink-stamp-lg in index.html.
     <button class="…"><span class="ink-stamp">ENTER</span></button>      small text (11–16px)
     <h2 class="ink-stamp ink-stamp--lg">Candace's Room</h2>               headings (20px and up)
   Copy stays as written (Chinese untouched); English is shown in capitals. No text-shadow on it (it would melt):
   --lg brings its own soft shadow. The guide buttons below use the same face with #ink-stamp-ui (adds a dark glow). */
.ink-stamp {
  font-family: 'Unbounded', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', system-ui, sans-serif;
  font-weight: 800; font-style: normal; text-transform: uppercase; letter-spacing: 0.12em;
  font-synthesis: none; -webkit-font-smoothing: antialiased; text-shadow: none;
  filter: url(#ink-stamp);
}
.ink-stamp:lang(zh), html[lang="zh-CN"] .ink-stamp { letter-spacing: 0.14em; }
.ink-stamp--lg { filter: url(#ink-stamp-lg); letter-spacing: 0.1em; font-weight: 800; }
@keyframes oh-breathe { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
body.outside #outside-hint { opacity: 1; transform: translate(-50%, 0); transition-delay: 0.4s; }
body.outside #hint, body.outside #reset, body.outside #stk-open, body.outside #fit-entry, body.outside #leave-room { opacity: 0; pointer-events: none; }

#leave-room {
  left: calc(16px + env(safe-area-inset-left)); top: calc(16px + env(safe-area-inset-top));
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px 7px 10px; border-radius: 999px;
  border: 1px solid var(--chip-border); background: var(--chip); color: var(--ink);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font: inherit; font-size: 12px; cursor: pointer; transition: opacity 0.5s ease, background 0.2s ease;
}
#leave-room:hover { background: rgba(255, 252, 247, 0.92); }
#leave-room:focus-visible { outline: 2px solid #6f7d5f; outline-offset: 2px; }
body.closet-mode #leave-room, body.lookbook-open #leave-room, body.magazine-open #leave-room,
body.placing-sticker #leave-room, body.fitting-open #leave-room { opacity: 0; pointer-events: none; }
@media (max-width: 560px) {
  .oh-title { font-size: 21px; }
  .oh-say { padding: 7px 14px; }
  .oh-say .ink-stamp { font-size: 11px; letter-spacing: 0.07em; white-space: nowrap; }   /* the wide stamp face: keep the English line on one line */
  #outside-hint { bottom: calc(26px + env(safe-area-inset-bottom)); }
}
@media (max-width: 359px) { .oh-say .ink-stamp { white-space: normal; } }   /* the narrowest phones: two lines rather than touching the edges */

/* ------------------------------------------------------------------ guide buttons: bare stamped lettering
   Every guiding control in and around the room (走出小屋, 中 / EN, sound, 重置视角, the drag hint, 我的贴纸, 回到卧室,
   the wardrobe whisper, the fitting doll's 「想给我搭一套吗？」, the heap / 13 pointer tips, the magazine controls, the
   sticker-placing bar, the outside line) is just text now: no pill, border, blur or shadow behind it. The lettering
   is the ink-stamp face in cream with #ink-stamp-ui (index.html), whose soft dark glow keeps it readable over bright
   sun and dark wood. Hover / focus: a stamped underline. Not used inside the computer (#lookbook) or the pixel
   fitting room, which keep their own look. --guide = the lettering colour. */
:root { --guide: #fbf2df; }
#hint, #reset, #leave-room, #closet-back, #closet-tip, #lang, #mute, #pile-tip, #cat-tip, .fe-say,
.mag-back, .mag-openbtn, .mag-cap, .mag-tip, .mag-turn, .mag-zoom button,
#stk-open .so-label, #stk-open .so-n, #stick-bar .sb-text, #stick-bar .sb-ok, #stick-bar .sb-cancel, .oh-say .ink-stamp {
  font-family: 'Unbounded', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', system-ui, sans-serif;
  font-weight: 700; font-style: normal; text-transform: uppercase; letter-spacing: 0.1em;   /* 700: dense Chinese strokes stay open at UI sizes */
  font-synthesis: none; text-shadow: none; color: var(--guide);
  filter: url(#ink-stamp-ui);
}
#hint, #reset, #leave-room, #closet-back, #closet-tip, #lang, #mute, #pile-tip, #cat-tip, .fe-say,
.mag-back, .mag-openbtn, .mag-cap, .mag-tip, .mag-turn, .mag-zoom button,
#stk-open, #stick-bar, #stick-bar .sb-ok, #stick-bar .sb-cancel, #stk-open .so-n, .oh-say {
  background: none !important; border-color: transparent !important; box-shadow: none !important;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
}
#hint { color: var(--guide); font-size: 12px; letter-spacing: 0.08em; }
#hint.dim { opacity: 0.6; }
#reset, #leave-room, #closet-back, .mag-back { font-size: 13px; gap: 7px; }
#closet-tip { font-size: 12.5px; }
#lang { font-size: 13px; }
#lang .lg-opt { opacity: 0.55; }
#lang .lg-opt.on { opacity: 1; color: var(--guide); }
#lang .lg-sep { opacity: 0.6; }
#mute, #mute[aria-pressed="true"] { color: var(--guide); }
#mute[aria-pressed="true"] { opacity: 0.6; }
#mute svg { width: 19px; height: 19px; }
#pile-tip, #cat-tip { font-size: 12.5px; }
#cat-tip .ct-name { color: var(--guide); font-weight: 800; }
#cat-tip .ct-say { font-size: 1em; }
.fe-say { font-size: 12.5px; letter-spacing: 0.08em; padding: 4px 6px; }
#fit-entry:hover .fe-say { background: none; }
.mag-cap b { font-family: inherit; font-weight: 800; font-size: 15px; letter-spacing: 0.1em; }
.mag-cap span { font-size: 12px; opacity: 0.85; }
.mag-openbtn { font-size: 16px; letter-spacing: 0.12em; }
.mag-tip { font-size: 12.5px; }
.mag-turn svg { width: 24px; height: 24px; }
.mag-zoom button { font-size: 20px; }
.mag-zoom svg { width: 20px; height: 20px; }
#stk-open { padding-left: 0; color: var(--guide); }
#stk-open .so-label { font-size: 13px; }
#stk-open .so-n { min-width: 0; padding: 0 0 0 2px; font-size: 13px; line-height: inherit; color: var(--guide); }
#stk-open .so-n::before { content: '· '; opacity: 0.7; }
#stick-bar { color: var(--guide); padding-left: 0; padding-right: 0; }
#stick-bar .sb-text { font-size: 13px; line-height: 1.6; }
#stick-bar .sb-note { color: inherit; font-size: 11.5px; opacity: 0.85; }
#stick-bar .sb-ok, #stick-bar .sb-cancel { font-size: 13px; padding: 5px 6px; }
#stick-bar .sb-ok { text-decoration: underline 1.5px; text-underline-offset: 5px; }
.oh-say { padding: 4px 0; }
/* hover / keyboard focus: a stamped underline (and a touch brighter) instead of a lighter pill */
#reset:hover, #leave-room:hover, #closet-back:hover, .mag-back:hover, .mag-openbtn:hover, #stk-open:hover .so-label,
#fit-entry:hover .fe-say, #stick-bar .sb-cancel:hover, #lang:hover .lg-opt:not(.on) {
  text-decoration: underline 1.5px; text-underline-offset: 5px; color: #fffaf0;
}
.mag-turn:hover, .mag-zoom button:hover, #mute:hover { color: #fffaf0; transform: scale(1.08); }
.mag-turn:active, .mag-zoom button:active, #mute:active { transform: scale(0.94); }
#reset:focus-visible, #leave-room:focus-visible, #closet-back:focus-visible, .mag-back:focus-visible, .mag-openbtn:focus-visible,
#lang:focus-visible, #mute:focus-visible, #stk-open:focus-visible, #fit-entry:focus-visible, .mag-turn:focus-visible,
.mag-zoom button:focus-visible, #stick-bar button:focus-visible {
  outline: 2px dashed var(--guide); outline-offset: 3px;
}
@media (max-width: 560px) {
  #hint { font-size: 11px; letter-spacing: 0.06em; line-height: 1.7; }
  #reset, #leave-room, #closet-back, .mag-back, #lang, #stk-open .so-label, #stk-open .so-n { font-size: 12px; }
  #stick-bar .sb-text, #stick-bar .sb-ok, #stick-bar .sb-cancel { font-size: 12px; }
  #stk-open .so-n::before { content: none; }   /* the label is hidden on phones: just the sticker and its count */
}

/* 「点一下任意处，开启声音」: under the speaker while the browser is holding sound back (until the first interaction) */
#sound-tip {
  top: calc(52px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); z-index: 30;
  font-family: 'Unbounded', 'Noto Sans SC', 'PingFang SC', system-ui, sans-serif; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; font-size: 11px; color: var(--guide); filter: url(#ink-stamp-ui);
  pointer-events: none; opacity: 0; transition: opacity 0.6s ease;
}
#sound-tip.on { opacity: 0.9; animation: oh-breathe 2.6s ease-in-out infinite; }
#sound-tip .st-touch { display: none; }
@media (hover: none) and (pointer: coarse) { #sound-tip .st-desk { display: none; } #sound-tip .st-touch { display: inline; } }
body.fitting-open #sound-tip, body.placing-sticker #sound-tip { display: none; }

/* the fitting room's reward / Lookbook cards: the same stamped lettering as the guide buttons, in the card's ink (and
   cream on the filled button). The filter sits on the TEXT (the button labels are spans), so the buttons keep their
   shape. #ink-stamp = the small stamp without the dark glow (the card is light). */
.rw-card .rw-title, .rw-card .rw-text, .rw-card .rw-btn > span, .rw-card .rw-pc > span {
  font-family: 'Unbounded', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', system-ui, sans-serif;
  font-weight: 700; font-style: normal; text-transform: uppercase; letter-spacing: 0.1em;
  font-synthesis: none; -webkit-text-stroke: 0; text-shadow: none;
  filter: url(#ink-stamp);
}
.rw-card .rw-title { font-size: 17px; line-height: 1.45; letter-spacing: 0.08em; }
.rw-card .rw-text { font-size: 12.5px; line-height: 1.7; letter-spacing: 0.08em; }
.lk-ask .rw-text { font-size: 12.5px; }
.rw-card .rw-btn { font-family: 'Unbounded', 'Noto Sans SC', system-ui, sans-serif; font-size: 12.5px; letter-spacing: 0; padding: 10px 18px; }
.rw-card .rw-btn > span { display: inline-block; }
.rw-card .rw-pc > span { font-size: 12px; line-height: 1.75; letter-spacing: 0.06em; }
.rw-card .rw-pc b { font-size: 13px; font-weight: 800; }
.rw-card .rw-pc em { font-weight: 800; }

/* 我的贴纸 (the sticker shelf): the same stamped lettering, in the shelf's ink. Button labels are spans so the buttons
   keep their frames; the filter is the glow-less #ink-stamp (light card). */
#stk-shelf .ss-title, #stk-shelf .ss-sub, #stk-shelf .ss-tag, #stk-shelf .ss-date, #stk-shelf .ss-btn > span,
#stk-shelf .ss-del-ask, #stk-shelf .ss-empty {
  font-family: 'Unbounded', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', system-ui, sans-serif;
  font-weight: 700; font-style: normal; text-transform: uppercase; letter-spacing: 0.08em;
  font-synthesis: none; -webkit-text-stroke: 0; text-shadow: none;
  filter: url(#ink-stamp);
}
#stk-shelf .ss-title { font-size: 19px; letter-spacing: 0.1em; }
#stk-shelf .ss-sub { font-size: 12px; line-height: 1.8; }
#stk-shelf .ss-tag { font-size: 10px; letter-spacing: 0.05em; white-space: nowrap; }
#stk-shelf .ss-date { font-size: 9.5px; letter-spacing: 0.04em; white-space: nowrap; }
#stk-shelf .ss-btn { font-family: 'Unbounded', 'Noto Sans SC', system-ui, sans-serif; font-size: 10px; letter-spacing: 0; padding: 6px 9px; line-height: 1.35; max-width: 100%; }
#stk-shelf .ss-item { min-width: 0; }
#stk-shelf .ss-btn > span { letter-spacing: 0.05em; }
/* the "tap again" state spans the card's top edge, so the longer English fits */
#stk-shelf .ss-del.ask { left: 4px; right: 4px; }
#stk-shelf .ss-del.ask svg { display: none; }
#stk-shelf .ss-del-ask { font-size: 9px; letter-spacing: 0.03em; }
#stk-shelf .ss-btn > span { display: inline-block; }
#stk-shelf .ss-empty { font-size: 12.5px; line-height: 1.8; }

/* phones: the 去试衣间试穿 link steps down with the story's type (closet.js fitPanel --fit) and stays on one line */
body.closet-portrait #item-detail .idt-try { font-size: calc(12.5px * min(1, var(--fit, 1))); letter-spacing: 0.04em; white-space: nowrap; }
