@font-face {
  font-family: "Letter Brush";
  src: url("/letter-brush.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Letter Text";
  src: url("/letter-text.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
:root {
  color-scheme: light;
  --ink: #402b27;
  --wine: #7b3c42;
  --gold: #ad8e62;
  --line: #c9b699;
  --serif: "Letter Text", "Songti SC", "Noto Serif CJK SC", SimSun, serif;
  --brush: "Letter Brush", "Kaiti SC", KaiTi, var(--serif);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100svh; color: var(--ink); font-family: var(--serif);
  background: radial-gradient(ellipse at 22% 12%, #f6eee0, transparent 61%), linear-gradient(120deg,#e4d7c3,#eee4d5 55%,#ddcdb9);
}
button, input { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; color: inherit; }
button:focus-visible, input:focus-visible, h1:focus-visible { outline: 2px solid var(--wine); outline-offset: 5px; }
.topline {
  margin: 0 auto; width: min(1216px,89vw); height: clamp(70px,10vh,104px);
  display: flex; align-items: center; justify-content: space-between;
}
.wordmark { display: flex; gap: .65rem; align-items: center; font: 1.4rem var(--brush); letter-spacing: .1em; }
.mark { font-family: "Segoe UI Symbol",serif; font-size: 2.45rem; line-height: 1; color: var(--wine); }
.sound { display: flex; gap: .55rem; align-items: center; padding: .45rem .9rem; min-height: 44px; border: 0; background: transparent; font-size: 1rem; }
.bars { width: 18px; display: flex; align-items: center; gap: 2px; height: 18px; }
.bars i { width: 2px; height: 6px; background: var(--wine); }
.bars i:nth-child(2) { height: 14px; }
.bars i:nth-child(3) { height: 10px; }
.bars i:nth-child(4) { height: 5px; }
.sound[aria-pressed="true"] i { animation: play .85s ease-in-out infinite alternate; }
.sound[aria-pressed="true"] i:nth-child(2n) { animation-delay: -.55s; }
@keyframes play { to { transform: scaleY(.35); } }
.book {
  isolation: isolate; position: relative; display: grid; grid-template-columns: 1fr 1fr;
  width: min(1150px,88vw); min-height: clamp(575px,74vh,750px); margin: 2vh auto 8vh;
  border: 1px solid #b59b78; border-radius: 3px 5px 5px 3px;
  background: #f9f0e1; box-shadow: 0 2px #e7d9c4,0 3px #ad9678,0 5px #e7d9c4,0 6px #b69c7d,0 9px 0 1px #714947,0 22px 48px -16px #5c402f77;
}
.plate { padding: clamp(15px,2.1vw,31px); display: grid; align-items:center; background: linear-gradient(90deg,#efe2cc,#f4e9d8 12%,#f3e7d3 90%,#d3c1a4); }
.plate-frame {
  margin:0; border:1px solid #bfa983; padding:5px;
  background:#f7efde;
}
.piano { display:block; width:100%; height:auto; object-fit:cover; object-position:50% 49%; }
figcaption { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:1.2rem .5rem .7rem; }
.plate-title { color:#70453b; font:italic clamp(2.7rem,4.7vw,4.4rem)/1.1 "Baskerville Old Face",Baskerville,Georgia,serif; letter-spacing:-.05em; }
.work { display:inline-flex; align-items:center; min-height:44px; color:#69503f; font-size:1rem; text-decoration-color:#c5b298; text-underline-offset:5px; }
.leaf {
  position:relative; display:grid; align-content:center; padding:clamp(48px,6vw,95px) clamp(32px,5.4vw,82px);
  background: linear-gradient(90deg,#d5c6af 0%,#f1e6d5 2.8%,#faf2e4 9%,#fcf6eb 74%,#f3e8d6);
}
.ribbon { position:absolute; right:11%;top:-1px;width:23px;height:48px;background:linear-gradient(90deg,#72353a,#a15c5d 42%,#774047);clip-path:polygon(0 0,100% 0,100% 100%,50% 82%,0 100%); }
.writing { width:100%; max-width:380px; margin:auto; }
.envelope { position:relative; width:48px;height:31px; overflow:hidden; transform:rotate(-7deg); border:1px solid #ab8f6f;background:linear-gradient(32deg,transparent 48%,#c4aa864f 49%,transparent 52%),#f4e5cf; margin:0 0 1.4rem 2px; }
.envelope i { position:absolute; left:4px;top:-19px;width:36px;height:36px;border:1px solid #ad9271; transform:rotate(45deg);background:#f7ebd6; }
.envelope::after { content:"";position:absolute;left:20px;top:10px;width:9px;height:9px;border-radius:48%;background:#954e51;box-shadow:inset 0 0 0 2px #7a3d40; }
h1 { font-family:var(--brush); font-weight:400; font-size:clamp(3.4rem,5.5vw,5.2rem); line-height:1.18; margin:0; letter-spacing:.04em; }
.opening { font-size:clamp(1.05rem,1.45vw,1.3rem); line-height:1.95; margin:1rem 0 2.1rem; }
form { max-width:300px; }
label { color:#674e40; display:flex;align-items:baseline;gap:.65rem; font-size:1.04rem; }
label span { font-size:.9rem;color:#796759; }
.digits { position:relative; margin:.7rem 0 1.25rem; width:100%; }
.digits input { position:absolute; z-index:1; inset:0; width:100%; height:100%; opacity:.01; font-size:20px; border:0; background:transparent; caret-color:transparent; cursor:text; }
#slots { display:grid; grid-template-columns:1fr 1fr .23fr 1fr 1fr; align-items:center; gap:8px; }
#slots i { display:grid;place-items:center; height:48px; background:#fffcf44d; border:1px solid var(--line); border-radius:3px; font:1.15rem Georgia,serif; color:var(--wine); }
#slots i:empty::after { content:""; width:8px; height:1px; background:#b4a18b; }
#slots b { color:var(--gold);text-align:center; }
.digits:focus-within i.active { border:2px solid var(--wine)!important; }
.digits:has(input[aria-invalid="true"]) i { border-color:var(--wine)!important; }
.primary,.back { min-height:48px; border-radius:3px; padding:.65rem 1.3rem; font-size:1.05rem; letter-spacing:.12em; }
.primary { color:#fff6e8; background:var(--wine); border:1px solid #70363b; }
.primary:hover { background:#653239; }
form .primary { width:100%; }
.feedback { color:var(--wine); margin:.65rem 0 0; font-size:1rem; }
.feedback:empty { display:none; }
.pages { display:flex; gap:4px; margin:0 0 1.2rem; }
.pages button { width:44px;height:44px; position:relative; background:none;border:0; padding:0; }
.pages button::after { content:"";position:absolute; top:50%;left:4px;right:4px;height:2px;background:#d3c4ae; }
.pages button[aria-current="step"]::after { background:var(--wine);height:4px; }
.story h1 { font-size:clamp(2.3rem,3.2vw,3.4rem); }
#prose { line-height:1.95; font-size:clamp(1.06rem,1.3vw,1.18rem); }
#prose p { margin:.9em 0; }
.actions { display:flex; align-items:center; gap:1rem; margin-top:1.5rem; justify-content:flex-end; }
.back { margin-right:auto; background:transparent; border:0; color:#785854; padding-left:0; }
.reveal { animation: turn .55s ease both; }
@keyframes turn { from { opacity:0; transform:translateX(7px); } to { opacity:1;transform:none; } }
@media (max-width:700px) {
  .topline { width:calc(100% - 40px); height:55px; }
  .wordmark { font-size:1.18rem; }.mark { font-size:1.9rem; }
  .sound { padding-right:0; }
  .book { width:min(440px,calc(100% - 28px)); grid-template-columns:1fr; margin:1px auto 26px; min-height:0; }
  .plate { padding:11px 12px 0; background:#f5ead6; }
  .plate-frame { padding:3px; }
  .piano { height:clamp(155px,26svh,235px); }
  figcaption { flex-direction:row; justify-content:space-between; flex-wrap:wrap; padding:0 .65rem; gap:0 .4rem; }
  .plate-title { font-size:clamp(1.7rem,7vw,2.2rem); }
  .work { font-size:.94rem; }
  .leaf { background:linear-gradient(110deg,#f5ead6,#fcf4e6 50%,#f6ecdb); padding:1.55rem clamp(20px,8vw,38px) 1.9rem; }
  .ribbon { top:-1px; right:8%;height:27px;width:15px; }
  .envelope { float:right; margin:12px 14px 0 0; transform:rotate(7deg); }
  h1 { font-size:clamp(3rem,12vw,3.6rem); }
  .opening { font-size:1.09rem; line-height:1.7; margin:.6rem 0 1.25rem; }
  form { max-width:none; }
  #slots i { height:45px; }
  .digits { margin:.55rem 0 1rem; }
  .reading .piano { height:clamp(100px,17svh,150px); }
  .reading .leaf { padding-top:.65rem; }
  .pages { margin:0 0 .35rem; }
}
@media (prefers-reduced-motion: reduce) { *,*::after { animation:none!important; } }
