/* nextpolish1 — hierarchy, acquire settle, landscape battle, contrast, pause sheet.
   Opt-in by class. Calm / reduced-motion kill decorative motion only. */

/* --- P1: Acquire settle (relic / result / draft) --- */
@media (prefers-reduced-motion: no-preference) {
  html:not(.calm-motion) .exp-result .exp-result-symbol,
  html:not(.calm-motion) .exp-relic-choice.selected .relic-illustration,
  html:not(.calm-motion) .draft-exchange-grid article.is-acquired {
    animation: nextAcquireSettle 420ms var(--pm-ui-ease, cubic-bezier(.16,1,.3,1)) both;
  }
  html:not(.calm-motion) .combo-kit-receipt > p {
    animation: nextAcquireSettle 360ms var(--pm-ui-ease, cubic-bezier(.16,1,.3,1)) both;
  }
  html:not(.calm-motion) .combo-kit-receipt > p:nth-child(2) { animation-delay: 40ms; }
  html:not(.calm-motion) .combo-kit-receipt > p:nth-child(3) { animation-delay: 80ms; }
}
@keyframes nextAcquireSettle {
  from { opacity: 0; transform: translateY(-12px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- P1: Cabinet first-open — shelf is hero; buy path is one CTA --- */
.progression-system[data-keepsake-panel=shelf] .progression-buy-next {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px 4px;
  border-top: 1px solid var(--pm-ui-line);
}
.progression-system[data-keepsake-panel=shelf] .progression-buy-next > p {
  margin: 0;
  flex: 1 1 160px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--pm-ui-muted);
}
.progression-system[data-keepsake-panel=shelf] .progression-buy-next .exp-button.primary {
  flex: 0 1 auto;
  min-height: 48px;
}
.progression-system[data-keepsake-panel=upgrade] .progression-buy-next { display: none; }
.progression-system .progression-toolbar {
  gap: 8px;
}
@media (max-width: 849px) {
  .progression-system[data-keepsake-panel=shelf] .progression-buy-next {
    position: sticky;
    bottom: 0;
    background: color-mix(in srgb, var(--pm-ui-ink) 92%, transparent);
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    z-index: 2;
  }
}

/* --- P1: Profile setup composition --- */
.profile-app .profile-setup {
  max-width: 720px;
}
.profile-setup .profile-setup-lead {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--pm-ui-text);
}
.profile-setup .profile-setup-restore {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--pm-ui-muted);
}
.profile-setup .profile-setup-hero-heading {
  margin: 20px 0 8px;
  font-size: 19px;
}
.profile-setup .profile-progress {
  border-top: 1px solid var(--pm-ui-line);
  margin-top: 16px;
  padding-top: 16px;
}
.profile-setup .profile-reader-footer {
  display: grid;
  gap: 10px;
}
.profile-setup .profile-reader-footer .exp-button:first-child {
  min-height: 52px;
  font-weight: 650;
  background: var(--pm-ui-accent);
  color: var(--pm-ui-on-accent);
  border-radius: 28px;
}
.profile-setup .profile-reader-footer .exp-button:last-child {
  min-height: 44px;
  background: transparent;
  color: var(--pm-ui-muted);
  border: 0;
  box-shadow: none;
}

/* --- P1: Battle short landscape + secondary targets --- */
@media (max-height: 420px) and (min-width: 600px) {
  .battle-system .arena-content {
    --phase-row: 40px;
    --enemy-hud-row: 28px;
    --player-hud-row: 28px;
  }
  .battle-system .battle-journal-button,
  .battle-system .inspect-button,
  .battle-system .selection-help .tap-burn {
    min-height: 44px;
    min-width: 44px;
  }
  .battle-system #phase-hint { max-height: 22px; font-size: 10px; }
  .battle-system .hand-heading { min-height: 40px; }
}
.battle-system .selection-help .tap-burn {
  min-height: 44px;
  padding-inline: 12px;
}

/* --- P1: Contrast over translucent / over-art surfaces --- */
.exploration-system .exp-map-heading,
.exploration-system .exp-map-dock,
.encounter-system .exp-encounter-copy,
.exp-illustrated .exp-modal,
.pause-system,
.journey-result-heading,
.ship-summary-heading {
  color: var(--pm-ui-text);
}
.exploration-system .exp-map-title small,
.exploration-system .exp-hud-amount small,
.encounter-system .encounter-region,
.ship-summary-heading .exp-eyebrow,
.pause-system .exp-eyebrow {
  color: var(--pm-ui-muted);
}
.exp-map-heading,
.exp-map-dock {
  text-shadow: 0 1px 2px color-mix(in srgb, var(--pm-ui-ink) 55%, transparent);
}
:root[data-theme=light] .exp-map-heading,
:root[data-theme=light] .exp-map-dock {
  text-shadow: 0 1px 0 color-mix(in srgb, #fff 70%, transparent);
}
.exp-illustrated .exp-modal > :is(h2, p, .exp-eyebrow, .journey-choice-note) {
  color: var(--pm-ui-text);
}
.exp-illustrated .exp-modal {
  background: color-mix(in srgb, var(--pm-ui-surface) 94%, transparent);
}

/* --- P2: Summary return view hierarchy --- */
.ship-summary.summary-view-return .ship-summary-heroes,
.ship-summary.summary-view-return .exp-summary-stats,
.ship-summary.summary-view-return .ship-summary-reset {
  display: none;
}
.ship-summary.summary-view-details .ship-summary-plan {
  display: none;
}
.ship-summary .ship-summary-actions {
  gap: 10px;
}
.ship-summary .ship-summary-actions .exp-button.primary {
  flex: 1 1 100%;
  min-height: 52px;
}

/* --- P2: Pause sheet utility parity --- */
.pause-system {
  display: grid;
  gap: 16px;
  color: var(--pm-ui-text);
  border-radius: 24px;
  background: linear-gradient(160deg, var(--pm-ui-surface-raised), var(--pm-ui-surface) 70%);
  box-shadow: 0 20px 70px var(--pm-ui-shadow);
  padding: 20px 16px max(16px, env(safe-area-inset-bottom));
}
.pause-system > header h2 {
  margin: 4px 0 0;
  font-size: 22px;
  letter-spacing: -.02em;
}
.pause-system .pause-primary .exp-button {
  min-height: 52px;
  width: 100%;
  border-radius: 28px;
  background: var(--pm-ui-accent);
  color: var(--pm-ui-on-accent);
  font-weight: 650;
}
.pause-system .pause-links {
  display: grid;
  gap: 8px;
}
.pause-system .pause-disclosure {
  border: 0;
  border-top: 1px solid var(--pm-ui-line);
  border-radius: 0;
  background: transparent;
}
.pause-system .pause-disclosure > summary {
  min-height: 48px;
  font-size: 15px;
  color: var(--pm-ui-text);
  cursor: pointer;
}
.pause-system .game-preferences {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 4px 0 8px;
  border-radius: 18px;
  background: var(--pm-ui-surface-soft);
}
@media (max-width: 600px) and (min-height: 501px) {
  .exp-overlay:has(> .exp-modal .pause-system),
  .exp-overlay:has(.pause-system) {
    align-items: flex-end;
  }
  .exp-modal:has(.pause-system) {
    width: 100%;
    max-height: calc(100dvh - max(16px, env(safe-area-inset-top)));
    border-radius: 24px 24px 0 0;
  }
}

/* --- P2: Phone inspect sheen (coarse pointer) --- */
@media (pointer: coarse) {
  .card-showcase[data-inspect-panel=card]:not([data-card-back=true]):not([data-artwork=true]) .showcase-stage::after {
    content: "";
    position: absolute;
    inset: 8% 12%;
    pointer-events: none;
    border-radius: 12px;
    background: linear-gradient(115deg, transparent 35%, #ffffff40 48%, transparent 62%);
    background-size: 220% 100%;
    opacity: .4;
  }
}
@media (pointer: coarse) and (prefers-reduced-motion: no-preference) {
  html:not(.calm-motion) .card-showcase[data-inspect-panel=card]:not([data-card-back=true]):not([data-artwork=true]) .showcase-stage::after {
    animation: nextInspectSheen 2.8s ease-in-out 1;
  }
}
@keyframes nextInspectSheen {
  from { background-position: 120% 0; opacity: .15; }
  40% { opacity: .45; }
  to { background-position: -20% 0; opacity: 0; }
}

html.calm-motion .exp-result-symbol,
html.calm-motion .combo-kit-receipt > p,
html.calm-motion .showcase-stage::after {
  animation: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .exp-result-symbol,
  .combo-kit-receipt > p,
  .showcase-stage::after,
  .exp-relic-choice.selected .relic-illustration,
  .draft-exchange-grid article.is-acquired {
    animation: none !important;
  }
}
