/**
 * Catena - stile specifico del gioco.
 * Dipende da assets/shared/tokens.css per le custom property e i pulsanti.
 */

.pkbc__hud {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pkbc__stats {
  display: flex;
  gap: 18px;
}

.pkbc__stat {
  min-width: 54px;
}

.pkbc__label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pbg-muted);
}

.pkbc__value {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
}

.pkbc__ctrl {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.pkbc__stage {
  position: relative;
  margin: 14px 0 10px;
}

.pkbc__board {
  display: grid;
  gap: var(--pbg-gap);
  transition: opacity 0.18s ease;
}

.pkbc--over .pkbc__board {
  opacity: 0.3;
  pointer-events: none;
}

.pkbc__over {
  display: none;
}

.pkbc--over .pkbc__over {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.pkbc__card {
  background: var(--pbg-panel);
  border: 1px solid var(--pbg-line);
  border-radius: 12px;
  padding: 16px 20px 18px;
  max-width: 300px;
  text-align: center;
}

.pkbc__badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--pbg-accent);
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pkbc__title {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--pbg-fg);
}

.pkbc__detail {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--pbg-muted);
}

.pkbc__board:focus-visible {
  outline: 2px solid var(--pbg-accent);
  outline-offset: 4px;
}

.pkbc__t {
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: var(--pbg-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.pkbc__t svg {
  width: 58%;
  height: 58%;
  display: block;
}

.pkbc__t--void {
  background: transparent;
  cursor: default;
}

.pkbc__t--sel {
  transform: scale(0.78);
}

.pkbc__t--pop {
  transform: scale(0.2);
  opacity: 0;
}

.pkbc__t--cur {
  outline: 2px solid var(--pbg-accent);
  outline-offset: 1px;
}

.pkbc__t--conv {
  opacity: 0.42;
}

.pkbc__t--cross {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6);
}

.pkbc__chip--cross {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6);
}

.pkbc__msg {
  margin: 0 0 12px;
  min-height: 1.5em;
  font-size: 14px;
  color: var(--pbg-muted);
}

.pkbc__legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  background: var(--pbg-panel);
  border-radius: var(--pbg-radius);
  font-size: 13px;
  color: var(--pbg-muted);
}

.pkbc__legend li {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
}

.pkbc__note {
  flex: 1 0 100%;
  border-top: 1px solid var(--pbg-line);
  padding-top: 8px;
  line-height: 1.45;
}

.pkbc__chip {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 2px solid transparent;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pkbc__chip svg {
  width: 60%;
  height: 60%;
}

/* --- modalita e Survival --- */

.pkbc__only-surv {
  display: none;
}

.pkbc--surv .pkbc__only-surv {
  display: flex;
}

.pkbc--surv .pkbc__ctrl [data-types] {
  display: none;
}

/* Il bordo alto e la linea della morte: se la pila lo supera, partita finita. */
.pkbc--surv .pkbc__stage::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -5px;
  border-top: 2px dashed var(--pbg-line);
  pointer-events: none;
}

.pkbc__t--new {
  animation: pkbc-rise 0.28s ease-out;
}

@keyframes pkbc-rise {
  from { transform: translateY(45%); opacity: 0.2; }
  to { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .pkbc__t--new { animation: none; }
}

@media (max-width: 480px) {
  .pkbc {
    --pbg-gap: 3px;
    --pbg-radius: 6px;
  }
  .pkbc__stats {
    gap: 12px;
  }
  .pkbc__value {
    font-size: 20px;
  }
  .pkbc__t {
    border-width: 1.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pkbc__t {
    transition: none;
  }
}
