:root {
  --gold: #cda45b;
  --gold-bright: #f0c978;
  --ink: #140e09;
  --paper: #eee0bf;
  --red: #ff6a55;
  --blue: #7fa8ff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 42%, #382516 0, #17100b 44%, #090706 100%);
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  color: var(--paper);
}

#scene {
  position: fixed;
  inset: 0;
  display: block;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

.hud-top, #panel, #hint, .battle-controls, .demo-trigger { transition: opacity 0.18s ease, visibility 0.18s ease; }
body.general-cinematic-active .hud-top,
body.general-cinematic-active #panel,
body.general-cinematic-active #hint,
body.general-cinematic-active .battle-controls,
body.general-cinematic-active .demo-trigger {
  opacity: 0;
  visibility: hidden;
}

/* ---------- 首帧加载 / 错误兜底 ---------- */
#bootScreen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  color: #f0ce8d;
  background:
    radial-gradient(circle at 50% 48%, rgba(129, 70, 31, 0.38), transparent 25%),
    linear-gradient(145deg, #21150d, #080706 72%);
  transition: opacity 0.65s ease, visibility 0.65s ease;
}
#bootScreen::before {
  content: "";
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(205, 164, 91, 0.28);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
#bootScreen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-emblem { display: flex; align-items: center; gap: 18px; font-family: "Ma Shan Zheng", "STKaiti", serif; font-size: 54px; }
.boot-emblem span:first-child { color: #ef755d; text-shadow: 0 0 25px rgba(218, 62, 38, 0.55); }
.boot-emblem span:last-child { color: #9bbbea; text-shadow: 0 0 25px rgba(77, 124, 199, 0.55); }
.boot-emblem i { width: 1px; height: 46px; background: linear-gradient(transparent, #d4ad62, transparent); transform: rotate(24deg); }
#bootText { font-size: 14px; letter-spacing: 6px; color: rgba(240, 224, 191, 0.72); }
.boot-line { width: 210px; height: 2px; overflow: hidden; background: rgba(205, 164, 91, 0.16); }
.boot-line b { display: block; width: 42%; height: 100%; background: linear-gradient(90deg, transparent, #edbd63, transparent); animation: bootSweep 1.4s ease-in-out infinite; }
#bootScreen.error #bootText { max-width: 520px; text-align: center; color: #ff9e88; line-height: 1.8; }
#bootScreen.error .boot-line b { background: #b94a36; animation: none; }
@keyframes bootSweep { from { transform: translateX(-120%); } to { transform: translateX(340%); } }
.noscript { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; background: #140e09; color: #f0c978; }

.demo-trigger {
  position: fixed;
  left: 50%;
  bottom: 64px;
  z-index: 25;
  transform: translateX(-50%);
  padding: 10px 24px;
  color: #2a1608;
  font: 700 14px/1 "Noto Serif SC", "Songti SC", serif;
  letter-spacing: 3px;
  background: linear-gradient(145deg, #f1ce83, #b8873e);
  border: 1px solid #ffdf99;
  border-radius: 999px;
  box-shadow: 0 8px 30px rgba(190, 126, 48, 0.36);
  cursor: pointer;
}
.demo-trigger:hover { filter: brightness(1.1); }

/* ---------- 顶部 HUD ---------- */
.hud-top {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 28px;
  background: linear-gradient(180deg, rgba(12, 8, 6, 0.9), rgba(12, 8, 6, 0));
  pointer-events: none;
  z-index: 10;
}
.hud-top > * { pointer-events: auto; }

.seal {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #a02318, #6d1512);
  border: 2px solid var(--gold);
  border-radius: 8px;
  font-family: "Ma Shan Zheng", serif;
  font-size: 30px;
  color: #ffd9a0;
  box-shadow: 0 4px 18px rgba(160, 35, 24, 0.45);
  transform: rotate(-4deg);
}

.brand h1 {
  font-family: "Ma Shan Zheng", serif;
  font-size: 30px;
  font-weight: 400;
  letter-spacing: 6px;
  color: var(--gold-bright);
  text-shadow: 0 2px 12px rgba(201, 162, 90, 0.35);
  line-height: 1.1;
}
.brand p {
  font-size: 12px;
  letter-spacing: 4px;
  color: rgba(232, 220, 192, 0.55);
  margin-top: 2px;
}

.turn {
  margin-left: auto;
  padding: 8px 22px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 3px;
  transition: all 0.4s ease;
}
.turn.red {
  color: #ffd9c8;
  background: rgba(160, 35, 24, 0.35);
  box-shadow: 0 0 18px rgba(255, 90, 60, 0.25), inset 0 0 12px rgba(255, 90, 60, 0.12);
}
.turn.black {
  color: #d4e4ff;
  background: rgba(30, 50, 80, 0.4);
  box-shadow: 0 0 18px rgba(80, 130, 255, 0.25), inset 0 0 12px rgba(80, 130, 255, 0.12);
}

.actions { display: flex; gap: 10px; }
.actions button {
  font-family: "Noto Serif SC", serif;
  font-size: 14px;
  letter-spacing: 2px;
  padding: 8px 16px;
  color: var(--gold-bright);
  background: rgba(201, 162, 90, 0.08);
  border: 1px solid rgba(201, 162, 90, 0.5);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s ease;
}
.actions button:hover {
  background: rgba(201, 162, 90, 0.22);
  box-shadow: 0 0 14px rgba(201, 162, 90, 0.3);
  transform: translateY(-1px);
}
.repo-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  letter-spacing: 1px;
  padding: 8px 14px;
  color: var(--gold-bright);
  text-decoration: none;
  background: rgba(201, 162, 90, 0.08);
  border: 1px solid rgba(201, 162, 90, 0.5);
  border-radius: 6px;
  transition: all 0.25s ease;
}
.repo-link:hover {
  background: rgba(201, 162, 90, 0.22);
  box-shadow: 0 0 14px rgba(201, 162, 90, 0.3);
  transform: translateY(-1px);
}

/* ---------- 对弈军令 ---------- */
.battle-controls {
  position: fixed;
  top: 88px;
  left: 26px;
  z-index: 12;
  display: grid;
  gap: 6px;
  padding: 6px;
  color: var(--paper);
  background:
    linear-gradient(110deg, rgba(57, 34, 18, 0.92), rgba(13, 12, 12, 0.9)),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(238, 199, 117, 0.05) 19px 20px);
  border: 1px solid rgba(205, 164, 91, 0.38);
  border-left: 3px solid #9c3927;
  border-radius: 4px 9px 9px 4px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.32), inset 0 0 22px rgba(205, 164, 91, 0.04);
  backdrop-filter: blur(9px);
}
.control-row { display: flex; align-items: center; }
.ai-row { min-height: 38px; padding-top: 6px; border-top: 1px solid rgba(205, 164, 91, 0.18); }
.battle-controls button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 5px 11px;
  color: inherit;
  font-family: "Noto Serif SC", "Songti SC", serif;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.battle-controls button:hover { background: rgba(232, 192, 112, 0.1); }
.battle-controls small {
  display: block;
  margin-bottom: 3px;
  color: rgba(238, 224, 191, 0.5);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 2px;
}
.battle-controls b { display: block; font-size: 13px; line-height: 1; letter-spacing: 2px; }
.mode-picker { display: grid; align-content: center; gap: 4px; }
.mode-picker > small { margin: 0 0 0 3px; }
.mode-options { display: flex; gap: 3px; }
.battle-controls .mode-option {
  min-height: 29px;
  padding: 6px 10px;
  color: rgba(238, 224, 191, 0.6);
  font-size: 12px;
  line-height: 1;
  letter-spacing: 1px;
  border: 1px solid transparent;
}
.battle-controls .mode-option.active {
  color: #ffe0a0;
  background: linear-gradient(145deg, rgba(153, 48, 31, 0.72), rgba(96, 29, 22, 0.62));
  border-color: rgba(240, 190, 97, 0.68);
  box-shadow: inset 0 0 13px rgba(255, 180, 76, 0.1), 0 0 10px rgba(157, 48, 27, 0.2);
}
.ai-controls {
  display: flex;
  align-items: stretch;
}
.ai-controls[hidden] { display: none; }
.ai-choice { display: grid; align-content: center; gap: 4px; padding: 0 9px; }
.ai-choice + .ai-choice { border-left: 1px solid rgba(205, 164, 91, 0.14); }
.ai-choice small { margin: 0; }
.ai-choice select {
  min-width: 72px;
  color: #f3d99f;
  font: 600 11px/1 "Noto Serif SC", "Songti SC", serif;
  background: #21160f;
  border: 1px solid rgba(205, 164, 91, 0.34);
  border-radius: 4px;
  padding: 5px 7px;
  cursor: pointer;
  outline: none;
}
.ai-choice select:focus { border-color: rgba(240, 190, 97, 0.78); box-shadow: 0 0 0 2px rgba(240, 190, 97, 0.1); }
.ai-choice select:disabled { opacity: 0.5; cursor: wait; }
.ai-status {
  align-self: center;
  width: 7px;
  height: 7px;
  margin: 0 7px 0 2px;
  border-radius: 50%;
  background: #846c45;
  box-shadow: 0 0 0 3px rgba(132, 108, 69, 0.12);
}
.ai-status.ready { background: #7cbd79; box-shadow: 0 0 11px rgba(124, 189, 121, 0.7); }
.ai-status.thinking { background: #f0c978; animation: aiPulse 0.8s ease-in-out infinite alternate; }
.ai-status.error { background: #e1634c; box-shadow: 0 0 11px rgba(225, 99, 76, 0.65); }
@keyframes aiPulse { to { opacity: 0.35; transform: scale(0.72); } }

/* ---------- 联机军帐 ---------- */
.online-dialog {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 42%, rgba(75, 39, 20, 0.3), rgba(5, 4, 3, 0.82));
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.online-dialog.show { opacity: 1; visibility: visible; pointer-events: auto; }
.online-card {
  position: relative;
  width: min(430px, 100%);
  padding: 34px 38px 36px;
  color: var(--paper);
  text-align: center;
  background:
    linear-gradient(145deg, rgba(64, 39, 22, 0.98), rgba(16, 13, 11, 0.98)),
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(238, 199, 117, 0.04) 24px);
  border: 1px solid rgba(232, 192, 112, 0.5);
  border-radius: 3px 16px 3px 16px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62), inset 0 0 50px rgba(205, 164, 91, 0.05);
  transform: translateY(14px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.online-dialog.show .online-card { transform: translateY(0) scale(1); }
.online-card::before,
.online-card::after {
  content: "";
  position: absolute;
  width: 52px;
  height: 1px;
  top: 19px;
  background: var(--gold);
}
.online-card::before { left: 18px; }
.online-card::after { right: 18px; }
.online-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 30px;
  height: 30px;
  color: rgba(238, 224, 191, 0.55);
  font-size: 24px;
  line-height: 1;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.online-seal {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  color: #ffd59a;
  font: 400 28px/1 "Ma Shan Zheng", "STKaiti", serif;
  background: #7f2018;
  border: 2px solid #d4a75e;
  box-shadow: 0 0 22px rgba(180, 48, 30, 0.35);
  transform: rotate(-4deg);
}
.online-kicker { color: rgba(232, 192, 112, 0.58); font-size: 10px; letter-spacing: 0.5em; }
.online-card h2 {
  margin: 6px 0 10px;
  color: var(--gold-bright);
  font: 400 30px/1.3 "Ma Shan Zheng", "STKaiti", serif;
  letter-spacing: 5px;
}
.online-message { min-height: 42px; color: rgba(238, 224, 191, 0.62); font-size: 13px; line-height: 1.7; }
.online-message.error { color: #ff9c86; }
.online-primary,
.online-join button,
.room-ticket button {
  color: #231508;
  font: 600 13px/1 "Noto Serif SC", serif;
  letter-spacing: 2px;
  background: linear-gradient(145deg, #efcf89, #b9853e);
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}
.online-primary { width: 100%; margin-top: 15px; padding: 13px; }
.online-primary:disabled,
.online-join button:disabled { opacity: 0.45; cursor: wait; }
.online-or { display: flex; align-items: center; gap: 12px; margin: 17px 0; color: rgba(238, 224, 191, 0.3); font-size: 11px; }
.online-or::before, .online-or::after { content: ""; flex: 1; height: 1px; background: rgba(205, 164, 91, 0.2); }
.online-join { text-align: left; }
.online-join label { display: block; margin-bottom: 7px; color: rgba(238, 224, 191, 0.46); font-size: 10px; letter-spacing: 3px; }
.online-join > div { display: flex; gap: 8px; }
.online-join input {
  min-width: 0;
  flex: 1;
  padding: 11px 12px;
  color: #f4dfb3;
  font: 700 17px/1 monospace;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  background: rgba(5, 6, 8, 0.54);
  border: 1px solid rgba(205, 164, 91, 0.36);
  border-radius: 5px;
  outline: none;
}
.online-join input:focus { border-color: #e2b765; box-shadow: 0 0 0 2px rgba(226, 183, 101, 0.12); }
.online-join button { padding: 0 15px; }
.room-ticket {
  margin-top: 20px;
  padding: 17px;
  background: rgba(8, 11, 14, 0.48);
  border: 1px dashed rgba(232, 192, 112, 0.42);
}
.room-ticket small { display: block; color: rgba(238, 224, 191, 0.44); font-size: 9px; letter-spacing: 3px; }
.room-ticket strong { display: block; margin: 6px 0; color: #ffd98f; font: 800 30px/1 monospace; letter-spacing: 0.22em; }
.room-ticket p { margin-bottom: 12px; color: rgba(238, 224, 191, 0.67); font-size: 12px; }
.room-ticket button { padding: 9px 14px; }
.online-back {
  margin-top: 18px;
  padding: 9px 13px;
  color: rgba(238, 224, 191, 0.64);
  font: 500 11px/1 "Noto Serif SC", serif;
  letter-spacing: 2px;
  background: transparent;
  border: 1px solid rgba(205, 164, 91, 0.3);
  border-radius: 5px;
  cursor: pointer;
}
.online-back:hover { color: #f5d99d; border-color: rgba(232, 192, 112, 0.6); }
.ai-status.online { background: #72c8dd; box-shadow: 0 0 11px rgba(114, 200, 221, 0.72); }
.ai-status.waiting { background: #e4b75f; animation: aiPulse 0.9s ease-in-out infinite alternate; }

/* ---------- 战利品侧栏 ---------- */
#panel {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 132px;
  padding: 18px 14px;
  background: linear-gradient(155deg, rgba(35, 23, 14, 0.84), rgba(10, 10, 12, 0.82));
  border: 1px solid rgba(201, 162, 90, 0.35);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  z-index: 10;
}
.cap-block h3 {
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--gold);
  text-align: center;
  margin-bottom: 10px;
  font-weight: 600;
}
.divider {
  height: 1px;
  margin: 14px 4px;
  background: linear-gradient(90deg, transparent, rgba(201, 162, 90, 0.5), transparent);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  min-height: 30px;
}
.chip {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 600;
  animation: chipIn 0.35s ease backwards;
}
.chip.black { background: #232f3d; color: #cfe0f5; border: 1px solid #5a708c; }
.chip.red { background: #5c1212; color: #ffd9a0; border: 1px solid #a05040; }
.chip .none, .none { color: rgba(232, 220, 192, 0.3); font-size: 14px; }
@keyframes chipIn {
  from { transform: scale(0.3); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- 将军横幅 ---------- */
#checkBanner {
  position: fixed;
  top: 22%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  font-family: "Ma Shan Zheng", serif;
  font-size: 84px;
  color: #ff5040;
  text-shadow: 0 0 30px rgba(255, 60, 40, 0.8), 0 0 80px rgba(255, 60, 40, 0.4);
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  transition: all 0.25s cubic-bezier(0.2, 1.6, 0.4, 1);
}
#checkBanner.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: bannerShake 0.5s ease;
}
@keyframes bannerShake {
  0%, 100% { margin-left: 0; }
  25% { margin-left: -6px; }
  75% { margin-left: 6px; }
}

/* ---------- 帅 / 将击杀电影特写 ---------- */
#generalCinematic {
  --cinematic-color: 255, 190, 86;
  position: fixed;
  inset: 0;
  z-index: 24;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.16s ease, visibility 0.16s ease;
}
#generalCinematic[data-side="black"] { --cinematic-color: 128, 180, 255; }
#generalCinematic.active { opacity: 1; visibility: visible; }
#generalCinematic::before,
#generalCinematic::after {
  content: "";
  position: absolute;
  z-index: 4;
  left: 0;
  width: 100%;
  height: clamp(34px, 7vh, 74px);
  background: #050403;
  box-shadow: 0 0 34px rgba(0, 0, 0, 0.92);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#generalCinematic::before { top: 0; transform: translateY(-105%); }
#generalCinematic::after { bottom: 0; transform: translateY(105%); }
#generalCinematic.active::before,
#generalCinematic.active::after { transform: translateY(0); }
.cinematic-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 44%, transparent 18%, rgba(5, 3, 2, 0.16) 48%, rgba(2, 1, 1, 0.9) 100%),
    linear-gradient(90deg, rgba(var(--cinematic-color), 0.2), transparent 28%, transparent 72%, rgba(var(--cinematic-color), 0.16));
}
.cinematic-speedlines {
  position: absolute;
  inset: -35%;
  opacity: 0;
  background: repeating-conic-gradient(from 90deg at 50% 50%, rgba(var(--cinematic-color), 0) 0deg 4deg, rgba(var(--cinematic-color), 0.12) 4.2deg 4.45deg);
  transform: scale(1.15) rotate(-4deg);
  mix-blend-mode: screen;
}
#generalCinematic.active .cinematic-speedlines { animation: cinematicLines 1.1s ease-out both; }
.cinematic-title {
  position: absolute;
  z-index: 3;
  left: clamp(28px, 7vw, 110px);
  bottom: clamp(48px, 9vh, 96px);
  display: flex;
  align-items: flex-end;
  gap: 22px;
  color: rgb(var(--cinematic-color));
  filter: drop-shadow(0 0 18px rgba(var(--cinematic-color), 0.48));
  transform: translateX(-30px) skewX(-7deg);
  opacity: 0;
}
#generalCinematic.active .cinematic-title { animation: cinematicTitle 1.05s 0.12s cubic-bezier(0.18, 0.9, 0.2, 1) both; }
.cinematic-title span {
  font-family: "Ma Shan Zheng", "STKaiti", serif;
  font-size: clamp(112px, 19vw, 240px);
  line-height: 0.72;
  text-shadow: 3px 3px 0 rgba(20, 8, 2, 0.8), 0 0 42px rgba(var(--cinematic-color), 0.5);
}
.cinematic-title small {
  padding: 7px 13px;
  border-top: 1px solid rgba(var(--cinematic-color), 0.72);
  border-bottom: 1px solid rgba(var(--cinematic-color), 0.42);
  font-size: clamp(11px, 1.3vw, 17px);
  letter-spacing: 0.45em;
  white-space: nowrap;
}
.cinematic-flash {
  position: absolute;
  z-index: 5;
  inset: 0;
  opacity: 0;
  background: rgb(var(--cinematic-color));
  mix-blend-mode: screen;
}
#generalCinematic.impact .cinematic-flash { animation: cinematicFlash 0.34s ease-out; }
#generalCinematic.impact { animation: cinematicShake 0.28s linear; }
@keyframes cinematicLines {
  0% { opacity: 0; transform: scale(1.35) rotate(-7deg); }
  28% { opacity: 0.55; }
  100% { opacity: 0.08; transform: scale(0.98) rotate(0); }
}
@keyframes cinematicTitle {
  0% { opacity: 0; transform: translateX(-46px) skewX(-12deg) scale(1.08); }
  42%, 82% { opacity: 1; transform: translateX(0) skewX(-7deg) scale(1); }
  100% { opacity: 0.74; transform: translateX(9px) skewX(-5deg) scale(0.98); }
}
@keyframes cinematicFlash { 0% { opacity: 0.82; } 18% { opacity: 0.42; } 100% { opacity: 0; } }
@keyframes cinematicShake {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-7px, 3px); }
  42% { transform: translate(6px, -3px); }
  66% { transform: translate(-3px, 2px); }
  84% { transform: translate(2px, -1px); }
}

/* ---------- 底部提示 ---------- */
#hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  letter-spacing: 2px;
  color: rgba(238, 224, 191, 0.68);
  background: rgba(20, 13, 8, 0.72);
  border: 1px solid rgba(201, 162, 90, 0.2);
  border-radius: 999px;
  padding: 8px 22px;
  backdrop-filter: blur(6px);
  z-index: 10;
  pointer-events: none;
}
#hint.error { color: #ffad99; border-color: rgba(225, 99, 76, 0.46); }

/* ---------- 终局遮罩 ---------- */
#overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at center, rgba(6, 8, 12, 0.55), rgba(6, 8, 12, 0.92));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
  z-index: 30;
}
#overlay.show { opacity: 1; pointer-events: auto; }
.overlay-card {
  text-align: center;
  transform: translateY(14px);
  transition: transform 0.6s ease;
}
#overlay.show .overlay-card { transform: translateY(0); }
#resultText {
  font-family: "Ma Shan Zheng", serif;
  font-size: 110px;
  font-weight: 400;
  letter-spacing: 14px;
  color: var(--red);
  text-shadow: 0 0 50px rgba(255, 90, 60, 0.4);
}
#resultSub {
  font-size: 17px;
  letter-spacing: 8px;
  color: rgba(232, 220, 192, 0.6);
  margin: 10px 0 36px;
}
#btnAgain {
  font-family: "Noto Serif SC", serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 6px;
  padding: 14px 44px;
  color: #1a1208;
  background: linear-gradient(145deg, #e8c070, #c9a25a);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 6px 30px rgba(201, 162, 90, 0.4);
  transition: all 0.25s ease;
}
#btnAgain:hover { transform: translateY(-2px); box-shadow: 0 10px 36px rgba(201, 162, 90, 0.55); }

@media (max-width: 760px) {
  .brand p { display: none; }
  .hud-top { gap: 9px; padding: 10px 12px; }
  .seal { width: 42px; height: 42px; font-size: 25px; }
  .brand h1 { font-size: 23px; letter-spacing: 3px; }
  .turn { padding: 7px 11px; font-size: 12px; letter-spacing: 1px; }
  .actions { gap: 5px; }
  .actions button { padding: 7px 9px; font-size: 12px; letter-spacing: 1px; }
  .repo-link { display: none; }
  .online-card { padding: 30px 22px 26px; }
  .battle-controls { top: 66px; left: 10px; padding: 4px; }
  .battle-controls button { min-height: 37px; padding: 4px 7px; gap: 6px; }
  .battle-controls small { display: none; }
  .battle-controls b { font-size: 11px; letter-spacing: 1px; }
  .battle-controls .mode-option { min-height: 29px; padding: 5px 7px; font-size: 11px; }
  .ai-choice { padding: 0 4px; }
  .ai-choice select { min-width: 64px; max-width: 78px; padding: 5px 4px; font-size: 10px; }
  #panel { display: none; }
  #hint { bottom: 12px; width: calc(100% - 28px); padding: 7px 12px; text-align: center; font-size: 11px; letter-spacing: 1px; }
  #resultText { font-size: 64px; }
  .cinematic-title { left: 24px; bottom: 72px; gap: 12px; }
  .cinematic-title small { letter-spacing: 0.2em; }
}
