/* 《雾岭疑踪：月影誓约》 原创像素 UI */
*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%;background:#0e141b;overflow:hidden}
body{font-family:"Courier New",ui-monospace,monospace;color:#e8eef2;font-size:16px;
  display:flex;justify-content:center;align-items:stretch;user-select:none;-webkit-user-select:none}

#app{width:100%;max-width:480px;height:100%;height:100dvh;display:flex;flex-direction:column;
  background:#131c26;position:relative;box-shadow:0 0 0 2px #2a3b4d}

/* 顶栏 */
#topbar{height:46px;flex:0 0 46px;display:flex;align-items:center;gap:8px;padding:0 10px;
  background:#1b2836;border-bottom:3px solid #31465c}
.tb-chapter{flex:1;font-weight:bold;color:#cfe3f0;text-shadow:2px 2px 0 #0b1017;overflow:hidden;
  white-space:nowrap;text-overflow:ellipsis}
.tb-stats{display:flex;gap:10px}
.stat{color:#9fb6c8;font-size:14px}
.stat b{color:#ffd98a}
.tb-btn{width:44px;height:36px;font-size:18px;background:#24384c;color:#cfe3f0;
  border:2px solid #3a5470;border-radius:4px}

/* 舞台 */
#stageWrap{flex:1;position:relative;min-height:0;background:#0b1219;display:flex;
  align-items:center;justify-content:center;overflow:hidden}
#cv{width:100%;height:100%;image-rendering:pixelated;image-rendering:crisp-edges}
#toast{position:absolute;top:10px;left:50%;transform:translateX(-50%);max-width:88%;
  background:#22354a;border:2px solid #4a6a8c;border-radius:4px;padding:8px 12px;
  font-size:14px;color:#ffe9b8;opacity:0;transition:opacity .25s;pointer-events:none;text-align:center}
#toast.show{opacity:1}
.eagle-btn{position:absolute;top:8px;right:8px;min-width:64px;height:40px;padding:0 10px;
  background:#2b2038;border:2px solid #6a4f8c;border-radius:4px;color:#d8c6f0;font-size:14px;
  font-family:inherit}
.eagle-btn b{color:#ffd98a}
.eagle-btn:disabled{opacity:.4}

/* 战斗指令 */
#battleBar{position:absolute;left:0;right:0;bottom:0;display:flex;gap:6px;padding:8px;
  background:rgba(14,20,27,.92);border-top:3px solid #31465c;justify-content:center;flex-wrap:wrap}
#battleBar .cmd{min-width:64px;min-height:44px;padding:6px 10px;font-family:inherit;font-size:15px;
  background:#24384c;color:#e8eef2;border:2px solid #4a6a8c;border-radius:4px}
#battleBar .cmd:active{background:#355372}
#battleBar .cmd:disabled{opacity:.35}

/* 控制区 */
#controls{flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;
  padding:8px 14px;background:#16212e;border-top:3px solid #31465c}
#dpad{position:relative;width:132px;height:132px}
.dbtn{position:absolute;width:44px;height:44px;font-size:16px;font-family:inherit;
  background:#24384c;color:#cfe3f0;border:2px solid #3a5470;border-radius:6px}
.dbtn:active{background:#3b5a78}
.d-up{left:44px;top:0}.d-down{left:44px;bottom:0}.d-left{left:0;top:44px}.d-right{right:0;top:44px}
#btnAct{width:96px;height:96px;border-radius:50%;font-size:20px;font-family:inherit;font-weight:bold;
  background:#5c4326;color:#ffe9b8;border:3px solid #a67c3f;box-shadow:0 4px 0 #3d2c18}
#btnAct:active{transform:translateY(2px);box-shadow:0 2px 0 #3d2c18}
#btnAct.glow{animation:pulse 1s infinite alternate}
@keyframes pulse{from{border-color:#a67c3f}to{border-color:#ffd98a}}

/* 底栏 */
#navbar{flex:0 0 56px;display:flex;background:#1b2836;border-top:3px solid #31465c}
.nav{flex:1;font-family:inherit;font-size:15px;background:none;border:none;color:#9fb6c8;
  border-right:2px solid #131c26}
.nav:last-child{border-right:none}
.nav:active{background:#24384c;color:#fff}
.nav .dot{display:inline-block;width:8px;height:8px;background:#ffd98a;border-radius:50%;margin-left:4px}

/* 覆盖层 */
.overlay{position:absolute;inset:0;background:rgba(8,12,17,.78);display:flex;
  align-items:center;justify-content:center;z-index:20;padding:12px}
.hidden{display:none!important}

/* 对话 */
.dlg-box{width:100%;max-width:440px;background:#1b2836;border:3px solid #4a6a8c;border-radius:6px;
  box-shadow:0 6px 0 #0b1017;padding:12px}
.dlg-head{display:flex;gap:10px;align-items:center;margin-bottom:8px}
#portrait{width:48px;height:48px;image-rendering:pixelated;border:2px solid #4a6a8c;
  background:#0e141b;flex:0 0 48px}
.dlg-name{font-weight:bold;color:#ffd98a;font-size:17px}
.dlg-topic{font-size:12px;color:#7d97ab;margin-top:2px}
.dlg-text{min-height:96px;font-size:16px;line-height:1.7;color:#e8eef2;white-space:pre-wrap}
.dlg-next{text-align:right;color:#7d97ab;font-size:13px;margin-top:6px;animation:blink 1s infinite}
@keyframes blink{50%{opacity:.3}}
.dlg-opts{display:flex;flex-direction:column;gap:8px;margin-top:10px}
.dlg-opts button{min-height:44px;text-align:left;padding:8px 12px;font-family:inherit;font-size:15px;
  background:#24384c;color:#e8eef2;border:2px solid #4a6a8c;border-radius:4px}
.dlg-opts button:active{background:#355372}
.dlg-opts .tag{display:inline-block;font-size:12px;padding:1px 6px;margin-right:6px;border-radius:3px;
  background:#3d2c18;color:#ffd98a;border:1px solid #a67c3f}
.dlg-opts .tag.press{background:#4a2330;color:#f0b8c6;border-color:#8c4a5c}
.dlg-opts .tag.empathy{background:#1e3d2e;color:#b8e6c6;border-color:#3f8c5c}

/* 面板 */
.panel-box{width:100%;max-width:440px;max-height:92%;background:#1b2836;border:3px solid #4a6a8c;
  border-radius:6px;box-shadow:0 6px 0 #0b1017;display:flex;flex-direction:column}
.panel-box.tall{height:92%}
.panel-head{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;
  border-bottom:3px solid #31465c;font-weight:bold;color:#ffd98a}
#panelClose,#boardClose{width:44px;height:36px;background:#3d2c30;color:#f0b8c6;border:2px solid #8c4a5c;
  border-radius:4px;font-size:16px;font-family:inherit}
.panel-body{padding:12px;overflow-y:auto;font-size:15px;line-height:1.6}
.panel-body h3{color:#cfe3f0;margin:10px 0 6px;font-size:16px}
.panel-body .kv{margin:4px 0;color:#9fb6c8}
.panel-body .kv b{color:#e8eef2}

/* 线索卡 */
.clue-card{display:flex;gap:10px;align-items:flex-start;background:#22354a;border:2px solid #3a5470;
  border-radius:4px;padding:8px;margin-bottom:8px}
.clue-card canvas{width:32px;height:32px;image-rendering:pixelated;flex:0 0 32px;border:1px solid #4a6a8c}
.clue-card .cname{color:#ffd98a;font-weight:bold;font-size:15px}
.clue-card .cdesc{color:#9fb6c8;font-size:13px;margin-top:2px;line-height:1.5}
.clue-card.key{border-color:#a67c3f}
.clue-card.mislead{opacity:.75;border-style:dashed}
.clue-card.card-concl{border-color:#3f8c5c;background:#1e3d2e}
.clue-card.picked{outline:3px solid #ffd98a}

/* 线索板 */
.board-hint{padding:8px 12px;font-size:13px;color:#9fb6c8}
.board-slots{display:flex;gap:6px;padding:0 12px}
.slot{flex:1;min-height:64px;border:2px dashed #3a5470;border-radius:4px;display:flex;
  align-items:center;justify-content:center;text-align:center;font-size:13px;color:#7d97ab;
  padding:4px;background:#16212e}
.slot.filled{border-style:solid;border-color:#a67c3f;color:#ffe9b8;background:#22354a}
.board-actions{display:flex;gap:8px;padding:10px 12px}
.board-actions button{flex:1;min-height:44px;font-family:inherit;font-size:15px;border-radius:4px;
  border:2px solid #4a6a8c;background:#24384c;color:#e8eef2}
.board-actions .primary{background:#5c4326;border-color:#a67c3f;color:#ffe9b8}
.board-tabs{display:flex;gap:4px;padding:0 12px 8px;flex-wrap:wrap}
.btab{min-height:36px;padding:4px 10px;font-family:inherit;font-size:13px;background:#16212e;
  color:#9fb6c8;border:2px solid #31465c;border-radius:4px}
.btab.on{background:#2b2038;color:#d8c6f0;border-color:#6a4f8c}
.board-cards{padding:0 12px 12px;overflow-y:auto;flex:1}
.board-cards .clue-card{cursor:pointer}

/* 首页 */
#home{background:linear-gradient(#101820,#0b1219);z-index:40}
.home-inner{text-align:center;display:flex;flex-direction:column;align-items:center;gap:10px;padding:16px}
#homeArt{image-rendering:pixelated;border:3px solid #31465c;border-radius:4px;background:#16212e;
  width:240px;height:150px}
#home h1{font-size:34px;letter-spacing:8px;color:#cfe3f0;text-shadow:3px 3px 0 #0b1017}
#home h2{font-size:18px;letter-spacing:12px;color:#ffd98a;margin-top:-6px}
.home-sub{color:#7d97ab;font-size:14px;margin-bottom:8px}
button.big{min-width:220px;min-height:48px;font-size:17px;font-family:inherit;border-radius:4px;
  border:2px solid #4a6a8c;background:#24384c;color:#e8eef2}
button.primary{background:#5c4326;border-color:#a67c3f;color:#ffe9b8;font-weight:bold}
.home-tip{color:#5b7284;font-size:12px;margin-top:10px}

/* 结局 */
#ending{z-index:45}
#endingArt{image-rendering:pixelated;border:3px solid #31465c;border-radius:4px;margin:12px auto 0;
  display:block;width:240px;height:150px;background:#16212e}
#ending .panel-box{overflow-y:auto;text-align:center}
#endingTitle{color:#ffd98a;padding:10px 0 4px;letter-spacing:4px}
.ending-text{padding:0 16px;text-align:left;line-height:1.8;font-size:15px;color:#e8eef2}
.ending-review{padding:12px 16px 4px;text-align:left;font-size:13px;color:#9fb6c8;line-height:1.7}
#btnEndingRestart{margin:12px auto 16px}

/* 设置 */
.set-row{display:flex;align-items:center;justify-content:space-between;min-height:44px;
  border-bottom:1px solid #22354a;padding:6px 0}
.set-row span{color:#cfe3f0}
.switch{width:60px;height:32px;border:2px solid #4a6a8c;border-radius:16px;background:#16212e;
  position:relative;cursor:pointer}
.switch::after{content:"";position:absolute;top:3px;left:4px;width:22px;height:22px;border-radius:50%;
  background:#7d97ab;transition:left .15s}
.switch.on{background:#2e4a2e}
.switch.on::after{left:30px;background:#8ce6a0}

/* 高对比模式 */
body.hc #app{background:#000;box-shadow:0 0 0 2px #fff}
body.hc .dlg-box,body.hc .panel-box{background:#000;border-color:#fff}
body.hc .dlg-text,body.hc .panel-body{color:#fff}
body.hc .stat b,body.hc .dlg-name,body.hc .clue-card .cname{color:#ffe000}

@media (max-height:640px){
  .dlg-text{min-height:72px;font-size:15px}
  #dpad{width:120px;height:120px}
  .d-up,.d-down{left:38px}
  .d-left,.d-right{top:38px}
  #btnAct{width:84px;height:84px}
}
