/* =============================================================================
 * 奥特曼对战怪兽 小游戏样式（shijinwa.com/games/ultraman.html，见 docs/12 §8.16）
 *
 * 🔴 与 site.css 同一纪律：完全自包含，不引用任何外部资源（无字体/图标/图片）；
 *    角色与打斗特效全部由 game-um.js 在 canvas 里现场绘制。
 * 🔴 本页是键盘游戏：按钮只做「开始/再来一局/音乐开关」，不承担游戏操作。
 * ========================================================================== */

.um-world {
  --um-red: #e94b3c;
  --um-red-deep: #c03425;
  --um-cyan: #4fd9ff;
  --mon-green: #7cb342;
  --mon-deep: #558b2f;
  --gold: #f5b942;
  --ink-brown: #5b4636;

  position: relative;
  overflow: hidden;
  padding: 56px 0 72px;
  background: linear-gradient(180deg, #c9ecff 0%, #e8f7ff 52%, #fdf6e3 100%);
}

.game-title {
  margin: 0 0 6px;
  font-size: clamp(36px, 8vw, 54px);
  font-weight: 900;
  letter-spacing: .08em;
  color: var(--ink-brown);
  line-height: 1.15;
}
.game-title .t-um { color: var(--um-red); }
.game-title .t-vs { display: inline-block; font-size: .5em; color: #a08b76; transform: translateY(-6px); }
.game-title .t-mon { color: var(--mon-green); }

.game-sub {
  margin: 0 0 26px;
  font-size: 17px;
  font-weight: 600;
  color: #6f5a49;
}
.game-noscript {
  display: inline-block;
  margin: 0 0 18px;
  padding: 10px 20px;
  border: 3px dashed var(--um-red);
  border-radius: 999px;
  background: #fff;
  color: var(--um-red-deep);
  font-weight: 700;
}

.um-stage {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
  text-align: center;
}

/* ── 战场画布 ────────────────────────────────────────────────────────────── */
.um-arena {
  position: relative;
  border: 4px solid #e9d5ac;
  border-radius: 26px;
  background: #fffaef;
  box-shadow: 0 8px 0 rgba(91, 70, 54, .14);
  overflow: hidden;
}
.um-arena canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}

/* ── 浮层（开局 / 结果）─────────────────────────────────────────────────── */
.um-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(255, 250, 239, .84);
}
.um-card {
  max-width: 600px;
  width: 100%;
  padding: 22px 26px 26px;
  border: 4px solid var(--gold);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 9px 0 rgba(91, 70, 54, .16);
}
.um-card h2 { margin: 0 0 4px; font-size: 22px; color: var(--ink-brown); }
.um-card .card-tip { margin: 0 0 14px; font-size: 14px; color: #7a6753; }
.um-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 16px;
}
.um-side {
  padding: 12px 12px 10px;
  border: 3px solid #efe7d8;
  border-radius: 16px;
  background: #fffdf6;
  text-align: left;
}
.um-side .um-avatar { width: 44px; height: 44px; display: block; margin: 0 auto 4px; }
.um-side h3 { margin: 2px 0 6px; font-size: 15.5px; text-align: center; }
.um-side.s-um h3 { color: var(--um-red-deep); }
.um-side.s-mon h3 { color: var(--mon-deep); }
.um-side p { margin: 0; font-size: 12.5px; line-height: 1.75; color: #6f5a49; }
.k {
  display: inline-block;
  min-width: 14px;
  padding: 1px 7px;
  margin: 0 1px;
  border: 2px solid #e2d7bf;
  border-bottom-width: 3px;
  border-radius: 8px;
  background: #fff;
  font-weight: 800;
  font-size: 12px;
  color: var(--ink-brown);
}
.result-icon { display: block; width: 56px; height: 56px; margin: 0 auto 6px; }
.result-icon svg { width: 100%; height: 100%; display: block; }
.result-text {
  margin: 0 0 16px;
  font-size: 21px;
  font-weight: 900;
  color: var(--ink-brown);
}

/* 屏幕阅读器专用（打斗状态播报） */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── 按钮（糖果/胶囊，贴纸投影，按下陷下去）───────────────────────────── */
.btn-candy,
.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 800;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn-candy {
  padding: 12px 38px;
  font-size: 19px;
  color: #fff;
  background: var(--um-red);
  border: 3px solid var(--um-red-deep);
  box-shadow: 0 5px 0 var(--um-red-deep);
}
.btn-candy:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--um-red-deep); }
.btn-candy:focus-visible,
.btn-pill:focus-visible { outline: 4px dashed var(--mon-deep); outline-offset: 3px; }
.btn-pill {
  padding: 9px 20px;
  font-size: 15px;
  color: #6f5a49;
  background: #fff;
  border: 3px solid #e8dcc4;
  box-shadow: 0 4px 0 #e8dcc4;
}
.btn-pill:hover { border-color: var(--mon-green); color: var(--mon-deep); }
.btn-pill:active { transform: translateY(3px); box-shadow: 0 1px 0 #e8dcc4; }
.btn-pill.is-off { color: #b0a18f; border-color: #eee5d4; box-shadow: 0 4px 0 #eee5d4; }
.ico-svg { width: 18px; height: 18px; flex: none; }

/* ── 记分板 / 控制行 / 游戏互链 ─────────────────────────────────────────── */
.um-scores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}
.score-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border: 3px solid #efe7d8;
  border-radius: 999px;
  background: #fff;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-brown);
}
.score-chip b { font-size: 16.5px; }
.sc-um b { color: var(--um-red-deep); }
.sc-mon b { color: var(--mon-deep); }
.mini-svg { width: 18px; height: 18px; flex: none; }

.um-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}
.um-more { margin: 18px 0 0; font-size: 15px; font-weight: 600; color: #6f5a49; }
.um-more a { color: var(--um-red-deep); font-weight: 800; }
.um-more a:hover { text-decoration: none; }

/* ── 玩法说明区 ──────────────────────────────────────────────────────────── */
.um-rules { padding: 58px 0 64px; background: #fdf9ef; border-top: 3px solid #f3ead6; }
.um-rules h2 { text-align: center; }
.rules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  max-width: 960px;
  margin: 34px auto 0;
}
.rule-card {
  position: relative;
  padding: 24px 20px 20px;
  border: 3px solid #efe3cb;
  border-radius: 20px;
  background: #fff;
  text-align: left;
}
.rule-num {
  position: absolute;
  top: -16px;
  left: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-size: 17px;
  font-weight: 900;
  border: 3px solid #fff;
  box-shadow: 0 3px 0 rgba(91, 70, 54, .18);
}
.rule-num.n1 { background: var(--um-red); }
.rule-num.n2 { background: var(--mon-green); }
.rule-num.n3 { background: #ff8fab; }
.rule-card h3 { margin: 4px 0 8px; font-size: 16.5px; color: var(--ink-brown); }
.rule-card p { margin: 0; font-size: 14.5px; line-height: 1.8; color: #7a6753; }
.rules-note {
  max-width: 720px;
  margin: 30px auto 0;
  padding: 18px 24px;
  border: 3px dashed #dcc9a4;
  border-radius: 18px;
  background: #fffdf6;
  text-align: left;
}
.rules-note h3 { margin: 0 0 6px; font-size: 15.5px; color: var(--ink-brown); }
.rules-note p { margin: 0; font-size: 14px; line-height: 1.8; color: #7a6753; }

/* ── 窄屏 ────────────────────────────────────────────────────────────────── */
@media (max-width: 620px) {
  .um-world { padding: 40px 0 56px; }
  .um-sides { grid-template-columns: 1fr; }
  .rules-grid { grid-template-columns: 1fr; }
  .um-card { padding: 16px 16px 20px; }
}

/* ── 减少动态：停掉过渡（canvas 内特效由 JS 按 prefers-reduced-motion 降级）─ */
@media (prefers-reduced-motion: reduce) {
  .btn-candy, .btn-pill { transition: none; }
}
