/* Phase 8 — perk choice UX */
.perk-choices[data-enhanced="true"] {
  align-items: stretch;
}

.perk-choice {
  position: relative;
  overflow: hidden;
}

.perk-choice::after {
  content: "";
  position: absolute;
  inset: auto 14px 0;
  height: 2px;
  border-radius: 999px 999px 0 0;
  opacity: .7;
  background: currentColor;
  transform: scaleX(.28);
  transform-origin: left;
  transition: transform 150ms ease, opacity 150ms ease;
  pointer-events: none;
}

.perk-choice:hover::after,
.perk-choice:focus-visible::after {
  transform: scaleX(1);
  opacity: 1;
}

.perk-choice.is-pressed {
  transform: translateY(-1px) scale(.985);
}

.perk-choice__head {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.perk-choice__icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 13px;
  background: rgba(255,255,255,.045);
  color: #f4fbff;
  font-size: 1.2rem;
  font-weight: 1000;
  line-height: 1;
  text-shadow: 0 0 12px currentColor;
  box-shadow: inset 0 0 18px rgba(255,255,255,.025);
}

.perk-choice__identity {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.perk-choice__category {
  line-height: 1;
}

.perk-choice__name {
  display: block;
  line-height: 1.15;
}

.perk-choice__effect {
  display: block;
  margin-top: 2px;
  color: #ffffff;
  font-size: clamp(.95rem, 2.2vw, 1.12rem);
  line-height: 1.05;
  letter-spacing: .035em;
  text-wrap: balance;
}

.perk-choice__description {
  margin: 0;
  color: rgba(220,239,244,.69);
  line-height: 1.35;
}

.perk-choice__stack-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  margin-top: auto;
  padding-top: 3px;
}

.perk-choice__stack-track {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.perk-choice__stack-track i {
  width: 18px;
  height: 5px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  background: rgba(255,255,255,.05);
}

.perk-choice__stack-track i.is-owned {
  background: currentColor;
  box-shadow: 0 0 7px currentColor;
  opacity: .72;
}

.perk-choice__stack-track i.is-next {
  border-color: currentColor;
  background: transparent;
  box-shadow: inset 0 0 5px currentColor;
  opacity: .95;
}

.perk-choice__stack-label {
  color: rgba(218,240,245,.64);
  font-size: .54rem;
  font-weight: 1000;
  letter-spacing: .09em;
  white-space: nowrap;
}

.perk-choice--offense { color: #ff7d98; }
.perk-choice--control { color: #75bbff; }
.perk-choice--defense { color: #79e9ba; }
.perk-choice--economy { color: #ffd06a; }

.perk-choice--offense .perk-choice__icon {
  border-color: rgba(255,125,152,.32);
  background: radial-gradient(circle, rgba(255,125,152,.14), rgba(255,125,152,.025));
}
.perk-choice--control .perk-choice__icon {
  border-color: rgba(117,187,255,.34);
  background: radial-gradient(circle, rgba(117,187,255,.15), rgba(117,187,255,.025));
}
.perk-choice--defense .perk-choice__icon {
  border-color: rgba(121,233,186,.34);
  background: radial-gradient(circle, rgba(121,233,186,.14), rgba(121,233,186,.025));
}
.perk-choice--economy .perk-choice__icon {
  border-color: rgba(255,208,106,.34);
  background: radial-gradient(circle, rgba(255,208,106,.14), rgba(255,208,106,.025));
}

.perk-choice:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .perk-panel {
    width: min(100%, 520px);
  }

  .perk-panel h2 {
    margin-bottom: 3px;
  }

  .perk-panel > p {
    font-size: .72rem;
    line-height: 1.3;
  }

  .perk-choice {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
    padding: 11px 12px;
  }

  .perk-choice__head {
    grid-column: 1 / -1;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 9px;
  }

  .perk-choice__icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 1rem;
  }

  .perk-choice__effect {
    grid-column: 1;
    margin-top: 1px;
    align-self: center;
    font-size: .88rem;
  }

  .perk-choice__description {
    grid-column: 1;
    font-size: .68rem;
    line-height: 1.25;
  }

  .perk-choice__stack-row {
    grid-column: 2;
    grid-row: 2 / span 2;
    width: auto;
    min-width: 68px;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    gap: 5px;
    margin: 0;
    padding: 0;
  }

  .perk-choice__stack-track i {
    width: 15px;
    height: 4px;
  }

  .perk-choice__stack-label {
    font-size: .47rem;
  }
}

@media (max-width: 380px) {
  .perk-panel {
    padding: 14px 11px;
  }

  .perk-choices {
    gap: 6px;
  }

  .perk-choice {
    padding: 9px 10px;
  }

  .perk-choice__category {
    font-size: .49rem;
  }

  .perk-choice__name {
    font-size: .89rem;
  }

  .perk-choice__effect {
    font-size: .8rem;
  }

  .perk-choice__description {
    font-size: .62rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .perk-choice,
  .perk-choice::after {
    transition: none;
  }

  .perk-choice.is-pressed {
    transform: none;
  }
}
