*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:#dff5ff;color:#444;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif}
body{overscroll-behavior:none}
body.sheet-open{overflow:hidden}
.app{max-width:560px;min-height:100vh;margin:auto;background:#e9f8ff;position:relative;padding-bottom:138px}
.topbar{height:76px;background:#fff;display:flex;align-items:flex-end;gap:10px;padding:10px 14px;position:sticky;top:0;z-index:10;border-bottom:1px solid #e5edf0}
.icon-btn{border:0;background:transparent;color:#5ba9ca;font-size:38px;line-height:28px;padding:0 5px;cursor:pointer}
.menu-icon-btn{font-size:34px;line-height:20px;padding-bottom:2px}
.book-icon{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:#d9f3ff;color:#56a9cc;font-size:20px}
.heading{min-width:0;flex:1;padding-bottom:1px}
#appTitle{font-size:20px;font-weight:600;color:#333;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#eventTitle{display:block;color:#7da5b6;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.eventbar{height:34px;background:#c8efff;display:flex;align-items:center;gap:8px;padding:0 14px;color:#4f9cbb;font-size:12px;font-weight:700}
.event-line{flex:1;height:6px;background:#edfaff;border-radius:99px;overflow:hidden}
.event-line i{display:block;height:100%;width:0;background:#57afd2;border-radius:99px;transition:width .25s}
.story{padding:14px 18px calc(var(--composer-height, 67px) + 110px)}
.msg{margin:0 0 10px;background:#fff;border-radius:12px;padding:13px 17px;font-size:15px;line-height:1.62;box-shadow:0 1px 0 rgba(0,0,0,.025);white-space:pre-wrap;overflow-wrap:anywhere}
.msg.user{background:#0b76ad;color:#fff;margin-left:18%;border-radius:17px 17px 4px 17px;padding:10px 14px}
.msg.system{background:#eefaff;color:#5b8ea4;font-size:13px}
.msg .npc-dialogue{color:#087fb5;font-weight:800}
.msg.pending{opacity:.85}
.msg.ooc-note{border-left:4px solid #7a5bf0;background:#f4f0ff;color:#6b5db0}
.loading{color:#75a6b7;padding:10px 4px;font-size:13px}
.error{color:#c93636;background:#fff4f4;border:1px solid #ffd5d5;border-radius:8px;padding:10px;margin-bottom:10px;font-size:13px}
.bottom-actions{position:fixed;bottom:calc(var(--composer-height, 67px) + 10px);left:50%;transform:translateX(-50%);width:min(560px,100%);display:flex;justify-content:center;z-index:15;pointer-events:none;padding:0 12px}
.continue-btn{pointer-events:auto;border:1px solid #b9dfef;background:rgba(255,255,255,.96);color:#0b76ad;border-radius:20px;padding:9px 17px;font-weight:700;font-size:13px;box-shadow:0 4px 15px rgba(0,0,0,.08);cursor:pointer}
.continue-btn:disabled{opacity:.45}
.composer{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:min(560px,100%);background:#c8efff;padding:8px 11px calc(9px + env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:8px;z-index:20;border-top:1px solid rgba(0,0,0,.03)}
.composer-main{display:flex;gap:8px;align-items:flex-end}
#messageInput{flex:1;resize:none;min-height:42px;max-height:130px;border:0;outline:0;border-radius:22px;padding:11px 14px;font:15px/1.35 inherit;box-shadow:0 0 0 1px rgba(0,0,0,.06)}
#sendBtn{width:43px;height:43px;border:0;background:transparent;color:#0877aa;font-size:29px;cursor:pointer;transform:rotate(-10deg)}
.mode-hint{font-size:12px;color:#4e8ca6;line-height:1.35;padding:0 2px}
.mode-hint.ooc{color:#6a57bb}
button:disabled{cursor:default;opacity:.55}
.overlay{position:fixed;inset:0;background:rgba(19,42,54,.3);backdrop-filter:blur(2px);z-index:40}
.info-sheet{position:fixed;left:50%;transform:translateX(-50%);bottom:0;width:min(560px,100%);max-height:min(76vh,720px);background:#fff;border-radius:22px 22px 0 0;z-index:50;box-shadow:0 -10px 35px rgba(0,0,0,.15);padding-bottom:calc(12px + env(safe-area-inset-bottom));display:flex;flex-direction:column}
.hidden{display:none !important}
.sheet-handle{width:48px;height:5px;border-radius:999px;background:#d7eaf3;margin:10px auto 6px}
.sheet-header{display:flex;align-items:center;justify-content:space-between;padding:0 16px 10px;border-bottom:1px solid #edf3f6}
.sheet-header h2{margin:0;font-size:18px;color:#294957}
.icon-close{border:0;background:transparent;color:#6995aa;font-size:30px;line-height:1;cursor:pointer;padding:0 4px}
.sheet-body{padding:14px 16px 2px;overflow:auto}
.sheet-section{margin-bottom:18px}
.sheet-section h3{margin:0 0 8px;font-size:15px;color:#2d5363}
.sheet-section p{margin:0 0 8px;line-height:1.55}
.info-list{margin:0;padding-left:18px;line-height:1.55}
.info-list.compact li{margin-bottom:4px}
.muted{color:#7997a6}
.card-list{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.info-card{background:#f3fbff;border:1px solid #d8eef7;border-radius:14px;padding:11px 12px;display:flex;flex-direction:column;gap:5px}
.info-card .label{font-size:11px;font-weight:800;color:#74a3b8;text-transform:uppercase;letter-spacing:.03em}
.info-card strong{font-size:13px;color:#264b5a}
.sheet-mode-switch{display:inline-flex;background:#dff3fc;border-radius:999px;padding:4px;gap:4px;border:1px solid #cbe8f4}
.sheet-chip{border:0;background:transparent;color:#4f8096;border-radius:999px;padding:8px 14px;font-size:12px;font-weight:800;cursor:pointer;min-width:58px}
.sheet-chip.active{background:#fff;color:#0b76ad;box-shadow:0 1px 2px rgba(0,0,0,.08)}
.menu-list{display:flex;flex-direction:column;gap:10px}
.menu-item,.menu-link{width:100%;text-align:left;border:1px solid #d6ebf5;background:#f8fdff;border-radius:14px;padding:12px 13px;cursor:pointer}
.menu-item{display:flex;flex-direction:column;gap:4px}
.menu-main{font-size:14px;font-weight:800;color:#24566b}
.menu-sub{font-size:12px;color:#7390a0;line-height:1.45}
.menu-link{font-size:13px;font-weight:700;color:#37677c;background:#fff}
.compact-list{gap:8px}
@media(max-width:480px){
  .app{padding-bottom:148px}
  .story{padding:12px 14px calc(var(--composer-height, 67px) + 120px)}
  .card-list{grid-template-columns:1fr}
}
@media(min-width:700px){.app{box-shadow:0 0 35px rgba(0,0,0,.08)}}
