@import url('./hand-card.css?v=siegewait1');

* { box-sizing: border-box; }
html, body {
  scrollbar-gutter: stable;
  margin: 0;
  height: 100%;
  height: 100dvh;
  background: #0a0e16;
  color: var(--hs-text, #e8eef8);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
}
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  max-width: min(1200px, 100vw);
  margin: 0 auto;
  min-height: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(61,124,255,.12), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(212,168,75,.08), transparent 40%),
    #0c121e;
}

/* —— Top bar —— */
#top-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(212,168,75,.25);
  background: rgba(8,12,20,.9);
  z-index: 5;
  flex-shrink: 0;
  min-height: 0;
}
#top-bar h1 {
  font-size: 1rem;
  margin: 0;
  color: var(--hs-gold, #d4a84b);
  letter-spacing: .06em;
  white-space: nowrap;
}
#turn-banner {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: var(--hs-cyan, #3ecfbf);
  text-shadow: 0 0 12px rgba(62, 207, 191, 0.35);
}
/* turn round emphasis */
#turn-banner.enemy { color: #ff8a3d; }
.enemy-mana {
  font-size: .85rem;
  color: var(--hs-muted, #8a97b0);
  min-width: 72px;
  text-align: right;
}

/* —— Hints / toast —— */
#target-hint, #toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  padding: 8px 16px;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  max-width: 90vw;
  text-align: center;
}
#target-hint {
  top: 52px;
  background: rgba(20,40,60,.95);
  border: 1px solid var(--hs-cyan, #3ecfbf);
  color: #c8f0ff;
}
#toast {
  bottom: calc(var(--hand-h, 210px) + 12px);
  background: rgba(40,20,10,.95);
  border: 1px solid var(--hs-gold, #d4a84b);
}
#target-hint.show, #toast.show { opacity: 1; }

/* 蔡文姬悲歌：必须先弃牌，手牌不再显示成“可以打出” */
#discard-banner {
  display: none;
}
#hand-area.discard-must {
  position: relative;
}
#hand-area.discard-must #discard-banner {
  display: block;
  position: absolute;
  left: 50%;
  top: 4px;
  transform: translateX(-50%);
  z-index: 60;
  margin: 0;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(92, 18, 12, 0.96);
  border: 2px solid #ff5a32;
  color: #fff4ec;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 0 18px rgba(255, 90, 50, 0.55);
  animation: discard-banner-pulse 1s ease-in-out infinite;
}
#stage.discard-must #battlefield {
  filter: brightness(0.62);
}
#stage.discard-must #btn-end-turn,
#stage.discard-must #btn-sacrifice,
#stage.discard-must #btn-lord-skill {
  filter: grayscale(0.4) brightness(0.75);
}
.hand-slot.discard-pick .card {
  border-color: #ff5a32 !important;
  box-shadow: 0 0 0 2px #ff5a32, 0 0 16px rgba(255, 90, 50, 0.65) !important;
  animation: discard-card-pulse 1s ease-in-out infinite;
}
.hand-slot.discard-pick .card::after {
  content: '点此弃牌';
  position: absolute;
  left: 8px;
  right: 8px;
  top: 46%;
  z-index: 6;
  text-align: center;
  padding: 5px 0;
  border-radius: 6px;
  background: rgba(120, 24, 16, 0.92);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  pointer-events: none;
}
@keyframes discard-banner-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.04); }
}
@keyframes discard-card-pulse {
  0%, 100% { box-shadow: 0 0 0 2px #ff5a32, 0 0 10px rgba(255, 90, 50, 0.45); }
  50% { box-shadow: 0 0 0 3px #ffd0c2, 0 0 22px rgba(255, 90, 50, 0.9); }
}

/* —— Table —— */
#game-table {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}
#combat-log {
  padding: 8px;
  overflow-y: auto;
  font-size: .7rem;
  line-height: 1.35;
  color: var(--hs-muted, #8a97b0);
  border-right: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.25);
}
.log-line {
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.log-line:first-child { color: #c5d8ff; }

#battlefield {
  display: flex;
  flex-direction: column;
  padding: 4px 10px;
  gap: 4px;
  min-height: 0;
  overflow: hidden;
}

/* —— Mages —— */
.mage-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.mage-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1a2438, #121820);
  border: 1px solid #3a4a68;
  min-width: 0;
  max-width: 100%;
}
.mage-card.low-hp { border-color: #e04545; box-shadow: 0 0 12px rgba(224,69,69,.35); }
.mage-art {
  width: 40px;
  height: auto;
  aspect-ratio: 2 / 3;
  border-radius: 50%;
  overflow: hidden;
  background-size: cover;
  background-position: center top;
  border: 2px solid var(--hs-gold, #d4a84b);
  flex-shrink: 0;
}
.mage-info { min-width: 0; }
.mage-name {
  font-weight: 700;
  color: var(--hs-gold, #d4a84b);
  font-size: .9rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.mage-hp { font-size: .95rem; font-weight: 800; white-space: nowrap; }
.hp-num { color: #ff6b6b; }
.mage-meta { font-size: .7rem; color: var(--hs-muted, #8a97b0); }

#hud-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
#mana-display {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-weight: 800;
}
.mana-gem {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 粮草 amber */
  background: radial-gradient(circle at 35% 30%, #ffe08a, #d4a017);
  border: 1px solid #c5d8ff;
  font-size: 1.1rem;
}
.mana-max { color: var(--hs-muted, #8a97b0); font-size: .9rem; }

.btn-resign {
  cursor: pointer;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: .8rem;
  color: #ffb4a8;
  background: transparent;
  border: 1px solid rgba(255, 90, 50, 0.7);
}
.btn-resign.armed {
  color: #1a1208;
  background: #ff5a32;
  border-color: #ff5a32;
}
.btn-resign:disabled {
  opacity: 0.45;
  cursor: default;
}

#match-chat {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#match-chat-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 8px 6px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  line-height: 1.35;
  color: #d5deea;
  scrollbar-width: thin;
  scrollbar-color: #c9a14a rgba(0, 0, 0, 0.28);
}
#match-chat-log::-webkit-scrollbar {
  width: 7px;
}
#match-chat-log::-webkit-scrollbar-track {
  margin: 4px 0;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 999px;
}
#match-chat-log::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #f0d78c, #a67c2d);
  border-radius: 999px;
  border: 1px solid rgba(42, 28, 8, 0.55);
}
#match-chat-log::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ffe7ad, #c4963a);
}
.match-chat-line {
  margin: 0 0 4px;
  word-break: break-word;
}
.match-chat-line .who {
  font-weight: 700;
}
.match-chat-line.mine .who { color: #ffd08a; }
.match-chat-line.foe .who { color: #7ec8ff; }
.match-chat-row {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
}
#match-chat-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 5px 6px;
  border-radius: 6px;
  border: 1px solid #3a4a66;
  background: #141c28;
  color: #e8eef8;
  font: inherit;
  font-size: 0.72rem;
}
#match-chat-send {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #c9a227;
  background: rgba(60, 40, 12, 0.9);
  color: #f0d78c;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-end, .btn-sac, #btn-again {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: .8rem;
  color: #fff;
}
.btn-end {
  background: linear-gradient(180deg, #3d7cff, #1a4ab0);
  border: 1px solid #7eb0ff;
}
.btn-end:hover:not(:disabled) { filter: brightness(1.1); }
.btn-end:disabled { opacity: .45; cursor: not-allowed; }
.btn-sac {
  background: linear-gradient(180deg, #6a3a8a, #3a1848);
  border: 1px solid #a855f7;
}
.btn-sac.active {
  box-shadow: 0 0 12px rgba(168,85,247,.6);
  outline: 2px solid #c9a227;
}
.btn-sac:disabled { opacity: .45; cursor: not-allowed; }

/* —— Lanes —— */
.lane-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(3px, 0.6vw, 8px);
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  align-content: stretch;
}
.lane-bridge {
  text-align: center;
  font-size: .7rem;
  color: var(--hs-gold-dim, #8a6a28);
  padding: 2px 4px;
  letter-spacing: .12em;
  background: linear-gradient(90deg, transparent, rgba(212,168,75,.12), transparent);
  border-top: 1px solid rgba(212,168,75,.15);
  border-bottom: 1px solid rgba(212,168,75,.15);
  flex-shrink: 0;
}

.lane-slot {
  position: relative;
  border-radius: 10px;
  border: 1px dashed rgba(90,106,136,.5);
  background: rgba(20,28,42,.55);
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  cursor: default;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.lane-slot.empty .slot-label {
  margin: auto;
  color: rgba(138,151,176,.45);
  font-size: .85rem;
  font-weight: 700;
}
.lane-slot.targetable {
  border: 2px solid #5dff8a;
  box-shadow: 0 0 14px rgba(93,255,138,.35);
  background: rgba(30,60,40,.45);
  cursor: pointer;
}
.lane-slot.targetable:hover {
  filter: brightness(1.12);
}
.lane-slot.can-swap {
  border: 2px solid #7fd4c0;
  cursor: pointer;
}
.lane-slot.swap-source {
  border: 2px solid #d4a84b;
  cursor: pointer;
}
.lane-slot.fort-ready {
  border: 2px solid #f0c14a;
  cursor: pointer;
  animation: fort-pulse 1.05s ease-in-out infinite;
}
.lane-slot.fort-ready.fort-aiming {
  border-color: #fff4cc;
  animation: none;
  box-shadow: 0 0 0 3px rgba(255, 236, 170, 0.85), 0 0 22px rgba(240, 193, 74, 0.95);
}
.fort-fire-tip {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  z-index: 6;
  pointer-events: none;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f0c14a;
  color: #2a1604;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
@keyframes fort-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(240, 193, 74, 0.45), 0 0 8px rgba(240, 193, 74, 0.35);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(255, 226, 140, 0.85), 0 0 22px rgba(240, 193, 74, 0.95);
  }
}

.unit {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #5a6a88;
  background: #151c28;
  min-height: 0;
}
.unit.legendary { border-color: var(--hs-gold, #d4a84b); }
.unit.epic { border-color: #a855f7; }
.unit.rare { border-color: #3b82f6; }
.unit-art {
  flex: 1 1 auto;
  min-height: 0;
  background-size: cover;
  background-position: center top;
  background-color: #222;
}
.unit-name {
  font-size: clamp(.5rem, 1.1vw, .58rem);
  text-align: center;
  padding: 1px 2px;
  color: var(--hs-gold, #d4a84b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.unit-stats {
  display: flex;
  justify-content: space-between;
  padding: 1px 4px 3px;
  font-weight: 800;
  font-size: clamp(.7rem, 1.4vw, .8rem);
  flex-shrink: 0;
}
.u-atk { color: #ddd; }
.u-def { color: #7eb0ff; }
.u-hp { color: #ff6b6b; }
.u-hp.hurt { color: #ffb347; }
.unit-stats {
  gap: 2px;
  flex-wrap: wrap;
  justify-content: space-around;
}

/* —— Overlay —— */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.overlay.show { display: flex; }
.panel {
  background: linear-gradient(180deg, #1a2438, #0e1420);
  border: 1px solid var(--hs-gold, #d4a84b);
  border-radius: 16px;
  padding: 28px 36px;
  text-align: center;
  max-width: 420px;
}
.panel h2 { color: var(--hs-gold, #d4a84b); margin: 0 0 8px; }
.panel p { color: var(--hs-muted, #8a97b0); margin: 0 0 18px; }
#gameover-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
#gameover [hidden] { display: none !important; }
#btn-leave,
#btn-home {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid #8a97b0;
  background: transparent;
  color: #e7eefc;
  font-weight: 700;
  cursor: pointer;
}
#gameover-wait { color: #f0d78c; }

@media (max-width: 1000px) {
  #game-table { grid-template-columns: 1fr; }
  #combat-log { display: none; }
}
@media (max-height: 860px) {
  /* card/hand sizes owned by hand-card.css — do not override here */
  .mage-art { width: 40px; height: auto; aspect-ratio: 2 / 3; }
}
@media (max-height: 720px) {
  #top-bar { padding: 4px 8px; }
  #top-bar h1 { font-size: .85rem; }
  #battlefield { padding: 2px 6px; gap: 2px; }
  .btn-end, .btn-sac, #btn-again { padding: 6px 10px; font-size: .72rem; }
}
@media (max-width: 800px) {
  .lane-row { gap: 3px; }
  #top-bar h1 { max-width: 28vw; overflow: hidden; text-overflow: ellipsis; }
}

/* layout-fix-v4: CSS grid pins hand on screen */
html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden !important;
}
#app {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) var(--hand-h, 210px) !important;
  grid-template-columns: 1fr !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  max-width: min(1200px, 100vw);
  margin: 0 auto;
  overflow: hidden !important;
  min-height: 0 !important;
}
#top-bar {
  grid-row: 1;
  flex: unset !important;
}
#game-table {
  grid-row: 2;
  min-height: 0 !important;
  height: auto !important;
  overflow: hidden !important;
  display: grid !important;
  grid-template-columns: minmax(0, 140px) minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
}
#combat-log {
  min-height: 0 !important;
  overflow: auto !important;
}
#battlefield {
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 4px 8px !important;
  gap: 4px !important;
}
.lane-row {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  max-height: none !important;
}
.mage-row, .lane-bridge {
  flex: 0 0 auto !important;
}
#hand-area {
  grid-row: 3 !important;
  height: var(--hand-h, 210px) !important;
  min-height: var(--hand-h, 210px) !important;
  max-height: var(--hand-h, 210px) !important;
  overflow: hidden !important;
}
@media (max-width: 960px) {
  #game-table { grid-template-columns: 1fr !important; }
  #combat-log { display: none !important; }
}

/* 粮草（原法力）琥珀金 */
#mana-display, .mana-gem, .cost-gem {
  --mana-accent: #e8b84a;
}
.mana-pip.filled, .cost-gem {
  background: linear-gradient(145deg, #f0d078, #c4892a) !important;
  box-shadow: 0 0 6px rgba(232,184,74,.45);
}


/* ===== layout: left player / center lanes / right enemy ===== */
#app {
  grid-template-rows: auto 56px minmax(0, 1fr) var(--hand-h, 210px) !important;
}

/* ===== 敌方手牌（顶栏下，张数可见） ===== */
#enemy-hand-row {
  flex: 0 0 56px;
  flex-grow: 0;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  position: relative;
  z-index: 3;
  overflow: hidden; /* 牌背旋转不撑高整页，避免对方出牌时界面上下跳 */
  contain: layout style;
  background: linear-gradient(180deg, rgba(40, 16, 12, 0.55), transparent);
  border-bottom: 1px solid rgba(255, 120, 60, 0.15);
  box-sizing: border-box;
}
.enemy-hand-count {
  flex: 0 0 auto;
  align-self: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ffb07a;
  background: rgba(80, 30, 10, 0.55);
  border: 1px solid rgba(255, 140, 60, 0.35);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
#enemy-hand-backs {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  max-width: min(640px, 70vw);
  overflow: visible;
}
.enemy-back {
  width: 34px;
  height: 48px;
  margin-left: -16px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.06), transparent 40%),
    repeating-linear-gradient(135deg, #2a1830 0 6px, #1c1024 6px 12px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  flex: 0 0 auto;
  position: relative;
}
.enemy-back:first-child { margin-left: 0; }
.enemy-back-more {
  align-self: center;
  margin-left: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffb07a;
  opacity: 0.9;
}
.enemy-back-empty {
  font-size: 0.7rem;
  color: var(--hs-muted, #8a97b0);
  opacity: 0.7;
  padding: 8px 0;
}


#game-table {
  display: grid !important;
  grid-template-columns: minmax(140px, 200px) minmax(0, 1fr) minmax(140px, 200px) !important;
  gap: 0;
  min-height: 0;
  overflow: hidden;
  flex: 1 1 auto;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  min-height: 0;
  overflow: hidden;
  background: rgba(0,0,0,.22);
}
#player-panel {
  border-right: 1px solid rgba(255,255,255,.06);
}
#enemy-panel {
  border-left: 1px solid rgba(255,255,255,.06);
  align-items: stretch;
}
#enemy-panel .mage-card {
  flex-direction: row-reverse;
  text-align: right;
}
#enemy-panel .mage-info { text-align: right; }
/* 敌方主公技铭牌：敌方粮草正下方，只读（悬停 tip 可读说明，不施放） */
#enemy-lord-skill,
.enemy-lord-skill {
  align-self: flex-end;
  box-sizing: border-box;
  min-width: 4.8em;
  max-width: 100%;
  margin: 0;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.75rem;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  color: #2a2210;
  background: linear-gradient(180deg, #d8c078, #a88a2e);
  border: 1px solid #c9b06a;
  opacity: 0.78;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto; /* 允许悬停 tip；点击不绑施放 */
}
#enemy-lord-skill.used,
.enemy-lord-skill.used {
  opacity: 0.32;
  color: #9a9a9a;
  background: linear-gradient(180deg, #6e6e6e, #3c3c3c);
  border-color: #555;
  filter: grayscale(1);
}
#enemy-panel .enemy-mana {
  text-align: center;
  font-size: .9rem;
  font-weight: 700;
  color: #ffb07a;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(80,30,10,.35);
  border: 1px solid rgba(255,140,60,.25);
  min-width: 0;
}

#player-panel .mage-card,
#enemy-panel .mage-card {
  width: 100%;
  max-width: none;
  cursor: pointer;
}
#hud-controls {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}
#hud-controls .btn-end,
#hud-controls .btn-sac {
  width: 100%;
}
.hud-pair {
  display: flex;
  gap: 6px;
}
.hud-pair > button {
  flex: 1 1 0;
  min-width: 0;
}
#btn-auto {
  cursor: pointer;
  border-radius: 8px;
  padding: 8px 6px;
  font-weight: 700;
  font-size: .8rem;
  color: #f0d78c;
  background: transparent;
  border: 1px solid rgba(201, 162, 39, 0.75);
}
#btn-auto.is-on {
  color: #1a1208;
  background: #c9a227;
  border-color: #c9a227;
}
#mana-display {
  justify-content: center;
}

#combat-log {
  flex: 1 1 auto;
  min-height: 0;
  border-right: none;
  border-left: none;
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: 4px;
  padding-top: 6px;
  background: transparent;
}
/* 战报锚定右侧敌方面板，不遮挡中路与手牌 */
#enemy-panel #combat-log {
  align-self: stretch;
  width: 100%;
  text-align: left;
}

#battlefield {
  padding: 6px 8px;
  gap: 6px;
  justify-content: center;
}
#battlefield .lane-row {
  flex: 1 1 0;
}

/* app uses flex column; ensure enemy-hand-row sits under top-bar */
#app {
  display: flex !important;
  flex-direction: column !important;
}


/* ===== final layout lock (left me / right foe / top backs) ===== */
#app {
  display: flex !important;
  flex-direction: column !important;
  height: 100dvh !important;
  max-width: min(1280px, 100vw);
}
#top-bar { flex: 0 0 auto; }
#enemy-hand-row { flex: 0 0 56px; height: 56px; min-height: 56px; max-height: 56px; overflow: hidden; }
#game-table {
  flex: 1 1 auto !important;
  display: grid !important;
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr) minmax(150px, 210px) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
#hand-area {
  flex: 0 0 var(--hand-h, 210px) !important;
  height: var(--hand-h, 210px) !important;
}
#combat-log { width: auto !important; max-width: none !important; }
.mage-row { display: none !important; } /* old rows removed from DOM */


/* 粮草显示：敌我统一 🌾 胶囊 */
.grain-pip,
#mana-display.grain-pip,
#enemy-mana-pips,
#enemy-panel .enemy-mana {
  display: block;
  text-align: center;
  font-size: .95rem;
  font-weight: 700;
  color: #ffb07a;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(80, 30, 10, 0.35);
  border: 1px solid rgba(255, 140, 60, 0.25);
  letter-spacing: 0.02em;
}
#player-panel #mana-display.grain-pip {
  color: #ffd08a;
  background: rgba(90, 55, 10, 0.4);
  border-color: rgba(232, 184, 74, 0.35);
}


/* ===== Board uses same layout-B card face as hand (no layout overrides) ===== */
.lane-slot {
  overflow: visible; /* allow lunge past slot */
  padding: 3px;
}
.lane-slot .board-card,
.lane-slot .card.layout-b.board-card {
  width: 100%;
  height: 100%;
  max-height: 100%;
  aspect-ratio: 110 / 154;
  margin: 0 auto;
  box-shadow: 0 4px 12px rgba(0,0,0,.5);
  pointer-events: none;
  /* inherit all hand-card.css layout-B rules unchanged */
}
.lane-slot.empty .board-card { display: none; }

/* hide old compact unit chrome if any leftover */
.lane-slot .unit { display: none; }

@keyframes lunge-up {
  0% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-18px) scale(1.04); }
  45% { transform: translateY(-42px) scale(1.1); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes lunge-down {
  0% { transform: translateY(0) scale(1); }
  25% { transform: translateY(18px) scale(1.04); }
  45% { transform: translateY(42px) scale(1.1); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes hit-shake {
  0%, 100% { transform: translateX(0); filter: brightness(1); }
  15% { transform: translateX(-9px) rotate(-2deg); filter: brightness(1.55); }
  35% { transform: translateX(9px) rotate(2deg); filter: brightness(1.35); }
  55% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
@keyframes face-flash {
  0%, 100% { filter: brightness(1); box-shadow: none; }
  40% { filter: brightness(1.7); box-shadow: 0 0 26px rgba(255,120,60,.6); }
}

.board-card.atk-lunge-up {
  animation: lunge-up .42s cubic-bezier(.2,.7,.3,1);
  position: relative;
  z-index: 80 !important;
}
.board-card.atk-lunge-down {
  animation: lunge-down .42s cubic-bezier(.2,.7,.3,1);
  position: relative;
  z-index: 80 !important;
}
.lane-slot:has(.atk-lunge-up),
.lane-slot:has(.atk-lunge-down) {
  z-index: 80 !important;
}
.lane-row:has(.atk-lunge-up),
.lane-row:has(.atk-lunge-down) {
  z-index: 80 !important;
}
.board-card.hit-shake { animation: hit-shake .34s ease; }
.mage-card.face-hit { animation: face-flash .35s ease; }


/* ===== Card hover tip (spell / creature) ===== */
.card-tip {
  position: fixed;
  z-index: 2000;
  min-width: 180px;
  max-width: 260px;
  padding: 10px 12px 12px;
  border-radius: 10px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
  background: rgba(10, 16, 28, 0.82);
  border: 1px solid rgba(232, 184, 74, 0.35);
  box-shadow: 0 10px 28px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #e8eef8;
  font-size: .78rem;
  line-height: 1.35;
}
.card-tip.show {
  opacity: 1;
  transform: translateY(0);
}
/* tip lift */
.card-tip { max-width: 340px; font-size: .74rem; }
.hand-area, #player-hand { z-index: 40; }
.card-tip { z-index: 5200; }

.card-tip .tip-name {
  font-weight: 800;
  font-size: .95rem;
  color: #ffe6a8;
  margin-bottom: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}

/* Rarity text matches card frame colors */
.rarity-common { color: #5a6a88; font-weight: 700; }
.rarity-rare { color: #3b82f6; font-weight: 700; }
.rarity-epic { color: #a855f7; font-weight: 700; }
.rarity-legendary { color: var(--hs-gold, #d4a84b); font-weight: 700; }
.card-tip .tip-meta .rarity-common,
.card-tip .tip-meta .rarity-rare,
.card-tip .tip-meta .rarity-epic,
.card-tip .tip-meta .rarity-legendary { font-weight: 800; }
#codex-detail-body .rarity-common,
#codex-detail-body .rarity-rare,
#codex-detail-body .rarity-epic,
#codex-detail-body .rarity-legendary { font-weight: 800; }

.card-tip .tip-meta {
  font-size: .7rem;
  color: #9aa8c0;
  margin-bottom: 8px;
}
.card-tip .tip-body {
  color: #d5deee;
  white-space: pre-wrap;
}
.card-tip .tip-bonds {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(232, 184, 74, 0.22);
}
.card-tip .tip-bond-hd {
  color: #e8b84a;
  font-weight: 700;
  margin-bottom: 4px;
}
.card-tip .tip-bond-item {
  color: #d5deee;
  margin-top: 3px;
  line-height: 1.4;
}
.card-tip .tip-bond-name {
  color: #ffe6a8;
  font-weight: 700;
}
.card-tip .tip-stats {
  margin: 0 0 8px;
  font-size: .72rem;
  color: #c8d6a8;
}


/* Three.js spell VFX overlay */
#spell-fx {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.05s linear;
}


/* ---- Boot preload overlay ---- */
#boot-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a2238 0%, #0b0f1a 70%);
  color: #e8eefc;
  transition: opacity 0.28s ease;
}
#boot-loader.boot-hide {
  opacity: 0;
  pointer-events: none;
}
#boot-loader .boot-card {
  width: min(420px, 86vw);
  padding: 28px 26px 24px;
  border-radius: 14px;
  background: rgba(20, 28, 48, 0.92);
  border: 1px solid rgba(120, 150, 220, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  text-align: center;
}
#boot-loader h2 {
  margin: 0 0 10px;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  font-weight: 700;
}
#boot-text {
  margin: 0 0 16px;
  font-size: 0.92rem;
  color: #b8c6e6;
  min-height: 1.4em;
}
.boot-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
#boot-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #a855f7, #f59e0b);
  transition: width 0.12s linear;
}

/* ---- Spell card fly-across ---- */
#fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 8000;
  overflow: hidden;
}
.spell-fly-card {
  position: fixed;
  left: 0;
  top: 0;
  width: 132px;
  height: 184px;
  z-index: 8001;
  pointer-events: none;
  transform: var(--fx0);
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 18px rgba(168, 85, 247, 0.45));
  opacity: 0;
}
.spell-fly-card .card {
  width: 100%;
  height: 100%;
  transform: none !important;
}
.spell-fly-card.is-flying {
  animation: spell-fly-across 0.82s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.card-return-ghost {
  position: fixed;
  left: 0;
  top: 0;
  margin: 0;
  z-index: 8002;
  pointer-events: none;
  transform-origin: top left;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.45));
}
.cicada-shell {
  filter: sepia(1) saturate(2.6) brightness(1.45);
  box-shadow: 0 0 28px rgba(240, 215, 140, 0.9);
}
.cicada-fly {
  filter: drop-shadow(0 0 18px rgba(240, 200, 80, 0.95));
}
.cicada-ring {
  position: fixed;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(240, 215, 140, 0.95);
  border-radius: 50%;
  z-index: 8003;
  pointer-events: none;
  animation: cicada-ring-out 0.7s ease-out forwards;
}
.cicada-mote {
  position: fixed;
  width: 7px;
  height: 7px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #f0d78c;
  box-shadow: 0 0 10px #ffe082;
  z-index: 8004;
  pointer-events: none;
}
@keyframes cicada-ring-out {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(7); }
}
@keyframes spell-fly-across {
  0% {
    opacity: 0;
    transform: var(--fx0);
  }
  12% {
    opacity: 1;
  }
  42% {
    opacity: 1;
    transform: var(--fx1);
  }
  100% {
    opacity: 0;
    transform: var(--fx2);
  }
}

/* ===== combat-log scrollbar ===== */
#combat-log {
  scrollbar-width: thin;
  scrollbar-color: #8a6a28 #121a28;
}
#combat-log::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
#combat-log::-webkit-scrollbar-track {
  background: linear-gradient(90deg, #0a1018, #121a28);
  border-radius: 99px;
  border: 1px solid #1e2838;
  margin: 4px 0;
}
#combat-log::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #c9a227, #6a5020);
  border-radius: 99px;
  border: 2px solid #121a28;
  box-shadow: inset 0 0 0 1px rgba(240, 215, 140, 0.35);
}
#combat-log::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #f0d78c, #8a6a28);
}
#combat-log::-webkit-scrollbar-corner {
  background: transparent;
}

/* ===== LAYOUT STABILITY LOCK (jitter) ===== */
html, body {
  height: 100dvh !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
  overflow-anchor: none !important;
}
#app {
  display: flex !important;
  flex-direction: column !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
  overflow-anchor: none !important;
  contain: layout;
  /* kill conflicting grid from earlier rules */
  grid-template-rows: none !important;
  grid-template-columns: none !important;
}
#top-bar {
  flex: 0 0 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  flex-wrap: nowrap !important;
}
#turn-clock {
  display: none;
  min-width: 3.2em;
  height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid #f0d78c;
  background: rgba(20, 16, 8, 0.9);
  color: #f0d78c;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 24px;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
#turn-clock.show { display: inline-block; }
#turn-clock.urgent {
  color: #ff5a32;
  border-color: #ff5a32;
  box-shadow: 0 0 16px rgba(255, 90, 50, 0.45);
}
.lord-skill-flash {
  position: absolute;
  z-index: 7300;
  transform: translate(-50%, 0);
  pointer-events: none;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(16, 12, 6, 0.94);
  border: 1px solid #c9a227;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #f0d78c;
  white-space: nowrap;
  animation: turn-flash-in 0.9s ease forwards;
}
.lane-slot.lord-fx-hit,
.lane-slot.empty.lord-fx-hit {
  box-shadow: inset 0 0 0 3px #ff6644, 0 0 22px rgba(255, 80, 40, 0.95) !important;
  animation: lord-hit-pulse 0.65s ease;
}
@keyframes lord-hit-pulse {
  0% { filter: brightness(2.4) saturate(1.4); }
  100% { filter: none; }
}
.lane-slot.lord-fx-heal {
  box-shadow: inset 0 0 0 3px #7dffb0, 0 0 18px rgba(125, 255, 176, 0.75);
  animation: lord-hit-pulse 0.65s ease;
}
.lane-slot.lord-fx-buff {
  box-shadow: inset 0 0 0 3px #f0d78c, 0 0 18px rgba(240, 215, 140, 0.8);
  animation: lord-hit-pulse 0.65s ease;
}
#mana-display.lord-mana-flash,
#enemy-mana-pips.lord-mana-flash {
  animation: lord-hit-pulse 0.7s ease;
  box-shadow: 0 0 18px rgba(240, 215, 140, 0.9);
}
.lane-slot.flood-hit {
  box-shadow: inset 0 0 0 3px #8fd4ff, 0 0 22px rgba(41, 182, 246, 0.9);
  animation: flood-wash 0.375s ease;
}
#scry-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 4500;
  background: rgba(8, 10, 14, 0.72);
  align-items: center;
  justify-content: center;
}
#scry-overlay.show { display: flex; }
.scry-panel {
  text-align: center;
  color: #f3e6c0;
}
.scry-panel h2 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: 0.2em;
}
.scry-panel p {
  margin: 0 0 18px;
  color: rgba(243, 230, 192, 0.75);
}
#scry-cards {
  display: flex;
  gap: 18px;
  justify-content: center;
  align-items: flex-end;
  min-height: 180px;
}
.scry-choice {
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  animation: scry-rise 0.35s ease both;
}
.scry-choice .card {
  width: var(--card-w);
  height: var(--card-h);
  pointer-events: none;
}
.scry-choice:nth-child(2) { animation-delay: 0.06s; }
.scry-choice:nth-child(3) { animation-delay: 0.12s; }
.scry-choice:hover { transform: translateY(-10px); }
.scry-choice.chosen { transform: translateY(-16px) scale(1.04); }
.scry-choice.discarded {
  opacity: 0.28;
  transform: translateY(18px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#scry-cancel {
  margin-top: 18px;
  padding: 6px 18px;
  border: 1px solid rgba(243, 230, 192, 0.45);
  background: transparent;
  color: #f3e6c0;
  cursor: pointer;
}
@keyframes scry-rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes flood-wash {
  0% { filter: brightness(1.55) saturate(1.3); }
  100% { filter: none; }
}
#turn-flash {
  position: absolute;
  inset: 0;
  z-index: 7200;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
}
#turn-flash.show { animation: turn-flash-in 1.15s ease forwards; }
#turn-flash .turn-flash-card {
  text-align: center;
  background: none;
  border: none;
  box-shadow: none;
  transform: translateY(-88px) scale(0.86);
}
#turn-flash.show .turn-flash-card { animation: turn-card-pop 0.7s cubic-bezier(0.16, 0.84, 0.32, 1) forwards; }
#turn-flash.mine .turn-flash-card,
#turn-flash.enemy .turn-flash-card {
  background: none;
  border: none;
  box-shadow: none;
}
.turn-flash-kicker {
  letter-spacing: 0.42em;
  font-size: 0.95rem;
  color: #e7eefc;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}
#turn-flash.mine .turn-flash-title { color: #f0d78c; }
#turn-flash.enemy .turn-flash-title { color: #ff8a3d; }
.turn-flash-title {
  margin-top: 8px;
  font-size: 3.4rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-shadow: 0 6px 28px rgba(0, 0, 0, 0.92), 0 0 18px rgba(0, 0, 0, 0.65);
}
@keyframes turn-flash-in {
  0% { opacity: 0; }
  12% { opacity: 1; }
  72% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes turn-card-pop {
  0% { transform: translateY(-48px) scale(0.72); }
  55% { transform: translateY(-96px) scale(1.06); }
  100% { transform: translateY(-88px) scale(1); }
}
#enemy-hand-row {
  flex: 0 0 56px !important;
  height: 56px !important;
  min-height: 56px !important;
  max-height: 56px !important;
  overflow: hidden !important;
}
#game-table {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  contain: layout;
}
#hand-area {
  flex: 0 0 210px !important;
  height: 210px !important;
  min-height: 210px !important;
  max-height: 210px !important;
  overflow: hidden !important;
  overflow-anchor: none !important;
  contain: layout;
  position: relative;
  /* keep lifts inside; do not let transforms expand page scrollport */
  padding-top: 36px !important; /* room for hover/selected lift inside fixed box */
  padding-bottom: 10px !important;
  box-sizing: border-box !important;
}
#app { position: relative; }
#btn-deck-peek {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 200;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid #c9a227;
  background: rgba(28, 22, 10, 0.94);
  color: #f0d78c;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
}
#btn-deck-peek.is-open {
  background: #c9a227;
  color: #1a1208;
}
#deck-peek {
  position: absolute;
  left: 8px;
  bottom: 218px;
  z-index: 80;
  width: 240px;
  max-height: 360px;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid #c9a227;
  background: rgba(10, 12, 18, 0.96);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
#deck-peek[hidden] { display: none !important; }
.deck-peek-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(201, 162, 39, 0.35);
  color: #f0d78c;
  font-size: 0.8rem;
  font-weight: 800;
}
#deck-peek-close {
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(138, 155, 176, 0.5);
  background: transparent;
  color: #e7eefc;
  font-size: 0.72rem;
  cursor: pointer;
}
#deck-peek-list {
  overflow-y: auto;
  padding: 6px 8px 10px;
}
.deck-peek-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 3px 0;
  font-size: 0.78rem;
  color: #e8eef8;
}
.deck-peek-cost {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, #ffe08a, #d4a017);
  color: #1a1208;
  font-size: 0.72rem;
  font-weight: 800;
}
.deck-peek-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-peek-n { color: #f0d78c; font-weight: 800; }
.deck-peek-empty { margin: 8px 4px; color: #8a97b0; font-size: 0.78rem; }
#battlefield {
  position: relative !important;
  overflow: hidden !important; /* 只在战场根裁切，避免撑出整页滚动 */
  min-height: 0 !important;
  isolation: isolate;
}
.lane-row {
  position: relative !important;
  z-index: 2 !important;
  overflow: visible !important; /* 允许突击越过横条 */
  min-height: 0 !important;
}
.lane-bridge {
  position: relative !important;
  z-index: 1 !important; /* 横条在卡牌之下 */
}
.lane-slot {
  overflow: visible !important;
  position: relative !important;
  z-index: 2 !important;
}
#combat-log {
  scrollbar-gutter: stable;
  overflow-anchor: none;
}
#player-panel, #enemy-panel {
  overflow: hidden !important;
  min-height: 0 !important;
}

/* ===== ATTACK LUNGE ABOVE BRIDGE ===== */
#battlefield {
  position: relative !important;
  isolation: isolate;
  overflow: hidden !important;
}
.lane-bridge {
  position: relative !important;
  z-index: 1 !important;
  pointer-events: none;
}
.lane-row {
  position: relative !important;
  z-index: 2 !important;
  overflow: visible !important;
}
.lane-slot {
  overflow: visible !important;
  position: relative !important;
}
.board-card.atk-lunge-up,
.board-card.atk-lunge-down {
  position: relative !important;
  z-index: 90 !important;
}
.lane-slot:has(.atk-lunge-up),
.lane-slot:has(.atk-lunge-down),
.lane-row:has(.atk-lunge-up),
.lane-row:has(.atk-lunge-down) {
  z-index: 90 !important;
}

/* ---- 赵云 / 甘宁换位瞬移 ---- */
.teleport-streak {
  position: fixed;
  width: 12px;
  margin-left: -6px;
  border-radius: 8px;
  pointer-events: none;
  z-index: 8010;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(210, 245, 255, 0.95) 18%,
    rgba(255, 255, 255, 1) 50%,
    rgba(170, 220, 255, 0.95) 82%,
    rgba(255, 255, 255, 0) 100%
  );
  box-shadow:
    0 0 16px 5px rgba(190, 235, 255, 0.85),
    0 0 36px 8px rgba(120, 200, 255, 0.4);
  animation: teleport-blink 0.55s ease-out forwards;
  transform-origin: center center;
}
.teleport-sparks {
  position: fixed;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 8011;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(160, 220, 255, 0.35) 45%, transparent 70%);
  animation: teleport-spark 0.55s ease-out forwards;
}
@keyframes teleport-blink {
  0% {
    opacity: 0;
    transform: scaleY(0.15) scaleX(0.35);
    filter: brightness(2.2);
  }
  22% {
    opacity: 1;
    transform: scaleY(1.08) scaleX(1.35);
    filter: brightness(1.9);
  }
  55% {
    opacity: 0.9;
    transform: scaleY(1) scaleX(0.95);
    filter: brightness(1.4);
  }
  100% {
    opacity: 0;
    transform: scaleY(0.55) scaleX(0.25);
    filter: brightness(2.6);
  }
}
@keyframes teleport-spark {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  30% {
    opacity: 1;
    transform: scale(1.25);
  }
  100% {
    opacity: 0;
    transform: scale(1.8);
  }
}
