:root {
  color-scheme: light;
  --ink: #324132;
  --muted: #5a6855;
  --paper: #f9f7ed;
  --serif: "STKaiti", "KaiTi", "FangSong", "Songti SC", SimSun, serif;
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100svh;
  background-color: #e0e5d0;
  background-image: repeating-linear-gradient(0deg, transparent 0 18px, #a5b68c32 18px 35px, transparent 35px 37px),
                    repeating-linear-gradient(90deg, transparent 0 18px, #a5b68c32 18px 35px, transparent 35px 37px);
}
body::before, .sheet::after {
  content: "";
  pointer-events: none;
  background: url("wish-art/paper-grain.webp") repeat;
  mix-blend-mode: multiply;
}
body::before { position: fixed; inset: 0; opacity: .10; }
button, a { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #705387; outline-offset: 5px; }
.desk { width: min(1200px, 91%); margin: 0 auto; padding: clamp(16px, 3.4vh, 35px) 0 clamp(20px, 4vh, 46px); }
.mast { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; margin-bottom: clamp(17px, 3.2vh, 31px); }
.brand { display: flex; align-items: center; gap: 9px; font: italic 25px Georgia, serif; letter-spacing: -.045em; }
.brand img { width: 29px; height: 29px; object-fit: contain; }
.album-link {
  display: inline-flex; align-items: center; gap: 9px; font-size: 14px;
  text-decoration: none; border-bottom: 1px solid #778469; padding: 6px 1px;
}
.desk:has(.sheet:not([data-phase="closed"])) .album-link { display: none; }
.album-icon { width: 14px; height: 14px; border: 1.4px solid currentColor; border-radius: 2px; position: relative; }
.album-icon::after, .album-icon::before { content: ""; position: absolute; background: currentColor; }
.album-icon::after { width: 1px; inset: 0 auto 0 44%; }
.album-icon::before { height: 1px; inset: 44% 0 auto; }
.sheet {
  --sheet-h: clamp(455px, 75svh, 765px);
  isolation: isolate; position: relative; height: var(--sheet-h);
  background-color: var(--paper); border: 1px solid #b5b79b; border-radius: 9px 13px 12px 8px / 8px 9px 15px 9px;
  box-shadow: 1px 3px 0 #ecebdc, 1px 4px 0 #bdc1aa, 3px 12px 25px -15px #46563a80;
}
.sheet::before {
  content: ""; position: absolute; inset: 10px; border: 1px dashed #b2b69c9e; border-radius: 5px 8px 7px 6px; pointer-events: none;
}
.sheet::after { position: absolute; inset: 0; border-radius: inherit; opacity: .058; z-index: -1; }
.sheet-edge {
  position: absolute; width: clamp(50px, 6.8vw, 87px); height: 23px; top: 1px; left: -12px;
  transform: rotate(-24deg); pointer-events: none; opacity: .85; z-index: 2;
  background-color: #e6d8aaad;
  background-image: repeating-linear-gradient(90deg, transparent 0 3px, #fff5d040 3px 4px);
  clip-path: polygon(0 0,98% 1%,100% 16%,98% 30%,100% 45%,98.5% 62%,100% 77%,98% 100%,0 100%,1.5% 84%,0 71%,1.8% 55%,0 37%,1.4% 20%);
}
.intro {
  position: absolute; top: 50%; left: 9.5%; width: 35%; transform: translateY(-50%); z-index: 2;
  transition: opacity 240ms ease, translate 400ms ease;
}
.intro h1 { margin: 0 0 16px; font: 500 clamp(62px, 7.8vw, 104px)/1.12 var(--serif); letter-spacing: .005em; }
.intro-text { margin: 0; color: #53604c; font: 18px/1.8 var(--serif); max-width: 16em; text-wrap: pretty; }
.inventory { display: flex; gap: 11px; align-items: center; color: var(--muted); margin-top: 30px; font-size: 13px; }
.inventory img { width: 68px; height: auto; transform: rotate(-4deg); }
.inventory em { font-style: normal; margin: 0 .55em; }
.wish-box {
  padding: 0; margin: 0; border: 0; background: transparent; color: var(--ink); position: absolute; z-index: 3;
  width: min(48%, 570px); left: 70%; top: 50%; transform: translate(-50%, -58%);
  display: flex; flex-direction: column; align-items: center;
}
.sheet[data-phase="opening"] .wish-box { transition: left 540ms cubic-bezier(.37,.03,.2,1) 300ms, top 540ms ease 300ms, width 540ms ease 300ms, transform 540ms ease 300ms; }
.box-art { display: block; width: 100%; aspect-ratio: 960/750; position: relative; isolation: isolate; filter: drop-shadow(1px 2px 1px #494b3535) drop-shadow(3px 8px 6px #52513a28); }
.box-art img { display: block; width: 100%; height: 100%; position: absolute; inset: 0; user-select: none; -webkit-user-drag: none; }
.box-open-lid, .box-lid { transform-origin: 50% 43%; }
.box-open-lid { opacity: 0; transform: scaleY(.02); }
.box-open { position: absolute; inset: 40% 7% 5%; padding: 0; border: 0; border-radius: 12px; background: transparent; }
.sheet[data-phase="closed"] .box-art { transition: translate 180ms ease; }
@media (hover: hover) {
  .wish-box:has(.box-open:hover) .box-art { translate: 0 -3px; }
}
.sheet:not([data-phase="closed"]) .box-open { display: none; }
#wish-mouth { position: absolute; left: 50%; top: 58%; width: 1px; height: 1px; pointer-events: none; }
.sheet:not([data-phase="closed"]) .intro { opacity: 0; translate: -16px 0; pointer-events: none; visibility: hidden; }
.sheet:not([data-phase="closed"]) .wish-box { width: min(27%, 320px); left: 20%; top: 61%; transform: translate(-50%, -31%); }
.sheet:not([data-phase="closed"]) .box-lid { opacity: 0; transform: scaleY(.015); }
.sheet:not([data-phase="closed"]) .box-open-lid { opacity: 1; transform: none; }
.sheet[data-phase="opening"] .box-lid { animation: lift-outer 410ms cubic-bezier(.46,0,.78,.62) both; }
.sheet[data-phase="opening"] .box-open-lid { animation: lift-inner 400ms cubic-bezier(.18,.6,.22,1) 370ms both; }
@keyframes lift-outer { 0% { opacity: 1; transform: scaleY(1); } 92% { opacity: 1; } 100% { opacity: 0; transform: scaleY(.02); } }
@keyframes lift-inner { from { opacity: 0; transform: scaleY(.02); } 8% { opacity: 1; } to { opacity: 1; transform: scaleY(1); } }
.stage {
  position: absolute;
  inset: 0;
  display: grid;
  padding: clamp(18px, 3vh, 36px) clamp(26px, 4.4vw, 66px);
  grid-template-columns: minmax(0, 34%) minmax(0, 1fr);
  column-gap: 6%;
  align-items: center;
  pointer-events: none;
}
.guide, .drawn { grid-area: 1/2; min-width: 0; display: none; text-align: center; }
.sheet[data-phase="guide"] .guide { display: block; pointer-events: auto; }
.sheet[data-phase="note"] .drawn { display: grid; justify-items: center; pointer-events: auto; }
.sheet[data-phase="drawing"] .drawn { display: grid; justify-items: center; opacity: 0; }
.guide-heading {
  grid-area: 1/1;
  align-self: start;
  display: none;
  gap: clamp(10px, 1.55vw, 23px);
  align-items: center;
  margin: clamp(34px, 8vh, 88px) 0 0;
}
.sheet:is([data-phase="guide"], [data-phase="drawing"], [data-phase="note"]) .guide-heading { display: flex; }
.guide-heading h2 { flex: none; margin: 0; line-height: 1; }
.guide-heading p { display: grid; gap: 3px; margin: 0; min-width: 0; }
.guide-heading p img { display: block; width: min(100%, 244px); height: auto; }
.guide-heading h2:focus, #drawn-image:focus { outline: 0; }
.guide-original { display: block; border-radius: 36%; pointer-events: auto; }
.guide-original img { display: block; height: clamp(108px, 20vh, 177px); width: auto; }
.guide-original:hover { filter: drop-shadow(1px 1px 1px #53604a55); }
.mood-board { min-width: 0; animation: place-stickers 300ms cubic-bezier(.18,.67,.3,1) both; }
.mood-picker {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border-block: 1px solid #c7cbb6;
}
@keyframes place-stickers { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.mood-board button {
  --tilt: -2deg;
  border: 0;
  background: transparent;
  min-height: 44px;
  min-width: 0;
}
.mood-picker button {
  padding: clamp(6px, 1.1vh, 12px) 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(2px, 1vw, 13px);
}
.mood-picker button:nth-child(n+4) { border-top: 1px dashed #bac4ae; }
.mood-board button:nth-child(3n+2) { --tilt: 3deg; }
.mood-face {
  width: clamp(49px, min(7.2vw, 10.6vh), 88px); height: auto; aspect-ratio: 1; display: block;
  transform: rotate(var(--tilt)); filter: drop-shadow(0 1px 0 #5b62423f);
  transition: transform 180ms ease, filter 180ms ease;
}
.mood-writing { display: block; width: auto; height: clamp(18px, 2.5vw, 29px); max-width: 40%; object-fit: contain; }
.mood-board button:focus-visible { border-radius: 8px; outline-offset: -3px; }
@media (hover: hover) {
  .mood-board button:hover .mood-face { transform: translateY(-4px) rotate(-6deg); filter: drop-shadow(1px 5px 2px #58623d36); }
}
.mood-board button:active .mood-face { transform: translateY(1px) rotate(2deg) scale(.95); }
.extra-faces {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  margin-block: clamp(10px, 1.8vh, 20px) clamp(6px, 1.5vh, 15px);
}
.extra-faces > * { display: grid; place-items: center; padding: 0 2px; min-width: 0; }
.extra-faces .mood-face { width: min(100%, 54px); }
.guide-postscript { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 1px 6px; margin: 0; }
.guide-postscript > span:not(.sr-only) { display: flex; align-items: center; gap: 1px; }
.guide-postscript img { width: auto; height: clamp(11px, 1.7vw, 19px); }
.guide-postscript .ink-paren { height: clamp(7px, 1vw, 12px); margin-left: 2px; }
#original-guide-dialog { width: min(92vw, 820px); max-height: 92svh; padding: clamp(14px, 2.1vw, 26px); color: var(--ink); background: var(--paper); border: 1px solid #aab39c; border-radius: 9px; }
#original-guide-dialog:not([open]) { display: none; }
#original-guide-dialog::backdrop { background: #29322899; }
#original-guide-dialog header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
#original-guide-dialog h2 { margin: 0; font: 600 23px/1.4 var(--serif); }
#original-guide-dialog button { padding: 7px 15px; min-height: 38px; background: none; border: 1px solid #9aab90; border-radius: 18px; }
#original-guide-dialog > img { display: block; width: 100%; height: auto; max-height: 65svh; object-fit: contain; }
#original-guide-dialog > a { display: block; width: fit-content; margin: 12px auto 0; font-size: 14px; text-underline-offset: 3px; }
#drawn-image { display: block; width: auto; height: auto; max-width: 91%; max-height: calc(var(--sheet-h) - 137px); object-fit: contain; filter: drop-shadow(1px 2px 1px #34382d40) drop-shadow(3px 7px 4px #474d3733); }
.wish-flying-paper { filter: drop-shadow(2px 4px 3px #474d374d); }
.reading-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 5px 12px; margin-top: 14px; }
.reading-actions button { padding: 7px 13px; border-radius: 18px; border: 1px solid #a7b29c; background: transparent; color: #43583f; font-size: 13px; min-height: 36px; }
.reading-actions button:hover { background: #e8eddc; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
noscript { position: absolute; left: 12%; bottom: 8%; }
@media (max-width: 890px) and (min-width: 681px) {
  .desk { width: 94%; }
  .intro { left: 7%; }
  .intro-text { font-size: 17px; }
  .sheet:not([data-phase="closed"]) .wish-box { left: 19%; }
}
@media (max-width: 680px) {
  .desk { width: calc(100% - 24px); padding: 15px 0 24px; }
  .mast { margin: 0 6px 15px; }
  .brand { font-size: 21px; gap: 6px; }
  .brand img { width: 24px; height: 24px; }
  .album-link { font-size: 13px; }
  .sheet { --sheet-h: clamp(535px, 79svh, 825px); }
  .sheet::before { inset: 7px; }
  .sheet-edge { height: 17px; top: 2px; left: -5px; }
  .intro { top: 10%; left: 11%; width: 80%; transform: none; }
  .intro h1 { font-size: clamp(53px, 11.8vw, 73px); margin-bottom: 10px; }
  .intro-text { font-size: 17px; max-width: 100%; }
  .inventory { margin-top: 13px; gap: 8px; font-size: 12px; }
  .inventory img { width: 57px; }
  .wish-box { width: min(89%, 465px); left: 50%; top: 62%; transform: translate(-50%,-53%); }
  .sheet:is([data-phase="guide"], [data-phase="drawing"], [data-phase="note"]) { height: auto; }
  .sheet:is([data-phase="guide"], [data-phase="drawing"], [data-phase="note"]) .stage { position: relative; }
  .stage { grid-template-columns: minmax(0, 1fr); row-gap: 16px; padding: 33px clamp(12px, 5vw, 34px) 26px; }
  .guide-heading { width: 76%; margin: 0; }
  .guide, .drawn { grid-area: 2/1; }
  .guide-original img { height: clamp(83px, 24vw, 112px); }
  .sheet:not([data-phase="closed"]) .wish-box { top: 19px; left: auto; right: 14px; width: min(23%, 96px); transform: none; pointer-events: none; }
  .mood-picker button { flex-direction: column; gap: 0; padding: 5px 0 8px; }
  .mood-picker .mood-face { width: clamp(48px, 14vw, 76px); }
  .mood-writing { height: 20px; max-width: min(80%, 68px); }
  .extra-faces { width: min(100%, 380px); margin-inline: auto; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .extra-faces .mood-face { width: min(100%, 45px); }
  .guide-postscript img { height: clamp(12px, 3vw, 18px); }
  #drawn-image { max-height: calc(var(--sheet-h) * .52); max-width: 84%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
}

.wish-embedded body { min-height: 0; background: transparent; }
.wish-embedded body::before, .wish-embedded .mast { display: none; }
.wish-embedded .desk { width: 100%; padding: 8px 10px 24px; }
/* The frame follows the desk's height, so the embedded sheet uses width-based sizing. */
.wish-embedded .sheet { --sheet-h: clamp(460px, 59vw, 680px); }
@media (max-width: 680px) {
  .wish-embedded .sheet { --sheet-h: clamp(480px, calc(128vw + 45px), 630px); }
  .wish-embedded .sheet[data-phase="guide"] .stage { row-gap: 34px; }
  .wish-embedded .sheet[data-phase="guide"] .guide-heading { width: 68%; }
}
