/* ============================================================
   CREW ACTIVATION — components: cards, crew board, slots,
   bars, rules table, scoring, log
   ============================================================ */

/* ================= Trojan cards ================= */
.tcard {
  position: relative;
  width: 72px; height: 102px;
  margin: 0 -7px;
  background: linear-gradient(165deg, #131c2e, #0c1220);
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  display: flex; flex-direction: column;
  padding: 6px 7px;
  user-select: none;
  cursor: grab;
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  flex-shrink: 1;
}
.tcard:active { cursor: grabbing; }
.tcard:hover { transform: translateY(-9px); z-index: 5; box-shadow: 0 10px 24px rgba(0,0,0,0.5); }
.tcard.selected {
  transform: translateY(-18px);
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(255,215,94,0.35), 0 12px 26px rgba(0,0,0,0.55);
  z-index: 6;
}
.tcard.selected:hover { transform: translateY(-21px); }
.tcard.placed { opacity: 0.35; pointer-events: none; }
.tcard.hand-dragging { opacity: 0.45; transform: translateY(-12px) scale(0.96); }
.tcard.insert-before::before,
.tcard.insert-after::after {
  content: "";
  position: absolute;
  top: -8px;
  bottom: -8px;
  width: 3px;
  border-radius: 3px;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(255, 215, 94, 0.75);
  z-index: 8;
}
.tcard.insert-before::before { left: -10px; }
.tcard.insert-after::after { right: -10px; }
.tcard .tc-rank { font-family: var(--mono); font-size: 19px; font-weight: 700; line-height: 1; }
.tcard .tc-suit { font-size: 13px; line-height: 1.25; }
.tcard .tc-big {
  position: absolute; right: 7px; top: 32px;
  font-size: 26px; opacity: 0.3;
}

.tcard.hearts   .tc-rank, .tcard.hearts   .tc-suit, .tcard.hearts   .tc-big { color: var(--hearts); }
.tcard.diamonds .tc-rank, .tcard.diamonds .tc-suit, .tcard.diamonds .tc-big { color: var(--diamonds); }
.tcard.clubs    .tc-rank, .tcard.clubs    .tc-suit, .tcard.clubs    .tc-big { color: var(--clubs); }
.tcard.spades   .tc-rank, .tcard.spades   .tc-suit, .tcard.spades   .tc-big { color: var(--spades); }

/* ================= Score bar ================= */
#crew-board-area { position: relative; margin: 8px 0; overflow-x: auto; }

#hand-result-badge {
  position: absolute; z-index: 8; top: 78px; left: 50%; transform: translateX(-50%);
  min-width: 170px; padding: 8px 18px; border: 1px solid var(--gold-deep); border-radius: 7px;
  background: rgba(7, 9, 15, 0.94); box-shadow: 0 0 24px rgba(255,215,94,0.3);
  color: var(--gold); font-family: var(--mono); font-size: 18px; font-weight: 900;
  letter-spacing: 0.12em; text-align: center; pointer-events: none;
}
#hand-result-badge.visible { animation: localHandIn 0.24s ease-out both; }
#hand-result-badge.fade-out { animation: localFeedbackOut 0.18s ease-in forwards; }

#score-bar {
  display: flex; gap: 0; justify-content: center;
  margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; position: relative; isolation: isolate;
  --pressure-opacity: 0; --pressure-speed: 2.4s; --pressure-glow: transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#score-bar::before, #score-bar::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: var(--pressure-opacity); }
#score-bar::before {
  background: linear-gradient(105deg, transparent 0 35%, rgba(63,217,255,0.18) 43%, #eaffff 50%, rgba(63,217,255,0.24) 57%, transparent 65% 100%);
  background-size: 240% 100%; animation: scoreCurrent var(--pressure-speed) linear infinite paused;
  mix-blend-mode: screen;
}
#score-bar::after {
  inset: 2px; border: 1px solid rgba(63,217,255,0.55); border-radius: 7px;
  box-shadow: inset 0 0 12px var(--pressure-glow), 0 0 14px var(--pressure-glow);
}
#score-bar.pressure-calm { --pressure-opacity: 0.08; --pressure-glow: rgba(63,217,255,0.14); }
#score-bar[class*="pressure-"]:not(.pressure-idle)::before { animation-play-state: running; }
#score-bar.pressure-charged { --pressure-opacity: 0.2; --pressure-speed: 1.65s; --pressure-glow: rgba(63,217,255,0.25); border-color: rgba(63,217,255,0.42); }
#score-bar.pressure-high { --pressure-opacity: 0.34; --pressure-speed: 1.1s; --pressure-glow: rgba(63,217,255,0.4); border-color: rgba(63,217,255,0.66); box-shadow: 0 0 16px rgba(63,217,255,0.18); }
#score-bar.pressure-critical { --pressure-opacity: 0.5; --pressure-speed: 0.72s; --pressure-glow: rgba(190,249,255,0.56); border-color: rgba(190,249,255,0.86); box-shadow: 0 0 24px rgba(63,217,255,0.32); animation: scorePressurePulse 0.7s ease-in-out infinite; }
#score-bar.pressure-lethal { --pressure-opacity: 0.68; --pressure-speed: 0.42s; --pressure-glow: rgba(255,255,255,0.74); border-color: #efffff; box-shadow: 0 0 34px rgba(190,249,255,0.56); animation: scorePressurePulse 0.38s ease-in-out infinite; }
#score-bar.pressure-high::after, #score-bar.pressure-critical::after, #score-bar.pressure-lethal::after {
  background:
    linear-gradient(115deg, transparent 9%, rgba(190,249,255,0.62) 10%, transparent 11%) 18% 35% / 42px 18px no-repeat,
    linear-gradient(65deg, transparent 9%, rgba(63,217,255,0.58) 10%, transparent 11%) 76% 68% / 54px 20px no-repeat;
  animation: electricBranches 0.72s steps(2, end) infinite;
}
.score-block {
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 20px; min-width: 100px;
  background: rgba(13,19,32,0.88); position: relative; z-index: 1;
}
.score-block-main {
  flex: 1; min-width: 140px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: rgba(16,24,42,0.7);
}
.score-label {
  font-family: var(--mono); font-size: 8px; letter-spacing: 0.14em;
  text-transform: uppercase; margin-bottom: 4px;
}
.score-block:nth-child(1) .score-label { color: var(--cyan); }
.score-block:nth-child(3) .score-label { color: var(--orange); }
.score-block-main .score-label { color: var(--faint); }
.score-value {
  font-family: var(--mono); font-size: 26px; font-weight: 800;
  color: var(--text); line-height: 1; position: relative; z-index: 3;
}
.score-label { position: relative; z-index: 3; }
.score-delta {
  position: absolute; z-index: 5; right: 10px; top: 50%; transform: translateY(-50%);
  color: #dffcff; font-family: var(--mono); font-size: 12px; font-weight: 900;
  text-shadow: 0 0 9px var(--cyan); pointer-events: none; animation: scoreDeltaOut 0.72s ease-out forwards;
}
#score-power { color: var(--cyan); }
#score-combo { color: var(--orange); }
#score-combo.cold-1 { color: var(--reaction-cold-1); }
#score-combo.cold-2 { color: var(--reaction-cold-2); }
#score-combo.warm-1 { color: var(--reaction-warm-1); }
#score-combo.warm-2 { color: var(--reaction-warm-2); }
#score-combo.hot-1 { color: var(--reaction-hot-1); }
#score-combo.hot-2 { color: var(--reaction-hot-2); }
.score-value.stat-pop {
  animation: statPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes statPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.3); color: var(--gold); }
  100% { transform: scale(1); }
}

/* ================= Crew board (columns: crew chip + card slot) ================= */
#crew-board {
  display: flex; gap: 88px; justify-content: center;
  padding: 78px 14px 18px;
  min-height: 306px;
  width: max-content;
  min-width: 100%;
}
.circuit-host { position: relative; }
.reaction-circuit { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; overflow: visible; pointer-events: none; }
.crew-slot-col { position: relative; z-index: 1; }
.circuit-base, .circuit-feed { fill: none; stroke: var(--line-bright); stroke-width: 2; opacity: 0.55; vector-effect: non-scaling-stroke; }
.circuit-feed { stroke: var(--faint); stroke-dasharray: 4 5; }
.circuit-predicted { opacity: 0.4; stroke-width: 3; }
.circuit-live { stroke-dasharray: 100; stroke-dashoffset: 100; animation: circuitFill 0.42s ease-out forwards; opacity: 1; stroke-width: 4; }
.circuit-failure { stroke: var(--reaction-hot-1); stroke-width: 4; stroke-dasharray: 100; stroke-dashoffset: 100; animation: circuitFailFill 0.42s ease-out forwards; }
.circuit-fuse-live { stroke: var(--reaction-cold-2); stroke-width: 4; stroke-dasharray: 100; stroke-dashoffset: 100; animation: circuitFill 0.42s ease-out forwards; }
.circuit-fuse-live.circuit-fuse-transfer { animation-name: fuseTransferFill; }
.circuit-label-group { pointer-events: none; }
.circuit-label-bg { fill: rgba(5, 7, 11, 0.94); stroke: rgba(118, 131, 155, 0.5); stroke-width: 1; }
.circuit-label, .circuit-node-label { font-family: var(--mono); font-size: 10px; font-weight: 900; letter-spacing: 0.05em; paint-order: stroke; stroke: var(--bg0); stroke-width: 3px; }
.circuit-node-label { font-size: 11px; }
.cold-1 { color: var(--reaction-cold-1); stroke: var(--reaction-cold-1); fill: var(--reaction-cold-1); }
.cold-2 { color: var(--reaction-cold-2); stroke: var(--reaction-cold-2); fill: var(--reaction-cold-2); }
.warm-1 { color: var(--reaction-warm-1); stroke: var(--reaction-warm-1); fill: var(--reaction-warm-1); }
.warm-2 { color: var(--reaction-warm-2); stroke: var(--reaction-warm-2); fill: var(--reaction-warm-2); }
.hot-1 { color: var(--reaction-hot-1); stroke: var(--reaction-hot-1); fill: var(--reaction-hot-1); }
.hot-2 { color: var(--reaction-hot-2); stroke: var(--reaction-hot-2); fill: var(--reaction-hot-2); }
.reaction-circuit .circuit-label, .reaction-circuit .circuit-node-label { stroke: var(--bg0); stroke-width: 2px; }
.circuit-break-label { color: var(--reaction-hot-1); fill: var(--reaction-hot-1); }
.fuse-label { color: var(--reaction-cold-2); fill: var(--reaction-cold-2); }
.origin-label { color: var(--reaction-cold-1); fill: var(--reaction-cold-1); }
.echo-label { color: var(--reaction-warm-1); fill: var(--reaction-warm-1); }
.crew-slot-col {
  display: flex; flex-direction: column; align-items: center;
  width: 142px; flex: 0 0 142px; gap: 10px;
}
.crew-card-chip {
  width: 142px; height: 118px; padding: 9px 10px;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 8px; text-align: center;
  transition: border-color 0.2s ease, transform 0.15s ease;
  position: relative;
}
.crew-card-chip.has-crew {
  cursor: grab;
}
.crew-card-chip.has-crew:active { cursor: grabbing; }
.crew-card-chip.has-crew:hover { border-color: var(--gold-deep); transform: translateY(-2px); }
.crew-card-chip.beat-incoming { border-color: var(--reaction-cold-2); box-shadow: 0 0 16px rgba(63,217,255,0.35); }
.crew-card-chip.beat-power { border-color: var(--gold); box-shadow: 0 0 20px rgba(255,215,94,0.55); }
.crew-card-chip.beat-success { border-color: var(--green); box-shadow: 0 0 24px rgba(65,245,143,0.62); }
.crew-card-chip.beat-failure { border-color: var(--reaction-hot-1); box-shadow: 0 0 24px rgba(255,77,94,0.62); animation: crewFailureShake 0.35s ease; }
.crew-card-chip.beat-failure.capacitor-charging { border-color: var(--reaction-hot-1); box-shadow: 0 0 24px rgba(255,77,94,0.62), inset 0 0 18px rgba(255,107,214,0.42); }
.crew-card-chip.beat-failure.capacitor-charging::after {
  content: ""; position: absolute; inset: -4px; z-index: 4; pointer-events: none;
  border: 2px solid var(--pink); border-radius: 11px; animation: capacitorCaptureRing 0.52s ease-out both;
}
.crew-card-chip.beat-fuse-pending { border-color: var(--gold); box-shadow: 0 0 20px rgba(255,215,94,0.5); }
.crew-card-chip.beat-fuse-hero { border-color: var(--gold); box-shadow: 0 0 30px rgba(176,107,255,0.52); }
.crew-card-chip.beat-fuse { border-color: var(--gold); box-shadow: 0 0 24px rgba(255,215,94,0.62); }
.crew-card-chip.beat-capacitor { border-color: var(--green); box-shadow: 0 0 22px rgba(65,245,143,0.5), inset 0 0 18px rgba(255,107,214,0.4); }
.crew-card-chip.beat-echo { border-color: var(--green); box-shadow: 0 0 28px rgba(65,245,143,0.72); }
.crew-card-chip.beat-fuse-hero::before, .crew-card-chip.beat-fuse-hero::after,
.crew-card-chip.beat-fuse::before, .crew-card-chip.beat-fuse::after {
  content: ""; position: absolute; z-index: 4; top: -4px; bottom: -4px; width: 34%; pointer-events: none;
  border-top: 3px solid var(--purple); border-bottom: 3px solid var(--purple);
  filter: drop-shadow(0 0 7px rgba(176,107,255,0.95));
}
.crew-card-chip.beat-fuse-hero::before, .crew-card-chip.beat-fuse::before {
  left: -5px; border-left: 4px solid var(--purple); border-radius: 11px 0 0 11px;
}
.crew-card-chip.beat-fuse-hero::after, .crew-card-chip.beat-fuse::after {
  right: -5px; border-right: 4px solid var(--purple); border-radius: 0 11px 11px 0;
}
.crew-card-chip.beat-fuse-hero::before {
  animation: crewFuseClampLeft 0.22s ease-out both;
}
.crew-card-chip.beat-fuse-hero::after {
  animation: crewFuseClampRight 0.22s ease-out both;
}
.crew-card-chip.beat-echo::before, .crew-card-chip.beat-echo::after {
  content: ""; position: absolute; inset: -3px; z-index: 4; pointer-events: none;
  border: 2px solid var(--green); border-radius: 10px;
  animation: crewEchoRing 0.7s ease-out both;
}
.crew-card-chip.beat-echo::after { border-style: dashed; animation-delay: 0.16s; }
.crew-chip-loadout { transition: opacity 0.2s ease; }
.crew-card-chip[class*="beat-"] .crew-chip-loadout { opacity: 0.5; }
.crew-resolution { display: none; position: absolute; inset: 0; z-index: 3; flex-direction: column; justify-content: center; align-items: center; gap: 5px; font-family: var(--mono); font-size: 13px; font-weight: 900; letter-spacing: 0.05em; text-align: center; background: rgba(5,7,11,0.88); border-radius: 7px; pointer-events: none; }
.crew-resolution.visible { display: flex; }
.crew-resolution.crew-res-pop { animation: crewResultIn 0.22s ease-out both; }
.crew-resolution.fade-out { animation: crewResultOut 0.3s ease-in forwards; }
.beat-fuse-hero .crew-resolution::after {
  content: "⚡"; position: absolute; z-index: 5; top: -17px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 20px; line-height: 1; text-shadow: 0 0 7px #fff, 0 0 16px var(--purple);
  animation: crewFuseSpark 0.28s ease-out 0.2s both;
}
.crew-resolution.fuse-hero-state { background: rgba(5,7,11,0.97); }
.crew-resolution.fuse-hero-state .crew-res-extra { color: var(--purple); font-size: 15px; letter-spacing: 0.02em; white-space: nowrap; text-shadow: 0 0 14px rgba(176,107,255,0.8); }
.crew-res-power { color: var(--gold); }
.crew-res-bonus { color: var(--gold); }
.crew-res-extra { color: var(--text); font-size: 9px; }
.beat-success .crew-res-bonus, .beat-capacitor .crew-res-bonus, .beat-echo .crew-res-bonus { color: var(--green); }
.beat-failure .crew-res-bonus { color: var(--reaction-hot-1); }
.beat-fuse-pending .crew-res-bonus, .beat-fuse .crew-res-bonus { color: var(--reaction-hot-1); }
.beat-fuse .crew-res-extra { color: var(--purple); font-size: 10px; }
.beat-capacitor .crew-res-extra { color: var(--pink); font-size: 10px; text-shadow: 0 0 12px rgba(255,107,214,0.72); }
.beat-echo .crew-res-extra { color: var(--green); }
.crew-card-chip.no-crew {
  opacity: 0.45;
}
.crew-chip-name {
  font-size: 13px; font-weight: 800; margin-bottom: 2px;
}
.crew-card-chip.no-crew .crew-chip-name { color: var(--faint); }
.crew-chip-action {
  font-family: var(--mono); font-size: 10px; color: var(--cyan);
  margin-bottom: 1px; font-weight: 700;
}
.crew-chip-bonus {
  font-family: var(--mono); font-size: 10px; color: var(--dim);
  margin-bottom: 1px;
}
.crew-chip-bonus-result {
  font-family: var(--mono); font-size: 10px; color: var(--gold);
  margin-bottom: 1px; font-weight: 700;
}
.crew-chip-role {
  font-family: var(--mono); font-size: 8px; color: var(--dim);
  letter-spacing: 0.06em;
}

.card-slot {
  width: 72px; height: 102px;
  border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.card-slot.slot-empty {
  border: 1px dashed var(--line);
  background: rgba(13,19,32,0.35);
  cursor: pointer;
}
.card-slot.slot-empty:hover {
  border-color: var(--line-bright);
  background: rgba(16,24,42,0.45);
}
.slot-empty-text {
  font-family: var(--mono); font-size: 12px; color: var(--faint);
  font-weight: 700; letter-spacing: 0.06em;
}
.slot-empty-sub {
  font-family: var(--mono); font-size: 9px; color: var(--faint);
}

.card-slot.slot-card {
  border: 1px solid var(--line-bright);
  background: linear-gradient(165deg, #131c2e, #0c1220);
  cursor: pointer;
}
.card-slot.slot-card.used {
  border-color: var(--green);
  box-shadow: 0 0 8px rgba(65,245,143,0.2);
}
.card-slot.slot-card.ignored {
  border-color: var(--faint);
  opacity: 0.7;
}

.slot-card-rank {
  font-family: var(--mono); font-size: 20px; font-weight: 800; line-height: 1;
}
.slot-card-rank.hearts   { color: var(--hearts); }
.slot-card-rank.diamonds { color: var(--diamonds); }
.slot-card-rank.clubs    { color: var(--clubs); }
.slot-card-rank.spades   { color: var(--spades); }
.slot-card-suit {
  font-size: 13px; line-height: 1;
}
.slot-card-suit.hearts   { color: var(--hearts); }
.slot-card-suit.diamonds { color: var(--diamonds); }
.slot-card-suit.clubs    { color: var(--clubs); }
.slot-card-suit.spades   { color: var(--spades); }
.slot-card-status {
  font-family: var(--mono); font-size: 8px;
  padding: 1px 5px; border-radius: 4px;
  margin-top: 2px;
}
.card-slot.used .slot-card-status {
  background: #0a2a1c; color: var(--green); border: 1px solid #1d5c3c;
}
.card-slot.ignored .slot-card-status {
  background: var(--bg0); color: var(--faint); border: 1px solid var(--line);
}
.card-resolution {
  display: none; position: absolute; inset: 0; z-index: 4; align-items: center; justify-content: center;
  border-radius: 7px; background: rgba(5,7,11,0.9); color: var(--cyan);
  font-family: var(--mono); font-size: 12px; font-weight: 900; letter-spacing: 0.06em;
  text-align: center; pointer-events: none;
}
.card-resolution.visible { display: flex; animation: cardScoreIn 0.2s ease-out both; }
.card-resolution.ignored { color: var(--faint); }
.card-resolution.fade-out { animation: localFeedbackOut 0.18s ease-in forwards; }
.card-slot.card-scoring { border-color: var(--cyan) !important; box-shadow: 0 0 20px rgba(63,217,255,0.5) !important; }
.card-slot.card-ignored { border-color: var(--faint) !important; filter: saturate(0.2); opacity: 0.68; }

/* Scoring highlights on card slots */
.card-slot.scoring-glow {
  border-color: var(--green) !important;
  box-shadow: 0 0 16px rgba(65,245,143,0.4) !important;
}
.card-slot.ignored-glow {
  border-color: var(--faint) !important;
  box-shadow: 0 0 8px rgba(118,131,155,0.3) !important;
}
.card-slot.resolving {
  border-color: var(--gold) !important;
  box-shadow: 0 0 12px rgba(255,215,94,0.3) !important;
}

.score-discharge {
  position: fixed; z-index: 98; height: 3px; transform-origin: left center; pointer-events: none;
  border-radius: 999px; opacity: 0; clip-path: inset(0 100% 0 0);
  background: linear-gradient(90deg, rgba(63,217,255,0), var(--cyan) 18%, #fff 52%, var(--cyan) 82%, rgba(63,217,255,0));
  box-shadow: 0 0 8px #fff, 0 0 18px var(--cyan), 0 0 32px rgba(63,217,255,0.7);
}
.score-discharge.active { animation: scoreDischarge 0.36s ease-in forwards; }
.modifier-transfer {
  position: fixed; z-index: 99; height: 4px; transform-origin: left center; pointer-events: none;
  border-radius: 999px; opacity: 0; clip-path: inset(0 100% 0 0);
}
.modifier-transfer-capacitor {
  background: linear-gradient(90deg, rgba(255,107,214,0), var(--pink) 18%, #fff 52%, var(--pink) 82%, rgba(255,107,214,0));
  box-shadow: 0 0 8px #fff, 0 0 20px var(--pink), 0 0 34px rgba(255,107,214,0.72);
}
.modifier-transfer.active { animation: modifierTransfer 0.36s ease-in forwards; }
#firewall-panel.firewall-impact { animation: firewallElectricImpact 0.64s ease-out; }

/* ================= Firewall bar ================= */
.bar {
  height: 18px; background: var(--bg0);
  border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; position: relative;
  margin: 6px 0;
}
.bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--red), var(--orange));
  width: 100%; transform-origin: left;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px; color: var(--text);
}
.fw-name { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.fw-type { font-size: 10px; color: var(--dim); margin-left: 6px; }

/* ================= Preview panel ================= */
#preview-main { font-family: var(--mono); font-size: 12px; }
.pv-empty {
  width: 100%; text-align: center; color: var(--faint);
  font-size: 12px; padding: 12px 0;
}
.pv-row { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; flex-wrap: wrap; }
.pv-hand {
  font-size: 16px; font-weight: 800; letter-spacing: 0.1em;
  color: var(--gold); padding: 2px 10px;
  background: rgba(255,215,94,0.08);
  border: 1px solid var(--gold-deep); border-radius: 6px;
}
.pv-used-label { font-size: 10px; color: var(--green); }
.pv-ignored-label { font-size: 10px; color: var(--orange); }
.pv-bhp { font-size: 13px; color: var(--dim); }
.pv-bhp b { color: var(--text); }
.pv-capacitor-info {
  margin: 6px 0; padding: 5px 8px; border-left: 2px solid var(--pink);
  color: var(--pink); background: rgba(255,107,214,0.06);
  font-family: var(--mono); font-size: 10px; font-weight: 800; letter-spacing: 0.04em;
}

.pv-slot-breakdown { margin: 4px 0; }
.pv-slot-line { font-size: 10px; color: var(--dim); padding: 1px 0; }
.pv-slot-line.ok { color: var(--text); }
.pv-slot-line.break { color: var(--orange); }
.pv-slot-line.ignored { color: var(--faint); }
.pv-slot-line b { font-weight: 700; }

.pv-totals {
  display: flex; flex-direction: column; gap: 3px;
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid var(--line);
}
.pv-total-row { font-size: 11px; color: var(--dim); }
.pv-total-row b { color: var(--text); }
.pv-total-row.power-row b { color: var(--cyan); }
.pv-total-row.combo-row b { color: var(--orange); }
.pv-total-row.pv-final {
  font-size: 14px; font-weight: 700; color: var(--text);
  padding-top: 4px; margin-top: 4px;
  border-top: 1px solid var(--line);
}

/* ================= Rules table ================= */
.rules-table {
  width: 100%; border-collapse: collapse;
  font-family: var(--mono); font-size: 10px;
  margin: 8px 0 12px;
}
.rules-table th {
  text-align: left; color: var(--gold);
  border-bottom: 1px solid var(--line);
  padding: 4px 6px; font-size: 9px; letter-spacing: 0.08em;
}
.rules-table td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(29,41,66,0.5);
  color: var(--dim);
}
.rules-table td b { color: var(--text); }
#rules-content h3 {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
  color: var(--cyan); margin: 12px 0 4px;
}
#rules-content p { font-family: var(--mono); font-size: 10px; color: var(--dim); line-height: 1.5; }
#rules-content p b { color: var(--text); }

/* ================= Controls row ================= */
.controls-row { text-align: center; margin-bottom: 8px; }

/* ================= Zone labels ================= */
.zone-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  color: var(--faint); padding: 4px 0 2px; text-align: center;
}
.zone-hint { color: var(--faint); font-size: 9px; letter-spacing: normal; }

/* ================= Phase banner ================= */
.phase-ribbon {
  width: 100%; padding: 12px 20px;
  text-align: center;
  font-family: var(--mono); font-size: 15px; font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
}
.ribbon-pop { animation: ribbonPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.ribbon-damage { color: var(--red); background: rgba(255,77,94,0.06); }
.ribbon-gold { color: var(--gold); background: rgba(255,215,94,0.06); }
@keyframes ribbonPop {
  0% { transform: scale(0.95); opacity: 0; }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); opacity: 1; }
}

/* ================= Log ================= */
#log-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 8px 12px; }
#log-panel .panel-title { margin-bottom: 4px; }
#event-log { flex: 1; min-height: 0; overflow-y: auto; }
.log-entry {
  font-family: var(--mono); font-size: 10px;
  padding: 2px 4px; border-bottom: 1px solid rgba(29,41,66,0.3);
}
.log-t { color: var(--faint); margin-right: 6px; }
.log-sys { color: var(--dim); }
.log-dmg { color: var(--orange); }
.log-win { color: var(--green); font-weight: 700; }

/* ================= NEXT button (step mode) ================= */
#btn-step-next {
  position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%);
  z-index: 100;
  font-family: var(--mono); font-size: 16px; font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--gold); background: linear-gradient(180deg, #443411, #2c210a);
  border: 1px solid var(--gold-deep); border-radius: 10px;
  padding: 14px 36px; cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
  box-shadow: 0 0 18px rgba(255,215,94,0.35), 0 8px 24px rgba(0,0,0,0.5);
  animation: pulse-glow 1.6s ease-in-out infinite;
}
#btn-step-next:hover { transform: translateX(-50%) translateY(-2px); box-shadow: 0 0 28px rgba(255,215,94,0.5); }
#btn-step-next.hidden { display: none !important; }
#btn-step-next span { font-size: 11px; color: var(--faint); margin-left: 10px; }
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 18px rgba(255,215,94,0.35), 0 8px 24px rgba(0,0,0,0.5); }
  50% { box-shadow: 0 0 30px rgba(255,215,94,0.55), 0 8px 24px rgba(0,0,0,0.5); }
}
.resolving .tcard { pointer-events: none; }

/* ================= Selection screen ================= */
#screen-selection .game-body { grid-template-columns: 1fr; }
#screen-selection #center { padding: 0 40px; }

.select-header { text-align: center; margin: 12px 0 8px; }
.select-header h2 { font-family: var(--mono); font-size: 22px; font-weight: 800; color: var(--gold); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 2px; }
.select-header p { font-size: 13px; color: var(--dim); }
.variant-picker { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; font-family: var(--mono); font-size: 12px; color: var(--gold); }
.variant-picker select { background: var(--bg0); color: var(--text); border: 1px solid var(--line-bright); border-radius: 6px; padding: 6px 10px; font-family: var(--mono); font-size: 12px; }

.select-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 14px 20px; width: 100%; margin: 0 auto; }
.select-crew-card {
  min-width: 0; padding: 16px 20px; border: 1px solid var(--line); border-radius: 10px;
  width: 100%;
  background: var(--bg2); cursor: pointer; position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.select-crew-card:hover { border-color: var(--line-bright); transform: translateY(-2px); }
.select-crew-card.selected { border-color: var(--gold-deep); box-shadow: 0 0 0 1px var(--gold-deep), 0 0 12px rgba(255,215,94,0.14); }
.select-crew-card.selected::before { content: "✓"; position: absolute; top: 8px; right: 10px; color: var(--gold); font-size: 16px; font-weight: 700; }
.select-crew-name { font-size: 17px; font-weight: 800; margin-bottom: 3px; }
.select-crew-role { font-size: 11px; color: var(--dim); font-family: var(--mono); margin-bottom: 6px; }
.select-crew-action { font-size: 12px; color: var(--dim); font-family: var(--mono); margin-bottom: 2px; }
.select-crew-action b { color: var(--cyan); font-size: 13px; }
.select-crew-bonus { font-size: 12px; color: var(--dim); font-family: var(--mono); margin-bottom: 3px; }
.select-crew-result { font-size: 13px; color: var(--gold); font-family: var(--mono); margin-bottom: 8px; font-weight: 700; }
.select-crew-level { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.select-level-drop { background: var(--bg0); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 2px 8px; margin-left: 4px; font-family: var(--mono); font-size: 12px; cursor: pointer; }
#select-bar { margin: 8px 20px !important; }
.select-bar-header { font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; color: var(--cyan); margin-bottom: 6px; }
.select-chip { display: inline-block; font-family: var(--mono); font-size: 11px; background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; margin: 3px; color: var(--text); }

.suit-color { font-weight: 700; }
.suit-color.hearts   { color: var(--hearts); }
.suit-color.diamonds { color: var(--diamonds); }
.suit-color.clubs    { color: var(--clubs); }
.suit-color.spades   { color: var(--spades); }

/* ================= Shop modal ================= */
#shop-modal-wrap {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(3px);
}
#shop-modal-wrap.hidden { display: none; }
#shop-modal {
  width: 760px; max-width: 94vw;
  background: var(--panel-solid);
  border: 1px solid var(--line-bright);
  border-radius: 14px;
  padding: 28px 24px 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.shop-modal-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 16px;
}
.shop-modal-title {
  font-family: var(--mono); font-size: 18px; font-weight: 800;
  letter-spacing: 0.08em; color: var(--gold);
}
.shop-modal-credits {
  font-family: var(--mono); font-size: 14px; color: var(--dim);
}
.shop-modal-credits b { color: var(--gold); }
.shop-offer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.shop-offer-card {
  padding: 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg2); text-align: center;
}
.shop-offer-name { font-size: 15px; font-weight: 800; margin-bottom: 6px; }
.shop-offer-category { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; color: var(--cyan); margin-bottom: 8px; }
.shop-offer-unlock .shop-offer-category { color: var(--gold); }
.shop-offer-modifier .shop-offer-category { color: var(--purple); }
.shop-offer-role { font-size: 10px; color: var(--dim); font-family: var(--mono); margin-bottom: 2px; }
.shop-offer-power { font-size: 12px; color: var(--cyan); font-family: var(--mono); margin-bottom: 2px; font-weight: 700; }
.shop-offer-bonus-cond { font-size: 10px; color: var(--dim); font-family: var(--mono); margin-bottom: 8px; line-height: 1.3; }
.shop-offer-cost { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--gold); margin-bottom: 10px; }
.shop-offer-empty {
  border-color: var(--faint); opacity: 0.4;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 150px;
}
.shop-offer-empty-text { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.shop-offer-empty-hint { font-family: var(--mono); font-size: 9px; color: var(--faint); margin-top: 4px; }
.shop-buy-btn { width: 100%; margin-top: auto; }
.shop-modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ================= Modifier panel (right rail) ================= */
#modifiers-panel { flex-shrink: 0; }
#modifiers-content { display: flex; flex-direction: column; gap: 8px; }
.modifier-empty {
  font-family: var(--mono); font-size: 11px; color: var(--faint);
  text-align: center; padding: 18px 8px;
}
.modifier-card {
  padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg2);
  pointer-events: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
}
.modifier-card[data-state="consumed"] { opacity: 0.45; border-color: var(--faint); }
.modifier-fuse { border-left: 3px solid var(--purple); }
.modifier-echo { border-left: 3px solid var(--gold-deep); }
.modifier-capacitor { border-left: 3px solid var(--pink); }
.modifier-capacitor[data-state="charged"] { border-color: rgba(255,107,214,0.75); box-shadow: inset 0 0 16px rgba(255,107,214,0.12), 0 0 16px rgba(255,107,214,0.2); }
.modifier-card[data-state="consumed"].modifier-fuse { border-left-color: var(--faint); }
.modifier-card[data-state="consumed"].modifier-echo { border-left-color: var(--faint); }
.modifier-card[data-state="consumed"].modifier-capacitor { border-left-color: var(--faint); }
.modifier-icon {
  font-size: 20px; line-height: 1; margin-bottom: 4px;
}
.modifier-card[data-state="consumed"] .modifier-icon { opacity: 0.4; }
.modifier-name {
  font-family: var(--mono); font-size: 12px; font-weight: 800;
  letter-spacing: 0.06em; color: var(--text); margin-bottom: 4px;
}
.modifier-desc {
  font-family: var(--mono); font-size: 10px; color: var(--dim);
  line-height: 1.35; margin-bottom: 8px;
}
.modifier-badge {
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 10px; border-radius: 999px;
  display: inline-block;
}
.modifier-badge.ready { background: rgba(63, 217, 255, 0.12); color: var(--cyan); border: 1px solid rgba(63, 217, 255, 0.3); }
.modifier-fuse .modifier-badge.ready { background: rgba(176,107,255,0.12); color: var(--purple); border-color: rgba(176,107,255,0.38); }
.modifier-capacitor .modifier-badge.ready,
.modifier-capacitor .modifier-badge.charged { background: rgba(255,107,214,0.12); color: var(--pink); border: 1px solid rgba(255,107,214,0.42); }
.modifier-badge.consumed { background: rgba(74, 86, 112, 0.12); color: var(--faint); border: 1px solid var(--faint); }
.modifier-card.modifier-activating {
  animation: modifierPulse 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modifierPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(176,107,255,0); }
  30% { transform: scale(1.06); box-shadow: 0 0 22px rgba(176,107,255,0.62); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(176,107,255,0); }
}
.modifier-echo.modifier-activating {
  animation-name: modifierPulseGold;
}
.modifier-capacitor.modifier-activating,
.modifier-capacitor.modifier-discharging {
  animation: modifierPulsePink 0.52s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modifierPulseGold {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 215, 94, 0); }
  30% { transform: scale(1.06); box-shadow: 0 0 18px rgba(255, 215, 94, 0.5); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 215, 94, 0); }
}
@keyframes modifierPulsePink {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(255,107,214,0); }
  30% { transform: scale(1.06); box-shadow: 0 0 24px rgba(255,107,214,0.66); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(255,107,214,0); }
}

/* ================= Credits counter ================= */
.counter-gold .counter-label { color: var(--gold-deep); }
.counter-gold { border-left: 1px solid var(--gold-deep); padding-left: 10px; }

@media (max-width: 1180px) {
  #hand-result-badge { min-width: 150px; max-width: 70%; font-size: 16px; padding: 7px 14px; }
  .score-delta { right: 6px; font-size: 11px; }
  .card-resolution { font-size: 11px; }
}

@media (max-width: 620px) {
  #shop-modal { padding: 20px 14px 16px; }
  .shop-modal-header { display: block; }
  .shop-modal-credits { display: block; margin-top: 8px; }
  .shop-offer-grid { grid-template-columns: repeat(3, minmax(145px, 1fr)); overflow-x: auto; }
  .shop-offer-card { min-height: 154px; padding: 10px; }
  .shop-modal-actions { flex-wrap: wrap; }
}
