* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #06060c; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
#wrap { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#holder { position: relative; overflow: hidden; flex: none; box-shadow: 0 0 0 1px #1a1a2a; }
#screen { position: absolute; left: 0; top: 0; width: 384px; height: 288px; transform-origin: 0 0; overflow: hidden;
  font-family: 'DotGothic16', 'Hiragino Kaku Gothic ProN', monospace; color: #f3ecd8; font-size: 12px; line-height: 1.6; }
#cv { display: block; width: 384px; height: 288px; image-rendering: pixelated; image-rendering: crisp-edges; }
#tint { position: absolute; inset: 0; pointer-events: none; transition: background .8s; }
#tint.night { background: rgba(8, 14, 54, .5); }
#tint.fire { background: radial-gradient(ellipse at 50% 120%, rgba(255, 90, 20, .35), rgba(120, 20, 10, .22) 60%, rgba(40, 0, 0, .3)); animation: firepulse 1.6s ease-in-out infinite; }
#tint.rain { background: rgba(30, 40, 60, .3); }
@keyframes firepulse { 50% { opacity: .75; } }
#fade { position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity .42s; pointer-events: none; z-index: 5; }
#ui { position: absolute; inset: 0; }
#mini { position: absolute; right: 6px; top: 6px; width: auto; height: auto; max-width: 84px; max-height: 64px; image-rendering: pixelated; border: 1px solid #efe6cc; background: #000; opacity: .85; z-index: 4; display: none; pointer-events: none; }

.win { position: absolute; z-index: 10; background: linear-gradient(#18204a, #0f1430); border: 2px solid #efe6cc; border-radius: 5px;
  box-shadow: 0 0 0 2px #0c1028, inset 0 0 0 1px #4a5490; padding: 5px 9px; }
.dlg { min-height: 90px; }
.dlg .por { display: none; position: absolute; left: 7px; top: 12px; width: 64px; height: 64px; image-rendering: pixelated; border: 1px solid #efe6cc; }
.dlg.hasp .por { display: block; }
.dlg.hasp .tx, .dlg.hasp .nm { margin-left: 70px; }
.dlg .nm { color: #ffd77a; font-size: 11px; height: 16px; }
.dlg .tx { white-space: pre-wrap; font-size: 12.5px; }
.dlg.narr .nm { display: none; }
.dlg.narr .tx { color: #e8e0c4; padding-top: 6px; }
.dlg .arw { position: absolute; right: 10px; bottom: 4px; font-size: 9px; animation: blink 1s steps(2) infinite; }
.sub { font-size: 10px; line-height: 1.4; color: #cfe0ff; background: rgba(10, 16, 40, .92); padding: 3px 8px; }
@keyframes blink { 50% { opacity: 0; } }

.menu .ttl, .win .ttl { color: #ffd77a; font-size: 11px; border-bottom: 1px solid #3a4470; margin-bottom: 3px; }
.menu .it { position: relative; padding-left: 14px; display: flex; justify-content: space-between; gap: 8px; cursor: pointer; white-space: nowrap; }
.menu .it.sel::before { content: '▶'; position: absolute; left: 0; font-size: 9px; top: 2px; animation: blink .8s steps(2) infinite; }
.menu .it.sel { color: #fff6d0; }
.menu .it.dis { opacity: .4; }
.menu .rt { color: #cfc6a8; }
.menu::-webkit-scrollbar, .logs::-webkit-scrollbar, .scrollp::-webkit-scrollbar { width: 4px; }
.menu::-webkit-scrollbar-thumb, .logs::-webkit-scrollbar-thumb, .scrollp::-webkit-scrollbar-thumb { background: #efe6cc; }

.money { font-size: 15px; text-align: right; }
.money small { font-size: 10px; margin-left: 2px; }
.ptime { font-size: 9px; text-align: right; color: #a8a090; }
.desc { font-size: 11px; line-height: 1.5; }
.desc.tall { font-size: 10.5px; }
.desc small { color: #a8a090; font-size: 9px; }
.banner { padding: 3px 12px; transition: opacity .8s; }
.banner.out { opacity: 0; }
.toast { position: absolute; z-index: 25; left: 50%; top: 30px; transform: translateX(-50%); background: rgba(10, 14, 36, .92); border: 1px solid #ffd77a; color: #ffd77a; font-size: 10px; padding: 2px 10px; border-radius: 10px; white-space: nowrap; transition: opacity .6s, top .6s; pointer-events: none; }
.toast.out { opacity: 0; top: 18px; }

.st2 { display: flex; gap: 10px; align-items: flex-start; font-size: 11px; line-height: 1.5; }
.st2 canvas { width: 64px; height: 64px; image-rendering: pixelated; border: 1px solid #efe6cc; flex: none; }
.st2 .big { font-size: 14px; color: #ffd77a; }
.eqs { display: grid; grid-template-columns: 1fr 1fr; font-size: 10.5px; margin-top: 6px; color: #e0d8c0; }
.sks { font-size: 10px; margin-top: 6px; color: #cfc6a8; }
.heart { font-size: 10.5px; margin-top: 6px; }
.heart .jo { color: #ff9a8a; } .heart .ri { color: #8ac0ff; }
.pg { position: absolute; bottom: 4px; right: 10px; font-size: 10px; color: #a8a090; }
.bio { font-size: 11px; line-height: 1.6; margin-top: 8px; }
.lk { font-size: 11px; padding: 2px 0; border-bottom: 1px dotted #3a4470; }
.lk b { color: #ffd77a; }
.scrollp { overflow-y: auto; }
.logp .logs { height: 238px; overflow-y: auto; font-size: 10.5px; }
.lg { padding: 2px 0; border-bottom: 1px dotted #2a3360; }
.lg b { color: #ffd77a; margin-right: 6px; }
.fullmap { text-align: center; }
.fullmap canvas { image-rendering: pixelated; max-width: 340px; max-height: 210px; border: 1px solid #efe6cc; }
.fullmap .lbl { position: absolute; font-size: 9px; color: #fff; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; white-space: nowrap; pointer-events: none; }
.fullmap .goal { font-size: 11px; color: #ffd77a; margin-top: 4px; }
.qty { text-align: center; }
.qty .q { font-size: 18px; } .qty small { color: #a8a090; font-size: 9px; }

.bst { font-size: 10.5px; line-height: 1.3; padding: 3px 7px; transition: transform .1s; }
.bst .bn { color: #ffd77a; display: flex; justify-content: space-between; }
.bst .bn span { color: #cfc6a8; font-size: 10px; }
.bst small { color: #a8a090; }
.bst .bar { height: 3px; background: #2a2a40; margin: 1px 0 2px; }
.bst .bar i { display: block; height: 100%; background: #6ad06a; transition: width .3s; }
.bst .bar.ki i { background: #6ab0ff; }
.bst.act { border-color: #ffd77a; transform: translateY(3px); }
.bst.low .bar i { background: #ffb040; }
.bst.dead { color: #e05050; } .bst.dead .bn { color: #e05050; }
.bst.hurt { animation: hurt .35s; }
@keyframes hurt { 0%, 100% { filter: none; } 30% { filter: brightness(2) sepia(1) hue-rotate(-30deg) saturate(4); } }
.bmsg { font-size: 12.5px; white-space: pre-wrap; }
.kbar { font-size: 10.5px; padding: 3px 8px; }
.kbar .ktitle { color: #ffd77a; display: flex; justify-content: space-between; }
.kbar .ktitle span { color: #ff9a8a; }
.kbar .krow { display: flex; gap: 10px; }
.kbar .kside { flex: 1; }
.kbar .bar { height: 4px; background: #2a2a40; } .kbar .bar i { display: block; height: 100%; transition: width .4s; }
.tachiki .tk { position: relative; height: 18px; background: #2a2a40; border: 1px solid #efe6cc; margin: 8px 0; }
.tachiki .z { position: absolute; top: 0; bottom: 0; background: #c03030; }
.tachiki .c { position: absolute; top: -4px; bottom: -4px; width: 3px; background: #fff; }
.tachiki .tks { text-align: center; color: #ffd77a; }

.card { position: absolute; inset: 0; z-index: 20; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; transition: opacity .8s; text-align: center; }
.card.on { opacity: 1; }
.card .ct { font-size: 22px; color: #f3ecd8; letter-spacing: 3px; text-shadow: 0 0 12px #c0502a; }
.card .cs { margin-top: 12px; font-size: 12px; color: #c8bf9f; }
.still { position: absolute; inset: 0; z-index: 19; background: #000; opacity: 0; transition: opacity .8s; display: flex; align-items: center; justify-content: center; }
.still canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; opacity: .45; }
.still.on { opacity: 1; }
.st-t { position: relative; font-size: 14px; line-height: 1.9; text-align: center; white-space: pre-wrap; color: #fff8e0; text-shadow: 0 0 6px #000, 1px 1px 0 #000; opacity: 0; transform: translateY(6px); transition: opacity 1s, transform 1s; padding: 0 20px; }
.st-t.in { opacity: 1; transform: none; }

.title { position: absolute; inset: 0; z-index: 9; text-align: center; padding-top: 40px; pointer-events: none; }
.title .tser { font-size: 14px; letter-spacing: 10px; color: #e8d8b0; text-shadow: 1px 1px 0 #000; }
.title .tt { font-size: 44px; letter-spacing: 8px; color: #fff3d0; text-shadow: 0 0 12px #e0602a, 2px 2px 0 #5a1a0a; margin-top: 2px; }
.title .ts { font-size: 12px; color: #f0d8b0; margin-top: 2px; text-shadow: 1px 1px 0 #000; letter-spacing: 2px; }
.title .tv { position: absolute; bottom: 6px; right: 8px; font-size: 9px; color: #8a8070; }

#screen.shake { animation: shake .25s; } #screen.shake2 { animation: shake2 .45s; }
@keyframes shake { 25% { margin-left: 3px; } 50% { margin-left: -3px; } 75% { margin-left: 2px; } }
@keyframes shake2 { 15% { margin: 4px 0 0 -5px; } 30% { margin: -3px 0 0 5px; } 45% { margin: 3px 0 0 -4px; } 60% { margin: -2px 0 0 3px; } 80% { margin: 1px 0 0 -1px; } }
#screen.flash::after { content: ''; position: absolute; inset: 0; background: var(--flash, #fff); z-index: 30; animation: fl .4s forwards; pointer-events: none; }
@keyframes fl { 0%, 40% { opacity: .85; } 20%, 60% { opacity: 0; } 50% { opacity: .6; } 100% { opacity: 0; } }

/* ---- 画面まわりの飾り（縦画面の余白を埋める） ---- */
body { background-color: #0b0f22;
  background-image: radial-gradient(ellipse at 50% 40%, transparent 30%, rgba(0,0,0,.55) 100%),
    radial-gradient(circle at 50% 100%, transparent 36%, rgba(60,74,140,.32) 37% 41%, transparent 42% 54%, rgba(60,74,140,.32) 55% 59%, transparent 60% 72%, rgba(60,74,140,.32) 73% 77%, transparent 78%);
  background-size: 100% 100%, 44px 22px; }
body.touch #holder { box-shadow: 0 0 0 2px #0c0806, 0 0 0 4px #b8923a, 0 0 0 6px #3a1a10, 0 6px 24px rgba(0,0,0,.7); }
#topbar { display: none; }
body.touch:not(.land) #topbar { display: flex; flex: none; width: 100%; max-width: 560px; justify-content: space-between; align-items: flex-end; padding: calc(8px + env(safe-area-inset-top)) 16px 8px; font-family: 'DotGothic16', sans-serif; color: #c8b98a; font-size: 11px; }
#topbar .tb-t { color: #8a7a58; letter-spacing: 2px; } #topbar .tb-t b { display: block; color: #ffe2a0; font-size: 18px; font-weight: normal; letter-spacing: 4px; text-shadow: 0 0 8px #c04a1a; }
#tbInfo { text-align: right; line-height: 1.5; white-space: pre; }

/* ---- 操作パッド（スマホ）：真ん中にスティック、まわりに矢印 ---- */
#pad, .padside { display: none; }
body.touch #pad { display: flex; width: 100%; max-width: 560px; flex: 1; min-height: 210px; max-height: 300px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); justify-content: space-between; align-items: center; gap: 10px; }
#stickSlot { flex: 1; display: flex; align-self: stretch; align-items: center; justify-content: center; }
#stick { position: relative; touch-action: none; width: 184px; height: 184px; flex: none; }
#dpad { position: absolute; inset: 0; border-radius: 50%; touch-action: none;
  background: radial-gradient(circle at 50% 45%, #2a3060 0 30%, #1a1f40 31% 64%, #11152c 65% 100%);
  box-shadow: inset 0 0 0 2px #b8923a, inset 0 0 0 4px #2a1a10, inset 0 -6px 14px rgba(0,0,0,.6), 0 4px 12px rgba(0,0,0,.6); }
#dpad .arw { position: absolute; width: 0; height: 0; border: 15px solid transparent; opacity: .75; transition: opacity .08s, filter .08s; pointer-events: none; }
#dpad .arw.u { left: 50%; top: 10px; margin-left: -15px; border-bottom: 22px solid #efe6cc; border-top-width: 0; }
#dpad .arw.d { left: 50%; bottom: 10px; margin-left: -15px; border-top: 22px solid #efe6cc; border-bottom-width: 0; }
#dpad .arw.l { top: 50%; left: 10px; margin-top: -15px; border-right: 22px solid #efe6cc; border-left-width: 0; }
#dpad .arw.r { top: 50%; right: 10px; margin-top: -15px; border-left: 22px solid #efe6cc; border-right-width: 0; }
#dpad .arw.on { opacity: 1; filter: drop-shadow(0 0 6px #ffd77a); }
#dpad .arw.u.on { border-bottom-color: #ffd77a; } #dpad .arw.d.on { border-top-color: #ffd77a; } #dpad .arw.l.on { border-right-color: #ffd77a; } #dpad .arw.r.on { border-left-color: #ffd77a; }
#stickKnob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6dc, #c8b48a 55%, #7a6a4a); box-shadow: 0 3px 8px #000, inset 0 -3px 0 rgba(0,0,0,.25); transform: translate(-50%, -50%); pointer-events: none; }
#btns { display: flex; flex-direction: column; justify-content: center; gap: 10px; width: 176px; }
#btns .row { display: flex; gap: 6px; justify-content: flex-end; }
#btns button { font-family: 'DotGothic16', sans-serif; background: linear-gradient(#262e58, #161b38); color: #f3ecd8; border: 2px solid #b8923a; border-radius: 9px; font-size: 12px; touch-action: none; padding: 6px 7px; box-shadow: 0 2px 0 #000; }
#btns button.on { background: #4a5aa0; } #btns button.lit { background: #8a5a1a; border-color: #ffd77a; color: #ffd77a; }
#btns .ab { align-items: center; gap: 14px; }
#btns .ab button { border-radius: 50%; font-size: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
#btns .ab button small { font-size: 8px; margin-top: 3px; }
#btns .a { width: 80px; height: 80px; background: radial-gradient(circle at 35% 30%, #c84a3a, #7a2020); } #btns .b { width: 62px; height: 62px; margin-top: 26px; }
/* 横画面：左にスティック、右にボタン（.rot は回転ロック中でも横向きに表示するモード） */
body.land.touch #wrap { flex-direction: row; }
body.land.touch .padside { display: flex; align-items: center; justify-content: center; width: 200px; height: 100%; padding: 8px; }
body.land.touch #pad { flex-direction: column; width: 190px; max-width: none; height: 100%; max-height: none; min-height: 0; padding: 10px; }
body.land.touch #stickSlot { display: none; }
body.land.touch #btns { width: 100%; height: 100%; justify-content: center; gap: 18px; }
body.land.touch #btns .row.small { flex-wrap: wrap; justify-content: center; }
body.rot #wrap { inset: auto; left: 0; top: 0; width: 100vh; height: 100vw; transform-origin: 0 0; transform: rotate(90deg) translateY(-100%); }
#btns .row.small button { white-space: nowrap; font-size: 11px; padding: 5px 6px; }
body.touch:not(.land) #btns .row.small:first-child { display: grid; grid-template-columns: 1fr 1fr; }
/* 主要人物の顔絵（高画質）：会話窓の右上に重ねる */
.bust { position: absolute; z-index: 11; pointer-events: none; image-rendering: auto; filter: drop-shadow(0 0 2px rgba(0,0,0,.9)) drop-shadow(2px 3px 0 rgba(0,0,0,.5)); }
.dlg.hasbust .tx, .dlg.hasbust .nm { margin-right: 112px; }
.bst .chips { font-style: normal; position: absolute; left: 3px; bottom: -11px; display: flex; gap: 1px; white-space: nowrap; pointer-events: none; }
.bst .chips i { font-style: normal; font-size: 8.5px; padding: 0 2px; margin-left: 1px; border-radius: 2px; background: #6a3a1a; color: #ffd77a; }
.bst .chips i.rg { background: #1e5a2a; color: #b0ffb0; }
#stickKnob.on { background: radial-gradient(circle at 35% 30%, #fff6dc, #e0b860 55%, #9a6a2a); }

.bst .chips i.dn { background: #2a2a6a; color: #a8c8ff; }
.bst .chips i { box-shadow: 0 0 0 1px rgba(0,0,0,.6); }
.menu.pick { border-color: #ffd77a; box-shadow: 0 0 0 2px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.6); z-index: 12; }
.el { font-weight: bold; }
.ptime { font-size: 9.5px; color: #cfc6a8; line-height: 1.35; margin-top: 2px; }
.bst .nmx { display: flex; align-items: center; gap: 3px; }
.bst .elc { font-style: normal; font-size: 9px; border: 1px solid currentColor; border-radius: 3px; padding: 0 2px; line-height: 1.2; }
.gogyo { text-align: center; } .gogyo canvas { width: 160px; height: 145px; }
.fullmap .lbl { transform: translate(-50%, -50%); }
