/* 《剪一扇春窗》 */
.chuang {
  --c-red: #C8261E;
  --c-red-deep: #8E1A14;
  --c-cream: #F7F1E4;
  --c-night: #2a1c22;
  --c-dusk: #4a2f3a;
  --c-gold: #E8C98A;
  --stage-bg: #1e1418;
}
.chuang .stage-frame { background: var(--c-night); color: var(--c-cream); }
/* 直式手機：改成直的畫框 */
@media (max-aspect-ratio: 4/5) {
  .chuang .stage-frame { aspect-ratio: 640 / 1000; width: min(100cqw, calc(100cqh * 640 / 1000)); }
}
.chuang .serif, .chuang h1, .chuang h2, .chuang .dlg-text, .chuang .chapter-card { font-family: var(--font-serif); }
.chuang .small { font-size: clamp(11px, 1.9cqmin, 14px); opacity: .82; margin: .3em 0; }

/* 文字按鈕 */
.tbtn {
  min-height: max(44px, 6cqmin); padding: 0 1.2em; border-radius: 999px;
  border: 1.5px solid #F7F1E4aa; background: #2a1c22aa; color: var(--c-cream);
  font: 500 clamp(14px, 2.4cqmin, 18px)/1 var(--font-sans); letter-spacing: .12em; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  box-shadow: 0 3px 10px #0004;
}
.tbtn:hover { background: #3a2830cc; }
.tbtn:focus-visible, .rbtn:focus-visible, .win:focus-visible, .prop:focus-visible, .dlg:focus-visible { outline: 3px solid var(--c-gold); outline-offset: 3px; }
.tbtn.primary { background: var(--c-red); border-color: #F3C9A0; color: #fff8ec; }
.tbtn.primary:hover { background: #d83a2f; }
.tbtn.ghost { background: transparent; box-shadow: none; }
.tbtn.small { min-height: 40px; padding: 0 .9em; font-size: 14px; }
.cta-row { display: flex; gap: 1.2cqmin; flex-wrap: wrap; justify-content: center; margin-top: 1.6cqmin; }
.cta-col { display: flex; flex-direction: column; gap: 1.2cqmin; align-items: stretch; margin-top: 2cqmin; min-width: min(70cqw, 300px); }
.cta-col .cont { display: flex; flex-direction: column; align-items: center; gap: .2em; }
.cta-col .cont .tbtn { width: 100%; }

/* 圓形圖片按鈕：陰影照共用圖示按鈕用 CSS 畫 */
.rbtn {
  --s: clamp(52px, 10.5cqmin, 84px);
  border: 0; background: none; padding: 0; cursor: pointer; color: var(--c-cream);
  display: inline-flex; flex-direction: column; align-items: center; gap: .35em;
  font: 500 clamp(12px, 1.9cqmin, 15px)/1.1 var(--font-sans); letter-spacing: .1em;
  -webkit-tap-highlight-color: transparent;
}
.rbtn-md { --s: clamp(46px, 9cqmin, 72px); }
.rbtn-face { width: var(--s); height: var(--s); position: relative; border-radius: 50%; box-shadow: 0 4px 10px #0006, 0 1px 0 #fff3 inset; transition: transform .12s; }
.rbtn-img { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.rbtn .is-normal { display: block; }
.rbtn:active:not(:disabled) .is-normal { display: none; }
.rbtn:active:not(:disabled) .is-pressed { display: block; }
.rbtn:active:not(:disabled) .rbtn-face { transform: translateY(1px) scale(.97); box-shadow: 0 2px 5px #0006; }
.rbtn:disabled { cursor: default; }
.rbtn:disabled .is-normal { display: none; }
.rbtn:disabled .is-disabled { display: block; }
.rbtn:disabled .rbtn-face { box-shadow: none; }
.rbtn:disabled .rbtn-cap { opacity: .5; }
.rbtn-fallback { position: absolute; inset: 0; border-radius: 50%; background: var(--c-cream); color: var(--c-red-deep); display: grid; place-items: center; }
.rbtn.is-wanted .rbtn-face { animation: wanted 1.6s ease-in-out infinite; }
@keyframes wanted { 50% { box-shadow: 0 0 0 7px #E8C98A55, 0 4px 10px #0006; } }
.rbtn.is-down .rbtn-face { transform: rotate(180deg); }

/* 開始畫面、目錄 */
.c-gate, .c-title-scene, .c-chapters {
  position: absolute; inset: 0; background-size: cover; background-position: center 30%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.c-gate::before, .c-title-scene::before, .c-chapters::before { content: ""; position: absolute; inset: 0; background: linear-gradient(#2a1c2299, #2a1c22dd 70%); }
.c-gate > *, .c-title-scene > *, .c-chapters > * { position: relative; }
.c-gate { cursor: pointer; }
.c-gate-inner, .c-title-card, .c-chapters-card { display: flex; flex-direction: column; align-items: center; padding: 3cqmin 5cqmin; max-width: 92cqw; }
.c-title { font-size: clamp(34px, 9cqmin, 76px); letter-spacing: .3em; margin: 0 0 .3em .3em; color: #fff3e0; text-shadow: 0 3px 16px #000a, 0 0 2px #C8261E; font-weight: 700; }
.c-prompt { font-size: clamp(16px, 3cqmin, 22px); letter-spacing: .2em; margin: 1em 0 .8em; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .55; } }
.c-gate .quiet { margin-top: 1.4em; }
.c-gate-foot { position: absolute; bottom: 2.4cqmin; font-size: 12px; opacity: .7; margin: 0; }
.c-title-card .lede { color: #f3e3cc; font-size: clamp(15px, 2.8cqmin, 20px); letter-spacing: .1em; margin: 0 0 .4em; font-family: var(--font-serif); }
.c-home { position: absolute; left: 2.4cqmin; bottom: 2cqmin; color: var(--c-cream); opacity: .75; font-size: 13px; }
.c-chapters { justify-content: flex-start; }
.c-chapters .c-hud { position: relative; width: 100%; }
.c-chapters-card h2 { font-size: clamp(20px, 4cqmin, 30px); letter-spacing: .2em; margin: .4em 0 .8em; }
.chap-list { display: flex; flex-direction: column; gap: 1cqmin; width: min(80cqw, 460px); margin-bottom: 1.6cqmin; }
.chap-item { display: flex; justify-content: space-between; align-items: center; gap: 1em; min-height: 52px; padding: .5em 1.1em; border-radius: 12px; border: 1px solid #F7F1E466; background: #2a1c22cc; color: var(--c-cream); font: 500 clamp(14px, 2.4cqmin, 18px)/1.3 var(--font-serif); cursor: pointer; text-align: left; }
.chap-item .chap-meta { font-size: .78em; color: var(--c-gold); white-space: nowrap; }
.chap-item.is-locked { opacity: .5; }

/* HUD */
.c-hud { position: relative; z-index: 6; flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; min-height: max(48px, 7.4cqmin); padding: .6cqmin 2cqmin; background: linear-gradient(#1e1418f0, #1e141800); }
.c-hud-label { font-family: var(--font-serif); letter-spacing: .14em; font-size: clamp(13px, 2.3cqmin, 17px); }
.c-hud-actions { display: flex; gap: 1cqmin; align-items: center; }
.c-hud .mute-btn { background: #F7F1E4e6; }

/* 樓層畫面 */
.c-floor { position: absolute; inset: 0; display: flex; flex-direction: column; background: radial-gradient(ellipse at 50% 20%, #6b4250, #2a1c22 70%); }
.c-floor .c-hud { position: absolute; left: 0; right: 0; top: 0; }
.floor-body { position: relative; flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 58% 42%; }
@media (max-aspect-ratio: 4/5) { .floor-body { grid-template-columns: 1fr; grid-template-rows: 60% 40%; } }
.facade-view { position: relative; overflow: hidden; min-height: 0; }
.facade { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.facade-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.facade .floor-light { position: absolute; inset: 0; overflow: visible; transform: none; }
.facade .floor-light img { width: 100%; height: 100%; display: block; }
.facade .win { position: absolute; padding: 0; border: 0; background: transparent; cursor: default; overflow: hidden; z-index: 2; }
.facade .win .win-lit { position: absolute; inset: 0; overflow: hidden; background: none; }
.facade .win .win-lit img { max-width: none; }
.win-glass { position: absolute; overflow: hidden; z-index: 2; }
.win-sil { position: absolute; inset: 0; display: block; }
.win-sil .sil-actor { position: absolute; object-fit: contain; object-position: 50% 100%; }
.win-imprint, .win-paper { position: absolute; inset: 0; display: grid; place-items: center; z-index: 3; }
.win-imprint img, .win-paper img { width: auto; height: 86%; max-width: 86%; object-fit: contain; }
.win-imprint { opacity: .34; filter: saturate(.35) brightness(1.55); mix-blend-mode: screen; }
.win-imprint.is-faint { opacity: .16; }
.win.is-pasted .win-imprint { display: none; }
.win-paper img { filter: drop-shadow(0 1px 1px #5a0e0a88); }
.win-paper img.paper-in { animation: paper-in .5s cubic-bezier(.2,.8,.3,1.2); }
@keyframes paper-in { from { transform: scale(1.25); opacity: 0; } }
.win.is-pick { cursor: pointer; }
.win.is-pick::after { content: ""; position: absolute; inset: 0; border: 3px solid #FFE3A8; border-radius: 4px; box-shadow: 0 0 18px #FFE3A8aa inset; animation: pick 1.6s ease-in-out infinite; }
@keyframes pick { 50% { opacity: .35; } }
.prop { position: absolute; width: 5%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 0; background: none; padding: 0; z-index: 3; display: none; cursor: pointer; }
.prop.is-on { display: block; }
.prop-dot { position: absolute; inset: 25%; border-radius: 50%; background: radial-gradient(#fff7da, #ffe3a800 70%); animation: twinkle 2.2s ease-in-out infinite; }
@keyframes twinkle { 50% { transform: scale(1.5); opacity: .45; } }

/* 對話框 */
.panel { position: relative; display: flex; flex-direction: column; justify-content: flex-end; padding: max(8cqmin, 56px) 2.4cqmin 2.4cqmin; min-height: 0; gap: 1.4cqmin; }
@media (max-aspect-ratio: 4/5) { .panel { padding-top: 1cqmin; justify-content: flex-start; } }
.dlg { position: relative; background: #F7F1E4f2; color: #3a2216; border-radius: 14px; padding: 1.8cqmin 2.4cqmin 2.6cqmin; min-height: 18cqmin; box-shadow: 0 8px 24px #0007; border: 2px solid #C8261E; cursor: pointer; }
.dlg.is-idle { cursor: default; }
.dlg.is-idle .dlg-more { display: none; }
.dlg:empty, .dlg.is-idle:has(.dlg-text:empty) { visibility: hidden; }
.dlg-who[hidden] { display: none; }
.dlg-who { display: inline-block; background: var(--c-red); color: #fff6e6; font: 600 clamp(12px, 2cqmin, 15px)/1 var(--font-sans); letter-spacing: .14em; padding: .45em .8em; border-radius: 999px; margin-bottom: .6em; }
.dlg-text { margin: 0; font-size: clamp(16px, 3cqmin, 23px); line-height: 1.65; letter-spacing: .06em; }
.dlg.is-narration .dlg-text { font-style: normal; color: #5a3a2a; }
.dlg-more { position: absolute; right: 1.4cqmin; bottom: .8cqmin; color: var(--c-red); animation: breathe 1.2s infinite; }
.dlg.pop { animation: pop .22s ease-out; }
@keyframes pop { from { transform: translateY(6px); opacity: .6; } }
.panel-actions { display: flex; justify-content: center; }

/* 浮出字 */
.toast { position: absolute; left: 50%; transform: translateX(-50%); z-index: 9; background: #2a1c22ee; color: var(--c-cream); border: 1px solid #E8C98A88; padding: .7em 1.2em; border-radius: 12px; font: 500 clamp(13px, 2.4cqmin, 18px)/1.5 var(--font-sans); letter-spacing: .06em; max-width: 86%; text-align: center; box-shadow: 0 6px 18px #0008; animation: toast-in .3s ease-out; }
.toast-top { top: max(9cqmin, 60px); }
.toast-bottom { bottom: 4cqmin; }
.toast.tut { background: #F7F1E4f5; color: #6a1810; border-color: #C8261E; }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } }

/* 段落字卡 */
.chapter-card { position: absolute; inset: 0; z-index: 9; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #1e1418d0; text-align: center; animation: fade-in .5s ease-out; cursor: pointer; }
.chapter-card h2 { font-size: clamp(24px, 5.6cqmin, 44px); letter-spacing: .24em; margin: 0 0 .5em; color: #fff3e0; }
.chapter-card p { font-size: clamp(15px, 3cqmin, 22px); letter-spacing: .2em; margin: 0; color: var(--c-gold); }
.chapter-card.out { opacity: 0; transition: opacity .45s; }
@keyframes fade-in { from { opacity: 0; } }

/* 剪紙台 */
.floor-body.is-cutting > .facade-view { filter: blur(2px) brightness(.6); }
.cut-layer { position: absolute; inset: 0; z-index: 4; padding: max(8cqmin, 54px) 2cqmin 2cqmin; background: radial-gradient(ellipse at 45% 45%, #7a5040ee, #3a2420f4 75%); display: flex; }
.cutter { flex: 1; display: grid; grid-template-columns: 18% 1fr 20%; gap: 2cqmin; min-height: 0; position: relative; }
.cut-side { display: flex; flex-direction: column; align-items: center; gap: 1.2cqmin; justify-content: center; }
.cut-target { width: 100%; aspect-ratio: 1; border-radius: 10px; background: #F7F1E4; box-shadow: 0 6px 16px #0006 inset, 0 0 0 4px #5a3a2a; display: grid; place-items: center; }
.cut-target img { width: 86%; height: 86%; object-fit: contain; opacity: .55; filter: saturate(.6); }
.cut-target-blank { width: 70%; height: 70%; border: 2px dashed #c9b79a; border-radius: 8px; }
.cut-counter { font-size: clamp(12px, 2.1cqmin, 16px); letter-spacing: .1em; text-align: center; }
.cut-stage { position: relative; min-height: 0; min-width: 0; display: grid; place-items: center; container-type: size; }
.cut-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.paper-flat { position: relative; width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); perspective: 1400px; }
.pf-sheet { position: absolute; inset: 7%; background-color: #D7261E; background-size: cover; box-shadow: 0 10px 24px #0007; backface-visibility: visible; }
.pf-flap { filter: brightness(.86); box-shadow: none; }
.pf-result { background-color: transparent; box-shadow: none; background-size: 100% 100%; filter: drop-shadow(0 8px 14px #0008); }
.pf-result.pf-flap { filter: brightness(.9); }
.cut-tools { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.4cqmin; flex-wrap: wrap; }
.cut-result { position: absolute; left: 18%; right: 20%; bottom: 0; display: flex; justify-content: center; pointer-events: none; }
.plums { display: flex; gap: .6cqmin; filter: drop-shadow(0 3px 6px #0008); }
.plum { width: clamp(40px, 8cqmin, 64px); aspect-ratio: 1; position: relative; }
.plum img { position: absolute; inset: 0; width: 100%; height: 100%; }
.plum .plum-full { opacity: 0; transform: scale(.4) rotate(-30deg); transition: all .45s cubic-bezier(.2,1.4,.4,1); }
.plum.on .plum-full { opacity: 1; transform: none; }
@media (max-aspect-ratio: 4/5) {
  .cutter { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; gap: 1.4cqmin; }
  .cut-side { flex-direction: row; justify-content: center; }
  .cut-target { width: 16cqh; }
  .cut-tools { flex-direction: row; flex-wrap: nowrap; gap: 1.8cqmin; }
  .cut-result { left: 0; right: 0; bottom: auto; top: 22%; }
}

/* 小結 */
.summary { background: #F7F1E4f4; color: #3a2216; border-radius: 16px; padding: 2.6cqmin 3cqmin; box-shadow: 0 8px 24px #0007; border: 2px solid var(--c-red); text-align: center; }
.summary h2 { margin: .1em 0 .4em; font-size: clamp(20px, 4cqmin, 30px); letter-spacing: .14em; color: var(--c-red-deep); }
.sum-kicker { margin: 0; font-size: 13px; letter-spacing: .2em; color: #8a6a50; }
.sum-line { font-family: var(--font-serif); font-size: clamp(15px, 2.7cqmin, 20px); line-height: 1.6; margin: 0 0 .4em; }
.sum-actions { display: flex; align-items: center; justify-content: center; gap: 1.6cqmin; flex-wrap: wrap; margin-top: 1.2cqmin; }
.summary .rbtn { color: var(--c-red-deep); }
.summary .tbtn { background: #fff8ec; color: var(--c-red-deep); border-color: var(--c-red); box-shadow: none; }
.summary .tbtn.ghost { background: transparent; border-color: transparent; }

/* 樓梯過場 */
.stair { position: absolute; inset: 0; z-index: 9; background: #1e1418f4; display: grid; place-items: center; padding: 6cqmin; text-align: center; animation: fade-in .4s; }
.stair-break { letter-spacing: .3em; opacity: .7; }
.stair-line { font-family: var(--font-serif); font-size: clamp(17px, 3.4cqmin, 26px); line-height: 1.8; letter-spacing: .1em; max-width: 30em; }

/* 面板 */
.chuang .overlay { z-index: 10; background: #1e1418aa; }
.chuang .sheet { background: #F7F1E4; color: #3a2216; border: 2px solid var(--c-red); border-radius: 16px; text-align: center; align-items: center; overflow: auto; }
.chuang .sheet h2 { color: var(--c-red-deep); letter-spacing: .14em; }
.chuang .sheet .tbtn { background: #fff8ec; color: var(--c-red-deep); border-color: var(--c-red); box-shadow: none; }
.chuang .sheet .tbtn.primary { background: var(--c-red); color: #fff8ec; }
.chuang .sheet .tbtn.ghost { background: transparent; border-color: transparent; }
.bless-list { display: flex; flex-wrap: wrap; gap: .8cqmin; justify-content: center; margin: 1cqmin 0; max-width: 560px; }
.bless { font: 500 clamp(13px, 2.2cqmin, 16px)/1.3 var(--font-serif); padding: .55em .9em; min-height: 44px; border-radius: 10px; border: 1.5px solid #C8261E66; background: #fff; color: #5a2a1c; cursor: pointer; }
.bless[aria-checked="true"] { background: var(--c-red); color: #fff8ec; border-color: var(--c-red-deep); }
.card-sheet { width: min(94cqw, 760px) !important; }
.card-preview { display: flex; justify-content: center; max-height: 52cqh; }
.card-img { max-height: 52cqh; max-width: 100%; border-radius: 8px; box-shadow: 0 6px 18px #0005; }
.card-status { min-height: 1.4em; font-size: 14px; margin: .4em 0 0; }
.bless-title { margin: .8em 0 0; font-weight: 600; color: var(--c-red-deep); }
.bless-note { margin: 0; font-size: 12px; opacity: .75; }

/* 結局 */
.end-view { position: relative; min-height: 0; overflow: hidden; }
.end-view .facade-view { position: absolute; inset: 0; }
.reunion { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.4s ease; }
.reunion.on { opacity: 1; }
.end-summary { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: #1e141899; animation: fade-in .8s; }
.end-card { background: #F7F1E4f6; color: #3a2216; border: 2px solid var(--c-red); border-radius: 18px; padding: 3cqmin 4cqmin; text-align: center; max-width: 90%; }
.end-card h2 { color: var(--c-red-deep); font-size: clamp(20px, 4.2cqmin, 32px); letter-spacing: .12em; margin: 0 0 .4em; }
.end-card .tbtn { background: #fff8ec; color: var(--c-red-deep); border-color: var(--c-red); box-shadow: none; }
.end-card .tbtn.primary { background: var(--c-red); color: #fff8ec; }
.end-card .tbtn.ghost { background: transparent; border-color: transparent; }

@media (prefers-reduced-motion: reduce) {
  .facade { transition: none !important; }
  .win.is-pick::after, .prop-dot, .c-prompt { animation: none; }
}
