/* 火柴人武道会 - 样式 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: #0c0e1a;
  color: #e8eaf2;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

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

#wrap {
  position: relative;
  width: min(98vw, calc((100vh - 24px) * 16 / 9));
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  background: #000;
}

body.show-touch #wrap {
  width: min(98vw, calc((100vh - 170px) * 16 / 9));
}

#game {
  display: block;
  width: 100%;
  height: 100%;
}

/* 右上角小按钮 */
#top-buttons {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 40;
  display: flex;
  gap: 8px;
}
#top-buttons button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(15,18,35,0.65);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
#top-buttons button.off { opacity: 0.45; text-decoration: line-through; }

/* 覆盖层(菜单) */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(9,11,24,0.86);
  padding: 16px;
  text-align: center;
}
.overlay.hidden { display: none; }

.game-logo {
  font-size: clamp(34px, 7vw, 62px);
  letter-spacing: 10px;
  font-weight: 900;
  background: linear-gradient(180deg, #ffe082, #ff7043);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 4px 24px rgba(255,112,67,0.25);
}
.subtitle { color: #9aa3c0; letter-spacing: 4px; font-size: clamp(11px, 1.6vw, 15px); }
.foot-hint { color: #6d7590; font-size: 12px; }

h2 { font-size: clamp(20px, 3.4vw, 32px); letter-spacing: 6px; color: #ffd54f; }
h3 { color: #8fd3ff; margin-bottom: 6px; }

.menu-col { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.menu-col.row { flex-direction: row; }

.mbtn {
  min-width: 220px;
  padding: 13px 30px;
  font-size: 19px;
  letter-spacing: 4px;
  color: #fff;
  background: linear-gradient(180deg, #39406b, #232848);
  border: 2px solid #5560a0;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
  font-family: inherit;
}
.mbtn:hover { transform: scale(1.05); border-color: #ffd54f; background: linear-gradient(180deg, #454e80, #2b3158); }
.mbtn:active { transform: scale(0.97); }
.mbtn.small { min-width: 170px; padding: 9px 20px; font-size: 15px; }

/* 角色选择 */
#char-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 900px;
}
@media (max-width: 720px) { #char-grid { grid-template-columns: repeat(2, 1fr); } }

.char-card {
  position: relative;
  background: #181d33;
  border: 3px solid #333a5e;
  border-radius: 12px;
  padding: 8px 8px 10px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
  width: 100%;
}
.char-card:hover { transform: translateY(-4px); border-color: #8fd3ff; }
.char-card canvas { display: block; margin: 0 auto; }
.char-card .cname { font-size: 18px; font-weight: 700; letter-spacing: 2px; }
.char-card .ctitle { font-size: 11px; color: #9aa3c0; margin-bottom: 4px; }
.char-card .cskill { font-size: 11px; color: #ffd54f; margin-bottom: 4px; }
.char-card .cdesc { font-size: 10px; color: #7d85a5; line-height: 1.4; min-height: 28px; }
.char-card .bar { height: 5px; background: #2a3052; border-radius: 3px; margin-top: 3px; overflow: hidden; }
.char-card .bar i { display: block; height: 100%; border-radius: 3px; }
.char-card .bar-label { font-size: 9px; color: #6d7590; text-align: left; margin-top: 4px; }

.char-card.cursor-p1 { border-color: #3fa7ff; box-shadow: 0 0 12px rgba(63,167,255,0.5); }
.char-card.cursor-p2 { border-color: #ff5252; box-shadow: 0 0 12px rgba(255,82,82,0.5); }
.char-card.picked-p1 { border-color: #3fa7ff; background: #1b2846; }
.char-card.picked-p2 { border-color: #ff5252; background: #331d26; }
.char-card .badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  color: #fff;
}
.char-card .badge.p1 { background: #3fa7ff; }
.char-card .badge.p2 { background: #ff5252; }

#select-tip { color: #7d85a5; font-size: 12px; }

/* 帮助与统计 */
.help-cols { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.help-box { background: #181d33; border-radius: 10px; padding: 12px 22px; text-align: left; min-width: 240px; }
.help-box p { font-size: 13px; margin: 3px 0; color: #c6cce4; }
.help-box b { color: #ffd54f; }
.help-rules { font-size: 12px; color: #9aa3c0; line-height: 1.7; max-width: 640px; text-align: left; }
.help-rules b { color: #ff8a65; }

#stats-body {
  background: #181d33;
  border-radius: 10px;
  padding: 14px 26px;
  min-width: min(560px, 90%);
  font-size: 14px;
  line-height: 2;
  text-align: left;
  max-height: 50vh;
  overflow-y: auto;
}
#stats-body .stitle { color: #8fd3ff; font-weight: 700; margin-top: 6px; }
#stats-body table { width: 100%; border-collapse: collapse; margin-top: 4px; }
#stats-body td, #stats-body th { padding: 2px 8px; font-size: 13px; border-bottom: 1px solid #262c4a; text-align: left; }
#stats-body th { color: #9aa3c0; font-weight: 400; }

#over-score { font-size: 40px; font-weight: 900; color: #ffd54f; letter-spacing: 6px; }

/* 手机虚拟按键 */
#touch-controls {
  display: none;
  width: 100%;
  max-width: 1000px;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 10px 8px;
  touch-action: none;
}
body.show-touch #touch-controls { display: flex; }
.tc-cluster { display: flex; flex-direction: column; gap: 5px; align-items: center; }
.tc-label { font-size: 11px; color: #6d7590; letter-spacing: 2px; }
.tc-row { display: flex; gap: 6px; }
.tc-btn {
  width: 58px;
  height: 50px;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  color: #e8eaf2;
  background: rgba(70,80,130,0.35);
  border: 1.5px solid rgba(160,175,230,0.45);
  border-radius: 12px;
  touch-action: none;
}
.tc-btn.atk { background: rgba(150,70,60,0.35); border-color: rgba(255,150,130,0.5); }
.tc-btn.on { background: rgba(255,213,79,0.55); color: #1a1a1a; }
#touch-controls.single #tc-p2 { display: none; }
#touch-controls.single { justify-content: center; }

@media (max-width: 560px) {
  .tc-btn { width: 46px; height: 44px; font-size: 14px; }
  .mbtn { min-width: 180px; font-size: 16px; }
}
