:root{--bg:#15171c;--bg2:#1d2027;--bd:#2c313c;--tx:#e6e8ee;--mut:#9aa1ad;--acc:#e0a14b;--ok:#5bbf7b;--war:#d98a8a}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--tx);font:15px/1.6 -apple-system,"Noto Sans CJK TC",sans-serif}
#top{display:flex;gap:8px;align-items:center;padding:10px 14px;background:var(--bg2);border-bottom:1px solid var(--bd);flex-wrap:wrap}
select,input,button{background:#0f1115;color:var(--tx);border:1px solid var(--bd);border-radius:7px;padding:6px 10px;font:inherit}
button{cursor:pointer}button:hover{border-color:var(--acc)}
.b-acc{background:var(--acc);color:#1a1205;border:none;font-weight:600}
#wrap{display:grid;grid-template-columns:1fr 320px;gap:14px;padding:14px;max-width:1180px;margin:0 auto}
#feed{background:var(--bg2);border:1px solid var(--bd);border-radius:10px;padding:14px;min-height:50vh;max-height:64vh;overflow:auto}
.nar{margin:0 0 12px;white-space:pre-wrap}
/* W71 呈現分層:對話行=白字+說話者名+保留頭像空間(無立繪=空槽;有立繪=縮圖)。 */
.nar.say{display:flex;gap:8px;align-items:flex-start}
.nar.say .avatar{flex:0 0 28px;width:28px;height:28px;border-radius:50%;background:#0f1115;border:1px solid var(--bd);overflow:hidden}
.nar.say .avatar img{width:100%;height:100%;object-fit:cover;display:block}
.nar.say .saybody{flex:1;min-width:0}
u.ent{text-decoration:underline;text-decoration-color:var(--acc);text-underline-offset:2px;cursor:pointer}
u.ent.special{text-decoration-style:dotted}
u.ent.strong{font-weight:700}
.ev{margin:2px 0;color:var(--mut);font-size:13.5px}.ev.system{color:var(--acc)}
/* W69 事件=一等實體:整行點狀底線可點開詳情卡(Daniel:事件也要加底線)。
   與行內實體的金色**實線**底線(u.ent)視覺區分:事件=整行淡色點狀。 */
.ev.evd{cursor:pointer;text-decoration:underline dotted;text-decoration-color:var(--mut);text-underline-offset:3px}
.ev.evd:hover{text-decoration-color:var(--acc)}
.ev.combat{color:var(--war)}.ev.social{color:#8ab0d9}.ev.npc{color:#c9a0dc}.ev.think{color:var(--mut);font-style:italic;opacity:.8}
.side{display:flex;flex-direction:column;gap:12px;max-height:calc(100vh - 90px);overflow-y:auto;align-self:start;position:sticky;top:14px}
.card{background:var(--bg2);border:1px solid var(--bd);border-radius:10px;padding:12px}
.card h3{margin:0 0 8px;font-size:13px;color:var(--mut);font-weight:600;letter-spacing:.05em}
.kv{display:flex;justify-content:space-between;font-size:13.5px;margin:2px 0}.kv span:last-child{color:var(--acc)}
.bar{height:6px;background:#0f1115;border-radius:4px;overflow:hidden;margin:2px 0 6px}.bar>i{display:block;height:100%;background:var(--ok)}
.chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
.chip{background:#0f1115;border:1px solid var(--bd);border-radius:14px;padding:3px 10px;font-size:13px;cursor:pointer}
/* W67-4:`.chip.b-acc` 深字深底——`.b-acc`(L6) 是給 <button> 寫的(button 底色來自 L4),
   套到 .chip 上時 `.chip` 的 background 較後宣告會蓋回 #0f1115,但 .chip 沒宣告 color,
   於是 .b-acc 的 color:#1a1205 留著 → 對比近乎零(「＋建立助理」等七處全中)。
   比照既有 .chip.mapmode.s0(L24) 以三類選擇器補回強調色。 */
.chip.b-acc{background:var(--acc);color:#1a1205;border-color:var(--acc);font-weight:600}
.chip.b-acc:hover{filter:brightness(1.08)}
.chip:hover{border-color:var(--acc)}.chip.exit{border-color:#3a5}.chip.foe{border-color:#a55}
.chip.gen{border-style:dashed;border-color:#3a5;opacity:.9}.chip.explore{border-color:#4a9;color:#8fd}
.chip.mapmode{font-size:12px}.chip.mapmode.s0{background:var(--acc);color:#1a1205;border-color:var(--acc)}
#mainmap svg{width:100%;height:auto;max-height:52vh;display:block}
#sugg{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0}
.sug{background:#23262e;border:1px solid var(--bd);border-radius:8px;padding:7px 12px;cursor:pointer;font-size:14px}
.sug:hover{border-color:var(--acc)}.sug.s0{border-color:var(--acc)}
.sug small{color:var(--mut)}
#bar{display:flex;gap:8px;margin-top:8px}#in{flex:1}
#meta{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}#meta button{font-size:13px;padding:4px 9px}
/* W36-3:導航下拉原語(語文/更多選項)——absolute popup、右對齊、點外自動關(app.js 獨立 listener) */
.menuwrap{position:relative}
.menu{position:absolute;top:calc(100% + 4px);right:0;z-index:70;display:flex;flex-direction:column;
  gap:8px;background:var(--bg2);border:1px solid var(--bd);border-radius:8px;padding:10px;
  min-width:200px;max-width:calc(100vw - 16px);box-shadow:0 4px 16px rgba(0,0,0,.45)}
.menu button{text-align:left}
/* W36-2:紀錄面板(日誌/我的回憶/編年史)——summary 沿 debugdrawer 隱三角;分頁 chip 沿 mapmode 高亮 */
#lrwrap summary{cursor:pointer;list-style:none;user-select:none}
#lrwrap summary::-webkit-details-marker{display:none}
.chip.lrtab{font-size:12px}.chip.lrtab.s0{background:var(--acc);color:#1a1205;border-color:var(--acc)}
.lrpane{max-height:24vh;overflow-y:auto;margin-top:8px;font-size:13px}
.mission{white-space:pre-wrap;font-size:13.5px;color:#cdd2db}
.dim{color:var(--mut);font-size:12.5px}
.end{color:var(--war);font-weight:600}
#sidetoggle{position:fixed;right:12px;bottom:12px;z-index:20;border-radius:22px;padding:10px 16px}
/* W67-4:背包搬到主欄(地圖下)——主欄沒有 .side 的 overflow,長清單要自帶捲動 */
#bagcard #bag{max-height:32vh;overflow-y:auto}
/* W67-4:頂列跳定位點的落點高亮(捲到後閃一下,讓眼睛找得到) */
@keyframes anchorflash{0%,100%{box-shadow:none}30%{box-shadow:0 0 0 2px var(--acc)}}
.flash{animation:anchorflash .9s ease-in-out}
#navjump{display:flex;gap:6px}#navjump button{font-size:13px}
/* W67-3 無盡小屋=特殊模式版面(Daniel):小屋卡插到地圖上面、同行者列釘在最下方、
   殞落名冊在最右欄。全部 gate 在 body[data-mode=hub] → 一般劇本一條規則都不生效。 */
#hutdock{position:fixed;left:0;right:0;bottom:0;z-index:30;display:flex;align-items:center;gap:8px;
  flex-wrap:wrap;padding:8px 14px;background:var(--bg2);border-top:1px solid var(--bd);
  box-shadow:0 -4px 14px rgba(0,0,0,.4)}
#hutdock-label{font-size:12px;letter-spacing:.05em}
#hutdock-rows{display:flex;gap:6px;flex-wrap:wrap}
.hutdock-chip{background:#0f1115}
body[data-mode=hub]{padding-bottom:56px}                     /* 讓出底條高度,不蓋住紀錄卡 */
body[data-mode=hub] #sidetoggle{bottom:64px}                 /* 手機的面板鈕上移,別撞底條 */
@media (min-width:821px){
  body[data-mode=hub] #wrap{grid-template-columns:1fr 320px 210px;max-width:1400px}
  body[data-mode=hub] #fallen{display:flex!important}         /* JS 只管有無亡者,版面由這裡決定 */
}
/* 窄機:第三欄沒有容身處 → 收起(復活入口在名冊迴廊卡裡本來就有,不會斷路) */
@media (max-width:820px){ #fallen{display:none!important} }
/* RWD(W16-6):窄螢幕單欄堆疊、面板收在三條線鈕後(對話流優先) */
/* W44-1:窄機頂欄縮距——降低換行機率;換行後下拉由 toggleMenu 夾回視窗內 */
@media (max-width:480px){
  #top{gap:6px;padding:8px 10px}
  #top button{padding:5px 8px;font-size:13px}
  #navjump .njt{display:none}          /* W67-4:窄機只留 icon,頂列才不會爆行 */
}
@media (max-width:820px){
  #wrap{grid-template-columns:1fr}
  .side{position:fixed;top:0;right:0;bottom:0;width:86vw;max-width:340px;max-height:100vh;
        background:var(--bg);border-left:1px solid var(--bd);padding:14px;transform:translateX(102%);
        transition:transform .2s;z-index:15}
  .side.open{transform:translateX(0)}
  #sidetoggle{display:inline-block!important}
}

/* ── VN 式主畫面(W30-5):場景背景鋪滿+立繪+半透明文字框——文字清晰=框底 rgba .6 +
   backdrop blur + text-shadow + 底部漸層 vignette;無圖 fallback=漸層底。 ── */
#vnstage{position:relative;aspect-ratio:16/9;border-radius:10px;overflow:hidden;margin-bottom:10px;
  background:linear-gradient(160deg,#232838,#15171c);border:1px solid var(--bd)}
#vnbg{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;transition:opacity .3s}
#vnstage::after{content:'';position:absolute;left:0;right:0;bottom:0;height:45%;
  background:linear-gradient(transparent,rgba(0,0,0,.55));pointer-events:none;z-index:1}
#vnsprite{position:absolute;right:3%;bottom:0;height:94%;max-width:38%;object-fit:contain;
  object-position:bottom;transition:opacity .25s;filter:drop-shadow(0 0 12px rgba(0,0,0,.5));z-index:1}
/* W38-CG:事件觸發 CG 覆蓋層——蓋過 bg(0)/sprite(1),#vntext(2) 仍可讀;事件無 cg 時隱藏 */
#vncg{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;
  background:rgba(0,0,0,.85);transition:opacity .3s;z-index:1;display:none}
#vntext{position:absolute;left:10px;right:10px;bottom:10px;z-index:2;border-radius:8px;padding:10px 14px;
  background:rgba(0,0,0,.6);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);
  color:#fff;text-shadow:0 1px 2px rgba(0,0,0,.9);font-size:15.5px;line-height:1.7;
  max-height:40%;overflow-y:auto;white-space:pre-wrap}
#vntext b{color:var(--acc)}

/* ── W35-0-1 全域錯誤橫幅:body 頂端固定紅 bar(訊息+重新整理+×);任何 fetch 失敗都在此現形 ── */
#errbar{position:fixed;top:0;left:0;right:0;z-index:200;
  display:flex;align-items:center;gap:10px;flex-wrap:wrap;
  padding:9px 14px;background:#a5322f;color:#fff;
  font-size:14px;line-height:1.5;box-shadow:0 2px 8px rgba(0,0,0,.4)}
#errbar #errbar-msg{flex:1;min-width:0;word-break:break-word}
#errbar button{background:rgba(255,255,255,.16);color:#fff;border:1px solid rgba(255,255,255,.5);
  border-radius:6px;padding:4px 10px;font-size:13px;cursor:pointer}
#errbar button:hover{background:rgba(255,255,255,.28);border-color:#fff}
#errbar #errbar-x{padding:4px 9px;font-weight:700;line-height:1}

/* W61-4:四季主題——小屋卡邊框隨季節微調(房間漸層由 #hutroom inline 提供) */
body[data-season=spring] #hutcard{border-color:#4a7a52}
body[data-season=summer] #hutcard{border-color:#3f7a80}
body[data-season=autumn] #hutcard{border-color:#8a6a3f}
body[data-season=winter] #hutcard{border-color:#5a6a85}

/* W63-4:小屋聊天動態立繪——canvas 邏輯比例 1000:1600≈0.64;runtime 自行 letterbox+DPR,
   CSS 只要給真實盒尺寸。 */
#hut-puppet,#hut-fallback{width:130px;height:208px;display:block;object-fit:contain;object-position:bottom}
/* W97 破圖真因修:上一行 display:block 是 author 規則,會蓋掉 UA 的 [hidden]{display:none}
   (author>UA,與 specificity 無關)——adapter 全靠 hidden 屬性控顯隱,被蓋=無 src 的
   fallback img 永遠以破圖框現形。此行把 hidden 語意奪回來。 */
#hut-puppet[hidden],#hut-fallback[hidden]{display:none!important}
/* W67-5 一對一立繪對話(Daniel 問「LIVE 2D 要去哪看」):小屋模式點角色 → 小屋那個框
   切換成戀愛遊戲式的一對一畫面。同一份 shell 兩套外觀——在 modal 內是浮層卡片、
   搬進 #hutsolo 後是滿版嵌入(去邊框/去外距,高度交給卡片)。 */
.hut-shell{max-width:560px;margin:4vh auto;padding:16px 18px;background:var(--bg2);
  border:1px solid var(--acc);border-radius:10px;max-height:90vh;display:flex;flex-direction:column}
#hutsolo .hut-shell{max-width:none;margin:0;padding:0;background:none;border:none;
  border-radius:0;max-height:none}
#hutsolo #hut-feed{min-height:150px;max-height:34vh}
#hutsolo #hut-stagewrap{flex:0 0 116px}

/* ── W97 戀愛遊戲式一對一(Daniel:人物放大置中+一個對話框;小屋置頂) ──
   body[data-hutvn]:一對一時純 CSS 收起 RPG 面板組(#hutdock 保留=換人/退出;
   hutBack/hutClose 解除)。舞台大置中,對話框=#hut-feed 壓舞台下緣(半透明,
   借 #vntext 語彙);📜 歷史 chip(body[data-hutlog])切 60vh 滾動回顧。 */
body[data-hutvn] #feed,body[data-hutvn] #sugg,body[data-hutvn] #bar,
body[data-hutvn] #meta,body[data-hutvn] #mainmapcard,body[data-hutvn] #bagcard,
body[data-hutvn] #convobar,body[data-hutvn] #scenebar,body[data-hutvn] #vnstage,
body[data-hutvn] #hubcard,body[data-hutvn] #hubroster,body[data-hutvn] #hubboard,
body[data-hutvn] #lrwrap{display:none!important}
body[data-hutvn] .side{display:none}
body[data-hutvn] #wrap{grid-template-columns:1fr}
#hutsolo{position:relative}
#hutsolo #hut-stagewrap{flex:none;position:relative;display:flex;justify-content:center}
/* ── W98b(Daniel PC 實測三修):一對一版面改「視窗高度約束的 flex 欄」——
   任何解析度下輸入列都保證在畫面內(舞台吃剩餘高度,絕不把底列擠出視窗);
   對話框只在「有立繪」時上疊(body[data-hutstage],JS 控)——無立繪(未綁定)時
   正常流=不再被 -16vh 拉到頁頂看不見;框寬 92%(兩側留邊)。 ── */
body[data-hutvn] #hutsolo .hut-shell{
  height:calc(100vh - 150px);height:calc(100dvh - 150px);
  display:flex;flex-direction:column;min-height:340px}
@media (max-width:520px){body[data-hutvn] #hutsolo .hut-shell{
  height:calc(100vh - 195px);height:calc(100dvh - 195px);min-height:300px}}
body[data-hutvn] #hutsolo #hut-stagewrap{flex:1 1 auto;min-height:120px;overflow:hidden}
body[data-hutvn] #hutsolo #hut-puppet,body[data-hutvn] #hutsolo #hut-fallback{
  width:auto;height:100%;max-width:96%;margin:0 auto;object-fit:contain}
body[data-hutvn] #hutsolo #hut-chatpane{flex:0 0 auto;min-height:0}
body[data-hutvn] #hutsolo #hut-feed{position:relative;z-index:2;margin-top:8px;
  width:92%;margin-left:auto;margin-right:auto;
  border-radius:8px;padding:10px 14px;background:rgba(0,0,0,.38);
  backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px);
  color:#fff;text-shadow:0 1px 3px rgba(0,0,0,1),0 0 8px rgba(0,0,0,.8);
  min-height:48px!important;max-height:22vh;overflow-y:auto}  /* !important:壓過 index.html inline 220px */
body[data-hutvn][data-hutstage] #hutsolo #hut-feed{margin-top:-14vh}  /* 有立繪才上疊 */
body[data-hutvn][data-hutlog] #hutsolo #hut-feed{max-height:56vh;margin-top:0;
  background:var(--bg2)}
.fbrow{display:flex;gap:6px;margin:0 0 6px;opacity:.45;font-size:11px;align-items:center}
.fbrow:hover{opacity:.9}
.fbrow span[data-msgfb]{cursor:pointer;border:1px solid transparent;border-radius:10px;
  padding:0 6px;color:var(--mut);user-select:none}
.fbrow span[data-msgfb]:hover{border-color:var(--bd)}
.fbrow span.on{color:var(--acc)}
.fbrow input.fbjab{font-size:11px;padding:1px 6px;flex:1;min-width:0}
