* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; background: #000; overflow: hidden; touch-action: manipulation; }
body { font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif; color: #e9edf2; -webkit-user-select: none; user-select: none; }
button { font-family: inherit; cursor: pointer; }

#root { position: fixed; inset: 0; overflow: hidden; background: #000; }
#stage { position: absolute; left: 0; top: 0; width: 1280px; height: 720px; transform-origin: 0 0; overflow: hidden; background: #05070a; }

/* 背景 */
#bg, #bg img { position: absolute; inset: 0; width: 100%; height: 100%; }
#bg img { object-fit: cover; opacity: 0; transition: opacity .9s ease, filter 1.2s ease, transform 12s ease-out; }
#bg img.on { opacity: 1; }
#bg img.zoom { transform: scale(1.06); }
#tint { position: absolute; inset: 0; pointer-events: none; transition: background 1.2s ease, opacity 1.2s ease; }
.tone-nora #bg img { filter: saturate(.75) brightness(.9) hue-rotate(-6deg); }
.tone-nora #tint { background: linear-gradient(180deg, rgba(20,32,48,.15), rgba(6,10,18,.45)); }
.tone-killer #bg img { filter: saturate(.8) brightness(.95) contrast(1.08); }
.tone-killer #tint { background: radial-gradient(ellipse at center, rgba(90,8,8,.05) 35%, rgba(25,0,0,.6)); }
.tone-child #bg img { filter: sepia(.75) saturate(1.3) brightness(.85) contrast(1.05); }
.tone-child #tint { background: radial-gradient(ellipse at center, rgba(255,220,140,.06), rgba(40,25,0,.6)); }
.tone-none #tint { background: none; }
.shake { animation: shake .45s; }
@keyframes shake { 0%,100%{transform:translate(0,0)} 20%{transform:translate(-8px,3px)} 40%{transform:translate(7px,-4px)} 60%{transform:translate(-5px,2px)} 80%{transform:translate(4px,-2px)} }

/* 人物 */
#chars { position: absolute; inset: 0; pointer-events: none; }
.ch { position: absolute; bottom: 0; height: 640px; transition: opacity .45s ease, filter .45s ease, transform .45s ease; opacity: 0; transform: translateY(14px); }
.ch.on { opacity: 1; transform: translateY(0); }
.ch.dim { filter: brightness(.45) saturate(.6); }
.ch.left { left: 40px; }
.ch.right { right: 40px; }
.ch.center { left: 50%; margin-left: -256px; }
.tone-killer .ch { display: none; }

/* 目線の札 */
#vlabel { position: absolute; left: 22px; top: 18px; padding: 8px 16px 8px 14px; font-size: 19px; letter-spacing: .06em; background: rgba(0,0,0,.55); border-left: 5px solid #7a90a8; opacity: 0; transition: opacity .6s; pointer-events: none; }
#vlabel.on { opacity: 1; }
#vcard { position: absolute; left: 0; right: 0; top: 40%; text-align: center; pointer-events: none; transition: opacity .7s; z-index: 55; }
#vcard .vbar { width: 90px; height: 5px; margin: 0 auto 18px; background: #7a90a8; }
#vcard .vwho { font-size: 46px; font-weight: 700; letter-spacing: .12em; text-shadow: 0 2px 18px #000; }
#vcard .vsub { margin-top: 12px; font-size: 26px; letter-spacing: .08em; color: #c9d3de; text-shadow: 0 2px 12px #000; }

/* 会話 */
#box { position: absolute; left: 50%; bottom: 26px; width: 1120px; margin-left: -560px; min-height: 176px; padding: 24px 40px 26px; background: linear-gradient(180deg, rgba(8,11,16,.86), rgba(4,6,9,.94)); border: 1px solid rgba(160,180,200,.22); border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.6); cursor: pointer; }
#who { position: absolute; left: 32px; top: -22px; padding: 6px 18px; font-size: 22px; font-weight: 700; background: #1c2a3a; border: 1px solid rgba(160,190,220,.35); border-radius: 4px; letter-spacing: .08em; }
#who:empty { display: none; }
#who .role { font-size: 15px; font-weight: 400; color: #a9b8c8; margin-left: 10px; }
#text { font-size: 27px; line-height: 1.75; letter-spacing: .03em; white-space: pre-wrap; }
#text.inner { color: #bcd0e6; font-style: italic; }
#text.narr { color: #d8d2c4; }
#next { position: absolute; right: 22px; bottom: 12px; font-size: 18px; color: #8fa3b8; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.hidden { display: none !important; }

/* 選択肢 */
#choices { position: absolute; left: 50%; bottom: 40px; width: 900px; margin-left: -450px; text-align: center; }
#cprompt { font-size: 24px; margin-bottom: 14px; color: #d9e2ec; text-shadow: 0 2px 10px #000; }
#cprompt:empty { display: none; }
#clist { display: flex; flex-direction: column; gap: 12px; max-height: 470px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#clist button { font-size: 26px; padding: 16px 28px; color: #eef3f8; background: rgba(10,16,24,.88); border: 1px solid rgba(170,195,220,.4); border-radius: 6px; letter-spacing: .04em; transition: background .2s, transform .1s; }
#clist button:hover { background: rgba(40,62,88,.92); }
#clist button:active { transform: scale(.98); }
#timer { height: 8px; margin-top: 16px; background: rgba(255,255,255,.12); border-radius: 4px; overflow: hidden; }
#timerbar { height: 100%; width: 100%; background: linear-gradient(90deg, #c24, #e85); }
#timer.off { visibility: hidden; }
.urgent #clist button { border-color: rgba(230,110,110,.6); }

/* 調べる場所 */
#hots { position: absolute; inset: 0; }
.hot { position: absolute; border-radius: 10px; cursor: pointer; }
.hot::after { content: ""; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 3px solid rgba(255,255,255,.85); box-shadow: 0 0 18px rgba(255,255,255,.6); animation: pulse 1.6s infinite; }
.hot.seen::after { border-color: rgba(150,170,190,.5); box-shadow: none; animation: none; }
.hot .hl { position: absolute; left: 50%; top: calc(50% + 26px); transform: translateX(-50%); white-space: nowrap; font-size: 19px; padding: 3px 10px; background: rgba(0,0,0,.65); border-radius: 4px; pointer-events: none; }
.tap::after { width: 54px; height: 54px; margin: -27px 0 0 -27px; border-color: rgba(255,120,120,.95); box-shadow: 0 0 26px rgba(255,60,60,.8); }
@keyframes pulse { 0% { transform: scale(.8); opacity: 1; } 70% { transform: scale(1.35); opacity: .3; } 100% { transform: scale(.8); opacity: 1; } }
#hotdone { position: absolute; right: 30px; bottom: 30px; font-size: 22px; padding: 12px 22px; background: rgba(10,16,24,.9); border: 1px solid rgba(170,195,220,.45); border-radius: 6px; cursor: pointer; }
#hotdone.wait { opacity: .5; }

/* 上の帯 */
#hud { position: absolute; right: 16px; top: 14px; display: flex; gap: 8px; }
#hud button { font-size: 18px; padding: 8px 14px; color: #dfe7ef; background: rgba(0,0,0,.55); border: 1px solid rgba(170,190,210,.35); border-radius: 5px; }
#hud button.flash { animation: flash 1s 3; }
@keyframes flash { 50% { background: rgba(120,150,190,.7); } }

/* 大きな文字 */
#bigtitle { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 64px; font-weight: 700; letter-spacing: .25em; text-shadow: 0 4px 30px #000; pointer-events: none; transition: opacity 1s; white-space: pre-line; line-height: 1.6; }
#bigtitle.small { font-size: 40px; letter-spacing: .12em; }
#meet { position: absolute; left: 60px; top: 90px; padding: 14px 26px; background: rgba(0,0,0,.6); border-left: 4px solid #c9a55a; pointer-events: none; transition: opacity .6s; }
#meet .mname { font-size: 34px; font-weight: 700; letter-spacing: .1em; }
#meet .mrole { font-size: 20px; color: #d6c9a8; margin-top: 4px; }
#toast { position: absolute; left: 50%; top: 80px; transform: translateX(-50%); padding: 10px 22px; font-size: 20px; background: rgba(20,30,44,.92); border: 1px solid rgba(170,195,220,.4); border-radius: 5px; pointer-events: none; }

#fade { position: absolute; inset: 0; background: #000; pointer-events: none; opacity: 1; transition: opacity .9s ease; z-index: 50; }
#fade.white { background: #fff; }
#fade.up { opacity: 0; }

/* 手帳・人物・前の文 */
#panel { position: absolute; left: 50%; top: 50%; width: 980px; height: 600px; margin: -300px 0 0 -490px; background: #e9e2d0; color: #2a2620; border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.8); z-index: 60; display: flex; flex-direction: column; }
#panel.dark { background: #0d131b; color: #dfe7ef; border: 1px solid rgba(170,190,210,.3); }
.phead { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid rgba(0,0,0,.15); font-size: 26px; font-weight: 700; }
#panel.dark .phead { border-color: rgba(255,255,255,.12); }
.phead button { font-size: 20px; padding: 8px 18px; border-radius: 5px; border: 1px solid rgba(0,0,0,.3); background: rgba(255,255,255,.5); }
#panel.dark .phead button { background: #1c2a3a; color: #e6edf4; border-color: rgba(255,255,255,.25); }
#pbody { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px 28px 28px; font-size: 22px; line-height: 1.7; }
.nline { padding: 8px 0; border-bottom: 1px dashed rgba(0,0,0,.18); font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; }
.nline .nd { font-size: 16px; color: #7a6f5c; margin-right: 10px; }
.sus { margin-top: 12px; padding: 10px 14px; background: rgba(160,40,40,.1); border-left: 4px solid #a33; }
.person { display: flex; gap: 18px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.1); align-items: center; }
.person img { width: 92px; height: 115px; object-fit: cover; object-position: top; border-radius: 4px; background: #1a2430; }
.person .pn { font-size: 26px; font-weight: 700; }
.person .pr { font-size: 18px; color: #a8b8c8; }
.person .pk { font-size: 19px; color: #d6dee6; margin-top: 4px; }
.logl { padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.logl b { color: #9fb7d0; margin-right: 10px; }
.menuitem { display: block; width: 100%; margin: 10px 0; font-size: 24px; padding: 14px; border-radius: 6px; border: 1px solid rgba(255,255,255,.25); background: #1c2a3a; color: #e6edf4; }
.fzrow button { font-size: 22px; padding: 10px 20px; margin-right: 8px; border-radius: 5px; border: 1px solid rgba(255,255,255,.25); background: #1c2a3a; color: #e6edf4; }
.fzrow button.sel, .tfont button.sel { background: #c9a55a; color: #111; }

/* タイトル */
.screen { position: absolute; inset: 0; z-index: 70; background: #05070a; }
.tbg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(.55) saturate(.7); }
.tinner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: radial-gradient(ellipse at center, rgba(0,0,0,.2), rgba(0,0,0,.75)); }
.tsub { font-size: 20px; letter-spacing: .4em; color: #9fb2c6; }
.tinner h1 { font-size: 96px; letter-spacing: .3em; margin: 18px 0 8px .3em; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; text-shadow: 0 6px 40px #000; }
.tep { font-size: 24px; color: #cdd6e0; letter-spacing: .1em; }
.tbtns { margin-top: 44px; display: flex; gap: 18px; }
.tbtns button { font-size: 28px; padding: 16px 44px; border-radius: 6px; border: 1px solid rgba(200,215,230,.5); background: rgba(10,16,24,.8); color: #eef3f8; letter-spacing: .1em; }
.tbtns button.primary { background: #8a1c1c; border-color: #c44; }
.tfont { margin-top: 30px; font-size: 21px; color: #b8c6d4; }
.tfont button { font-size: 20px; padding: 7px 16px; margin-left: 8px; border-radius: 5px; border: 1px solid rgba(200,215,230,.4); background: rgba(10,16,24,.8); color: #e6edf4; }
.tnote { margin-top: 26px; font-size: 18px; color: #8293a5; }

/* 終わり */
.endsum { font-size: 22px; line-height: 1.9; text-align: left; margin: 20px auto 0; max-width: 760px; color: #cfd8e2; }

/* 文字の大きさ */
#stage.fz1 #text, #stage.fz1 #clist, #stage.fz1 #cprompt, #stage.fz1 #pbody, #stage.fz1 #who, #stage.fz1 #vlabel, #stage.fz1 .hl, #stage.fz1 #hotdone { zoom: 1.15; }
#stage.fz2 #text, #stage.fz2 #clist, #stage.fz2 #cprompt, #stage.fz2 #pbody, #stage.fz2 #who, #stage.fz2 #vlabel, #stage.fz2 .hl, #stage.fz2 #hotdone { zoom: 1.3; }

/* スマホで縮むとき（縮みが0.55倍未満） */
#stage.tiny #text { font-size: 34px; line-height: 1.6; }
#stage.tiny #box { min-height: 200px; padding: 26px 36px 26px; width: 1200px; margin-left: -600px; bottom: 14px; }
#stage.tiny #who { font-size: 28px; top: -28px; }
#stage.tiny #who .role { font-size: 27px; }
#stage.tiny #cprompt:empty { display: none; }
#stage.tiny #vcard .vwho { font-size: 60px; }
#stage.tiny #vcard .vsub { font-size: 34px; }
#stage.tiny #bigtitle.small { font-size: 52px; }
#stage.tiny #clist button { font-size: 32px; padding: 16px 26px; }
#stage.tiny #choices { width: 1060px; margin-left: -530px; bottom: 20px; }
#stage.tiny #cprompt { font-size: 30px; }
#stage.tiny #hud button { font-size: 28px; padding: 10px 16px; }
#stage.tiny #vlabel { font-size: 27px; }
#stage.tiny .hot .hl { font-size: 28px; }
#stage.tiny #hotdone { font-size: 30px; }
#stage.tiny #pbody { font-size: 30px; }
#stage.tiny .phead { font-size: 32px; }
#stage.tiny .phead button { font-size: 28px; }
#stage.tiny #panel { width: 1180px; height: 660px; margin: -330px 0 0 -590px; }
#stage.tiny #meet .mname { font-size: 40px; }
#stage.tiny #meet .mrole { font-size: 28px; }
#stage.tiny #toast { font-size: 28px; }
#stage.tiny .person .pr, #stage.tiny .person .pk { font-size: 26px; }
#stage.tiny .person .pn { font-size: 32px; }
#stage.tiny .nline .nd { font-size: 22px; }
#stage.tiny .tfont, #stage.tiny .tfont button { font-size: 28px; }
#stage.tiny .tnote, #stage.tiny .tsub { font-size: 26px; }
#stage.tiny .tep { font-size: 30px; }
#stage.tiny .tbtns button { font-size: 36px; }
#stage.tiny .endsum { font-size: 28px; max-width: 1160px; line-height: 1.6; margin-top: 12px; }
#stage.tiny .ch { height: 560px; }
#stage.tiny .fzrow, #stage.tiny .fzrow button { font-size: 30px; }
#stage.tiny .menuitem { font-size: 30px; padding: 18px; }

/* 案内 */
#rotate { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 100; padding: 10px 18px; font-size: 16px; background: rgba(20,30,44,.95); border-radius: 6px; border: 1px solid rgba(170,195,220,.4); }
#hint { position: fixed; left: 50%; top: max(10px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 100; width: min(92vw, 560px); padding: 12px 44px 12px 16px; font-size: 16px; line-height: 1.55; background: rgba(20,30,44,.97); border-radius: 8px; border: 1px solid rgba(170,195,220,.45); color: #eef3f8; }
#hintClose { position: absolute; right: 8px; top: 8px; width: 30px; height: 30px; font-size: 18px; border-radius: 15px; border: none; background: rgba(255,255,255,.15); color: #fff; }
