/* ------------------------------------------------------------------
   Pile readouts, round collection, special-card row and type scale.
   Loaded after styles.css so it can refine the base skin.
   ------------------------------------------------------------------ */

.pile-zone {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 10px 8px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.pile-zone:hover,
.pile-zone:focus-visible,
.pile-zone.is-open {
  border-color: rgba(94, 223, 212, 0.42);
  background: rgba(9, 24, 33, 0.62);
  box-shadow: 0 0 24px rgba(94, 223, 212, 0.12);
  outline: none;
}

.pile-zone--discard:hover,
.pile-zone--discard:focus-visible,
.pile-zone--discard.is-open {
  border-color: rgba(238, 200, 109, 0.46);
  background: rgba(30, 26, 14, 0.55);
  box-shadow: 0 0 24px rgba(238, 200, 109, 0.14);
}

.pile-zone .deck-stack {
  width: 84px;
}

.pile-count {
  position: absolute;
  top: 6px;
  right: 8px;
  min-width: 22px;
  padding: 2px 5px;
  border: 1px solid rgba(94, 223, 212, 0.4);
  border-radius: 2px;
  background: rgba(4, 12, 18, 0.92);
  color: #b6fff6;
  font-family: var(--font-display);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.pile-zone--discard .pile-count {
  border-color: rgba(238, 200, 109, 0.42);
  color: #ffe6a6;
}

.pile-label {
  color: var(--text-soft);
  font-family: var(--font-display);
  font-size: 10px;
}

.pile-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 60;
  padding: 6px 10px;
  border: 1px solid rgba(94, 223, 212, 0.45);
  border-radius: 4px;
  background: rgba(4, 12, 18, 0.96);
  color: #d8fffb;
  font-family: var(--font-display);
  font-size: 10px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
  transition: opacity 160ms ease, transform 160ms ease;
}

.pile-zone--discard .pile-tip {
  border-color: rgba(238, 200, 109, 0.45);
  color: #ffe8ae;
}

.pile-zone:hover .pile-tip,
.pile-zone:focus-visible .pile-tip,
.pile-zone.is-open .pile-tip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.discard-stack {
  position: relative;
  width: 84px;
  aspect-ratio: 0.7;
  filter: drop-shadow(0 16px 18px rgba(0, 0, 0, 0.3));
}

.discard-card {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(94, 223, 212, 0.35);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(94, 223, 212, 0.16), transparent 52%),
    linear-gradient(45deg, transparent 46%, rgba(255, 255, 255, 0.07) 47% 50%, transparent 51%),
    #0d1f2b;
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
}

.discard-card--1 {
  transform: translate(-3px, 2px) rotate(-4deg);
}

.discard-card--2 {
  transform: translate(2px, 0) rotate(3deg);
}

.discard-card--3 {
  transform: translate(-1px, -2px) rotate(-1deg);
}

.discard-stack[data-empty="false"] .discard-card {
  opacity: 0.83;
}

.discard-stack[data-depth="mid"] .discard-card--3,
.discard-stack[data-depth="high"] .discard-card--3 {
  opacity: 0.92;
  transform: translate(3px, -4px) rotate(5deg);
}

.discard-stack[data-depth="high"] .discard-card--2 {
  opacity: 0.96;
  transform: translate(-4px, -1px) rotate(-5deg);
}

.discard-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(169, 187, 185, 0.24);
  border-radius: 6px;
  color: rgba(169, 187, 185, 0.5);
  font-family: var(--font-display);
  font-size: 8px;
  opacity: 0;
  transition: opacity 200ms ease;
}

.discard-stack[data-empty="true"] .discard-empty {
  opacity: 1;
}

.pile-zone.is-receiving .discard-stack {
  animation: discardReceive 620ms cubic-bezier(0.2, 0.78, 0.2, 1) both;
}

.pile-zone.is-receiving .pile-count {
  animation: pileCountPop 620ms ease both;
}

@keyframes discardReceive {
  0% {
    transform: scale(1);
  }
  38% {
    transform: scale(1.12);
    filter: drop-shadow(0 0 22px rgba(238, 200, 109, 0.5));
  }
  100% {
    transform: scale(1);
  }
}

@keyframes pileCountPop {
  0%,
  100% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.18);
  }
}

/* Every card on a player rail keeps one identical footprint. */
#playerGrid .game-card {
  flex: 0 0 var(--card-width, 66px);
  width: var(--card-width, 66px);
  aspect-ratio: 0.7;
}

.player-grid[data-count="10"],
.player-grid[data-count="11"],
.player-grid[data-count="12"],
.player-grid[data-count="13"],
.player-grid[data-count="14"],
.player-grid[data-count="15"],
.player-grid[data-count="16"],
.player-grid[data-count="17"],
.player-grid[data-count="18"] {
  --card-width: 54px;
}

/* Special cards get their own row; spent cards stay visible, struck out. */
.card-rail--numbers {
  min-height: 0;
  margin-top: 9px;
  max-height: calc(var(--card-width, 66px) / 0.7 * 3 + 26px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.card-rail--numbers:empty {
  display: none;
}

.card-rail--specials {
  min-height: 0;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(169, 187, 185, 0.18);
  max-height: calc(var(--card-width, 66px) / 0.7 + 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.card-rail--specials:empty {
  display: none;
}

.card-rail--specials:not(:empty)::before {
  display: block;
  flex: 0 0 100%;
  margin-bottom: 2px;
  color: rgba(169, 187, 185, 0.58);
  content: "SPECIAL";
  font-family: var(--font-display);
  font-size: 7px;
}

.game-card.is-shield {
  border-color: rgba(120, 240, 172, 0.72);
  box-shadow: 0 0 16px rgba(96, 226, 150, 0.34);
}

.game-card.is-spent {
  filter: grayscale(0.72) brightness(0.86);
  opacity: 0.84;
}

.game-card.is-spent::after {
  position: absolute;
  top: 50%;
  left: -14%;
  z-index: 8;
  display: block;
  width: 128%;
  height: 2px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(90deg, transparent, #ff6f82 12% 88%, transparent);
  box-shadow: 0 0 10px rgba(255, 90, 112, 0.72);
  content: "";
  opacity: 1;
  transform: rotate(-14deg);
}

.game-card.is-spent .card-stamp {
  top: auto;
  bottom: 7px;
  padding: 1px 4px;
  border-width: 1px;
  font-size: 6px;
  transform: translateX(-50%) rotate(-5deg);
}

/* Round score becomes a first-class readout on every player panel. */
.score-lockup {
  display: grid;
  justify-items: end;
  min-width: 62px;
}

.score-lockup .round-score {
  display: inline-flex;
  margin-top: 5px;
  padding: 2px 6px;
  align-items: baseline;
  gap: 3px;
  border: 1px solid rgba(94, 223, 212, 0.42);
  border-radius: 2px;
  background: rgba(94, 223, 212, 0.12);
  color: #bffbf3;
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 0;
}

.score-lockup .round-score span {
  color: rgba(214, 245, 241, 0.74);
  font-size: 9px;
}

.score-lockup .round-score b {
  color: #ffffff;
  font-size: 18px;
  font-weight: 850;
  line-height: 1;
}

.score-lockup .round-score i {
  color: rgba(214, 245, 241, 0.74);
  font-size: 9px;
  font-style: normal;
}

.score-lockup .round-score--final {
  border-color: rgba(238, 200, 109, 0.62);
  background: rgba(238, 200, 109, 0.16);
  color: #ffe7a8;
}

.score-lockup .round-score--final b {
  color: #fff3c9;
}

.score-lockup .round-score--lost {
  border-color: rgba(255, 83, 104, 0.55);
  background: rgba(255, 83, 104, 0.12);
  color: #ffa6b0;
}

.score-lockup .round-score--lost b {
  color: #ffc4ca;
}

/* Global type scale: everything around the action window gets a lift. */
#roundMonitor {
  gap: 16px;
  padding: 9px 18px;
}

#roundMonitor .monitor-item {
  min-width: 56px;
}

#roundMonitor .monitor-item b {
  font-size: 20px;
}

#roundMonitor .monitor-item small {
  font-size: 9px;
}

.event-console {
  grid-template-columns: 156px minmax(0, 1fr);
  min-height: 54px;
  padding: 10px clamp(16px, 3vw, 38px);
}

.console-label {
  font-size: 10px;
}

.event-line {
  font-size: 11px;
}

.command-deck .eyebrow {
  font-size: 9px;
}

.phase-badge {
  padding: 5px 8px;
  font-size: 9px;
}

.turn-readout strong {
  font-size: 16px;
}

.turn-readout p {
  font-size: 11.5px;
}

.action-stack b {
  font-size: 13px;
}

.action-stack small {
  margin-top: 4px;
  font-size: 9px;
}

.probability-strip span {
  font-size: 10px;
}

.probability-strip b {
  font-size: 20px;
}

.player-nameplate h3 {
  font-size: 15px;
}

.player-nameplate p {
  font-size: 9px;
}

.player-status {
  margin-top: 8px;
  font-size: 11px;
}

.player-status > span {
  font-family: var(--font-display);
  letter-spacing: 0;
}

.player-status .status-pill {
  padding: 5px 9px;
  font-size: 10px;
}

.second-chance-mark {
  font-size: 9px;
}

.status-effect strong {
  font-size: 9px;
}

.status-effect small {
  font-size: 7px;
}

.target-copy strong {
  font-size: 14px;
}

.target-copy p {
  font-size: 11px;
}

/* Target modal keeps each candidate's round score visible. */
.target-option {
  grid-template-columns: 30px minmax(0, 1fr) auto 18px;
}

.target-option__copy b {
  font-size: 12px;
}

.target-option__copy small {
  font-size: 8.5px;
}

.target-option__score {
  display: grid;
  min-width: 48px;
  padding-left: 9px;
  justify-items: center;
  border-left: 1px solid var(--line);
}

.target-option__score b {
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.target-option__score small {
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 8px;
}

/* Cleaner number faces: one centred digit, slightly calmer scale. */
.number-card__value {
  font-size: 32px;
}

.game-card--modifier .modifier-card__value {
  font-size: 24px;
}

@media (max-width: 1100px) {
  #playerGrid {
    --card-width: 58px;
  }
}

@media (max-width: 860px) {
  .deck-stage {
    width: 126px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    right: 10px;
  }

  .pile-zone {
    pointer-events: auto;
    padding: 6px 3px 4px;
    gap: 4px;
  }

  .pile-zone .deck-stack,
  .discard-stack {
    width: 42px;
  }

  .pile-zone .deck-emblem {
    width: 24px;
    font-size: 12px;
  }

  .pile-count {
    top: 2px;
    right: 2px;
    min-width: 18px;
    padding: 1px 4px;
    font-size: 9px;
  }

  .pile-label {
    font-size: 7px;
  }

  .turn-readout {
    padding-right: 142px;
  }

  #roundMonitor {
    gap: 9px;
    padding: 7px 10px;
  }

  #roundMonitor .monitor-item {
    min-width: 40px;
  }

  #roundMonitor .monitor-item b {
    font-size: 15px;
  }

  #roundMonitor .monitor-item small {
    font-size: 7px;
  }

  .command-deck .eyebrow,
  .phase-badge {
    font-size: 8px;
  }

  .turn-readout strong {
    font-size: 14px;
  }

  .turn-readout p {
    font-size: 10px;
  }

  .player-status {
    font-size: 9px;
  }

  .score-lockup .round-score b {
    font-size: 14px;
  }
}

@media (max-width: 560px) {
  #playerGrid {
    --card-width: 52px;
  }

  .number-card__value {
    font-size: 27px;
  }

  .number-card__axis {
    width: 32px;
  }

  .game-card--modifier .modifier-card__value {
    font-size: 19px;
  }

  .turn-readout {
    padding-right: 134px;
  }

  .pile-tip {
    max-width: 70vw;
    white-space: normal;
  }
}

/* Both piles share one compact row next to the turn readout. */
.deck-stage {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
  padding: 14px 0 6px;
  align-items: start;
}

.event-line {
  font-size: 12px;
}

@media (max-width: 860px) {
  .deck-stage {
    width: 126px;
    gap: 4px;
    padding: 0;
  }
}

/* Rail scrollbars stay on-theme instead of rendering as dark blocks. */
.card-rail {
  scrollbar-color: rgba(94, 223, 212, 0.35) transparent;
  scrollbar-width: thin;
}

.card-rail::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.card-rail::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: rgba(94, 223, 212, 0.35);
}

.card-rail::-webkit-scrollbar-track {
  background: transparent;
}

/* Active player: unmistakable animated highlight. */
.player-panel.is-current {
  border-color: color-mix(in srgb, var(--accent) 90%, white);
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
  background:
    radial-gradient(circle at 12% 4%, color-mix(in srgb, var(--accent) 48%, transparent), transparent 46%),
    linear-gradient(150deg, color-mix(in srgb, var(--accent) 26%, #172a3a), #0a1722 72%);
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--accent) 62%, transparent),
    0 0 46px color-mix(in srgb, var(--accent) 42%, transparent),
    0 22px 46px rgba(0, 0, 0, 0.36);
}

.player-panel.is-current:not(.is-busting):not(.is-freezing):not(.is-staying) {
  animation: activePanelPulse 2s ease-in-out infinite;
}

.player-panel.is-current::before {
  width: 4px;
  opacity: 1;
  background: linear-gradient(180deg, #ffffff, var(--accent) 45%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 70%, transparent);
}

.player-panel.is-current .player-sigil {
  border-color: #ffffff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 88%, white), var(--accent));
  color: #08121a;
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 60%, transparent);
}

.player-panel.is-current .player-sigil::after {
  border-color: color-mix(in srgb, #08121a 55%, transparent) transparent color-mix(in srgb, #08121a 55%, transparent) color-mix(in srgb, #08121a 55%, transparent);
  animation: activeSigilSpin 4.5s linear infinite;
}

.player-panel.is-current .player-nameplate h3 {
  color: #ffffff;
  text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 60%, transparent);
}

.player-panel.is-current .current-tag {
  display: inline-flex;
  padding: 4px 9px;
  align-items: center;
  gap: 5px;
  font-size: 8px;
  letter-spacing: 0.04em;
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 60%, transparent);
  animation: activeTagPulse 1.6s ease-in-out infinite;
}

.player-panel.is-current .current-tag i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: activeDot 1.1s ease-in-out infinite;
}

/* Sweep of light behind the active player's cards. */
.current-sheen {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
  mix-blend-mode: screen;
}

.player-panel.is-current > .player-header,
.player-panel.is-current > .card-rail,
.player-panel.is-current > .player-status {
  position: relative;
  z-index: 2;
}

.player-panel.is-current::before,
.player-panel.is-current::after {
  z-index: 3;
}

.current-sheen::before {
  position: absolute;
  top: -70%;
  left: -45%;
  width: 46%;
  height: 240%;
  content: "";
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--accent) 38%, transparent) 42%,
    rgba(255, 255, 255, 0.42) 50%,
    color-mix(in srgb, var(--accent) 38%, transparent) 58%,
    transparent
  );
  filter: blur(0.5px);
  animation: activeSheen 3.4s cubic-bezier(0.35, 0.6, 0.35, 1) infinite;
}

@keyframes activePanelPulse {
  0%,
  100% {
    border-color: color-mix(in srgb, var(--accent) 84%, white);
    box-shadow:
      0 0 0 2px color-mix(in srgb, var(--accent) 52%, transparent),
      0 0 34px color-mix(in srgb, var(--accent) 30%, transparent),
      0 20px 42px rgba(0, 0, 0, 0.34);
  }
  50% {
    border-color: #ffffff;
    box-shadow:
      0 0 0 3px color-mix(in srgb, var(--accent) 74%, transparent),
      0 0 70px color-mix(in srgb, var(--accent) 62%, transparent),
      0 22px 48px rgba(0, 0, 0, 0.38);
  }
}

@keyframes activeSheen {
  0% {
    opacity: 0;
    transform: rotate(16deg) translateX(-120%);
  }
  12% {
    opacity: 1;
  }
  60% {
    opacity: 0.95;
    transform: rotate(16deg) translateX(380%);
  }
  100% {
    opacity: 0;
    transform: rotate(16deg) translateX(380%);
  }
}

@keyframes activeSigilSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes activeTagPulse {
  50% {
    filter: brightness(1.35);
  }
}

@keyframes activeDot {
  50% {
    opacity: 0.32;
    transform: scale(0.7);
  }
}
