/* 三国霸业 - 网页移植版样式 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: #1a1c20;
  color: #cfd3da;
  font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  overscroll-behavior: none;
  user-select: none;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 8px;
  gap: 8px;
}

#screen-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0c0e11;
  border: 2px solid #3a4048;
  border-radius: 6px;
  padding: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,.6), inset 0 0 40px rgba(0,0,0,.5);
}

#screen {
  display: block;
  width: 480px;   /* 240 * 2（main.js 会按视口自动调整） */
  height: 640px;  /* 320 * 2 */
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #eaddc0; /* 宣纸底色（默认 ink 配色色 0）：页面首绘与游戏首帧同色，避免启动时闪绿 */
  touch-action: none;  /* 触摸直接作用于画面，禁止浏览器滚动/缩放手势 */
}

#status-bar {
  width: 100%;
  max-width: 815px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #7f8792;
  padding: 0 4px;
}

#scale-controls { display: flex; align-items: center; gap: 6px; }
.mini-btn {
  background: #2a2f36; color: #cfd3da; border: 1px solid #3a4048;
  border-radius: 4px; width: 24px; height: 22px; font-size: 13px; cursor: pointer;
}
.mini-btn:active { background: #3a4048; }
#scale-label { min-width: 28px; text-align: center; }

/* 下方虚拟按键：返回（左）— 方向键（中）— 确认（右） */
#touch-controls {
  display: flex;
  align-items: flex-end;    /* 返回/确认 与方向键下排（◀▼▶）同一基线 */
  justify-content: center;
  gap: 16px;
  user-select: none;
  -webkit-user-select: none;
}
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(2, 46px);
  gap: 6px;
}
.dpad .key[data-key="up"]    { grid-column: 2; grid-row: 1; }
.dpad .key[data-key="left"]  { grid-column: 1; grid-row: 2; }
.dpad .key[data-key="down"]  { grid-column: 2; grid-row: 2; }
.dpad .key[data-key="right"] { grid-column: 3; grid-row: 2; }
.key {
  min-width: 52px;
  height: 46px;
  padding: 0 6px;
  background: #2a2f36;
  color: #cfd3da;
  border: 1px solid #3a4048;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  touch-action: none;
}
.key.pressed { background: #4a5260; }

#help-note {
  font-size: 11px;
  color: #5a626e;
  text-align: center;
  line-height: 1.6;
  padding-bottom: 4px;
}

@media (max-width: 860px) {
  #screen-wrap { padding: 6px; }
  #help-note { display: none; }
}

/* ==================== 网页菜单（MOD / 存档） ==================== */

#status-actions { display: flex; align-items: center; gap: 10px; }
.menu-btn { width: auto; padding: 0 9px; }

.wm-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center;
  padding: 16px; background: rgba(8, 10, 12, .72);
}
.wm-overlay.open { display: flex; }
.wm-panel {
  width: min(440px, 100%); max-height: min(82vh, 680px); overflow: auto;
  background: #23272e; border: 1px solid #3a4048; border-radius: 10px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .6); color: #cfd3da; font-size: 13px;
}
.wm-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid #323841;
}
.wm-title { font-size: 15px; font-weight: 600; letter-spacing: .05em; }
.wm-close {
  background: none; border: 0; color: #8b93a0; font-size: 22px; line-height: 1;
  cursor: pointer; padding: 0 2px;
}
.wm-close:hover { color: #cfd3da; }
.wm-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 14px; }
.wm-sec { display: flex; flex-direction: column; gap: 8px; }
.wm-sec-title { font-size: 12px; color: #8b93a0; letter-spacing: .08em; }
.wm-row { display: flex; gap: 10px; align-items: baseline; }
.wm-label { color: #8b93a0; flex: none; }
.wm-value { color: #e6e9ee; word-break: break-all; }
.wm-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wm-btn {
  background: #2f353d; color: #cfd3da; border: 1px solid #3f4650; border-radius: 6px;
  padding: 7px 12px; font-size: 13px; font-family: inherit; cursor: pointer;
}
.wm-btn:hover:not(:disabled) { background: #3a414b; }
.wm-btn:disabled { opacity: .45; cursor: default; }
.wm-btn.primary { background: #4a5260; border-color: #5a6372; }
.wm-btn.small { padding: 4px 9px; font-size: 12px; }
.wm-hint { color: #6f7885; font-size: 11px; line-height: 1.6; }
.wm-slots { display: flex; flex-direction: column; gap: 6px; }
.wm-slot {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: #1d2127; border: 1px solid #30363e; border-radius: 6px;
}
.wm-slot-name { flex: none; color: #aeb6c2; }
.wm-slot-info {
  flex: 1; min-width: 0; color: #e6e9ee;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wm-slot-acts { flex: none; display: flex; gap: 6px; }
.wm-msg { min-height: 18px; font-size: 12px; color: #8b93a0; line-height: 1.5; word-break: break-all; }
.wm-msg.ok { color: #7fbf7f; }
.wm-msg.err { color: #e08a8a; }

@media (max-width: 420px) {
  .wm-slot { flex-wrap: wrap; }
  .wm-slot-info { flex-basis: 100%; order: 3; }
}
