:root {
  --space-deep: #1b1240;
  --space-mid: #362463;
  --panel: #2a1f52;
  --panel-light: #4a3a82;
  --panel-dark: #170f33;
  --grass-light: #8fd14f;
  --grass-dark: #5a9c2f;
  --accent: #ffd76b;
}

* { box-sizing: border-box; }

.hidden { display: none !important; }

body {
  margin: 0;
  padding: 24px;
  min-height: 100vh;
  background:
    radial-gradient(1px 1px at 10% 20%, #fff 100%, transparent),
    radial-gradient(1px 1px at 80% 10%, #fff 100%, transparent),
    radial-gradient(1px 1px at 60% 70%, #fff 100%, transparent),
    radial-gradient(1px 1px at 30% 85%, #fff 100%, transparent),
    radial-gradient(1px 1px at 90% 55%, #fff 100%, transparent),
    linear-gradient(180deg, var(--space-deep), var(--space-mid));
  font-family: 'Comic Sans MS', 'Segoe UI', cursive, sans-serif;
  color: #f0e9ff;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.deck-wrap {
  max-width: 480px;
  width: 100%;
  background: var(--panel);
  border: 6px solid;
  border-color: var(--panel-light) var(--panel-dark) var(--panel-dark) var(--panel-light);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.deck-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.deck-header h1 {
  margin: 0;
  font-size: 20px;
}

.link-btn {
  padding: 6px 12px;
  border: 2px solid;
  border-color: var(--grass-light) var(--grass-dark) var(--grass-dark) var(--grass-light);
  background: #79c94a;
  color: #23360f;
  font-weight: bold;
  font-family: inherit;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  display: inline-block;
}

.deck-hint {
  font-size: 12px;
  color: #cbb8ff;
  margin: 0 0 16px;
  line-height: 1.5;
}

.deck-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 12px;
}

/* ---------- Deck grid "front" card ----------
   Reference: a Pathfinder Adventure Card Game physical card's front
   face (portrait art + a name/class banner) - the "deck view changes"
   card's own attached image. Real composited sprite fills the art
   panel instead of an emoji-in-a-circle placeholder. */

.deck-card {
  display: flex;
  flex-direction: column;
  aspect-ratio: 5 / 7;
  padding: 0;
  border-radius: 12px;
  border: 4px solid;
  border-color: var(--grass-light) var(--grass-dark) var(--grass-dark) var(--grass-light);
  background: var(--panel-dark);
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  overflow: hidden;
}

.deck-card:hover {
  filter: brightness(1.15);
}

.deck-card-art {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.08), transparent 70%),
    var(--space-deep);
}

.deck-card-sprite-stack {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.deck-card-sprite-stack .pet-sprite.has-image {
  max-width: 84%;
  max-height: 84%;
}

.deck-card-sprite {
  font-size: 56px;
}

.deck-card-when {
  position: absolute;
  bottom: 3px;
  right: 5px;
  font-size: 8px;
  color: #cbb8ff;
  background: rgba(23, 15, 51, 0.7);
  border-radius: 4px;
  padding: 1px 4px;
}

.deck-card-footer {
  background: #79c94a;
  color: #23360f;
  padding: 6px 6px 7px;
}

.deck-card-name {
  font-weight: bold;
  font-size: 13px;
  line-height: 1.2;
}

.deck-card-sub {
  font-size: 10px;
  line-height: 1.3;
  opacity: 0.85;
}

.deck-empty {
  text-align: center;
  font-size: 13px;
  color: #cbb8ff;
  padding: 20px 0;
}

/* ---------- Card detail modal - "stat" card ----------
   Reference: the same physical card's top-right face (stat block +
   powers list). */

.deck-stat-card {
  padding: 0;
  overflow: hidden;
}

.deck-stat-card-banner {
  background: #79c94a;
  color: #23360f;
  padding: 16px 44px 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.deck-detail-sprite-stack {
  position: relative;
  width: 64px;
  height: 64px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.deck-detail-sprite {
  font-size: 40px;
}

.deck-stat-card-banner-text {
  text-align: left;
  min-width: 0;
}

.deck-stat-card-banner-text h2 {
  margin: 0 0 2px;
  font-size: 18px;
  color: #14230a;
}

.deck-detail-stage {
  margin: 0;
  font-size: 12px;
  opacity: 0.85;
}

.deck-stat-card-body {
  padding: 16px 20px 20px;
}

.deck-detail-archetype {
  text-align: center;
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--accent);
  font-weight: bold;
}

.deck-stat-card-section {
  margin-bottom: 12px;
}

.deck-stat-card-section-label {
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #cbb8ff;
  border-bottom: 1px solid var(--panel-light);
  padding-bottom: 3px;
  margin-bottom: 6px;
}

.deck-stat-row {
  display: grid;
  grid-template-columns: 56px 1fr 28px;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 11px;
}

.deck-stat-row-label {
  color: #a8e678;
  font-weight: bold;
}

.deck-stat-row-track {
  height: 6px;
  background: var(--space-deep);
  border-radius: 3px;
  overflow: hidden;
}

.deck-stat-row-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--grass-dark), var(--grass-light));
}

.deck-stat-row-value {
  text-align: right;
  color: #cbb8ff;
}

.deck-ability-text {
  margin: 0 0 5px;
  font-size: 11px;
  font-style: italic;
  color: #cbb8ff;
}

.deck-detail-xp,
.deck-detail-carded-at {
  text-align: center;
  margin: 0 0 4px;
  font-size: 12px;
}

.deck-detail-carded-at {
  color: #cbb8ff;
  font-size: 11px;
}

.deck-detail-no-slot-hint {
  font-size: 12px;
  color: #cbb8ff;
  text-align: center;
  margin-top: 8px;
}

.deck-stat-card #deck-detail-uncard-btn {
  display: block;
  width: calc(100% - 40px);
  margin: 4px 20px 20px;
}

.deck-stat-card #deck-detail-no-slot-hint {
  margin: 0 20px 16px;
}

#deck-detail-uncard-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  body { padding: 10px; }
  .deck-wrap { padding: 14px; }
}

/* ---------- Desktop wide-screen widening ("Display changes" card, 2026-07-25) ----------
   .deck-list is already `grid-template-columns: repeat(auto-fill,
   minmax(128px, 1fr))` - just widening the wrap makes it naturally
   reflow into more columns on its own, no restructuring needed. */
@media (min-width: 700px) {
  .deck-wrap {
    max-width: 900px;
  }
}
