/* === Graph Gambit Game-Specific Styles === */

/* Graph visualization area */
.graph-area {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  padding: 4px 0;
  min-height: 110px;
}
.graph-panel {
  flex: 1;
  max-width: 200px;
  text-align: center;
}
.graph-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.graph-svg {
  width: 100%;
  height: auto;
  max-height: 100px;
}
.graph-svg .vertex {
  fill: var(--surface-2);
  stroke: var(--border-glow);
  stroke-width: 2;
  transition:
    fill 0.3s,
    stroke 0.3s;
}
.graph-svg .vertex.active {
  fill: var(--gold-dim);
  stroke: var(--gold);
}
.graph-svg .vertex-label {
  fill: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
.graph-svg .edge-line {
  stroke: var(--zero);
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.4s;
}
.graph-svg .edge-line.show {
  opacity: 1;
}
.graph-svg .edge-line.highlight {
  stroke: var(--gold);
  stroke-width: 3.5;
  filter: drop-shadow(0 0 4px rgba(240, 192, 64, 0.5));
}
.graph-svg .edge-line.bridged {
  stroke: var(--win);
  stroke-width: 3.5;
  filter: drop-shadow(0 0 4px rgba(61, 212, 122, 0.5));
}
.graph-svg .edge-line.cycle {
  stroke: var(--lose);
  stroke-width: 3;
  filter: drop-shadow(0 0 6px rgba(224, 64, 96, 0.6));
}
.graph-svg .edge-weight {
  fill: var(--text);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
}
.graph-svg .edge-weight.show {
  opacity: 1;
}

/* Weight badge (replaces res-badge) */
.wt-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--gold);
  min-width: 20px;
  text-align: center;
  display: inline-block;
  transition: all 0.3s;
}
.wt-badge.pop {
  animation: popIn 0.3s ease-out;
}

/* Edge pip on card */
.edge-pip {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(64, 208, 240, 0.15);
  color: var(--zero);
  border: 1px solid rgba(64, 208, 240, 0.25);
  white-space: nowrap;
  line-height: 1.2;
}
.edge-pip .edge-wt {
  font-size: 8px;
  color: var(--gold);
  margin-left: 2px;
}

/* Wild card / self-loop */
.card.wild-card {
  box-shadow:
    0 0 0 2px rgba(240, 192, 64, 0.5),
    0 0 10px rgba(240, 192, 64, 0.2),
    0 1px 3px rgba(0, 0, 0, 0.25) !important;
}

/* Discarded card */
.card.discarded {
  opacity: 0.35;
  transform: scale(0.9);
  transition:
    opacity 0.3s,
    transform 0.3s;
}

/* Cycle flash on card */
.card.cycle-card {
  animation: surge-shake 0.4s ease;
  box-shadow:
    0 0 12px var(--lose),
    0 0 24px rgba(224, 64, 96, 0.3) !important;
}
@keyframes surge-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  50%,
  90% {
    transform: translateX(-3px);
  }
  30%,
  70% {
    transform: translateX(3px);
  }
}

/* Surge flash reuse */
.surge-flash {
  background: radial-gradient(
    ellipse at center,
    rgba(224, 64, 96, 0.25),
    transparent 70%
  );
}

/* Wild modal grid */
.wild-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 10px 0;
  max-height: 250px;
  overflow-y: auto;
}
.wild-edge-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.wild-edge-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}
.wild-edge-btn:active {
  transform: scale(0.95);
}
.wild-edge-btn.disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

/* Bridge call list */
.bridge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 10px 0;
}
.bridge-edge-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--zero);
  cursor: pointer;
  transition: all 0.15s;
}
.bridge-edge-btn:hover {
  border-color: var(--win);
  color: var(--win);
  background: rgba(61, 212, 122, 0.08);
}
.bridge-edge-btn:active {
  transform: scale(0.95);
}

/* Redirect highlight */
.card.redirect-target {
  box-shadow:
    0 0 0 2px rgba(144, 96, 224, 0.5),
    0 0 8px rgba(144, 96, 224, 0.2),
    0 1px 3px rgba(0, 0, 0, 0.25) !important;
  cursor: pointer;
}

/* History row */
.history-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeSlideUp 0.4s ease-out both;
}
.hist-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  opacity: 0.85;
}

/* Spanning tree celebration */
@keyframes tree-glow {
  0%,
  100% {
    filter: drop-shadow(0 0 4px rgba(61, 212, 122, 0.3));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(61, 212, 122, 0.6));
  }
}
.graph-svg.spanning-tree .edge-line.show {
  stroke: var(--win);
  animation: tree-glow 1.2s ease-in-out infinite;
}

/* Responsive */
@media (max-width: 390px) {
  .graph-area {
    gap: 4px;
    min-height: 90px;
  }
  .graph-panel {
    max-width: 160px;
  }
  .graph-svg {
    max-height: 80px;
  }
}
@media (max-height: 600px) {
  .graph-area {
    min-height: 80px;
    padding: 2px 0;
  }
  .graph-svg {
    max-height: 70px;
  }
}
