:root {
  color-scheme: dark;
  --bg: #020817;
  --surface: #0b1329;
  --card: #111c38;
  --border: #23355c;
  --text: #f8fafc;
  --muted: #94a3b8;
  --cyan: #22d3ee;
  --violet: #a855f7;
  --emerald: #34d399;
  --amber: #fbbf24;
  --rose: #fb7185;
  --target: 44px;
  --spring-ease: linear(0, 0.016 0.5%, 0.226 2%, 1.116 5.4%, 1.375 6.6%, 1.527 7.7%, 1.565 8.2%, 1.585 8.8%, 1.458 10.9%, 0.937 14.3%, 0.67 17.1%, 0.729 19.8%, 1.13 24.5%, 1.201 26.7%, 0.977 32.2%, 0.882 35.6%, 1.045 42.4%, 1.069 44.5%, 0.979 50.9%, 1.024 62.3%, 0.986 71.2%, 1);
}

/* Single-fade combat edge vignette */
.combat-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  opacity: 0;
}

.combat-vignette.dmg {
  background: radial-gradient(circle at center, transparent 52%, rgba(251, 113, 133, 0.45) 100%);
  animation: vignetteFade 380ms ease-out forwards;
}

.combat-vignette.heal {
  background: radial-gradient(circle at center, transparent 55%, rgba(52, 211, 153, 0.36) 100%);
  animation: vignetteFade 420ms ease-out forwards;
}

.combat-vignette.reflect {
  background: radial-gradient(circle at center, transparent 52%, rgba(168, 85, 247, 0.44) 100%);
  animation: vignetteFade 420ms ease-out forwards;
}

.combat-vignette.block {
  background: radial-gradient(circle at center, transparent 55%, rgba(34, 211, 238, 0.38) 100%);
  animation: vignetteFade 360ms ease-out forwards;
}

@keyframes vignetteFade {
  0% { opacity: 0; }
  25% { opacity: 1; }
  100% { opacity: 0; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  user-select: none;
  -webkit-user-select: none;
}

:where(button, input):focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

:where(button) {
  min-block-size: var(--target);
  font: inherit;
  cursor: pointer;
  transition: transform 120ms ease-out, filter 120ms ease-out, border-color 120ms ease-out;
}

button:active:not(:disabled) {
  transform: scale(0.97);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

.app-shell {
  max-width: 520px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(4px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.banner-header {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #040d1f;
}

.banner-img {
  display: block;
  width: 100%;
  height: 48px;
  object-fit: cover;
  object-position: center;
}

.bottom-bar {
  margin-top: 4px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.bar-btn {
  min-block-size: var(--target);
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-btn.on {
  border-color: rgba(34, 211, 238, 0.55);
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
}

/* Lobby */
.lobby-screen {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding-block: 6px 10px;
  flex: 1;
}

.waiting-screen, .arena-screen {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.lobby-screen[hidden], .waiting-screen[hidden], .arena-screen[hidden], .resume-card[hidden], .error-line[hidden] {
  display: none;
}

.hero-card {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  min-height: 210px;
  flex: 1 1 auto;
  display: flex;
  align-items: flex-end;
}

.hero-art, .hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
}

.hero-art[hidden], .hero-video[hidden] {
  display: none;
}

/* Animated Luminescent Dragonfly */
.df-stage-hero {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 176px;
  height: 132px;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 2;
}

.df-stage-arena {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 2;
  transition: opacity 220ms ease-out, transform 220ms ease-out;
}

.df-stage-arena.away {
  opacity: 0;
  transform: scale(0.75) translateY(-28px);
}

.df-rune-ring {
  position: absolute;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  border: 1.5px dashed rgba(34, 211, 238, 0.45);
  box-shadow: 0 0 28px rgba(34, 211, 238, 0.25), inset 0 0 20px rgba(168, 85, 247, 0.22);
  @media (prefers-reduced-motion: no-preference) {
    animation: dfRuneSpin 18s linear infinite;
  }
}

.df-rune-ring.small {
  width: 88px;
  height: 88px;
}

.df-sprite {
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.65));
  transform-origin: center;
  @media (prefers-reduced-motion: no-preference) {
    animation: dfHover 3.2s ease-in-out infinite;
  }
}

.df-sprite.arena-df {
  @media (prefers-reduced-motion: no-preference) {
    animation: dfHoverArena 3.8s ease-in-out infinite;
  }
}

.df-wing {
  transform-box: fill-box;
}

.df-wing-tl {
  transform-origin: 96% 65%;
  @media (prefers-reduced-motion: no-preference) {
    animation: dfWingTopL 0.14s ease-in-out infinite alternate;
  }
}

.df-wing-tr {
  transform-origin: 4% 65%;
  @media (prefers-reduced-motion: no-preference) {
    animation: dfWingTopR 0.14s ease-in-out infinite alternate;
  }
}

.df-wing-bl {
  transform-origin: 96% 20%;
  @media (prefers-reduced-motion: no-preference) {
    animation: dfWingBotL 0.14s ease-in-out infinite alternate-reverse;
  }
}

.df-wing-br {
  transform-origin: 4% 20%;
  @media (prefers-reduced-motion: no-preference) {
    animation: dfWingBotR 0.14s ease-in-out infinite alternate-reverse;
  }
}

@keyframes dfHover {
  0%, 100% { transform: translateY(0px) rotate(-1.5deg) scale(1); }
  50% { transform: translateY(-9px) rotate(1.5deg) scale(1.03); }
}

@keyframes dfHoverArena {
  0%, 100% { transform: translate(-10px, 2px) rotate(-3deg); }
  33% { transform: translate(12px, -8px) rotate(2.5deg); }
  66% { transform: translate(-4px, -12px) rotate(-1deg); }
}

@keyframes dfRuneSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes dfWingTopL {
  from { transform: rotate(-16deg) scaleY(0.92); opacity: 0.96; }
  to { transform: rotate(10deg) scaleY(0.68); opacity: 0.72; }
}

@keyframes dfWingTopR {
  from { transform: rotate(16deg) scaleY(0.92); opacity: 0.96; }
  to { transform: rotate(-10deg) scaleY(0.68); opacity: 0.72; }
}

@keyframes dfWingBotL {
  from { transform: rotate(-12deg) scaleY(0.94); opacity: 0.92; }
  to { transform: rotate(12deg) scaleY(0.72); opacity: 0.68; }
}

@keyframes dfWingBotR {
  from { transform: rotate(12deg) scaleY(0.94); opacity: 0.92; }
  to { transform: rotate(-12deg) scaleY(0.72); opacity: 0.68; }
}

.hero-overlay {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 58px 16px 16px;
  background: linear-gradient(180deg, rgba(2, 8, 23, 0) 0%, rgba(2, 8, 23, 0.88) 45%, rgba(2, 8, 23, 0.98) 100%);
}

.tag-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.14);
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 6px;
}

.hero-overlay h1 {
  margin: 0 0 6px;
  font-size: 1.45rem;
  text-wrap: balance;
}

.hero-overlay p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  text-wrap: pretty;
}

.resume-card {
  background: linear-gradient(135deg, #172554, #1e1b4b);
  border: 1px solid var(--cyan);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.resume-card strong { display: block; font-size: 0.92rem; }
.resume-card span { font-size: 0.78rem; color: #cbd5e1; }
.resume-btns { display: flex; gap: 6px; }

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.invite-friend-card {
  background: linear-gradient(145deg, rgba(17, 28, 56, 0.96), rgba(12, 34, 48, 0.94));
  border: 1px solid rgba(52, 211, 153, 0.45);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
}

.invite-friend-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.invite-eyebrow {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--emerald);
}

.invite-friend-copy h2 {
  margin: 0;
  font-size: 1.04rem;
}

.invite-friend-copy p {
  margin: 0;
  font-size: 0.8rem;
  color: #cbd5e1;
  line-height: 1.38;
}

.btn.emerald-btn {
  background: linear-gradient(135deg, #10b981, #34d399);
  color: #020817;
}

.full-width {
  width: 100%;
}
  gap: 10px;
}

.join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.join-row input {
  min-block-size: 46px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 0 14px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 800;
  font-size: 0.94rem;
  text-align: center;
}

.btn.primary { background: linear-gradient(135deg, #22d3ee, #38bdf8); color: #020817; }
.btn.primary-sm { background: var(--cyan); color: #020817; padding: 8px 12px; font-size: 0.82rem; }
.btn.secondary { background: var(--card); color: var(--text); border-color: var(--border); }
.btn.violet-btn { background: linear-gradient(135deg, #6366f1, #9333ea); color: #ffffff; }
.btn.ghost, .btn.ghost-sm { background: transparent; color: var(--muted); border-color: var(--border); }
.btn.ghost-sm { padding: 8px 10px; font-size: 0.8rem; }

.error-line {
  margin: 0;
  color: #fecdd3;
  background: #4c1d24;
  border: 1px solid #fb7185;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.84rem;
}

/* Waiting */
.waiting-card {
  margin: auto 0;
  background: linear-gradient(145deg, #172554, #2e1065);
  border: 1px solid #4f46e5;
  border-radius: 20px;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--cyan);
}

.waiting-card h2 { margin: 0; font-size: 1.4rem; }
.muted { margin: 0; color: var(--muted); font-size: 0.86rem; text-wrap: pretty; }

.room-code-big {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  background: rgba(2, 8, 23, 0.55);
  border: 1px solid rgba(34, 211, 238, 0.45);
  border-radius: 16px;
  padding: 12px 28px;
  color: var(--text);
}

.waiting-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

/* Arena */
.match-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 10px;
}

.match-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
}

.code-chip {
  min-block-size: 32px;
  background: var(--card);
  color: var(--cyan);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 10px;
  font-size: 0.76rem;
  font-weight: 800;
}

.leave-btn {
  min-block-size: 32px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 10px;
  font-size: 0.76rem;
  font-weight: 700;
}

.tally-chip {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.16);
  color: #e9d5ff;
  border: 1px solid rgba(168, 85, 247, 0.4);
  font-variant-numeric: tabular-nums;
}

.tally-chip[hidden] { display: none; }

.fighter-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 220ms ease-out, box-shadow 220ms ease-out;
}

.fighter-card.danger {
  border-color: rgba(251, 113, 133, 0.75);
  box-shadow: 0 0 18px rgba(225, 29, 72, 0.25);
  @media (prefers-reduced-motion: no-preference) {
    animation: dangerGlow 1.6s ease-in-out infinite;
  }
}

.fighter-card.hit-shake {
  @media (prefers-reduced-motion: no-preference) {
    animation: cardShake 220ms ease-out;
  }
}

@keyframes dangerGlow {
  0%, 100% { box-shadow: 0 0 12px rgba(225, 29, 72, 0.2); }
  50% { box-shadow: 0 0 22px rgba(251, 113, 133, 0.45); }
}

@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px) rotate(-0.6deg); }
  45% { transform: translateX(5px) rotate(0.6deg); }
  75% { transform: translateX(-3px); }
}

.float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  overflow: visible;
}

.float-callout {
  position: absolute;
  right: 18px;
  top: 12px;
  font-size: 1.05rem;
  font-weight: 900;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(2, 8, 23, 0.88);
  border: 1px solid currentColor;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
  animation: floatArc 950ms ease-out forwards;
}

.float-callout.dmg { color: var(--rose); }
.float-callout.heal { color: var(--emerald); }
.float-callout.block { color: var(--cyan); font-size: 0.78rem; right: 92px; }
.float-callout.reflect { color: #e879f9; font-size: 0.78rem; right: 92px; }

@keyframes floatArc {
  0% { opacity: 0; transform: translate(0, 8px) scale(0.72); }
  20% { opacity: 1; transform: translate(-4px, -10px) scale(1.12); }
  100% { opacity: 0; transform: translate(-12px, -38px) scale(0.95); }
}

.fighter-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 26px;
  min-height: 26px;
  overflow: hidden;
}

.fighter-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  white-space: nowrap;
}

.fighter-name {
  font-weight: 800;
  font-size: 0.92rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.ready-chip, .last-card-chip, .deck-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.ready-chip, .last-card-chip {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 118px;
  flex-shrink: 1;
}

.ready-chip.ready { color: var(--emerald); border-color: var(--emerald); }
.last-card-chip:empty { display: none; }

.hp-readout {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  white-space: nowrap;
}

.hp-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: #060b18;
  overflow: hidden;
  border: 1px solid #1e293b;
}

.hp-ghost {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  background: rgba(251, 191, 36, 0.7);
  transition: width 520ms ease-out 180ms;
}

.hp-fill {
  position: relative;
  z-index: 1;
  height: 100%;
  width: 100%;
  transition: width 240ms ease-out;
}

.hp-pips {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent calc(10% - 1.5px),
    rgba(2, 8, 23, 0.75) calc(10% - 1.5px),
    rgba(2, 8, 23, 0.75) 10%
  );
}

.opp-fill { background: linear-gradient(90deg, #e11d48, #fb7185); }
.you-fill { background: linear-gradient(90deg, #059669, #34d399); }
.hp-fill.danger { background: linear-gradient(90deg, #b91c1c, #f43f5e); }

.effects-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 22px;
  min-height: 22px;
  overflow: hidden;
}

.effects-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
  min-width: 0;
}

.effects-row::-webkit-scrollbar {
  display: none;
}

.forecast-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.forecast-badge[hidden] { display: none; }
.forecast-badge.neg { background: rgba(251, 113, 133, 0.16); color: #fecdd3; border: 1px solid rgba(251, 113, 133, 0.5); }
.forecast-badge.pos { background: rgba(52, 211, 153, 0.16); color: #a7f3d0; border: 1px solid rgba(52, 211, 153, 0.5); }

.eff-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.eff-poison { background: rgba(168, 85, 247, 0.2); color: #e9d5ff; border: 1px solid #a855f7; }
.eff-corrupt { background: rgba(251, 113, 133, 0.2); color: #fecdd3; border: 1px solid #fb7185; }
.eff-regen { background: rgba(52, 211, 153, 0.2); color: #a7f3d0; border: 1px solid #34d399; }

.arena-stage {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #030712;
  aspect-ratio: 16 / 9;
}

.arena-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.arena-media[hidden] { display: none; }

.exchange-overlay {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  background: rgba(2, 8, 23, 0.86);
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 12px;
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 12px;
  gap: 2px;
  z-index: 4;
}

.exchange-overlay[hidden] { display: none; }

.exchange-tag {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.16);
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.35);
}

.exchange-title {
  font-size: 1.02rem;
  font-weight: 900;
}

.exchange-overlay.win .exchange-title { color: var(--emerald); }
.exchange-overlay.loss .exchange-title { color: var(--rose); }
.exchange-overlay.even .exchange-title { color: var(--amber); }

.exchange-cards { font-size: 0.78rem; font-weight: 700; color: var(--text); }
.exchange-deltas { font-size: 0.74rem; color: var(--muted); }

.lock-banner {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(2, 8, 23, 0.9);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.lock-banner[hidden] { display: none; }

/* Hand */
.hand-section {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hand-hint {
  margin: 0;
  text-align: center;
  font-size: 0.74rem;
  color: var(--muted);
}

.hand-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.card-btn {
  position: relative;
  overflow: hidden;
  text-align: left;
  background: linear-gradient(155deg, #162344 0%, #0d162c 65%, #131d3b 100%);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 11px 12px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 5px;
  height: 126px;
  min-block-size: 126px;
  max-block-size: 126px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.55s ease-out, border-color 140ms ease-out, box-shadow 140ms ease-out;
  transition-timing-function: var(--spring-ease), ease-out, ease-out;
}

.card-btn::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--cyan);
  opacity: 0.85;
}

.card-btn.kind-dmg { border-color: rgba(251, 113, 133, 0.55); }
.card-btn.kind-dmg::before { background: linear-gradient(90deg, #e11d48, #fb7185); }
.card-btn.kind-dmg .card-stat { color: #fda4af; }

.card-btn.kind-pierce { border-color: rgba(34, 211, 238, 0.65); }
.card-btn.kind-pierce::before { background: linear-gradient(90deg, #06b6d4, #67e8f9); }
.card-btn.kind-pierce .card-stat { color: #67e8f9; }

.card-btn.kind-def { border-color: rgba(96, 165, 250, 0.6); }
.card-btn.kind-def::before { background: linear-gradient(90deg, #3b82f6, #93c5fd); }
.card-btn.kind-def .card-stat { color: #93c5fd; }

.card-btn.kind-heal { border-color: rgba(52, 211, 153, 0.6); }
.card-btn.kind-heal::before { background: linear-gradient(90deg, #10b981, #6ee7b7); }
.card-btn.kind-heal .card-stat { color: #6ee7b7; }

.card-btn.kind-trick { border-color: rgba(168, 85, 247, 0.65); }
.card-btn.kind-trick::before { background: linear-gradient(90deg, #9333ea, #e879f9); }
.card-btn.kind-trick .card-stat { color: #e9d5ff; }

.card-btn.locked {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.3);
}

.card-btn.selected-card {
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.4);
  transform: translateY(-3px);
}

@media (prefers-reduced-motion: no-preference) {
  .card-btn.dealt {
    animation: cardDealIn 360ms var(--spring-ease);
  }
}

@keyframes cardDealIn {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.card-icon { font-size: 1.25rem; }
.card-stat {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(2, 8, 23, 0.7);
  color: var(--cyan);
}

.card-name { font-size: 0.98rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-desc {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.28;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Dialogs */
dialog {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #0b1329;
  color: var(--text);
  width: min(92vw, 440px);
  padding: 0;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8);
}

dialog:modal { overscroll-behavior: contain; }
dialog::backdrop {
  background: rgba(2, 8, 23, 0.8);
  backdrop-filter: blur(4px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dlg-inner {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dlg-head { display: flex; align-items: center; justify-content: space-between; }
.dlg-inner h1 { margin: 0; font-size: 1.18rem; text-wrap: balance; }
.dlg-close {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 700;
}

.rules-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.84rem;
  color: #cbd5e1;
}

.dlg-actions, .dlg-actions-col { display: flex; gap: 8px; }
.dlg-actions { justify-content: flex-end; }
.dlg-actions-col { flex-direction: column; }

@media (prefers-reduced-motion: reduce) {
  .combat-vignette, .float-callout, .fighter-card.hit-shake {
    animation: none !important;
  }
  :where(button), .card-btn, .hp-fill, .hp-ghost {
    transition-property: color, background-color, border-color, opacity;
  }
}
