@font-face {
  font-family: Cinzel;
  src: url("assets/fonts/cinzel.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
}

@font-face {
  font-family: "Noto Serif SC UI";
  src: url("assets/fonts/notoserifsc-ui.ttf") format("truetype");
  font-style: normal;
  font-weight: 650;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0b120e;
  --table: #14231a;
  --card-bg: #202d22;
  --border: #786140;
  --text: #fff0d4;
  --muted: #c5bca6;
  --cyan: #90dcda;
  --green: #82d6a3;
  --amber: #efc67b;
  --red: #f08d80;
  --purple: #cc9aef;
  --panel-fill: linear-gradient(125deg, #253627, #111b14 48%, #161b13);
  --frame-shadow: inset 0 0 0 3px #0a110e, inset 0 0 0 4px #dcc08a2e, 0 4px 14px #0006;
  --display-font: Cinzel, "Noto Serif SC UI", "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  --body-font: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  background:
    radial-gradient(ellipse at 50% 0, #2c3b26b8, transparent 60%) fixed,
    repeating-linear-gradient(135deg, #fff0d405 0 1px, transparent 1px 5px),
    var(--bg);
  color: var(--text);
  font-family: var(--body-font);
  min-height: 100vh;
  overflow-x: clip;
}

.hs-table {
  max-width: 1392px;
  margin: 0 auto;
  padding: 14px clamp(10px, 2vw, 24px);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 12px;
}

/* 游戏标题、连战进度与工具栏 */
:is(.top-bar, .hero-pod, .battlefield, .hand-zone, .mana-tray, .modal) {
  background: var(--panel-fill);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: var(--frame-shadow);
}

:is(.game-wordmark, .goal-tag, .turn-pill, .hero-title, .side-label, .seat-name,
    .stage-placeholder, .sc-title, .hand-info > span, .hs-card-title, .mana-text,
    .modal-header, .language-modal h2, button, .btn-action-link) {
  font-family: var(--display-font);
  font-synthesis: none;
}

.top-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "brand goal turn" "brand controls controls";
  align-items: center;
  gap: 9px 18px;
  padding: 11px 16px;
}

.game-wordmark {
  grid-area: brand;
  display: grid;
  justify-items: center;
  gap: 3px;
  font-size: clamp(24px, 3vw, 38px);
  color: var(--amber);
  font-weight: 800;
  line-height: 1.18;
  white-space: nowrap;
  text-shadow: 0 3px 0 #100b06, 0 0 22px #ffc1683d;
}
.game-wordmark small {
  font-size: 0.42em;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text);
}
.goal-banner { grid-area: goal; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.goal-banner strong { color: var(--text); }
.goal-tag, .turn-pill {
  background: #151b11;
  border: 1px solid #a68952;
  box-shadow: inset 0 0 0 2px #d7ac6c26;
  color: var(--amber);
  font-size: 12px;
  font-weight: 750;
  padding: 4px 8px;
  border-radius: 2px;
}
.goal-tag { white-space: nowrap; }
.turn-pill { grid-area: turn; text-align: center; }
.top-btns { grid-area: controls; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.btn-top { padding: 6px 11px; font-size: 12px; }

/* 敌方英雄区 */
.enemy-hero-zone { display: flex; justify-content: center; }

.hero-pod {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  position: relative;
}
.enemy-pod { background: linear-gradient(115deg, #432721, #1b1b14 53%, #2d1e18); border-color: #a26954; max-width: 760px; width: 100%; }
.player-pod { border-color: #73956b; }

.hero-portrait {
  width: 104px;
  height: 120px;
  border-radius: 4px;
  object-fit: cover;
  object-position: top center;
  border: 3px double var(--border);
  flex-shrink: 0;
}
.enemy-border {
  width: 118px;
  height: 118px;
  border-color: var(--red);
  background: var(--card-bg);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.35);
}
.player-border { border-color: var(--green); box-shadow: 0 0 14px rgba(34, 197, 94, 0.35); }

.hero-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0;
  flex: 1; }
.hero-title { font-size: 17px; font-weight: 800; color: var(--text); }
.hero-title small { display: block; font-size: 12px; color: var(--amber); font-weight: 650; }
.seat-score { font-size: 12px; color: var(--muted); }
.enemy-score strong { color: var(--red); font-size: 16px; }
.cash-badge { font-size: 12px; color: var(--amber); }

.speech-bubble {
  flex: 1;
  background: #1e1512;
  border: 1px solid #895647;
  border-left: 3px solid #c57a65;
  border-radius: 3px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #ffddd1;
}

/* 中央对战区：9席董事会 + 舞台 */
.battlefield {
  background:
    radial-gradient(ellipse at center, #263e2c 0%, #111b14 82%),
    var(--table);
  border: 3px double #ad8b54;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.score-bar-wrap { display: flex; align-items: stretch; gap: 10px; }
.side-label { align-self: center; font-size: 13px; font-weight: 800; white-space: nowrap; }
.player-side strong { color: var(--green); font-size: 20px; }
.enemy-side strong { color: var(--red); font-size: 20px; }
.lock-progress { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.lock-progress[data-danger="true"] { color: #fca5a5; }

.seats-row {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 6px;
}

.seat-node {
  --seat-accent: #d3c7ab;
  background: #191e16;
  border: 1px solid #826c49;
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px #0005;
  padding: 7px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  position: relative;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.seat-node.owner-player {
  --seat-accent: #86efac;
  background: rgba(34, 197, 94, 0.14);
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.2);
}
.seat-node.owner-enemy {
  --seat-accent: #fca5a5;
  background: rgba(239, 68, 68, 0.14);
  border-color: var(--red);
}
.seat-node.owner-neutral { background: #23271c; }
.seat-node.locked { box-shadow: inset 0 0 0 2px #0c110b, inset 0 0 0 3px var(--amber), 0 0 12px #e0b26535; }
.seat-node.flash-anim { animation: seatFlip 0.65s ease; }

@keyframes seatFlip {
  0% { transform: scale(1); }
  40% { transform: scale(1.14) translateY(-4px); filter: brightness(1.4); }
  100% { transform: scale(1); }
}

.seat-portrait-frame {
  position: relative;
  width: min(100%, 72px);
  aspect-ratio: 1;
  margin-bottom: 2px;
}
.seat-portrait {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: var(--card-bg);
}
.seat-lock {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--amber);
  border-radius: 5px;
  background: #262018;
  font-size: 10px;
}
.seat-name { font-size: 12px; font-weight: 750; line-height: 1.15; min-height: 2.3em; max-width: 100%; overflow-wrap: anywhere; align-content: center; }
.seat-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--seat-accent);
  font-size: 10px;
}
.seat-tag::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* 中央出牌展示舞台 */
.clash-stage {
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-top: 3px double #977b4d8c;
  background:
    radial-gradient(ellipse 28% 52% at center, transparent 75%, #d3ad6929 76% 77%, transparent 78% 90%, #d3ad694d 91% 92%, transparent 93%),
    radial-gradient(ellipse at center, #b5c5801c, transparent 67%);
  padding: 10px 4px;
}

.stage-placeholder { display: grid; gap: 7px; justify-items: center; text-align: center; }
.stage-placeholder strong { color: var(--amber); font-size: clamp(19px, 2vw, 27px); }
.stage-placeholder span { font: 12px var(--body-font); color: var(--muted); }

.stage-card {
  width: 192px;
  background: var(--panel-fill);
  border: 3px double var(--cyan);
  border-radius: 5px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: var(--frame-shadow), 0 0 24px #90dcda3d;
  animation: cardSlam 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.stage-card.enemy-card {
  border-color: var(--red);
  box-shadow: 0 12px 32px rgba(239, 68, 68, 0.45);
  animation: enemySlam 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.stage-card img { width: 100%; height: 106px; object-fit: cover; border-radius: 6px; }
.stage-card .sc-title { font-size: 12px; font-weight: 800; text-align: center; }
.stage-card .sc-effect { font-size: 11px; color: var(--amber); text-align: center; font-weight: 700; }

.float-toast {
  position: absolute;
  top: 18px;
  right: 22%;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--green);
  color: var(--green);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  animation: floatUp 1.15s ease forwards;
  pointer-events: none;
}
.float-toast.bad { border-color: var(--red); color: var(--red); }

@keyframes cardSlam {
  0% { opacity: 0; transform: translateY(70px) scale(0.75); }
  70% { opacity: 1; transform: translateY(-6px) scale(1.06); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes enemySlam {
  0% { opacity: 0; transform: translateY(-70px) scale(0.75); }
  70% { opacity: 1; transform: translateY(6px) scale(1.06); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(14px) scale(0.9); }
  20% { opacity: 1; transform: translateY(0) scale(1.05); }
  80% { opacity: 1; transform: translateY(-10px); }
  100% { opacity: 0; transform: translateY(-24px); }
}

/* 下半区：我方英雄 + 手牌 + 水晶与结束回合 */
.player-zone {
  display: grid;
  grid-template-columns: minmax(240px, 275px) minmax(0, 1fr) 140px;
  gap: 12px;
  align-items: stretch;
}

.player-hero-dock { display: flex; flex-direction: column; gap: 8px; }
.hero-powers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }

.power-btn {
  --button-edge: #7caa93;
  --button-top: #304437;
  padding: 5px 4px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.power-btn.equity-power { --button-edge: #c99e5f; --button-top: #544126; }
.power-btn.inf-power { --button-edge: #9871af; --button-top: #3c2b43; }
.power-btn.inf-power .p-cost { color: #d8b4fe; }
.inf-cost { font-size: 10px; font-weight: 800; color: #d8b4fe; background: rgba(168, 85, 247, 0.2); padding: 1px 5px; border-radius: 4px; }
.p-icon { font-size: 16px; }
.p-name { font-size: 11px; font-weight: 750; line-height: 1.25; overflow-wrap: anywhere; }
.p-name small { color: var(--muted); font-weight: 500; }
.p-cost { font-size: 10px; color: var(--cyan); font-weight: 800; }

/* 手牌区 */
.hand-zone {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hand-info { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.hand-info > span { font-size: 15px; color: var(--amber); font-weight: 750; }
.hand-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-mulligan {
  --button-edge: #79a691;
  --button-top: #334e3f;
  padding: 4px 8px;
  font-size: 11px;
}
.hand-cards.discard-mode .hs-card {
  border-color: var(--cyan);
  box-shadow: 0 0 14px #90dcda73;
  cursor: pointer;
}

.hand-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  min-height: 250px;
  align-items: stretch;
}

/* 稀有度发光卡框（普通银灰 / 精良幽蓝 / 传说炽金） */
.hs-card {
  --card-edge: #999784;
  --card-glow: #c2baa140;
  background: linear-gradient(170deg, #2f3528 0%, #161b15 65%, #171912 100%);
  border: 3px double var(--card-edge);
  border-radius: 6px;
  box-shadow: inset 0 0 14px var(--card-glow), 0 2px 8px #0007;
  padding: 7px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  cursor: pointer;
  position: relative;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: dealCard 0.3s ease;
}

@keyframes dealCard {
  0% { opacity: 0; transform: translateX(40px) scale(0.85); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}

.hs-card.rarity-rare {
  --card-edge: #7fa6bb;
  --card-glow: #7fa6bb4a;
}
.hs-card.rarity-legendary {
  --card-edge: #e6b465;
  --card-glow: #e8b76e63;
}

.hs-card.playable:hover {
  transform: translateY(-7px) rotate(-1deg);
  box-shadow: inset 0 0 14px var(--card-glow), 0 12px 20px var(--card-glow);
  z-index: 10;
}

.hs-card.unplayable {
  background: #1e241b;
  border-color: #6e6453;
  cursor: not-allowed;
}
.hs-card.unplayable img { opacity: 0.65; filter: grayscale(0.5); }
.hand-cards.discard-mode .hs-card img { opacity: 1; filter: none; }

.rarity-gem {
  font-size: 9px;
  font-family: var(--body-font);
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}
.rarity-common .rarity-gem { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
.rarity-rare .rarity-gem { background: rgba(59, 130, 246, 0.25); color: #93c5fd; }
.rarity-legendary .rarity-gem { background: rgba(245, 158, 11, 0.25); color: #fde68a; }

.card-costs { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 3px; }
.gem-cost { background: #295850; color: #e8fffb; font-size: 11px; font-weight: 800; padding: 2px 5px; border: 1px solid #71c4bc; border-radius: 4px; }
.cash-cost { font-size: 10px; font-weight: 700; color: var(--amber); }

.hs-card img { width: 100%; height: 102px; object-fit: cover; border: 1px solid #d6b77a50; border-radius: 3px; flex-shrink: 0; }
.hs-card-title { font-size: 13px; font-weight: 800; text-align: center; line-height: 1.22; overflow-wrap: anywhere; }
.hs-card-title .rarity-gem { display: table; margin: 4px auto 0; }
.hs-card-desc { font-size: 11px; color: #e3d8bd; text-align: center; line-height: 1.3; }

/* 右侧体力水晶与结束回合 */
.end-turn-dock { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.mana-tray { padding: 10px; width: 100%; text-align: center; }
.mana-text { font-size: 12px; color: var(--cyan); margin-bottom: 5px; }
.mana-gems { display: flex; justify-content: center; gap: 7px; flex-wrap: wrap; padding: 4px; }
.gem { width: 12px; height: 12px; border-radius: 2px; transform: rotate(45deg); background: #26322b; border: 1px solid #5e7668; transition: background-color 0.2s ease; }
.gem.full { background: linear-gradient(135deg, #bffef1 13%, #4fa69a 45% 57%, #267267 58%); border-color: #b0f1e0; box-shadow: 0 0 7px #7adec4b0; }

.end-turn-btn {
  width: 100%;
  min-height: 58px;
  padding: 8px;
  font-size: 15px;
}
.enemy-turn-preview { color: var(--muted); font-size: 12px; text-align: center; }

/* 弹窗 */
.modal-backdrop { position: fixed; inset: 0; background: #030906db; display: flex; align-items: center; justify-content: center; z-index: 99; padding: 16px; }
.modal { width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); overflow: auto; }
.modal-header { padding: 12px 16px; border-bottom: 3px double var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--amber); }
.modal-close { min-width: 36px; min-height: 36px; font-size: 18px; }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.modal-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }
.radio-row { display: flex; flex-direction: column; gap: 6px; }
.radio-card { display: flex; align-items: center; gap: 8px; background: var(--card-bg); border: 1px solid var(--border); padding: 8px; border-radius: 3px; font-size: 13px; cursor: pointer; }
.radio-card small { margin-inline-start: 5px; color: var(--muted); }
.radio-card input { accent-color: var(--amber); }
.radio-card:has(input:checked) { border-color: var(--amber); }
.settings-section { display: flex; flex-direction: column; gap: 8px; }
input[type="text"], input[type="password"], select { background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 8px; border-radius: 3px; font-size: 14px; width: 100%; }
.hint-text { font-size: 12px; color: var(--muted); }
.btn-save { padding: 10px 12px; font-size: 13px; }
.end-desc { font-size: 14px; line-height: 1.6; }
.end-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.end-actions > * { flex: 1 1 130px; }
.btn-action-link { text-align: center; text-decoration: none; }
.share-modal { margin: auto; width: calc(100% - 32px); max-width: 560px; max-height: calc(100% - 32px); overflow: auto; color: var(--text); }
.share-modal::backdrop { background: #030906db; }
.share-poster { display: block; width: 100%; height: auto; border: 3px double var(--border); border-radius: 3px; }
.share-address { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }

.language-modal {
  max-width: 450px;
  background: radial-gradient(ellipse at 50% 0, #384b31 0%, #16231a 67%);
  border: 3px double #d1ae72;
}
.language-modal .modal-body { padding: clamp(20px, 5vw, 40px); gap: 22px; text-align: center; }
.language-modal h2 { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; color: var(--text); font-size: 16px; font-weight: 600; }
.language-modal h2 span + span { color: var(--muted); }
.language-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.language-options button { min-height: 46px; font-size: 14px; }

/* 游戏按钮共用压边和按压反馈，主要行动使用金色。 */
:is(.btn-top, .btn-mulligan, .power-btn, .end-turn-btn, .btn-save, .modal-close) {
  background: linear-gradient(var(--button-top, #3b4330), #151c14 90%);
  border: 1px solid var(--button-edge, #a68a55);
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px #120f0a, inset 0 0 0 3px #f3d69633, 0 3px 0 #080e0a;
  color: var(--text);
  cursor: pointer;
  font-weight: 750;
  transition: transform 0.13s ease, filter 0.13s ease, box-shadow 0.13s ease;
}
:is(.end-turn-btn, .btn-save:not(.btn-secondary), #btn-share-game) {
  background: linear-gradient(#f3d295, #c19453 54%, #a9783b);
  border-color: #f5cf90;
  box-shadow: inset 0 0 0 2px #745222, inset 0 0 0 3px #ffdb99a6, 0 3px 0 #29190d;
  color: #221609;
}
:is(.btn-top, .btn-mulligan, .power-btn, .end-turn-btn, .btn-save, .modal-close):hover:not(:disabled) {
  filter: brightness(1.16);
  transform: translateY(-1px);
}
:is(.btn-top, .btn-mulligan, .power-btn, .end-turn-btn, .btn-save, .modal-close):active:not(:disabled) {
  transform: translateY(2px);
}
button:disabled { opacity: 0.52; cursor: not-allowed; }
:focus-visible { outline: 2px solid #ffdc94; outline-offset: 3px; }

.inf-badge { font-size: 12px; color: #d8b4fe; }
.cat-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid;
  background: var(--bg);
}
.passive-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  width: fit-content;
}
.enemy-passive { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.35); }
.hero-passive { background: rgba(34, 197, 94, 0.16); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.35); cursor: help; }
.affix-tag {
  font-size: 10px;
  font-weight: 800;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 4px;
  padding: 1px 5px;
  text-align: center;
}
.stance-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stance-card.active { border-color: var(--cyan); background: rgba(56, 189, 248, 0.12); }
.stance-card p { font-size: 12px; color: var(--muted); }

@media (max-width: 1024px) {
  .player-zone { grid-template-columns: minmax(0, 1fr) minmax(130px, 0.55fr); }
  .hand-zone { grid-column: 1 / -1; }
  .end-turn-dock { grid-column: 2; grid-row: 1; }
}

@media (max-width: 880px) {
  .top-bar {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "brand turn" "goal goal" "controls controls";
  }
  .top-btns { justify-content: flex-start; }
  .score-bar-wrap {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .score-bar-wrap .enemy-side { text-align: right; }
  .seats-row {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .seat-portrait-frame { width: min(100%, 58px); }
}

@media (max-width: 700px) {
  .hand-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .top-bar {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "brand" "turn" "goal" "controls";
    padding: 10px;
  }
  .top-btns { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .top-btns .btn-top { grid-column: span 2; min-height: 36px; padding-inline: 5px; }
  .top-btns .btn-top:nth-child(n+4) { grid-column: span 3; }
  .enemy-pod {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 8px;
  }
  .enemy-border { width: 76px; height: 76px; }
  .enemy-pod .speech-bubble { grid-column: 1 / -1; }
  .battlefield { padding-inline: 10px; }
  .clash-stage { min-height: 150px; }
  .player-zone { grid-template-columns: minmax(0, 1fr); }
  .end-turn-dock { grid-column: 1; grid-row: auto; }
  .hand-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 即时自定义悬停提示浮窗 */
.custom-tooltip {
  position: fixed;
  z-index: 999;
  max-width: 280px;
  background: #101b14fa;
  border: 1px solid #a78b56;
  color: var(--text);
  padding: 8px 11px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65);
  pointer-events: none;
  white-space: pre-line;
}
.custom-tooltip.warn {
  border-color: var(--red);
  color: #fecaca;
}
.unplayable-reason {
  font-size: 10px;
  font-weight: 800;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.22);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 4px;
  padding: 2px 4px;
  text-align: center;
}

/* 打出卡牌冲击波与粒子特效 */
.clash-shockwave {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 4px solid var(--cyan);
  box-shadow: 0 0 24px var(--cyan);
  animation: shockwaveExpand 0.65s ease-out forwards;
  pointer-events: none;
}
.clash-shockwave.enemy {
  border-color: var(--red);
  box-shadow: 0 0 24px var(--red);
}
@keyframes shockwaveExpand {
  0% { transform: scale(0.4); opacity: 0.95; }
  100% { transform: scale(2.8); opacity: 0; }
}

.fx-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  pointer-events: none;
  animation: particleBurst 0.65s ease-out forwards;
}
.fx-particle.enemy {
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
}
@keyframes particleBurst {
  0% { transform: translate(0, 0) scale(1.2); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0.2); opacity: 0; }
}

.hero-hit {
  animation: heroShake 0.42s ease;
}
@keyframes heroShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); filter: brightness(1.3); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

.affix-tag.negative {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.55);
}

.modal-end {
  max-width: 560px;
}
.end-scene-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
  border: 3px double var(--border);
}

@media (prefers-reduced-motion: reduce) {
  .hs-table *, .modal * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
