:root { --navy: #1c2452; --navy2: #2a3672; --gold: #ffd83d; --blue: #5ad1ff; --white: #f6f8ff; --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif; }
html, body { margin: 0; height: 100%; background: #0b1020; overflow: hidden; font-family: var(--font); color: var(--white); user-select: none; -webkit-user-select: none; touch-action: none; }
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; image-rendering: pixelated; display: block; outline: none; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; font-size: 16px; }
#ui button, #dialog, #title, #ending, #bigmap, #minimap, #touch > * , #topbtns { pointer-events: auto; }
#minimap { cursor: pointer; }
.hidden { display: none !important; }
.panel { background: rgba(28, 36, 82, 0.92); border: 4px solid var(--white); box-shadow: 0 0 0 4px var(--navy), 0 8px 0 4px rgba(0, 0, 0, 0.35); border-radius: 6px; }
kbd { display: inline-block; min-width: 1.3em; padding: 0 0.35em; margin: 0 2px; text-align: center; background: var(--white); color: var(--navy); border-radius: 4px; font: 700 0.85em var(--font); box-shadow: 0 2px 0 #9aa7d8; }

#quest { position: absolute; left: 18px; top: 18px; width: min(330px, 44vw); padding: 10px 14px 12px; }
#quest .q-tag { display: inline-block; background: var(--gold); color: var(--navy); font-weight: 800; font-size: 12px; padding: 1px 8px; border-radius: 3px; letter-spacing: 2px; }
#quest .q-title { font-size: 19px; font-weight: 800; margin: 6px 0 4px; color: var(--gold); }
#quest .q-desc { font-size: 14.5px; line-height: 1.55; color: #dfe6ff; }
#quest .q-desc b { color: #fff; } #quest .q-desc em { color: var(--blue); font-style: normal; font-weight: 700; }
#quest.flash { animation: qflash 0.9s; }
@keyframes qflash { 0% { transform: scale(1); } 20% { transform: scale(1.08) rotate(-1deg); box-shadow: 0 0 0 4px var(--gold), 0 0 40px var(--gold); } 100% { transform: scale(1); } }

#inv { position: absolute; right: 18px; top: 62px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.chip { background: rgba(28, 36, 82, 0.88); border: 3px solid var(--white); border-radius: 999px; padding: 2px 12px 2px 6px; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.chip b { font-size: 18px; }
#topbtns { position: absolute; right: 18px; top: 16px; display: flex; gap: 8px; }
#topbtns button { width: 38px; height: 38px; border-radius: 8px; border: 3px solid var(--white); background: var(--navy); color: #fff; font-size: 17px; font-weight: 800; cursor: pointer; }

#compass { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); background: rgba(28, 36, 82, 0.9); border: 3px solid var(--gold); border-radius: 999px; padding: 4px 16px 4px 10px; font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
#compass .arrow { display: inline-block; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 18px solid var(--gold); }
#minimap { position: absolute; left: 18px; bottom: 18px; width: 168px; height: 168px; border-radius: 50%; border: 4px solid var(--white); box-shadow: 0 0 0 4px var(--navy), 0 6px 0 4px rgba(0, 0, 0, 0.35); overflow: hidden; background: #2b8fdb; }
#minimap canvas { width: 100%; height: 100%; image-rendering: pixelated; }
#minimap .mm-hint { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-size: 11px; font-weight: 700; text-shadow: 0 1px 0 var(--navy), 0 -1px 0 var(--navy), 1px 0 0 var(--navy), -1px 0 0 var(--navy); }

.label { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 13px; font-weight: 800; padding: 1px 8px; border-radius: 4px; background: rgba(28, 36, 82, 0.85); border: 2px solid var(--white); }
.label.quest { border-color: var(--gold); color: var(--gold); }
.label.bubble { background: #fff; color: var(--navy); border-color: var(--navy); font-size: 14px; border-radius: 12px; padding: 3px 10px; }
#prompt { position: absolute; left: 50%; bottom: 24%; transform: translateX(-50%); background: var(--white); color: var(--navy); font-weight: 800; padding: 6px 16px; border-radius: 999px; border: 3px solid var(--navy); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3); animation: bob 0.9s infinite alternate ease-in-out; white-space: nowrap; }
@keyframes bob { to { transform: translateX(-50%) translateY(-5px); } }

#toasts { position: absolute; left: 50%; top: 66px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: 90vw; }
.toast { background: rgba(255, 255, 255, 0.96); color: var(--navy); font-weight: 800; padding: 7px 18px; border-radius: 8px; border: 3px solid var(--navy); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3); animation: pop 0.3s cubic-bezier(0.2, 1.6, 0.4, 1); max-width: 86vw; text-align: center; font-size: 15px; }
.toast.gold { background: var(--gold); } .toast.blue { background: #bfeaff; } .toast.pink { background: #ffd3e2; } .toast.big { font-size: 20px; padding: 10px 26px; }
.toast.out { opacity: 0; transform: translateY(-10px); transition: 0.35s; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }

#trial { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); text-align: center; font-weight: 800; font-size: 18px; text-shadow: 0 2px 0 var(--navy), 0 -2px 0 var(--navy), 2px 0 0 var(--navy), -2px 0 0 var(--navy); }
#trial .t-bar { width: 300px; max-width: 70vw; height: 18px; background: var(--navy); border: 3px solid #fff; border-radius: 999px; margin: 8px auto 0; overflow: hidden; }
#trial .t-bar i { display: block; height: 100%; background: linear-gradient(90deg, #7ee081, #ffd83d); width: 0; }

#dialog { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(760px, 92vw); min-height: 96px; padding: 20px 22px 16px; box-sizing: border-box; cursor: pointer; }
#dialog .d-name { position: absolute; left: 14px; top: -17px; background: var(--gold); color: var(--navy); font-weight: 800; padding: 2px 14px; border-radius: 4px; border: 3px solid var(--navy); font-size: 15px; }
#dialog.me .d-name { background: var(--blue); }
#dialog .d-text { font-size: 18px; line-height: 1.65; font-weight: 600; min-height: 2.6em; white-space: pre-wrap; }
#dialog.narr .d-text { text-align: center; color: #cfe0ff; font-style: italic; }
#dialog .d-next { position: absolute; right: 16px; bottom: 8px; color: var(--gold); animation: bob2 0.6s infinite alternate; }
@keyframes bob2 { to { transform: translateY(4px); } }
#dialog .d-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.choice { text-align: left; font: 700 16px var(--font); color: #fff; background: var(--navy2); border: 3px solid #7f8fd8; border-radius: 6px; padding: 8px 12px; cursor: pointer; }
.choice i { display: inline-block; width: 1.5em; height: 1.5em; line-height: 1.5em; text-align: center; background: #7f8fd8; color: var(--navy); border-radius: 4px; margin-right: 10px; font-style: normal; }
.choice.sel, .choice:hover { border-color: var(--gold); background: #37468f; } .choice.sel i, .choice:hover i { background: var(--gold); }

#bigmap { position: absolute; inset: 0; background: rgba(8, 12, 30, 0.7); display: flex; align-items: center; justify-content: center; }
#bigmap .bm-box { padding: 12px 16px; text-align: center; }
#bigmap canvas { width: min(70vh, 86vw); height: min(70vh, 86vw); image-rendering: pixelated; display: block; border: 3px solid var(--white); border-radius: 4px; margin: 8px 0; }
.bm-title { font-size: 20px; font-weight: 800; color: var(--gold); } .bm-tip { font-size: 13px; color: #cfd8ff; }
#help { position: absolute; right: 18px; top: 66px; padding: 12px 16px; font-size: 14px; line-height: 2; }
#help b { color: var(--gold); font-size: 16px; }

#fade { position: absolute; inset: 0; background: #0b1020; opacity: 1; pointer-events: none; }
#narr { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; font-size: clamp(20px, 3.2vw, 34px); font-weight: 800; letter-spacing: 2px; padding: 0 8vw; line-height: 1.8; }
#narr div { animation: narr 0.8s; } @keyframes narr { from { opacity: 0; transform: translateY(12px); } }

#title, #ending { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; }
#title { background: linear-gradient(180deg, rgba(11, 16, 32, 0.25), rgba(11, 16, 32, 0.6)); }
.t-wrap { max-width: 92vw; }
.t-sub { font-weight: 800; letter-spacing: 6px; font-size: 14px; color: var(--gold); text-shadow: 0 2px 0 var(--navy); }
#title h1 { margin: 10px 0 6px; line-height: 1.05; }
#title h1 span { display: block; font-size: clamp(54px, 10vw, 120px); font-weight: 900; color: #fff; -webkit-text-stroke: 10px var(--navy); paint-order: stroke fill; text-shadow: 0 8px 0 #101638, 0 0 40px rgba(90, 209, 255, 0.7); letter-spacing: 8px; }
#title h1 em { display: inline-block; font-style: normal; font-size: clamp(24px, 4.2vw, 50px); font-weight: 900; color: var(--navy); background: var(--gold); padding: 2px 22px; border-radius: 8px; border: 4px solid var(--navy); transform: rotate(-2deg); box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35); }
.t-tag { margin: 18px 0 20px; font-weight: 700; font-size: clamp(13px, 1.6vw, 18px); text-shadow: 0 2px 0 var(--navy), 0 -2px 0 var(--navy), 2px 0 0 var(--navy), -2px 0 0 var(--navy); }
.t-btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.t-btns button { font: 900 22px var(--font); color: var(--navy); background: var(--white); border: 4px solid var(--navy); border-radius: 10px; padding: 10px 34px; cursor: pointer; box-shadow: 0 6px 0 var(--navy); transition: 0.08s; }
.t-btns button:first-child { background: var(--gold); animation: pulse 1.2s infinite alternate; }
.t-btns button:hover { transform: translateY(-2px); } .t-btns button:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--navy); }
@keyframes pulse { to { transform: scale(1.06); } }
.t-help { margin: 22px auto 0; font-size: 13.5px; line-height: 2; background: rgba(28, 36, 82, 0.8); border-radius: 10px; padding: 8px 18px; display: inline-block; text-align: left; }
.t-foot { margin-top: 14px; font-size: 12px; opacity: 0.85; text-shadow: 0 1px 0 var(--navy); }

#ending { background: rgba(8, 12, 30, 0.72); }
.e-wrap { width: min(640px, 92vw); padding: 18px 24px 20px; max-height: 94vh; overflow: auto; box-sizing: border-box; }
.e-tag { display: inline-block; background: var(--gold); color: var(--navy); font-weight: 800; padding: 1px 12px; border-radius: 4px; letter-spacing: 3px; }
#ending h2 { font-size: clamp(26px, 4vw, 40px); margin: 10px 0 6px; color: var(--gold); text-shadow: 0 4px 0 #101638; }
.e-bowl { font-size: 46px; letter-spacing: 6px; margin: 4px 0; }
#ending p { font-size: 16px; line-height: 1.8; margin: 8px 0 14px; color: #e6ecff; }
.e-stats { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.e-stats div { background: var(--navy2); border-radius: 8px; padding: 6px 14px; min-width: 84px; } .e-stats b { display: block; font-size: 22px; color: var(--blue); } .e-stats span { font-size: 12px; color: #cfd8ff; }
.e-rank { margin: 14px 0 16px; font-size: 18px; } .e-rank b { color: var(--gold); font-size: 22px; }
.e-tip { margin-top: 14px; font-size: 13px; color: #b9c4f5; }

#touch #joy { position: absolute; left: 22px; bottom: 200px; width: 120px; height: 120px; border-radius: 50%; background: rgba(28, 36, 82, 0.45); border: 3px solid rgba(255, 255, 255, 0.7); touch-action: none; }
#touch #joy i { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); }
#touch button { position: absolute; right: 22px; width: 72px; height: 72px; border-radius: 50%; border: 3px solid #fff; background: rgba(28, 36, 82, 0.6); color: #fff; font: 800 18px var(--font); touch-action: none; }
#btnJump { bottom: 30px; } #btnAct { bottom: 116px; right: 100px !important; background: rgba(255, 216, 61, 0.85) !important; color: var(--navy) !important; } #btnRun { bottom: 30px; right: 110px !important; width: 56px !important; height: 56px !important; font-size: 15px !important; }
#btnRun.on { background: var(--blue) !important; color: var(--navy) !important; }
@media (max-width: 720px) { #toasts { top: 132px; } .toast { font-size: 13px; padding: 5px 12px; } .toast.big { font-size: 16px; } #prompt { bottom: 30%; font-size: 14px; } #dialog { bottom: 12px; } #help { top: 110px; } #quest { width: 56vw; padding: 6px 10px 8px; } #quest .q-title { font-size: 15px; } #quest .q-desc { font-size: 12.5px; } #minimap { width: 110px; height: 110px; bottom: auto; top: 150px; left: 10px; } #compass { top: auto; bottom: 8px; font-size: 13px; } #dialog .d-text { font-size: 15.5px; } #inv { top: 58px; right: 8px; } .chip { font-size: 12px; } #help { font-size: 12px; } }

#loading { position: fixed; inset: 0; background: #1c2452; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; z-index: 9; color: #fff; text-align: center; padding: 0 8vw; }
#loading .l-fish { font-size: 64px; animation: swim 1s infinite alternate ease-in-out; } @keyframes swim { from { transform: translateX(-24px) rotate(-8deg); } to { transform: translateX(24px) rotate(8deg); } }
#loading .l-text { font-size: 22px; font-weight: 800; letter-spacing: 2px; } #loading .l-sub { font-size: 13px; opacity: 0.75; }
