/* game.css — 街机深色主题；画布整数缩放优先（§1.4） */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; padding: 0;
  background: #0a0a12;
  color: #e8e8f0;
  font-family: "Menlo", "SF Mono", "Courier New", monospace;
  -webkit-user-select: none; user-select: none;
}
#app {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px;
}

/* 面板通用 */
.panel { text-align: center; max-width: 560px; }
.panel h1, .panel h2 { color: #ffd54a; letter-spacing: 2px; }
.game-title { font-size: 40px; margin: 0 0 4px; }
.subtitle { display: block; font-size: 14px; color: #8888aa; letter-spacing: 6px; }
.pack-line { color: #9fd0ff; font-size: 13px; }
.profile-badge {
  display: inline-block; padding: 2px 10px; border: 1px solid #5555aa;
  border-radius: 3px; font-size: 12px; color: #aab;
}
.profile-badge.custom { color: #ffb851; border-color: #ffb851; }
.hiscore-line { color: #8888aa; font-size: 13px; }
.note { color: #777788; font-size: 12px; }

.menu { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; align-items: center; }
.menu button {
  min-width: 200px; padding: 10px 18px;
  background: #181828; color: #e8e8f0;
  border: 2px solid #2121de; border-radius: 4px;
  font-family: inherit; font-size: 15px; cursor: pointer;
}
.menu button:hover, .menu button:focus-visible { background: #2121de; outline: none; }
.menu button:disabled { opacity: 0.4; cursor: default; }

.keys { margin: 0 auto; border-collapse: collapse; }
.keys td { padding: 4px 12px; border: 1px solid #33334d; font-size: 13px; }

/* 游戏画面 */
#screen-game { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#canvas-wrap {
  position: relative; outline: none;
  line-height: 0;
}
#game-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
  border: 1px solid #222;
}
.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #ffd54a; letter-spacing: 3px;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: none; line-height: 1;
}
#overlay-ready { color: #ffd54a; }

#status-bar {
  display: flex; gap: 14px; align-items: center;
  font-size: 12px; color: #8888aa;
}
#status-bar button {
  background: #181828; color: #aaaacc; border: 1px solid #444466;
  border-radius: 3px; font-family: inherit; font-size: 12px; padding: 3px 10px; cursor: pointer;
}
#status-bar button:hover { background: #25253d; }

/* 触屏十字键（§5.3：48×48 最小、间距 8、画布外） */
#touch-pad {
  display: none;
  grid-template-columns: repeat(3, 48px);
  grid-template-rows: repeat(3, 48px);
  gap: 8px; margin-top: 8px;
}
#touch-pad .tbtn {
  width: 48px; height: 48px;
  background: #181828; color: #e8e8f0; border: 2px solid #2121de; border-radius: 6px;
  font-size: 18px; touch-action: none;
}
#touch-pad .tbtn:active { background: #2121de; }
#t-up { grid-column: 2; grid-row: 1; }
#t-left { grid-column: 1; grid-row: 2; }
#t-right { grid-column: 3; grid-row: 2; }
#t-down { grid-column: 2; grid-row: 3; }
@media (pointer: coarse) { #touch-pad { display: grid; } }

/* 选包三栏（§5.1） */
#pack-columns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.pack-card {
  width: 200px; padding: 12px; border: 1px solid #33334d; border-radius: 6px;
  background: #12121e; text-align: left;
}
.pack-card.dragover { border-color: #ffd54a; }
.pack-card h3 { margin: 0 0 8px; color: #9fd0ff; font-size: 14px; }
.pack-name { font-size: 13px; margin: 4px 0; }
.pack-status { font-size: 11px; color: #777788; }
.pack-status.custom { color: #ffb851; }
.pack-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.pack-actions button {
  background: #181828; color: #aaaacc; border: 1px solid #444466; border-radius: 3px;
  font-family: inherit; font-size: 12px; padding: 5px 8px; cursor: pointer; text-align: center;
}
.pack-actions button:hover { background: #25253d; }
.pack-errors { color: #ff8888; font-size: 11px; margin: 8px 0 0; padding-left: 16px; white-space: pre-wrap; }
#pack-preview { margin-top: 14px; text-align: left; }
#pack-preview h3 { color: #9fd0ff; font-size: 14px; }
#pack-preview-table { border-collapse: collapse; width: 100%; font-size: 12px; }
#pack-preview-table td, #pack-preview-table th { border: 1px solid #33334d; padding: 3px 8px; }
#pack-preview-warnings { color: #ffb851; font-size: 12px; }
.menu.horizontal { flex-direction: row; justify-content: center; }
.menu.horizontal button { min-width: 0; }

/* 参数/生成器表单 */
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px 16px; text-align: left; margin: 12px 0;
}
.form-grid label { font-size: 12px; color: #9fd0ff; display: flex; flex-direction: column; gap: 4px; }
.form-grid input {
  background: #0a0a12; color: #e8e8f0; border: 1px solid #444466; border-radius: 3px;
  padding: 5px 8px; font-family: inherit; font-size: 13px;
}
.form-grid fieldset { grid-column: 1 / -1; border: 1px solid #33334d; border-radius: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.form-grid fieldset label { flex-direction: row; align-items: center; gap: 6px; }
.form-grid fieldset input { width: 70px; }
.pack-card.wide { width: 100%; max-width: 640px; margin-top: 14px; }
#gen-preview-canvas { image-rendering: pixelated; border: 1px solid #333; margin-top: 10px; max-width: 100%; }
.pack-actions.horizontal { flex-direction: row; }

#boot-error h1 { color: #ff5555; }
#boot-error-list { text-align: left; color: #ff8888; font-size: 13px; }
#boot-notice {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  background: #25253d; color: #ffd54a; border: 1px solid #5555aa; border-radius: 4px;
  padding: 8px 16px; font-size: 12px; z-index: 10;
}
