/* Spell Card Duel — LoR / MTG-style board next to Adventure */

#panel-cardduel.panel.active {
  display: block;
  min-height: calc(100vh - 100px);
}

.cd-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.65rem 1rem 1.5rem;
  color: #e8e6f0;
}

.cd-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.cd-top h2 {
  margin: 0 0 0.25rem;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  color: #f0dcc0;
}

.cd-hint {
  margin: 0;
  max-width: 44rem;
  font-size: 0.84rem;
  line-height: 1.4;
  color: rgba(200, 195, 210, 0.8);
}

.cd-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cd-btn {
  min-height: 2.1rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(220, 180, 100, 0.5);
  background: rgba(40, 32, 24, 0.95);
  color: #f5ebd8;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.cd-btn:hover:not(:disabled) {
  border-color: rgba(255, 210, 130, 0.75);
  background: rgba(70, 50, 30, 0.95);
}

.cd-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cd-btn-accent {
  border-color: rgba(140, 180, 255, 0.55);
  background: rgba(30, 40, 70, 0.95);
  color: #dce8ff;
}

.cd-btn-accent:hover:not(:disabled) {
  border-color: rgba(180, 210, 255, 0.85);
  background: rgba(50, 70, 120, 0.95);
}

.cd-btn-danger {
  border-color: rgba(255, 120, 100, 0.5);
  background: rgba(60, 24, 20, 0.95);
}

.cd-btn-ghost {
  border-color: rgba(255, 255, 255, 0.15);
  background: transparent;
  color: rgba(210, 210, 220, 0.9);
}

.cd-btn.is-lit {
  border-color: rgba(100, 220, 140, 0.85);
  box-shadow: 0 0 0 1px rgba(80, 200, 120, 0.35), 0 0 14px rgba(60, 180, 100, 0.25);
  animation: cd-btn-pulse 1.2s ease-in-out infinite;
}

@keyframes cd-btn-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
}

.cd-attack-indicator {
  margin: 0.35rem 0 0.55rem;
  padding: 0.55rem 0.75rem 0.65rem;
  border-radius: 12px;
  font-size: 0.8rem;
  line-height: 1.4;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(16, 20, 30, 0.95);
  color: #e0e4f0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

.cd-attack-indicator[hidden] {
  display: none !important;
}

.cd-attack-indicator.is-idle {
  border-color: rgba(140, 140, 160, 0.3);
  color: rgba(180, 180, 195, 0.9);
}

.cd-attack-indicator.is-ready {
  border-color: rgba(90, 210, 130, 0.55);
  background: linear-gradient(
    135deg,
    rgba(18, 42, 28, 0.96),
    rgba(20, 24, 34, 0.96)
  );
  color: #d4f5dc;
}

.cd-attack-indicator.is-targeting {
  border-color: rgba(255, 140, 100, 0.65);
  background: linear-gradient(
    135deg,
    rgba(52, 26, 20, 0.97),
    rgba(28, 20, 28, 0.97)
  );
  color: #ffe4d8;
  box-shadow:
    0 0 0 1px rgba(255, 120, 80, 0.2),
    0 8px 24px rgba(80, 20, 10, 0.35);
}

.cd-attack-indicator.is-weave {
  border-color: rgba(160, 120, 255, 0.45);
  background: rgba(32, 24, 48, 0.95);
  color: #e8e0ff;
}

.cd-attack-indicator strong {
  color: inherit;
}

.cd-attack-head {
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
}

.cd-attack-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.75rem;
}

@media (max-width: 640px) {
  .cd-attack-grid {
    grid-template-columns: 1fr;
  }
}

.cd-attack-col {
  min-width: 0;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.cd-attack-col-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.cd-attack-col-label.is-ready-lab {
  color: #7dff9f;
}

.cd-attack-col-label.is-target-lab {
  color: #ff9a78;
}

.cd-attack-col-label.is-muted {
  color: rgba(170, 175, 190, 0.75);
}

.cd-attack-col-body {
  display: block;
  font-size: 0.8rem;
  opacity: 0.9;
}

.cd-attack-col-hint {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.68rem;
  opacity: 0.78;
  line-height: 1.3;
}

.cd-attack-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.cd-attack-pill {
  display: inline-block;
  max-width: 100%;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 650;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cd-attack-pill.is-ready {
  background: rgba(30, 120, 60, 0.55);
  border: 1px solid rgba(100, 230, 140, 0.55);
  color: #d8ffe4;
}

.cd-attack-pill.is-ready.is-selected-attacker {
  background: rgba(40, 160, 80, 0.85);
  border-color: rgba(160, 255, 190, 0.9);
  box-shadow: 0 0 10px rgba(60, 220, 110, 0.45);
}

.cd-attack-pill.is-target {
  background: rgba(140, 40, 28, 0.55);
  border: 1px solid rgba(255, 140, 100, 0.55);
  color: #ffe4d8;
}

.cd-attack-pill.is-target.is-taunt {
  border-color: rgba(255, 200, 80, 0.75);
  box-shadow: 0 0 8px rgba(255, 180, 60, 0.25);
}

.cd-attack-pill.is-hero {
  background: rgba(160, 70, 40, 0.65);
  border: 1px solid rgba(255, 170, 120, 0.7);
  color: #fff0e4;
  animation: cd-badge-pulse 1s ease-in-out infinite;
}

.cd-attack-list {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  opacity: 0.92;
}

.cd-attack-target-hero {
  color: #ffc8a8;
  font-weight: 650;
}

.cd-attack-blocked {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  opacity: 0.8;
}

.cd-badge {
  position: absolute;
  z-index: 4;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0.2rem;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}

.cd-badge-ready {
  bottom: auto;
  top: 0.3rem;
  background: rgba(30, 140, 70, 0.95);
  color: #e8ffe8;
  border: 1px solid rgba(160, 255, 180, 0.6);
  box-shadow: 0 0 10px rgba(60, 200, 100, 0.45);
  animation: cd-badge-pulse 1s ease-in-out infinite;
}

.cd-badge-target {
  background: rgba(180, 50, 30, 0.95);
  color: #ffe8e0;
  border: 1px solid rgba(255, 160, 120, 0.65);
  box-shadow: 0 0 12px rgba(255, 80, 50, 0.4);
  animation: cd-badge-pulse 0.85s ease-in-out infinite;
}

.cd-badge-target.is-soft {
  background: rgba(120, 45, 30, 0.82);
  border-color: rgba(255, 150, 110, 0.45);
  box-shadow: 0 0 8px rgba(255, 80, 50, 0.22);
  animation: none;
  opacity: 0.92;
}

.cd-badge-held {
  bottom: auto;
  top: 0.3rem;
  background: rgba(90, 90, 110, 0.95);
  color: #e8e8f4;
  border: 1px solid rgba(180, 180, 210, 0.55);
  box-shadow: 0 0 8px rgba(100, 100, 140, 0.35);
}

.cd-card.is-attack-held {
  border-color: rgba(160, 160, 190, 0.75);
  box-shadow:
    0 0 0 2px rgba(120, 120, 150, 0.35),
    0 0 12px rgba(80, 80, 110, 0.25);
  filter: saturate(0.75) brightness(0.92);
}

.cd-slot.is-held-slot {
  border-style: dashed;
  border-color: rgba(160, 160, 190, 0.45);
}

.cd-attack-help {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  line-height: 1.4;
  color: rgba(190, 195, 210, 0.85);
}

.cd-attack-held-note {
  color: #c8c8e0;
  font-weight: 650;
}

.cd-name-row {
  margin: 0.45rem 0 0.35rem;
}

.cd-name-row label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(200, 190, 160, 0.85);
  margin-bottom: 0.25rem;
}

.cd-player-name {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(200, 180, 120, 0.4);
  background: rgba(12, 14, 22, 0.9);
  color: #f0ead8;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
}

.cd-player-name:focus {
  outline: none;
  border-color: rgba(120, 200, 255, 0.65);
  box-shadow: 0 0 0 2px rgba(80, 150, 255, 0.2);
}

.cd-player-roster {
  margin: 0.45rem 0 0.35rem;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
  border: 1px solid rgba(120, 160, 200, 0.28);
  background: rgba(12, 18, 28, 0.75);
  min-height: 2.5rem;
}

.cd-roster-empty {
  margin: 0;
  font-size: 0.72rem;
  color: rgba(170, 180, 200, 0.75);
  line-height: 1.35;
}

.cd-roster-head {
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(160, 200, 255, 0.85);
  margin-bottom: 0.3rem;
}

.cd-roster-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cd-roster-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.cd-roster-item.is-host {
  border-color: rgba(100, 200, 140, 0.35);
}

.cd-roster-item.is-guest {
  border-color: rgba(120, 160, 255, 0.35);
}

.cd-roster-item.is-you {
  box-shadow: inset 0 0 0 1px rgba(255, 220, 120, 0.25);
}

.cd-roster-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f0ece4;
}

.cd-roster-role {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(160, 180, 210, 0.8);
}

.cd-roster-item.is-host .cd-roster-role {
  color: #8dffb0;
}

.cd-roster-item.is-guest .cd-roster-role {
  color: #9ec4ff;
}

.cd-invite-panel {
  margin-top: 0.55rem;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  border: 1px solid rgba(100, 180, 255, 0.35);
  background: rgba(20, 32, 48, 0.85);
}

.cd-invite-panel[hidden] {
  display: none !important;
}

.cd-invite-star-label {
  margin: 0 0 0.4rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.3;
  background: rgba(40, 90, 50, 0.55);
  border: 1px solid rgba(120, 220, 140, 0.55);
  color: #d8ffe0;
}

.cd-invite-star-label.is-missing {
  background: rgba(80, 40, 20, 0.65);
  border-color: rgba(255, 140, 80, 0.55);
  color: #ffe0c8;
}

.cd-invite-star-label.is-remote {
  background: rgba(30, 100, 55, 0.65);
  border-color: rgba(100, 240, 150, 0.7);
  box-shadow: 0 0 14px rgba(60, 200, 100, 0.25);
}

.cd-invite-panel label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(160, 200, 255, 0.85);
  margin-bottom: 0.3rem;
}

.cd-invite-row {
  display: flex;
  gap: 0.35rem;
  align-items: stretch;
}

.cd-invite-link {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(120, 160, 220, 0.4);
  background: rgba(8, 12, 20, 0.9);
  color: #e0ecff;
  font-size: 0.72rem;
}

.cd-invite-link.is-remote-preferred {
  border-color: rgba(100, 230, 140, 0.75);
  box-shadow: 0 0 0 1px rgba(80, 200, 120, 0.25);
  color: #e8ffe8;
}

.cd-invite-remote-warn {
  margin: 0.4rem 0 0.25rem;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  font-size: 0.7rem;
  line-height: 1.35;
}

.cd-invite-remote-warn.is-ok {
  background: rgba(20, 50, 32, 0.7);
  border: 1px solid rgba(90, 200, 120, 0.4);
  color: #c8f0d4;
}

.cd-invite-remote-warn.is-bad {
  background: rgba(60, 28, 16, 0.75);
  border: 1px solid rgba(255, 140, 80, 0.45);
  color: #ffd8c0;
}

.cd-invite-remote-warn[hidden] {
  display: none !important;
}

.cd-invite-hint {
  margin: 0.4rem 0 0.35rem;
  font-size: 0.68rem;
  line-height: 1.35;
  color: rgba(170, 190, 220, 0.8);
}

.cd-invite-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 12rem;
  overflow: auto;
}

.cd-invite-section-title {
  margin: 0.45rem 0 0.15rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(170, 190, 220, 0.75);
}

.cd-invite-section-title.is-remote-sec {
  color: #8dffb0;
}

.cd-invite-section-title.is-wifi-sec {
  color: #9ec4ff;
}

.cd-invite-section-title.is-local-sec {
  color: rgba(180, 180, 190, 0.7);
}

.cd-invite-alt {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(100, 140, 200, 0.25);
  background: rgba(12, 18, 28, 0.8);
  color: rgba(180, 200, 230, 0.9);
  font-size: 0.62rem;
  line-height: 1.3;
  cursor: pointer;
  word-break: break-all;
  font: inherit;
}

.cd-invite-alt .cd-invite-kind {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(160, 180, 210, 0.85);
}

.cd-invite-alt.kind-remote .cd-invite-kind {
  color: #8dffb0;
}

.cd-invite-alt.kind-wifi .cd-invite-kind {
  color: #9ec4ff;
}

.cd-invite-alt .cd-invite-url {
  font-size: 0.62rem;
  color: inherit;
}

.cd-invite-alt:hover {
  border-color: rgba(120, 180, 255, 0.55);
  color: #fff;
}

.cd-invite-alt.is-primary,
.cd-invite-alt.is-starred {
  border-color: rgba(90, 220, 130, 0.7);
  background: rgba(16, 48, 28, 0.9);
  box-shadow: 0 0 12px rgba(50, 180, 90, 0.25);
}

.cd-invite-alt.is-starred .cd-invite-kind {
  color: #b8ffcc;
}

.cd-hero-attack-badge {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  z-index: 3;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.cd-hero-attack-badge.is-open {
  background: rgba(180, 70, 40, 0.95);
  color: #fff0e4;
  border: 1px solid rgba(255, 170, 120, 0.7);
}

.cd-hero-attack-badge.is-hot {
  background: rgba(220, 60, 30, 0.98);
  color: #fff;
  border: 1px solid rgba(255, 200, 160, 0.85);
  animation: cd-badge-pulse 0.75s ease-in-out infinite;
}

.cd-hero-attack-badge.is-blocked {
  background: rgba(60, 60, 70, 0.9);
  color: rgba(200, 200, 210, 0.85);
  border: 1px solid rgba(140, 140, 150, 0.4);
}

.cd-hero-attack-badge[hidden] {
  display: none !important;
}

@keyframes cd-badge-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.75;
  }
}

.cd-card.is-ready-attack {
  border-color: rgba(90, 220, 130, 0.95);
  box-shadow:
    0 0 0 2px rgba(70, 200, 110, 0.45),
    0 0 18px rgba(50, 180, 90, 0.35);
}

.cd-card.is-legal-target {
  border-color: rgba(255, 120, 80, 0.95);
  box-shadow:
    0 0 0 2px rgba(255, 90, 50, 0.5),
    0 0 18px rgba(255, 70, 40, 0.35);
}

.cd-slot.is-ready-slot {
  border-color: rgba(90, 200, 120, 0.45);
  border-style: solid;
  background: rgba(20, 50, 30, 0.35);
}

.cd-slot.is-soft-target {
  border-color: rgba(255, 140, 100, 0.35);
  border-style: dashed;
}

.cd-hero.is-soft-target {
  border-color: rgba(255, 160, 120, 0.45);
  box-shadow: 0 0 12px rgba(255, 100, 60, 0.2);
}

.cd-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 0.85rem;
}

@media (max-width: 900px) {
  .cd-layout {
    grid-template-columns: 1fr;
  }
}

.cd-board-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.cd-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  align-items: center;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(12, 14, 22, 0.9);
  font-size: 0.82rem;
}

.cd-hud strong {
  color: #f0dcc0;
  font-variant-numeric: tabular-nums;
}

.cd-hp {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cd-hp-bar {
  width: 5.5rem;
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.cd-hp-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #c04040, #e08050);
  border-radius: inherit;
}

.cd-hp-bar.is-you > i {
  background: linear-gradient(90deg, #3a7a40, #70c070);
}

.cd-mana {
  color: #9ec8ff;
}

.cd-phase {
  margin-left: auto;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: rgba(80, 60, 30, 0.7);
  color: #f0dcc0;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cd-field {
  border-radius: 16px;
  border: 1px solid rgba(200, 160, 100, 0.4);
  background:
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(90, 50, 40, 0.35), transparent 55%),
    radial-gradient(ellipse 70% 45% at 50% 100%, rgba(40, 70, 90, 0.4), transparent 55%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 11px,
      rgba(255, 255, 255, 0.015) 11px,
      rgba(255, 255, 255, 0.015) 12px
    ),
    linear-gradient(180deg, #1a1420 0%, #0c1018 48%, #0a1210 100%);
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.45),
    0 12px 40px rgba(0, 0, 0, 0.4);
  padding: 0.65rem 0.7rem 0.75rem;
  min-height: 26rem;
  position: relative;
}

.cd-mid-line {
  height: 2px;
  margin: 0.45rem 8% 0.55rem;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(220, 180, 100, 0.55),
    rgba(140, 180, 255, 0.45),
    transparent
  );
  box-shadow: 0 0 12px rgba(200, 160, 100, 0.25);
}

.cd-hero-row {
  display: flex;
  justify-content: center;
  margin: 0.15rem 0 0.45rem;
}

.cd-hero {
  position: relative;
  min-width: 11rem;
  padding: 0.45rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(145deg, rgba(40, 36, 48, 0.95), rgba(16, 18, 28, 0.98));
  color: #e8e4f0;
  font: inherit;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

button.cd-hero {
  cursor: default;
}

button.cd-hero.is-targetable {
  cursor: pointer;
  border-color: rgba(255, 140, 100, 0.9);
  box-shadow:
    0 0 0 2px rgba(255, 100, 70, 0.45),
    0 0 24px rgba(255, 80, 50, 0.35);
  animation: cd-pulse-target 0.9s ease-in-out infinite;
}

.cd-hero.is-hit {
  animation: cd-hero-hit 0.5s ease;
}

.cd-hero-enemy {
  border-color: rgba(255, 120, 100, 0.35);
}

.cd-hero-you {
  border-color: rgba(100, 200, 120, 0.35);
}

.cd-hero-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(200, 190, 180, 0.75);
}

.cd-hero-hp {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #f0dcc0;
}

.cd-hero-hint {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.65rem;
  color: rgba(180, 190, 210, 0.7);
  max-width: 14rem;
}

.cd-row-label {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(200, 185, 160, 0.8);
}

.cd-slots {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
  min-height: 9.2rem;
  margin-bottom: 0.35rem;
  padding: 0.35rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: visible;
}

@media (max-width: 720px) {
  .cd-slots {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.cd-slot {
  border-radius: 12px;
  border: 1px dashed rgba(220, 190, 140, 0.2);
  background:
    radial-gradient(ellipse at 50% 30%, rgba(80, 60, 40, 0.25), transparent 70%),
    rgba(8, 10, 16, 0.55);
  min-height: 9rem;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0.25rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cd-slot.is-targetable {
  border-style: solid;
  border-color: rgba(255, 120, 100, 0.75);
  box-shadow: 0 0 0 2px rgba(255, 90, 60, 0.35), inset 0 0 20px rgba(255, 60, 40, 0.12);
  animation: cd-pulse-target 0.9s ease-in-out infinite;
}

.cd-slot.is-selected {
  border-style: solid;
  border-color: rgba(140, 200, 255, 0.85);
  box-shadow: 0 0 0 2px rgba(100, 160, 255, 0.4);
}

.cd-hand-row {
  margin-top: 0.35rem;
}

.cd-hand-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.cd-hand-head .cd-row-label {
  margin: 0;
}

.cd-sort-bar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.cd-sort-label {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(180, 175, 190, 0.7);
  margin-right: 0.15rem;
}

.cd-sort-btn {
  min-height: 1.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 22, 32, 0.9);
  color: rgba(210, 210, 220, 0.9);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.cd-sort-btn:hover {
  border-color: rgba(180, 200, 255, 0.4);
}

.cd-sort-btn.is-active {
  border-color: rgba(140, 180, 255, 0.65);
  background: rgba(40, 60, 110, 0.9);
  color: #e8f0ff;
}

.cd-effect-legend {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 16rem;
  overflow: auto;
  font-size: 0.72rem;
  line-height: 1.35;
}

.cd-effect-row strong {
  display: block;
  color: #c8d8ff;
  font-size: 0.74rem;
  margin-bottom: 0.08rem;
}

.cd-effect-row span {
  color: rgba(190, 188, 200, 0.88);
}

.cd-card-effect-desc {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.55rem;
  line-height: 1.25;
  color: rgba(170, 185, 210, 0.85);
  max-height: 2.6em;
  overflow: hidden;
}

.cd-hand {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.45rem 0.15rem 0.55rem;
  min-height: 10rem;
  scrollbar-width: thin;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.cd-card {
  flex: 0 0 auto;
  width: 7.6rem;
  border-radius: 12px;
  border: 2px solid rgba(230, 190, 110, 0.55);
  background: linear-gradient(165deg, #2a2430 0%, #14141c 55%, #101018 100%);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  text-align: left;
  color: inherit;
  font: inherit;
  padding: 0;
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.cd-card-frame {
  pointer-events: none;
  position: absolute;
  inset: 0;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 220, 150, 0.12);
  z-index: 2;
}

.cd-card:hover:not(:disabled) {
  transform: translateY(-6px) scale(1.02);
  border-color: rgba(255, 220, 150, 0.95);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.55),
    0 0 16px rgba(220, 160, 80, 0.2);
}

.cd-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cd-card.is-selected {
  border-color: rgba(120, 190, 255, 0.95);
  box-shadow: 0 0 0 2px rgba(100, 160, 255, 0.5), 0 8px 20px rgba(0, 0, 0, 0.4);
}

.cd-card.is-attacking {
  border-color: rgba(255, 120, 80, 0.95);
  z-index: 5;
  animation: cd-lunge 0.5s ease;
}

.cd-card.is-hit {
  animation: cd-shake-hit 0.5s ease;
  border-color: rgba(255, 80, 80, 0.9);
}

.cd-card.is-woven,
.cd-card.is-fusion {
  border-color: rgba(190, 140, 255, 0.9);
  box-shadow: 0 0 18px rgba(150, 90, 230, 0.4);
}

.cd-card.is-fuse-glow {
  z-index: 6;
  border-color: rgba(220, 180, 255, 1);
  box-shadow: 0 0 28px rgba(180, 100, 255, 0.65);
}

.cd-slot.is-fuse-active {
  z-index: 10;
  overflow: visible;
  border-color: rgba(180, 120, 255, 0.45);
  border-style: solid;
}

.cd-slot.is-fuse-loading-slot {
  z-index: 12;
  border-color: rgba(190, 140, 255, 0.85);
  border-style: solid;
  box-shadow:
    0 0 0 2px rgba(160, 100, 255, 0.35),
    0 0 28px rgba(140, 80, 255, 0.35);
  animation: cd-fuse-load-pulse 1.2s ease-in-out infinite;
}

.cd-slot.is-fuse-hidden-slot {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.cd-slot.is-fuse-reveal-slot {
  z-index: 11;
}

/* Swirl: cards orbit in a circle above the field */
.cd-card.is-fuse-orbit {
  z-index: 14;
  pointer-events: none;
  will-change: transform, filter;
  animation: cd-fuse-orbit 1.5s linear forwards;
  border-color: rgba(230, 190, 255, 1);
  box-shadow:
    0 0 0 2px rgba(180, 120, 255, 0.5),
    0 0 36px rgba(160, 90, 255, 0.7);
  filter: brightness(1.15) saturate(1.25);
}

/* Fall into the merge slot */
.cd-card.is-fuse-merge {
  z-index: 15;
  pointer-events: none;
  will-change: transform, opacity;
  animation: cd-fuse-merge 0.75s cubic-bezier(0.45, 0.05, 0.25, 1) forwards;
  border-color: rgba(255, 220, 255, 1);
  box-shadow: 0 0 40px rgba(200, 120, 255, 0.85);
}

.cd-card.is-fuse-hidden {
  opacity: 0 !important;
  pointer-events: none;
  transform: scale(0.2);
}

.cd-card.is-fuse-loading {
  z-index: 16;
  pointer-events: none;
  border-color: rgba(200, 160, 255, 0.95);
  box-shadow:
    0 0 0 2px rgba(170, 110, 255, 0.45),
    0 0 32px rgba(150, 90, 255, 0.55);
  animation: cd-fuse-load-pulse 1.2s ease-in-out infinite;
}

.cd-card.is-fuse-reveal {
  z-index: 16;
  animation: cd-fuse-reveal 0.65s ease-out;
  border-color: rgba(230, 200, 255, 1);
  box-shadow: 0 0 40px rgba(200, 140, 255, 0.8);
}

.cd-card-art.is-loading-art {
  background:
    radial-gradient(circle at 50% 40%, rgba(120, 70, 200, 0.35), transparent 60%),
    linear-gradient(135deg, #1a1428 0%, #0c0c14 50%, #18102a 100%);
  min-height: 5.1rem;
}

.cd-fuse-load-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: rgba(10, 8, 18, 0.55);
  pointer-events: none;
  border-radius: inherit;
}

.cd-fuse-spinner {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  border: 3px solid rgba(180, 150, 255, 0.25);
  border-top-color: rgba(220, 190, 255, 0.95);
  border-right-color: rgba(160, 120, 255, 0.7);
  animation: cd-fuse-spin-loader 0.75s linear infinite;
  box-shadow: 0 0 16px rgba(160, 100, 255, 0.45);
}

.cd-fuse-load-text {
  max-width: 90%;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  color: #f0e8ff;
  background: rgba(40, 24, 70, 0.75);
  border: 1px solid rgba(180, 140, 255, 0.4);
}

.cd-card-art {
  display: block;
  width: 100%;
  height: 5.1rem;
  object-fit: cover;
  background: #0c0c12;
  filter: saturate(1.08) contrast(1.05);
}

.cd-card-body {
  padding: 0.35rem 0.4rem 0.45rem;
  background: linear-gradient(180deg, rgba(20, 18, 28, 0.2), rgba(10, 10, 16, 0.95));
}

.cd-card-name {
  display: block;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.25;
  color: #f8f0e4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}

.cd-card-stats {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cd-card-atk {
  color: #ffb0a0;
  background: rgba(120, 40, 30, 0.45);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
}

.cd-card-hp {
  color: #9fe0a8;
  background: rgba(30, 80, 40, 0.45);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
}

.cd-card-cost {
  position: absolute;
  top: 0.3rem;
  left: 0.3rem;
  z-index: 3;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #6a9fff, #2848a0 70%);
  color: #eef4ff;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(200, 220, 255, 0.55);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.cd-card-effect {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.6rem;
  line-height: 1.25;
  color: rgba(190, 210, 255, 0.95);
  max-height: 2.2em;
  overflow: hidden;
}

.cd-slot .cd-card {
  width: 100%;
  max-width: 9rem;
}

@keyframes cd-lunge {
  0% {
    transform: translateY(0) scale(1);
  }
  35% {
    transform: translateY(-14px) scale(1.06);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes cd-shake-hit {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px) rotate(-2deg);
  }
  40% {
    transform: translateX(6px) rotate(2deg);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(3px);
  }
}

@keyframes cd-fuse-orbit {
  0% {
    transform: rotate(calc(var(--fuse-angle, 0) * 1deg))
      translateY(-3.2rem)
      rotate(calc(var(--fuse-angle, 0) * -1deg))
      scale(1.05);
    filter: brightness(1.1) saturate(1.2);
  }
  50% {
    filter: brightness(1.35) saturate(1.45) hue-rotate(15deg);
  }
  100% {
    transform: rotate(calc(var(--fuse-angle, 0) * 1deg + 720deg))
      translateY(-3.2rem)
      rotate(calc(var(--fuse-angle, 0) * -1deg - 720deg))
      scale(1.12);
    filter: brightness(1.4) saturate(1.5);
  }
}

@keyframes cd-fuse-merge {
  0% {
    transform: rotate(calc(var(--fuse-angle, 0) * 1deg))
      translateY(-2.4rem)
      rotate(calc(var(--fuse-angle, 0) * -1deg))
      scale(1.08);
    opacity: 1;
    filter: brightness(1.4) saturate(1.5);
  }
  55% {
    transform: translateX(var(--fuse-dx, 0rem)) translateY(-0.4rem) scale(0.72)
      rotate(180deg);
    opacity: 0.85;
    filter: brightness(1.6) hue-rotate(25deg);
  }
  100% {
    transform: translateX(var(--fuse-dx, 0rem)) translateY(0) scale(0.18)
      rotate(360deg);
    opacity: 0;
    filter: brightness(2) saturate(1.8);
  }
}

@keyframes cd-fuse-load-pulse {
  0%,
  100% {
    filter: brightness(1);
    box-shadow:
      0 0 0 2px rgba(170, 110, 255, 0.35),
      0 0 24px rgba(150, 90, 255, 0.4);
  }
  50% {
    filter: brightness(1.12);
    box-shadow:
      0 0 0 2px rgba(200, 150, 255, 0.55),
      0 0 36px rgba(170, 110, 255, 0.65);
  }
}

@keyframes cd-fuse-spin-loader {
  to {
    transform: rotate(360deg);
  }
}

@keyframes cd-fuse-reveal {
  0% {
    transform: scale(0.35);
    opacity: 0.4;
    filter: brightness(2) saturate(1.6);
  }
  55% {
    transform: scale(1.08);
    opacity: 1;
    filter: brightness(1.35);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1);
  }
}

@keyframes cd-pulse-target {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(255, 90, 60, 0.35);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(255, 120, 80, 0.55), 0 0 18px rgba(255, 80, 50, 0.35);
  }
}

@keyframes cd-hero-hit {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  40% {
    transform: scale(1.06);
    filter: brightness(1.4);
  }
}

.cd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.cd-fusion-bar.is-credits-blocked {
  opacity: 0.55;
  filter: grayscale(0.35);
  pointer-events: none;
}

.cd-fusion-bar.is-credits-blocked::after {
  content: "No API credits — weave locked (will not retry)";
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: #ffb0a0;
}

.cd-fusion-bar {
  border-radius: 12px;
  border: 1px solid rgba(160, 140, 255, 0.35);
  background: rgba(20, 18, 36, 0.92);
  padding: 0.55rem 0.65rem;
}

.cd-fusion-bar label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(190, 180, 255, 0.85);
  margin-bottom: 0.3rem;
}

.cd-fusion-prompt {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.6rem;
  resize: vertical;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0c0e16;
  color: #e8ecf8;
  font: inherit;
  font-size: 0.84rem;
  line-height: 1.35;
  margin-bottom: 0.45rem;
}

.cd-fusion-prompt:focus {
  outline: none;
  border-color: rgba(160, 150, 255, 0.55);
}

.cd-fusion-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.cd-log {
  margin: 0;
  max-height: 7.5rem;
  overflow: auto;
  font-size: 0.75rem;
  line-height: 1.4;
  color: rgba(200, 195, 210, 0.85);
  white-space: pre-wrap;
}

.cd-side {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.cd-card-panel {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(14, 16, 24, 0.95);
  padding: 0.55rem 0.65rem;
}

.cd-card-panel h3 {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(200, 190, 170, 0.85);
  font-weight: 600;
}

.cd-setup-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
}

.cd-setup-list label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.cd-lan-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.cd-lan-row input {
  flex: 1;
  min-width: 5rem;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #0c0e16;
  color: #e8ecf8;
  font: inherit;
  font-size: 0.8rem;
}

.cd-status {
  font-size: 0.78rem;
  color: rgba(180, 200, 255, 0.9);
  min-height: 1.2em;
}

.cd-status.is-error {
  color: #ffb0a4;
}

.cd-deck-count {
  font-size: 0.78rem;
  color: rgba(200, 195, 210, 0.75);
}

.cd-help {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.4;
  color: rgba(180, 175, 190, 0.8);
}

.cd-help code {
  font-size: 0.7rem;
  color: #c8d8ff;
}
