/* ============================================================
   STACKED POKER HANDS — prototype-specific styles
   (loaded after the Until It Breaks Minimal flat restyle)
   ============================================================ */

/* header brand fits the ai-bar */
#ai-bar .brand { font-size: 17px; }
#ai-bar .ai-identity { min-width: 300px; }

/* tighter 3-column body: log · center · cheat sheet */
.game-body { grid-template-columns: 280px 1fr 250px; }

#target-strip { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }

/* ================= Center layout — slots vertically centered ================= */
#center #slots-panel {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; justify-content: center;
}
#center #slots-panel .panel-title { flex: 0 0 auto; }
#center #slots-panel #hand-slots { flex: 0 0 auto; }
#center #play-area { min-height: 0; }
#center #hand-area { flex: 0 0 auto; min-height: auto; }
#center #preview-panel { flex: 0 0 auto; }

/* ================= Hand slots (5 across) ================= */
#hand-slots { display: flex; gap: 8px; }
.hand-slot {
  flex: 1; min-width: 0; height: 184px;
  border: 1px dashed rgba(255, 255, 255, 0.14); border-radius: 12px;
  position: relative; overflow: visible;
  background: var(--flat-1);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 6px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.15s;
}
.hand-slot:hover { background: var(--flat-2); }
.hand-slot .slot-num { position: absolute; top: 5px; left: 8px; font-family: var(--mono); font-size: 9px; color: var(--ink-faint); }

.hand-slot.empty .slot-hint {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 4px;
  align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em;
  color: var(--ink-faint); text-align: center; padding: 8px; pointer-events: none;
}
.hand-slot.filled { border-style: solid; border-color: rgba(255, 215, 94, 0.25); background: var(--flat-2); }

/* legality glow while something is selected */
.hand-slot.can-place { border-color: var(--gold); border-style: dashed; box-shadow: 0 0 14px rgba(255,215,94,0.22); }
.hand-slot.can-place .slot-hint { color: var(--gold); }
.hand-slot.can-fuse { border-color: var(--crypto); border-style: solid; box-shadow: 0 0 16px var(--crypto-glow); }
.hand-slot.no-target { opacity: 0.5; }
.hand-slot.unit-selected { border-color: var(--gold); border-style: solid; box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(255,215,94,0.3); transform: translateY(-3px); }
.hand-slot.drop-hover { background: var(--flat-3); transform: translateY(-2px); }

/* fuse preview bubble over a can-fuse slot */
.fuse-bubble {
  position: absolute; left: 50%; top: -14px; transform: translateX(-50%);
  z-index: 24; white-space: nowrap; pointer-events: none;
  font-family: var(--mono); font-size: 9px; font-weight: 950; letter-spacing: 0.05em;
  color: #041016; background: var(--crypto);
  border-radius: 999px; padding: 3px 9px;
  box-shadow: 0 0 14px var(--crypto-glow), 0 3px 10px rgba(0,0,0,0.5);
  animation: typeFloatWiggle 1.2s ease-in-out infinite;
}
.hand-slot.can-place .fuse-bubble { color: #140b02; background: var(--gold); box-shadow: 0 0 14px rgba(255,215,94,0.5), 0 3px 10px rgba(0,0,0,0.5); }
.fuse-bubble.full { color: #fff; background: var(--red); box-shadow: 0 0 12px rgba(255,77,94,0.5), 0 3px 10px rgba(0,0,0,0.5); animation: none; }

/* mini cards inside a unit — larger, fanned corner-index style */
.unit-cards { display: flex; justify-content: center; margin-bottom: 8px; padding-top: 4px; }
.mcard {
  width: 46px; height: 64px; margin: 0 -14px;
  border-radius: 7px; border: 1px solid var(--line-bright);
  background: linear-gradient(165deg, #182238, #0c1220);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start;
  padding: 5px 6px;
  font-family: var(--mono); font-size: 17px; font-weight: 800; line-height: 1;
  flex-shrink: 0; position: relative;
  box-shadow: -3px 0 8px rgba(0,0,0,0.45);
}
.mcard:first-child { margin-left: 0; }
.mcard > span:first-child { font-size: 17px; }
.mcard .m-suit { font-size: 14px; margin-top: 1px; }
.mcard.hearts { color: var(--hearts); }
.mcard.diamonds { color: var(--diamonds); }
.mcard.clubs { color: var(--clubs); }
.mcard.spades { color: var(--spades); }

/* loose card: part of the stack but outside the best hand — heat liability */
.mcard.leftover {
  border-style: dashed;
  border-color: rgba(255, 77, 94, 0.6);
  filter: saturate(0.5) brightness(0.72);
  opacity: 0.85;
}
.mcard.leftover::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 7px;
  background: repeating-linear-gradient(45deg, rgba(255,77,94,0.16) 0 4px, transparent 4px 8px);
  pointer-events: none;
}

.unit-name {
  font-family: var(--mono); font-size: 10px; font-weight: 950; letter-spacing: 0.06em;
  color: var(--gold); text-align: center; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 100%;
}
.unit-score { font-family: var(--mono); font-size: 12px; font-weight: 800; color: var(--ink); }
.unit-score b { color: var(--orange); }
.unit-heat { font-family: var(--mono); font-size: 8px; color: var(--ink-faint); }
.unit-leftover { font-family: var(--mono); font-size: 8px; font-weight: 800; color: var(--red); letter-spacing: 0.02em; text-align: center; }
.hand-slot.incomplete { border-color: rgba(255, 77, 94, 0.3); }

/* unit discard ✕ */
.unit-x {
  position: absolute; top: 3px; right: 4px; z-index: 6;
  width: 18px; height: 18px; border-radius: 6px;
  border: none; background: transparent; color: var(--ink-faint);
  font-size: 11px; line-height: 1; padding: 0;
  opacity: 0; transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.hand-slot:hover .unit-x { opacity: 1; }
.unit-x:hover { color: var(--red); background: rgba(255,77,94,0.12); }

/* resolve-time slot states */
.hand-slot.resolving-now { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange), 0 0 22px rgba(255,159,67,0.4); transform: translateY(-4px); }
.hand-slot.resolved { opacity: 0.45; filter: saturate(0.4); }
.hand-slot.wiping { animation: flyDiscard 0.5s ease-in forwards; }
.mcard.score-tick { animation: scoreTick 0.34s cubic-bezier(0.22,1,0.36,1); z-index: 18; }
.hand-slot.fused-pop { animation: summonPop 0.4s cubic-bezier(0.22,1,0.36,1); }

/* ================= Hand cards ================= */
#hand-cards { display: flex; justify-content: center; padding: 18px 0 6px; max-width: 100%; flex-wrap: wrap; row-gap: 14px; }
.tcard.dealing { animation: dealIn 0.3s cubic-bezier(0.22,1,0.36,1) both; }
.tcard.discarding { animation: flyDiscard 0.45s ease-in forwards; pointer-events: none; }
.tcard[draggable="true"] { -webkit-user-drag: element; }
.tcard.drag-ghost { opacity: 0.35; }

/* ================= Preview panel ================= */
#preview-panel { min-height: 72px; }
.pv-total { margin-left: auto; text-align: right; font-family: var(--mono); }
.pv-total .pvt-label { display: block; font-size: 9px; letter-spacing: 0.14em; color: var(--ink-faint); }
.pv-total .pvt-value { font-size: 24px; font-weight: 950; color: var(--orange); text-shadow: 0 0 14px rgba(255,159,67,0.4); }
.pv-total .pvt-bonus { display: block; font-size: 9px; color: var(--gold); }
.pv-sel-invalid { color: var(--red); font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; }
.pv-sel-valid { color: var(--green); font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; }

/* ================= Right rail cheat sheets ================= */
.value-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-family: var(--mono); font-size: 10px; padding: 3px 2px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.value-row:last-child { border-bottom: none; }
.value-row .v-name { color: var(--ink-dim); }
.value-row .v-score { color: var(--gold); font-weight: 800; white-space: nowrap; }
.value-row .v-heat { color: var(--red); font-size: 9px; white-space: nowrap; }
.fusion-row { font-size: 10px; color: var(--ink-dim); line-height: 1.5; padding: 3px 2px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.fusion-row:last-child { border-bottom: none; }
.fusion-row b { color: var(--crypto); font-family: var(--mono); }
.fusion-row .f-note { color: var(--ink-faint); font-size: 9px; }
.fusion-note { margin-top: 9px; font-size: 9.5px; line-height: 1.5; color: var(--ink-faint); border-top: 1px dashed rgba(255,255,255,0.1); padding-top: 8px; }

/* stack-bonus spotlight (reuses crew-spotlight geometry) */
.stack-spotlight { --tc: var(--gold); --tg: rgba(255,215,94,0.55); }
.stack-spotlight .cs-avatar { font-size: 30px; }

/* resolving: lock the board visually */
#screen-game.resolving #actions .btn,
#screen-game.resolving .tcard,
#screen-game.resolving .hand-slot { pointer-events: none; }
#screen-game.resolving #actions .btn { opacity: 0.35; }

@media (max-height: 760px) {
  .hand-slot { height: 152px; }
  .mcard { width: 40px; height: 56px; margin: 0 -13px; font-size: 15px; }
  .mcard > span:first-child { font-size: 15px; }
  .mcard .m-suit { font-size: 12px; }
}

/* ============================================================
   HEAT — prominence, escalating alert, penalty feedback
   ============================================================ */
#heat-panel {
  position: relative;
  --heat-a: 0; --heat-glow: 0px;
  transition: background 0.4s, box-shadow 0.4s;
}
#heat-panel .panel-title { transition: color 0.3s, text-shadow 0.3s; }
#heat-pct { transition: color 0.3s, text-shadow 0.3s; }
.heat-bar { height: 30px !important; transition: box-shadow 0.4s; }
.heat-bar .bar-fill {
  transition: transform 0.55s cubic-bezier(0.22,1,0.36,1), filter 0.4s, box-shadow 0.4s;
}

/* idle breathing — stronger & faster the hotter it gets */
@keyframes heatBreathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,77,94,0); }
  50% {
    box-shadow: 0 0 var(--heat-glow) rgba(255,77,94,var(--heat-a)),
                inset 0 0 26px rgba(255,77,94,calc(var(--heat-a) * 0.4));
  }
}
#heat-panel.heat-t1 { --heat-a: 0.22; --heat-glow: 16px; animation: heatBreathe 3.4s ease-in-out infinite; }
#heat-panel.heat-t2 { --heat-a: 0.4;  --heat-glow: 26px; animation: heatBreathe 2.3s ease-in-out infinite; }
#heat-panel.heat-t3 { --heat-a: 0.62; --heat-glow: 40px; animation: heatBreathe 1.4s ease-in-out infinite; }
#heat-panel.heat-t4 { --heat-a: 0.9;  --heat-glow: 60px; animation: heatBreathe 0.82s ease-in-out infinite; }

#heat-panel.heat-t2 .bar-fill { filter: saturate(1.15) brightness(1.08); box-shadow: 0 0 14px rgba(255,120,60,0.5); }
#heat-panel.heat-t3 .bar-fill { filter: saturate(1.3) brightness(1.15); box-shadow: 0 0 20px rgba(255,77,94,0.65); }
#heat-panel.heat-t4 .bar-fill { filter: saturate(1.5) brightness(1.25); box-shadow: 0 0 30px rgba(255,77,94,0.85); }
#heat-panel.heat-t3 .panel-title, #heat-panel.heat-t3 #heat-pct { color: var(--orange) !important; text-shadow: 0 0 12px rgba(255,159,67,0.6); }
#heat-panel.heat-t4 .panel-title, #heat-panel.heat-t4 #heat-pct { color: var(--red) !important; text-shadow: 0 0 14px rgba(255,77,94,0.8); }

/* jolt when a penalty lands */
@keyframes heatJolt {
  0% { transform: translateX(0) scale(1); }
  15% { transform: translateX(-5px) scale(1.02); }
  30% { transform: translateX(5px) scale(1.03); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
  100% { transform: translateX(0) scale(1); }
}
#heat-panel.heat-jolt { animation: heatJolt 0.5s ease-out; }
@keyframes heatAbsorb { 0% { box-shadow: 0 0 0 0 rgba(255,77,94,0.9); } 100% { box-shadow: 0 0 0 22px rgba(255,77,94,0); } }
#heat-panel.heat-absorb::after {
  content: ""; position: absolute; inset: 0; border-radius: 14px;
  animation: heatAbsorb 0.6s ease-out; pointer-events: none;
}

/* whole-screen red breathing vignette — ramps in past ~55%, loud by 80% */
#heat-vignette {
  position: fixed; inset: 0; z-index: 77; pointer-events: none;
  opacity: var(--vig, 0); transition: opacity 0.8s ease;
  background: radial-gradient(ellipse at 50% 50%, transparent 46%, rgba(150,0,18,0.30) 100%);
  box-shadow: inset 0 0 200px 34px rgba(255,24,48,0.5);
  animation: heatVigPulse 2.2s ease-in-out infinite;
}
@keyframes heatVigPulse { 0%,100% { filter: brightness(0.7) saturate(1); } 50% { filter: brightness(1.55) saturate(1.35); } }
#heat-vignette.alarm { animation-duration: 1.05s; }

/* ============================================================
   HEAT BUBBLES — vibrating cost flags above action buttons
   ============================================================ */
#actions .btn { position: relative; overflow: visible; }
.heat-bubble {
  position: absolute; left: 50%; bottom: 100%; margin-bottom: 8px;
  transform: translateX(-50%);
  z-index: 30; pointer-events: none; white-space: nowrap;
  font-family: var(--mono); font-size: 10px; font-weight: 950; letter-spacing: 0.04em;
  color: #fff; background: var(--red);
  border-radius: 999px; padding: 3px 9px;
  box-shadow: 0 0 12px rgba(255,77,94,0.6), 0 3px 8px rgba(0,0,0,0.5);
  animation: heatBubbleWiggle 0.9s ease-in-out infinite;
}
.heat-bubble::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--red);
}
.heat-bubble.hidden-bubble { display: none; }
@keyframes heatBubbleWiggle {
  0%, 100% { transform: translateX(-50%) rotate(-4deg); }
  50% { transform: translateX(-50%) rotate(4deg); }
}
/* re-deal: way more prominent, faster, bigger, hotter */
.heat-bubble.redeal-bubble {
  font-size: 13px; padding: 4px 12px; margin-bottom: 10px;
  color: #1a0402;
  background: linear-gradient(180deg, #ffb055, var(--red));
  box-shadow: 0 0 20px rgba(255,77,94,0.85), 0 0 34px rgba(255,120,40,0.5), 0 4px 10px rgba(0,0,0,0.5);
  animation: heatBubblePump 0.62s ease-in-out infinite;
}
.heat-bubble.redeal-bubble::after { border-top-color: var(--red); }
.heat-bubble.redeal-bubble::before {
  content: "🔥"; margin-right: 4px; font-size: 11px;
}
.heat-bubble.redeal-bubble.danger {
  animation-duration: 0.4s;
  box-shadow: 0 0 26px rgba(255,40,60,1), 0 0 40px rgba(255,80,30,0.7), 0 4px 12px rgba(0,0,0,0.5);
}
.heat-bubble.play-bubble { background: var(--orange); color: #1a0c02; }
.heat-bubble.play-bubble::after { border-top-color: var(--orange); }
.heat-bubble.play-bubble.danger { background: var(--red); color: #fff; animation-duration: 0.45s; }
.heat-bubble.play-bubble.danger::after { border-top-color: var(--red); }
@keyframes heatBubblePump {
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(-5deg) scale(1); }
  50% { transform: translateX(-50%) translateY(-2px) rotate(5deg) scale(1.08); }
}

/* ============================================================
   RESOLUTION — per-hand spotlight (name + points, paced)
   ============================================================ */
.hand-spotlight {
  position: fixed; left: 50%; top: 30vh; transform: translate(-50%, -50%);
  z-index: 89; width: min(440px, 64vw);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 20px 26px 22px; text-align: center;
  border: 1px solid var(--orange); border-radius: 16px;
  background:
    linear-gradient(160deg, rgba(255,159,67,0.18), transparent 60%),
    rgba(8, 11, 18, 0.97);
  box-shadow: 0 0 0 1px rgba(255,159,67,0.32), 0 24px 74px rgba(0,0,0,0.72), 0 0 44px rgba(255,159,67,0.4);
  animation: crewSpotlightIn 0.26s cubic-bezier(0.22,1,0.36,1) both;
  pointer-events: none;
}
.hand-spotlight.leaving { animation: crewSpotlightOut 0.2s ease-in forwards; }
.hand-spotlight .hs-slot { font-family: var(--mono); font-size: 10px; font-weight: 800; letter-spacing: 0.2em; color: var(--ink-faint); }
.hand-spotlight .hs-slot .hs-loose { color: var(--red); }
.hand-spotlight .hs-name {
  font-family: var(--mono); font-size: 27px; font-weight: 950; letter-spacing: 0.08em;
  color: var(--gold); text-shadow: 0 0 22px rgba(255,215,94,0.45);
}
.hand-spotlight .hs-value {
  font-family: var(--mono); font-size: 46px; font-weight: 950; line-height: 1;
  color: var(--orange); text-shadow: 0 0 24px rgba(255,159,67,0.6);
}
.hand-spotlight.hs-punch .hs-value { animation: corePop 0.32s cubic-bezier(0.22,1,0.36,1); }
.hand-spotlight .hs-detail { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); letter-spacing: 0.04em; }
.hand-spotlight .hs-detail b { color: var(--ink); }
