*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;background:#09141c;color:#f5eee2;font-family:"Yu Gothic",Meiryo,sans-serif}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation}button:disabled{opacity:.4;cursor:default}button:focus-visible,a:focus-visible,button.keyboard-focus{outline:3px solid #ecd1a0;outline-offset:3px}a{color:#ecd1a0}[hidden]{display:none!important}#game{--head:52px;--copy:235px;--pad:78px;height:100svh;height:100dvh;min-height:360px;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:var(--head) minmax(0,1fr) var(--copy) var(--pad);position:relative;overflow:hidden;isolation:isolate}.topbar{grid-row:1;display:flex;align-items:center;justify-content:space-between;padding:4px 20px;gap:15px;background:#0d1e2a;border-bottom:1px solid #b6a38666;z-index:5}.brand{font:19px/1.4 "Yu Mincho",serif;white-space:nowrap;letter-spacing:.12em;color:#efd4a2}.brand span{font:13px Meiryo,sans-serif;margin-left:10px;color:#b9c9cf}.topbar nav{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}.topbar button{font-size:13px;padding:7px 11px;border:1px solid #a8987966;background:#142a39}.art{grid-row:2;position:relative;overflow:hidden;min-height:0;background:#142630}.art>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center}.art-shade{position:absolute;inset:0;background:linear-gradient(0deg,#0a182433,transparent 45%);pointer-events:none}.cast{position:absolute;inset:0;overflow:hidden;pointer-events:none}.cast img{position:absolute;top:3%;height:155%;width:auto;max-width:none;transform:translateX(-50%);user-select:none;pointer-events:none}.cast img:first-child{left:28%}.cast img:nth-child(2){left:73%}.cast[data-count="1"] img{left:60%}.cast img[data-speaking="false"]{filter:brightness(.94)}.scene-label{position:absolute;top:0;left:0;max-width:100%;padding:7px 18px;background:#0b202cdb;color:#f0d6a6;font-size:13px;line-height:1.5}.dialogue{grid-row:3;background:#102635;border:3px double #d0be99;margin:0 12px 8px;padding:10px 22px;min-height:0;display:grid;grid-template-columns:minmax(0,1fr) 155px;grid-template-rows:32px minmax(0,1fr) 20px;column-gap:24px;z-index:4}.speaker-row{grid-column:1/3;display:flex;align-items:center;gap:15px;border-bottom:1px solid #bdac8c44;min-width:0;overflow:hidden;white-space:nowrap}.speaker-row strong{font:24px/1.3 "Yu Mincho",serif;letter-spacing:.06em;color:#e9cc97;flex-shrink:0}.speaker-row>span{font-size:13px;color:#b6c9d2;min-width:0;overflow:hidden;text-overflow:ellipsis}.speaker-row #counter{margin-left:auto;flex-shrink:0}#text{grid-column:1;grid-row:2;margin:0;padding:10px 0 3px;overflow:hidden;white-space:pre-wrap;overflow-wrap:anywhere;line-break:strict;font:25px/1.85 "Yu Mincho","Hiragino Mincho ProN",Meiryo,serif;letter-spacing:.035em;min-height:0;min-width:0}.next{grid-column:2;grid-row:2/4;align-self:center;border:1px solid #f3deb2;background:linear-gradient(135deg,#ecd8b1,#cbb07c);color:#142735;min-height:66px;padding:12px;font-size:22px;font-weight:bold;border-radius:3px}.next span{margin-left:10px}.read-status{grid-column:1;grid-row:3;display:flex;justify-content:space-between;font-size:11px;line-height:18px;color:#acbec7}.controller{grid-row:4;display:flex;justify-content:center;align-items:center;gap:27px;border-top:3px double #b8a481;background:linear-gradient(#283947,#172632);padding:5px 18px;z-index:10}.dpad{display:grid;grid-template-columns:repeat(3,25px);grid-template-rows:repeat(3,21px);flex-shrink:0;gap:0}.dpad button,.dpad span{display:grid;place-items:center;padding:0;background:#d8d1c1;color:#233744;border:1px solid #162633;font-size:13px}.dpad #padUp{grid-column:2;grid-row:1}.dpad #padLeft{grid-column:1;grid-row:2}.dpad span{grid-column:2;grid-row:2}.dpad #padRight{grid-column:3;grid-row:2}.dpad #padDown{grid-column:2;grid-row:3}.pad-help{font-size:14px;line-height:1.6;margin:0;letter-spacing:.1em}.pad-help small{font-size:11px;color:#b9c5c9}.pad-buttons{display:flex;gap:18px}.pad-buttons>div{display:flex;flex-direction:column;align-items:center;gap:2px}.round{width:43px;height:43px;border-radius:50%;border:2px solid #cf9f97;background:linear-gradient(#ab524d,#773734);font-size:25px;box-shadow:0 2px 2px #0006}.pad-buttons small{font-size:10px;color:#e4d1b3}.title-screen,.end-screen{position:absolute;inset:var(--head) 0 var(--pad);z-index:6;display:grid;place-items:center;background:linear-gradient(90deg,#0a1922ec,#0b202ac9);overflow:auto}.title-content,.end-content{width:min(800px,94%);padding:25px;text-align:center}.series-title{color:#ecd3a8;letter-spacing:.25em;font-size:24px;margin:0 0 15px}.chapter-label{display:inline-block;border:1px solid #cab181;color:#ead0a1;padding:4px 19px;font-size:17px;letter-spacing:.25em;margin:0 0 8px}.title-content h1{font:clamp(32px,5vw,62px)/1.5 "Yu Mincho",serif;margin:0;letter-spacing:.12em}.subtitle{font-size:16px;color:#c7d2d4;line-height:1.8;margin:12px 0 24px}.title-menu{display:grid;gap:12px;width:min(390px,100%);margin:0 auto}.title-menu button{display:flex;align-items:center;justify-content:space-between;padding:15px 22px;border:3px double #cfba93;background:#183241eb;font-size:24px;min-height:65px}.title-menu button small{font-size:13px;color:#c7c8bc}.load-info,.title-help{font-size:13px;line-height:1.9;color:#bfced4;margin:15px 0 0}.title-help{color:#ddc79e;margin:8px 0}.hub-link{font-size:13px}.end-content h2{font:35px/1.7 "Yu Mincho",serif;letter-spacing:.12em}.end-content p{font-size:20px;line-height:1.9}.end-content .end-small{font-size:14px;color:#bac9cc}.end-content button{display:block;width:min(370px,100%);margin:12px auto;padding:14px;background:#173345;border:1px solid #bdaa86;font-size:18px}.end-content .gold-button{background:#dfc393;color:#172d38}dialog{width:min(860px,calc(100% - 30px));max-height:86svh;border:2px solid #ac9470;background:#f3eee2;color:#263c44;padding:24px}dialog::backdrop{background:#07121cd9}.modal-header{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #b8ac98}.modal-header h2{font:25px "Yu Mincho",serif}.modal-header button{border:1px solid #b6a585;background:#e8dfcb;color:#273c44;padding:9px 14px}.log-entry{border-bottom:1px solid #cfbfa455;padding:13px 0}.log-entry strong{font-size:14px;color:#7c6038}.log-entry p{font:18px/1.9 "Yu Mincho",serif;white-space:pre-wrap;margin:5px 0}.log-entry small{font-size:12px;color:#697d81}#toast{position:absolute;top:65px;right:20px;z-index:30;padding:10px 16px;background:#102a3aed;border:1px solid #d1b989;font-size:14px;max-width:80%}#game[data-screen="title"] #logBtn,#game[data-screen="title"] #homeBtn{visibility:hidden}#game[data-screen="title"] .dialogue,#game[data-screen="end"] .dialogue{visibility:hidden}#game[data-screen="title"] .scene-label{visibility:hidden}
@media(orientation:portrait){#game{--head:82px;--copy:267px;--pad:78px}.topbar{flex-direction:column;justify-content:center;gap:5px;padding:5px 10px}.brand{font-size:17px}.topbar nav{gap:5px}.topbar button{padding:5px 8px;font-size:12px}.dialogue{grid-template-columns:minmax(0,1fr) 103px;grid-template-rows:30px minmax(0,1fr) 20px;padding:9px 13px;column-gap:13px;margin:0 7px 6px}.speaker-row{gap:9px}.speaker-row strong{font-size:21px}.speaker-row>span{font-size:11px}#text{font-size:21px;line-height:1.8;letter-spacing:.01em}.next{min-height:58px;font-size:18px;padding:8px}.next span{margin-left:5px}.scene-label{font-size:11px;padding:6px 11px}.cast img{height:145%}.cast img:first-child{left:25%}.cast img:nth-child(2){left:76%}.cast[data-count="1"] img{left:54%}.pad-help{display:none}.title-content{padding:18px}.title-content h1{font-size:34px}.series-title{font-size:18px}.subtitle{font-size:14px}.title-menu button{font-size:22px}.title-help,.load-info{font-size:12px}.end-content h2{font-size:29px}}
@media(orientation:landscape) and (max-height:600px){#game{--head:36px;--copy:142px;--pad:0px;grid-template-columns:minmax(0,1fr) 88px;grid-template-rows:36px minmax(0,1fr) 142px}.topbar{grid-column:1/3;padding:3px 10px}.brand{font-size:14px}.brand span{font-size:10px;margin-left:5px}.topbar nav{gap:4px}.topbar button{font-size:11px;padding:4px 6px}.art{grid-column:1;grid-row:2}.dialogue{grid-column:1;grid-row:3;margin:0 6px 5px;padding:5px 12px;grid-template-columns:minmax(0,1fr) 108px;grid-template-rows:24px minmax(0,1fr) 16px;column-gap:15px}.speaker-row{gap:10px}.speaker-row strong{font-size:18px}.speaker-row>span{font-size:10px}#text{font-size:18px;line-height:1.7;padding:4px 0 0;letter-spacing:.02em}.next{font-size:18px;min-height:51px;padding:8px}.read-status{font-size:9px;line-height:15px}.scene-label{font-size:10px;padding:4px 10px}.controller{grid-column:2;grid-row:2/4;flex-direction:column;gap:20px;padding:8px 4px;border-top:0;border-left:3px double #b8a481}.dpad{grid-template-columns:repeat(3,22px);grid-template-rows:repeat(3,22px)}.dpad button{font-size:11px}.pad-help{display:none}.pad-buttons{gap:9px;flex-direction:column}.round{width:39px;height:39px;font-size:22px}.pad-buttons small{font-size:9px}.title-screen,.end-screen{right:88px;bottom:0}.title-content,.end-content{padding:9px 20px}.series-title{font-size:15px;margin-bottom:4px}.chapter-label{font-size:12px;padding:2px 12px;margin-bottom:3px}.title-content h1{font-size:32px;line-height:1.3}.subtitle{font-size:12px;margin:5px 0 10px}.title-menu{width:320px;grid-template-columns:1fr 1fr;gap:10px}.title-menu button{font-size:17px;min-height:47px;padding:6px 12px;gap:6px}.title-menu button small{font-size:9px}.load-info,.title-help{font-size:10px;line-height:1.5;margin:7px 0 0}.hub-link{font-size:10px}.end-content h2{font-size:25px;margin:7px 0}.end-content p{font-size:15px;line-height:1.6;margin:8px 0}.end-content .end-small{font-size:11px}.end-content button{display:inline-block;width:auto;font-size:14px;padding:8px 12px;margin:6px}.cast img{height:155%}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;animation:none!important;transition:none!important}}

/* Dialogue crop follows the source framing, independent of text length. */
.cast img{height:calc(155% * var(--figure-scale,1))}.cast[data-count="3"] img:nth-child(1){left:20%}.cast[data-count="3"] img:nth-child(2){left:50%}.cast[data-count="3"] img:nth-child(3){left:80%}
#game[data-kind="transition"] #speaker{font-size:19px}#game[data-kind="transition"] #text{color:#edd6ae}
@media(orientation:portrait){.cast img{height:calc(145% * var(--figure-scale,1))}.cast[data-count="3"] img:nth-child(1){left:16%}.cast[data-count="3"] img:nth-child(2){left:50%}.cast[data-count="3"] img:nth-child(3){left:84%}#game[data-kind="transition"] #speaker{font-size:16px}}
@media(orientation:landscape) and (max-height:600px){.cast img{height:calc(155% * var(--figure-scale,1))}#game[data-kind="transition"] #speaker{font-size:16px}}

/* Hold the closing still in the unchanged artwork frame. */
.end-screen{inset:auto 12px calc(var(--pad) + 8px);height:calc(var(--copy) - 8px);border:3px double #d0be99;background:#102635;overflow:hidden}
.end-content{display:grid;grid-template-columns:minmax(0,1fr) 200px;align-items:center;gap:20px;width:100%;padding:18px 24px;text-align:left}.end-summary .chapter-label{font-size:14px;margin:0;padding:3px 12px}.end-summary h2{font-size:29px;margin:7px 0;line-height:1.5}.end-summary .end-small{font-size:14px;line-height:1.7;margin:0}.end-actions button{width:100%;font-size:16px;padding:11px;margin:8px 0}
@media(orientation:portrait){.end-screen{left:7px;right:7px;bottom:calc(var(--pad) + 6px);height:calc(var(--copy) - 6px)}.end-content{grid-template-columns:minmax(0,1fr) 110px;gap:12px;padding:14px}.end-summary h2{font-size:23px}.end-summary .end-small{font-size:12px}.end-actions button{font-size:14px;padding:10px 5px}}
@media(orientation:landscape) and (max-height:600px){.end-screen{left:6px;right:94px;bottom:5px;height:calc(var(--copy) - 5px)}.end-content{grid-template-columns:minmax(0,1fr) 165px;padding:7px 16px;gap:16px}.end-summary .chapter-label{font-size:10px;padding:2px 8px}.end-summary h2{font-size:23px;margin:3px 0}.end-summary .end-small{font-size:11px}.end-actions button{font-size:13px;padding:7px;margin:5px 0}}

#game[data-presentation="event"] .art>img{object-position:center top}

.end-summary h2 span{display:inline-block}

/* 卒業のお祝いCGは全体を表示。会話量による枠の伸縮はしない。 */
#game[data-presentation="graduation"] .art>img{object-fit:contain;object-position:center center}

/* 本編の締めと、次回導入の締めを同じ固定枠で表示する。 */
#game[data-presentation="departure"] .art>img{object-fit:contain;object-position:center}
.end-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}.end-actions button{margin:0;padding:9px 4px;font-size:13px;min-height:38px;line-height:1.4}#nextEpisodeBtn{grid-column:1/-1}
@media(orientation:portrait){.end-actions{grid-template-columns:1fr;gap:5px}.end-actions button{grid-column:1;padding:6px 4px;min-height:32px;font-size:12px}.end-summary h2{font-size:22px}}
@media(orientation:landscape) and (max-height:600px){.end-actions{gap:5px}.end-actions button{padding:7px 3px;min-height:32px;font-size:11px}.end-summary h2{font-size:21px}.end-summary .end-small{font-size:10px}}
