/* Pokémon Memory — compact toolbar + no-scroll board (laptop ~900–1000px) */
@font-face {
  font-family: "Memory Display";
  src: url("../assets/fonts/fredoka-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
:root {
  --sky: #6ec6ff;
  --sky-deep: #3ba0e6;
  --cream: #fff8e7;
  --ink: #1c2a3a;
  --muted: #5a6a7a;
  /* Nova light TCG chrome tokens */
  --chrome-cream: #FFF8E7;
  --chrome-navy: #1B2A4A;
  --chrome-gold: #D4A84B;
  --chrome-wash: rgba(27, 42, 74, 0.08);
  --p0: #ff8a65;
  --p0-soft: #ffe0d6;
  --p1: #5c6bc0;
  --p1-soft: #e8eaf6;
  --p2: #26a69a;
  --p2-soft: #e0f2f1;
  --gold: #ffd54f;
  --match: #66bb6a;
  --set-accent: #ffd54f;
  /* Nova theme v1 — first-paint fallbacks before setActiveId */
  --theme-base: #6ec6ff;
  --theme-wash:
    radial-gradient(ellipse at 20% 0%, #b3e5fc 0%, transparent 50%),
    radial-gradient(ellipse at 90% 10%, #ffe082 0%, transparent 40%),
    linear-gradient(180deg, #6ec6ff 0%, #e3f2fd 45%, #fff8e7 100%);
  --theme-pattern: none;
  --theme-pattern-size: 280px;
  --theme-overlay: none;
  --card-w: 120px;
  --card-h: 168px;
  --board-gap: 8px;
  --board-cols: 4;
  --board-rows: 3;
  --radius: 12px;
  --shadow: 0 6px 18px rgba(28, 42, 58, 0.16);
  --header-h: auto;
  font-size: 16px;
}

/* Card size set by JS fitBoard() from remaining viewport */

*, *::before, *::after { box-sizing: border-box; }

img, button, .card, .board, .toolbar, .seats, .set-picker-panel, .win-card, .album-panel {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  background-color: var(--theme-base, #6ec6ff);
  background-image: var(--theme-overlay, none), var(--theme-pattern, none), var(--theme-wash, none);
  background-size: auto, var(--theme-pattern-size, 280px), cover;
  background-repeat: no-repeat, repeat, no-repeat;
  background-position: center, center, center;
  background-attachment: fixed;
  /* JS supplies an era PNG or a CSS fallback; album/lightbox layers own their backgrounds. */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.app {
  max-width: none;
  width: 100%;
  margin: 0;
  padding:
    max(6px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* iPhone portrait: status icons are hidden. The toolbar sits below the notch,
   where it used to start, and the page background fills the strip above it. */
@media (max-width: 520px) {
  .app {
    padding-top: max(65px, calc(env(safe-area-inset-top) + 6px));
  }
}

/* —— Dense toolbar —— */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 6px 8px;
  margin-bottom: 6px;
  background: var(--chrome-cream);
  backdrop-filter: blur(6px);
  border-radius: var(--radius);
  border: 1.5px solid color-mix(in srgb, var(--chrome-navy) 28%, transparent);
  box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--chrome-navy) 10%, transparent);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.brand-ball {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(180deg, #e53935 0 50%, #fafafa 50% 100%);
  border: 2px solid #263238;
  box-shadow: inset 0 0 0 2px #263238;
  position: relative;
  flex-shrink: 0;
}
.brand-ball::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 9px; height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: #fafafa;
  border: 2px solid #263238;
}
.brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  gap: 2px;
}
.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.subtitle {
  margin: 0;
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 600;
}

.stats {
  display: flex;
  gap: 6px;
}
.stat {
  background: #fff;
  border-radius: 10px;
  padding: 2px 10px;
  min-width: 64px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.stat-label {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  line-height: 1.2;
}
.stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.15;
}

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

.seg {
  display: inline-flex;
  background: var(--chrome-wash);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
  border: 1px solid color-mix(in srgb, var(--chrome-navy) 12%, transparent);
}
.seg-btn {
  border: 1.5px solid transparent;
  background: transparent;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--chrome-navy) 72%, var(--muted));
  cursor: pointer;
  min-height: 32px;
  transition: background 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s, border-color 0.15s;
}
.seg-btn:hover { color: var(--chrome-navy); }
.seg-btn.active,
.seg-btn.is-active {
  background: var(--chrome-cream);
  color: var(--chrome-navy);
  border-color: var(--chrome-gold);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--chrome-gold) 55%, transparent),
    0 1px 4px rgba(27, 42, 74, 0.1);
}
.seg-btn:active { transform: scale(0.97); }

.toolbar-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  margin-left: auto;
  min-width: 0;
}

.btn-primary {
  border: none;
  background: linear-gradient(180deg, #ffca28, #ffb300);
  color: #3e2723;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 34px;
  flex-shrink: 0;
  white-space: nowrap; /* never clip "New Game" */
  box-shadow: 0 3px 0 #f57f17, 0 4px 10px rgba(245, 127, 23, 0.3);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #f57f17, 0 2px 6px rgba(245, 127, 23, 0.3);
}

.sfx-btn {
  appearance: none;
  border: 2px solid #263238;
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-weight: 800;
  font-size: 0.75rem;
  background: #fffde7;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  cursor: pointer;
  min-height: 32px;
  white-space: nowrap;
}
.sfx-btn:hover { filter: brightness(1.05); }
.sfx-btn[aria-pressed="false"] {
  background: #eceff1;
  color: var(--muted);
}

.mini-player {
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex: 0 1 260px;
  width: 260px;
  max-width: 260px;
  /* 4×26 controls + scrub + ≥10px end inset — circle clears pill end-caps */
  min-width: 196px;
  height: 34px;
  min-height: 34px;
  /* ≥8px Nova inset; 10px clears 26px circle from stadium end-cap clip */
  padding: 0 10px;
  background: var(--cream);
  border: 2px solid #263238;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  /* visible: overflow:hidden+radius was flattening green shuffle; inset keeps paint in-pill */
  overflow: visible;
}

.player-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  flex: 0 0 26px;
  flex-shrink: 0;
}
.player-btn:hover { background: rgba(0,0,0,0.06); }
.player-btn:active { transform: scale(0.94); }
.player-btn:focus-visible, .sfx-btn:focus-visible, .btn-primary:focus-visible {
  outline: 2px solid var(--sky-deep);
  outline-offset: 2px;
}
.player-btn.is-playing {
  background: var(--sky);
  box-shadow: inset 0 0 0 1px var(--sky-deep);
}
.player-btn.player-shuffle {
  flex: 0 0 26px;
  flex-shrink: 0;
}
.player-btn.player-shuffle.is-on {
  background: #c8e6c9;
  box-shadow: inset 0 0 0 1px #388e3c;
  color: #1b5e20;
}
.player-icon {
  display: block;
  width: 16px;
  height: 16px;
  pointer-events: none;
}
.icon-pause { display: none; }
.player-play.is-playing .icon-play { display: none; }
.player-play.is-playing .icon-pause { display: block; }

.player-track {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  flex: 1 1 auto;
  min-width: 0;
  height: 28px;
}

.now-playing {
  display: block;
  min-width: 0;
  width: 100%;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  line-height: 1.1;
  padding: 0 2px;
}

.music-progress {
  appearance: none;
  display: block;
  width: 100%;
  height: 10px;
  margin: 0;
  background: linear-gradient(to right, #1976d2 var(--progress, 0%), #cfd8dc var(--progress, 0%));
  cursor: pointer;
}
.music-progress::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: transparent;
}
.music-progress::-webkit-slider-thumb {
  appearance: none;
  width: 9px;
  height: 9px;
  margin-top: -3px;
  border: 0;
  border-radius: 50%;
  background: #1976d2;
}
.music-progress::-moz-range-track {
  height: 3px;
  border-radius: 999px;
  background: #cfd8dc;
}
.music-progress::-moz-range-progress {
  height: 3px;
  border-radius: 999px;
  background: #1976d2;
}
.music-progress::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: 0;
  border-radius: 50%;
  background: #1976d2;
}

.pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 42%, rgba(196, 154, 58, 0.24), transparent 43%),
    rgba(9, 17, 31, 0.86);
  backdrop-filter: blur(3px);
}
.pause-overlay[hidden] { display: none; }
.pause-sheet {
  width: min(100%, 360px);
  padding: 18px 18px 20px;
  border-radius: 18px;
  border: 2px solid color-mix(in srgb, var(--chrome-gold) 70%, #fff);
  background: var(--chrome-cream);
  color: var(--chrome-navy);
  box-shadow: 0 16px 40px rgba(9, 17, 31, 0.35);
}
.pause-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.pause-header h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pause-actions .sfx-btn,
.pause-actions .btn-primary {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
  padding: 10px 14px;
}

/* —— Seats (compact) —— */
.seats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 4px;
  margin-bottom: 4px;
  flex-shrink: 0;
}
.seats[hidden] { display: none; }
.seats.players-1 { grid-template-columns: minmax(160px, 280px); }
.seats.players-2 { grid-template-columns: 1fr 1fr; }
.seats.players-3 { grid-template-columns: 1fr 1fr 1fr; }

.seat {
  --seat-accent: #A8A77A;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 6px;
  border-radius: 8px;
  background: rgba(255,255,255,0.78);
  border: 2px solid transparent;
  /* ≥5px stripe; mix navy so quiet accents (Eevee #A8A77A) read on cream */
  border-left: 5px solid color-mix(in srgb, var(--seat-accent) 72%, var(--chrome-navy));
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
  min-height: 36px;
}
.seat.active {
  border-color: color-mix(in srgb, var(--seat-accent) 55%, var(--chrome-navy));
  border-left-width: 6px;
  border-left-color: color-mix(in srgb, var(--seat-accent) 58%, var(--chrome-navy));
  background: color-mix(in srgb, var(--seat-accent) 30%, #fff);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--seat-accent) 34%, transparent);
  transform: scale(1.01);
}
.seat-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(27, 42, 74, 0.18), 0 0 0 1px color-mix(in srgb, var(--seat-accent) 35%, transparent);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.seat-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
/* Active-turn cue: Master Ball beside avatar (multiplayer only) */
.seat-master {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: -2px;
}
.seat-master img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(27, 42, 74, 0.28));
}
.seat-info { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 0; line-height: 1.15; }
.seat-name {
  font-weight: 800;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--chrome-navy);
}
.seat-score {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap; /* keep "Matches:" + number on one line */
}
.seat-score strong { color: var(--ink); font-size: 0.82rem; }

/* —— Board fills remaining viewport; card size from JS fitBoard() —— */
.board-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  /* Symmetric side cream; fitBoard pad matches so Hard 5×5 never clips left */
  padding: 4px 8px;
  box-sizing: border-box;
}
.god-pack-banner {
  display: none;
  position: absolute;
  top: 6px;
  left: 50%;
  z-index: 6;
  margin: 0;
  transform: translateX(-50%);
  padding: 4px 14px 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff6cf, #e0b64a);
  color: #3a2a08;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: 0 6px 16px rgba(180, 130, 30, 0.35);
  pointer-events: none;
}
.board-wrap.is-god-pack {
  padding-top: 36px;
}
.board-wrap.is-god-pack .god-pack-banner { display: block; }
.board-wrap.is-god-pack .board {
  box-shadow:
    0 0 0 3px rgba(224, 182, 74, 0.95),
    0 0 22px rgba(255, 214, 90, 0.45);
  border-radius: 12px;
}
.board-wrap.is-god-pack .card {
  box-shadow: 0 0 0 2px rgba(224, 182, 74, 0.9);
}
.board-wrap.is-god-live::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 32%, rgba(255, 244, 196, 0.72) 50%, transparent 68%);
  background-size: 220% 100%;
  animation: godSweep 1.15s ease forwards;
}
@keyframes godSweep {
  from { background-position: 120% 0; opacity: 1; }
  to { background-position: -20% 0; opacity: 0; }
}

.board {
  display: grid;
  gap: var(--board-gap);
  width: max-content;
  max-width: 100%;
  max-height: 100%;
  margin-inline: auto;
  justify-content: center;
  justify-items: center;
  align-content: center;
  grid-template-columns: repeat(var(--board-cols, 4), var(--card-w));
  grid-auto-rows: var(--card-h);
}

.board[data-cols="3"] { --board-cols: 3; }
.board[data-cols="4"] { --board-cols: 4; }
.board[data-cols="5"] { --board-cols: 5; }
.board[data-cols="6"] { --board-cols: 6; }

/* Hard phone 5×5 decorative empty cell (center hole) — not a card */
.board-hole {
  width: var(--card-w);
  height: var(--card-h);
  pointer-events: none;
  border-radius: 8px;
  background: color-mix(in srgb, var(--chrome-navy) 7%, transparent);
  box-shadow: inset 0 1px 4px rgba(27, 42, 74, 0.14);
}

.card {
  perspective: 1000px;
  width: var(--card-w);
  height: var(--card-h);
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
  transition: transform 0.18s ease, filter 0.18s ease;
}
.card:focus-visible .card-inner {
  outline: 3px solid var(--sky-deep);
  outline-offset: 2px;
}
.card:disabled { cursor: default; }

/* Lift only from a real mouse. iPhone keeps :hover after a tap, which was raising the card under the splash. */
.card.is-lifted:not(.flipped):not(.matched) {
  transform: translateY(-4px) scale(1.04);
  z-index: 2;
}
.card.is-lifted:not(.flipped):not(.matched) .card-inner {
  box-shadow:
    0 10px 22px rgba(0,0,0,0.28),
    0 0 0 2px rgba(255, 213, 79, 0.55);
}
body.is-splash #play-screen {
  pointer-events: none;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.28s cubic-bezier(0.22, 0.9, 0.3, 1), box-shadow 0.18s ease;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}
.card.flipped .card-inner,
.card.matched .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 8px;
  overflow: hidden;
}
.card-back {
  background: #1a237e;
  background-image: url("../assets/card-back.png");
  background-size: cover;
  background-position: center;
}
.card-back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}
.card-front {
  transform: rotateY(180deg);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffe082;
}
.card-front img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
  background: #fafafa;
}

.card.matched .card-inner {
  /* Static only — no pulse/filter/scale (fights flips on iOS, costly on desktop). */
  box-shadow: 0 0 0 3px var(--match), 0 4px 14px rgba(102, 187, 106, 0.4);
}
.card.matched .card-front {
  border-color: var(--match);
}

.card:not(.flipped):not(.matched):active {
  transform: scale(0.96);
}

/* —— TCG win overlay —— */
.win-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  background:
    radial-gradient(circle at 50% 42%, rgba(196, 154, 58, 0.24), transparent 43%),
    rgba(9, 17, 31, 0.86);
  backdrop-filter: blur(3px);
  animation: winFadeIn 0.2s ease both;
}
.win-overlay[hidden] { display: none; }

@keyframes winFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.win-card {
  position: relative;
  width: min(100%, 460px);
  max-height: calc(100dvh - 40px);
  overflow: hidden;
  padding: 22px 24px 24px;
  text-align: center;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.95), transparent 35%),
    linear-gradient(155deg, #fffdf4 0%, #fff8e7 56%, #f6ecd2 100%);
  border: 3px solid #c6973e;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.46), 0 0 0 1px rgba(255, 232, 159, 0.45) inset;
  transform: scale(0.85);
  opacity: 0;
}
.win-card::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: -70% -25%;
  pointer-events: none;
  background: linear-gradient(112deg, transparent 42%, rgba(255, 255, 255, 0.62) 49%, rgba(255, 226, 135, 0.32) 53%, transparent 61%);
  transform: translateX(-90%) rotate(12deg);
}
.win-card.is-open {
  animation: winCardIn 0.42s cubic-bezier(0.22, 0.9, 0.3, 1) both;
}
.win-card.is-open::before {
  animation: foilSweep 0.78s 0.12s ease-out both;
}
.win-card > *:not(.win-fx):not(.win-hero):not(.win-share-icon) {
  position: relative;
  z-index: 1;
}
.win-card > .win-share-icon {
  position: absolute;
  z-index: 4;
}

@keyframes winCardIn {
  0% { transform: scale(0.85); opacity: 0; }
  62% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes foilSweep {
  from { transform: translateX(-90%) rotate(12deg); }
  to { transform: translateX(90%) rotate(12deg); }
}
@keyframes winCardFade {
  from { opacity: 0; transform: scale(1); }
  to { opacity: 1; transform: scale(1); }
}

.win-eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  max-width: min(100%, 360px);
  padding: 6px 14px;
  border: 2px solid #d4a84b;
  border-radius: 999px;
  color: #5c4310;
  background: #fff3c4;
  font-family: "Memory Display", "Avenir Next", "Trebuchet MS", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: normal;
  text-align: center;
}

.win-fan {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: min(100%, 280px);
  height: 168px;
  margin: 10px auto 4px;
}
.win-fan-card {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 86px;
  height: 120px;
  object-fit: contain;
  border: 2px solid #d2a94f;
  border-radius: 8px;
  background: #fffdf6;
  box-shadow: 0 10px 18px rgba(28, 42, 58, 0.28);
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(var(--i, 0deg)) translateY(var(--arc-y, 0px));
  animation: fanCardIn 0.4s 0.12s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes fanCardIn {
  from { opacity: 0; transform: translateX(-50%) translateY(24px) rotate(0deg) scale(0.82); }
  to { opacity: 1; transform: translateX(-50%) rotate(var(--i, 0deg)) translateY(var(--arc-y, 0px)); }
}

.win-card h2 {
  margin: 4px 0 7px;
  color: #182b42;
  font-family: "Memory Display", "Avenir Next", "Trebuchet MS", sans-serif;
  font-size: clamp(2rem, 7vw, 2.7rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.win-hero {
  position: absolute;
  z-index: 0;
  width: 132px;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.28));
}
.win-hero-left { left: -18px; top: 36px; }
.win-hero-right { right: -12px; top: 48px; width: 118px; }
.win-card.is-open .win-hero-left { animation: winHeroIn 0.45s 0.08s cubic-bezier(0.16, 1, 0.3, 1) both; }
.win-card.is-open .win-hero-right { animation: winHeroIn 0.45s 0.16s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes winHeroIn {
  from { opacity: 0; transform: translateY(16px) scale(0.86); }
  to { opacity: 1; transform: none; }
}
.win-sub {
  margin: 0 0 14px;
  color: #715018;
  font-size: 1rem;
  font-weight: 800;
}
.win-moves {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
}
.win-moves[hidden], .win-scores[hidden] { display: none; }
.win-scores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin: 0 0 18px;
}
.win-scores .pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 12px;
  border: 2px solid rgba(97, 117, 139, 0.2);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.75);
  font-size: 0.88rem;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(28, 42, 58, 0.08);
}
.win-scores .pill-score {
  color: #6e4d12;
  font-size: 1.05rem;
}
.win-scores .pill.is-leader {
  min-height: 42px;
  border-color: #c6973e;
  box-shadow: 0 0 0 2px rgba(198, 151, 62, 0.2), 0 4px 10px rgba(151, 106, 23, 0.16);
  background: linear-gradient(180deg, #fff8cf, #fffdf2);
}

.win-fx {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}
.win-fx-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 31px;
  object-fit: cover;
  border: 1px solid rgba(255, 235, 160, 0.9);
  border-radius: 3px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.28);
  opacity: 0;
  animation: winFxBurst 1.2s var(--delay, 0s) ease-out forwards;
}
@keyframes winFxBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(0deg) scale(0.45); }
  12% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--spin)) translateY(var(--distance)) scale(0.78); }
}

/* —— Album overlay (Nova/Boss) —— */
.album-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 110;
  background:
    radial-gradient(circle at 50% 42%, rgba(196, 154, 58, 0.24), transparent 43%),
    rgba(9, 17, 31, 0.86);
  backdrop-filter: blur(3px);
  animation: albumFadeIn 0.2s ease both;
}
.album-overlay[hidden] { display: none; }

@keyframes albumFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.album-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 1080px);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  padding: 16px 18px 18px;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.95), transparent 35%),
    linear-gradient(155deg, #fffdf4 0%, #fff8e7 56%, #f6ecd2 100%);
  border: 3px solid #c6973e;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.46), 0 0 0 1px rgba(255, 232, 159, 0.45) inset;
  transform: scale(0.85);
  opacity: 0;
}
.album-panel.is-open {
  animation: albumPanelIn 0.42s cubic-bezier(0.22, 0.9, 0.3, 1) both;
}

@keyframes albumPanelIn {
  0% { transform: scale(0.85); opacity: 0; }
  62% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes albumPanelFade {
  from { opacity: 0; transform: scale(1); }
  to { opacity: 1; transform: scale(1); }
}

.album-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  margin-bottom: 10px;
}
.album-header-lead {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.album-header h2 {
  margin: 0;
  color: #182b42;
  font-size: clamp(1.15rem, 3vw, 1.55rem);
  font-weight: 950;
  letter-spacing: -0.03em;
}
.album-mode-seg {
  flex: 0 0 auto;
}
.album-mode-seg .seg-btn.is-active,
.album-mode-seg .seg-btn.active {
  background: var(--chrome-cream);
  color: var(--chrome-navy);
  border-color: var(--chrome-gold);
}
/* Shared Close placement for Album + Set picker headers */
.album-close-btn,
.set-picker-close-btn,
.overlay-close-btn {
  flex: 0 0 auto;
}

#album-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
#album-body[hidden] { display: none !important; }

.album-banner {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 800;
  text-align: center;
}
.album-empty {
  color: #715018;
  background: rgba(255, 241, 188, 0.78);
  border: 1px solid rgba(147, 104, 32, 0.35);
}
.album-empty[hidden], .album-complete[hidden] { display: none; }
.album-complete {
  color: #1b5e20;
  background: rgba(200, 230, 201, 0.85);
  border: 1px solid rgba(76, 175, 80, 0.45);
}

.album-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  /* row height set in JS from column width (CSS aspect-ratio collapses here) */
  grid-auto-rows: 120px;
  gap: 12px;
  padding: 8px 16px 14px;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  align-content: start;
  align-items: stretch;
}

.album-cell {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  border: 2px solid rgba(198, 151, 62, 0.55);
  border-radius: 8px;
  background: #fffdf6;
  width: 100%;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(28, 42, 58, 0.12);
  display: block;
  line-height: 0;
  position: relative;
  transform: translateZ(0);
  transform-origin: center center;
  transition: transform 0.12s ease-out, box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.12s ease;
}
.album-cell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.album-cell.is-locked {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
  border-color: rgba(97, 117, 139, 0.35);
  background: #eceff1;
}
.album-cell.is-locked:active,
.album-cell.is-locked:focus-visible {
  opacity: 0.45;
  outline: none;
  transform: none;
}
.album-cell.is-unlocked {
  --rx: 0deg;
  --ry: 0deg;
  --lift: 0px;
  --scale: 1;
  cursor: pointer;
  z-index: 0;
  transform: perspective(800px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--lift)) scale(var(--scale));
}
.album-cell.is-unlocked.is-hot,
.album-cell.is-unlocked:focus-visible {
  z-index: 3;
  border-color: #c6973e;
  --lift: -4px;
  --scale: 1.045;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
}
.album-cell.is-unlocked:active {
  z-index: 3;
  --lift: -2px;
  --scale: 1.03;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
}
.album-cell.is-unlocked:focus-visible {
  outline: 3px solid #1a1a1a;
  outline-offset: 2px;
}
.album-cell.is-flip-source {
  opacity: 0;
  pointer-events: none;
}

/* Flying flip clone: dual-face (front + card-back) → lightbox */
.album-flip-clone {
  position: fixed;
  z-index: 125;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  overflow: visible;
  pointer-events: none;
  background: transparent;
  perspective: 900px;
  transform-style: preserve-3d;
  transition:
    top 0.5s cubic-bezier(0.22, 0.85, 0.28, 1),
    left 0.5s cubic-bezier(0.22, 0.85, 0.28, 1),
    width 0.5s cubic-bezier(0.22, 0.85, 0.28, 1),
    height 0.5s cubic-bezier(0.22, 0.85, 0.28, 1);
  will-change: top, left, width, height;
}
.album-flip-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
}
.album-flip-clone.is-flying .album-flip-inner {
  animation: albumFlipSpin 0.5s cubic-bezier(0.4, 0.05, 0.2, 1) forwards;
}
/* ~55ms dwell near 180°; total ~500ms */
@keyframes albumFlipSpin {
  0% { transform: rotateY(0deg); }
  38% { transform: rotateY(175deg); }
  49% { transform: rotateY(186deg); }
  100% { transform: rotateY(360deg); }
}
/* Match #album-detail-img chrome: art-only, no plate/border */
.album-flip-face {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: transparent;
  box-shadow: none;
}
.album-flip-face.album-flip-back {
  transform: rotateY(180deg);
  /* Full back art; white PNG corners are transparent + 6px radius clips remainder */
  background-color: transparent;
  background-image: url("../assets/card-back.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.album-flip-face.album-flip-back img {
  display: none;
}
.album-flip-face.album-flip-front img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.album-detail {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0);
  transition: background-color 0.5s ease;
  animation: none;
}
.album-detail.is-dimming,
.album-detail.is-open {
  background: rgba(0, 0, 0, 0.40);
}
.album-detail[hidden] { display: none; }

.album-detail-sheet {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: auto;
  max-width: 100%;
  padding: 0;
  text-align: center;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: scale(0.96);
  opacity: 0;
  /* Sheet is as wide as card art; empty regions must not swallow backdrop taps */
  pointer-events: none;
}
.album-detail.is-handoff .album-detail-sheet {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: none;
  animation: none !important;
}
.album-detail.is-open .album-detail-sheet {
  animation: albumLightboxIn 0.22s ease both;
}
.album-detail.is-open.is-ready .album-detail-sheet {
  animation: none;
  opacity: 1;
  visibility: visible;
  transform: none;
}
.album-detail.is-open.is-ready.is-settling .album-detail-sheet h3 {
  opacity: 0;
}
.album-detail.is-open.is-ready:not(.is-settling) .album-detail-sheet h3 {
  transition: opacity 0.18s ease;
}
@keyframes albumLightboxIn {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.album-detail-art {
  --rx: 0deg;
  --ry: 0deg;
  position: relative;
  line-height: 0;
  max-width: 100%;
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transform-origin: center center;
  transition: transform 0.12s ease-out, filter 0.18s ease;
  will-change: transform;
  cursor: default;
  touch-action: none;
  pointer-events: auto;
}
.album-detail-art.is-hot {
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.45));
}
.inspect-foil {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  overflow: hidden;
  pointer-events: none;
}
.inspect-holo {
  position: absolute;
  inset: 0;
  opacity: 0.14;
  pointer-events: none;
  background: linear-gradient(
    118deg,
    transparent 0%,
    rgba(255, 70, 150, 0.0) 34%,
    rgba(255, 90, 160, 0.85) 44%,
    rgba(255, 220, 80, 0.8) 50%,
    rgba(80, 220, 255, 0.85) 56%,
    rgba(150, 90, 255, 0.75) 62%,
    transparent 74%
  );
  background-size: 220% 220%;
  background-position: calc(40% + var(--px, 0) * 42%) calc(35% + var(--py, 0) * 36%);
  mix-blend-mode: color-dodge;
  -webkit-mask-image: linear-gradient(
    calc(128deg + var(--px, 0) * 18deg),
    transparent 34%,
    #000 47%,
    #000 53%,
    transparent 66%
  );
  mask-image: linear-gradient(
    calc(128deg + var(--px, 0) * 18deg),
    transparent 34%,
    #000 47%,
    #000 53%,
    transparent 66%
  );
  -webkit-mask-size: 180% 180%;
  mask-size: 180% 180%;
  -webkit-mask-position: calc(50% + var(--px, 0) * 38%) calc(42% + var(--py, 0) * 28%);
  mask-position: calc(50% + var(--px, 0) * 38%) calc(42% + var(--py, 0) * 28%);
}
.album-detail-art.is-hot .inspect-holo {
  opacity: 1;
}
.album-detail-img {
  display: block;
  width: clamp(240px, 56vw, 660px);
  height: auto;
  max-width: 88vw;
  max-height: 84vh;
  object-fit: contain;
  object-position: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.album-detail.is-foil-off .inspect-foil { visibility: hidden; }
.foil-toggle {
  appearance: none;
  min-height: 44px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 2px solid rgba(255, 248, 231, 0.85);
  background: rgba(212, 168, 75, 0.95);
  color: #1b2a4a;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  pointer-events: auto;
}
.foil-toggle[aria-pressed="false"] {
  background: transparent;
  color: #fff8e7;
}
.album-detail-sheet h3 {
  margin: 0;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

@media (max-width: 900px) {
  .album-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .album-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
}
@media (max-width: 520px) {
  .album-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .album-header { flex-wrap: wrap; }
  .album-detail-img {
    width: min(88vw, 660px);
    max-height: 78vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .win-overlay { animation: winFadeIn 0.2s ease both; }
  .win-card.is-open { animation: winCardFade 0.2s ease both; }
  .win-card.is-open::before, .win-fan-card, .win-fx-card { animation: none; }
  .win-fx-card { opacity: 0; }
  .album-overlay { animation: albumFadeIn 0.2s ease both; }
  .album-detail {
    transition: background-color 0.2s ease;
  }
  .album-panel.is-open,
  .album-detail.is-open:not(.is-ready) .album-detail-sheet {
    animation: albumPanelFade 0.2s ease both;
  }
  .album-cell.is-unlocked {
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
  }
  .album-cell.is-unlocked.is-hot,
  .album-cell.is-unlocked:focus-visible,
  .album-cell.is-unlocked:active {
    --rx: 0deg !important;
    --ry: 0deg !important;
    --lift: 0px;
    --scale: 1;
    transform: none;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  }
  .album-flip-clone,
  .album-flip-clone.is-flying {
    transition: opacity 0.15s ease;
  }
  .album-flip-clone.is-flying .album-flip-inner {
    animation: none;
    transform: none;
  }
  .album-detail-art,
  .album-detail-art.is-hot {
    --rx: 0deg !important;
    --ry: 0deg !important;
    transform: none;
    filter: none;
    transition: none;
  }
  .inspect-holo { animation: none; opacity: 0.2; }
}

/* Responsive */
@media (max-width: 900px) {
  .seats.players-3 { grid-template-columns: 1fr 1fr; }
  .toolbar-actions { margin-left: 0; }
}

@media (max-width: 720px) {
  /* Hard cols: fitBoard uses 6×4 above 720px, 5×5+center hole at ≤720px (see game.js) */
  /* Phone/narrow: ALL seats in ONE horizontal row (1P–3P), never stacked */
  .seats.players-1 {
    grid-template-columns: minmax(0, 1fr);
    max-width: 220px;
  }
  .seats.players-2 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .seats.players-3 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  }
  .seat.active {
    /* scale overflow was eating left cream next to the board on ~390 */
    transform: none;
  }
}

@media (max-width: 520px) {
  /* Dense HUD so Hard (12 pairs / 5×5+hole on phone) fits with no page scroll */
  .app {
    padding:
      max(65px, calc(env(safe-area-inset-top) + 6px))
      10px
      8px
      10px;
  }
  .toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    padding: 4px 6px;
    margin-bottom: 4px;
  }
  .brand { gap: 6px; }
  .brand-ball { width: 24px; height: 24px; }
  .brand-ball::after { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; }
  .brand h1 { font-size: 0.88rem; }
  .set-chip { margin: 1px 0 0; padding: 6px 10px; font-size: 0.9rem; min-height: 40px; max-width: min(100%, 200px); }
  .stats { gap: 4px; }
  .stat { padding: 1px 7px; min-width: 52px; border-radius: 8px; }
  .stat-label { font-size: 0.68rem; }
  .stat-value { font-size: 1.05rem; }
  .toolbar-controls {
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
  }
  .seg { flex: 1 1 auto; }
  .seg-btn {
    flex: 1;
    padding: 8px 8px;
    min-height: 44px;
    font-size: 0.95rem;
  }
    .toolbar-actions {
    margin-left: 0;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
  }
  .mini-player {
    /* Shrink-to-fit beside actions; keep shuffle inset inside pill */
    flex: 1 1 auto;
    width: auto;
    max-width: 200px; /* grow into spare width @430; @390 stays ~160 */
    min-width: 128px;
    height: 32px;
    min-height: 32px;
    padding: 0 8px;
    overflow: visible;
  }
  .player-btn {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
  }
  .player-btn.player-shuffle {
    flex: 0 0 22px;
  }
  .player-icon {
    width: 13px;
    height: 13px;
  }
  /* ≤520: drop title text, keep scrub + all 5 buttons */
  .player-track .now-playing {
    display: none;
  }
  .player-track {
    height: 16px;
    justify-content: center;
  }
  .sfx-btn {
    flex: 0 0 auto;
    flex-shrink: 0;
    min-height: 44px;
    padding: 8px 12px;
    font-size: 0.95rem;
    white-space: nowrap;
  }
  .btn-primary {
    width: auto;
    flex: 0 0 auto;
    flex-shrink: 0;
    min-height: 44px;
    padding: 8px 14px;
    font-size: 1rem;
    white-space: nowrap; /* full "New Game" — never ellipsize/clip */
  }
  .music-disc {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }
  .seats {
    gap: 3px;
    margin-bottom: 3px;
  }
  /* Compact chips so 3P still fits one row at ~390 */
  .seat {
    min-height: 32px;
    padding: 2px 4px 2px 4px;
    gap: 3px;
    border-radius: 7px;
    min-width: 0;
  }
  .seat-icon { flex-basis: 28px; width: 28px; height: 28px; }
  .seat-icon img { width: 22px; height: 22px; }
  .seat-master { flex-basis: 16px; width: 16px; height: 16px; margin-left: 0; }
  .seat-master img { width: 16px; height: 16px; }
  .seat-name { font-size: 0.68rem; }
  .seat-score { font-size: 0.56rem; white-space: nowrap; }
  .seat-score strong { font-size: 0.7rem; }
  .board-wrap { padding: 2px 8px; }
}


/* Card size comes from fitBoard(); no height media shrinks */



/* ---- Multi-set chip (HUD) ---- */
.set-chip {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 2px 0 0;
  padding: 3px 10px 3px 8px;
  max-width: min(100%, 220px);
  border-radius: 14px;
  border: 2px solid var(--chrome-gold);
  background: color-mix(in srgb, var(--chip-accent, var(--set-accent, #ffd54f)) 38%, var(--chrome-cream));
  color: var(--chrome-navy);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  line-height: 1.2;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
  white-space: normal;
  text-align: left;
  position: relative;
}
.set-chip::before {
  content: "";
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chrome-gold);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--chrome-navy) 25%, transparent);
}
.set-chip-label {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  white-space: normal;
  text-overflow: clip;
  max-width: 100%;
}
.set-chip:hover {
  filter: brightness(1.05);
}
.set-chip:focus-visible {
  outline: 3px solid var(--chip-accent, var(--set-accent, #ffd54f));
  outline-offset: 2px;
}
.set-chip-caret {
  font-size: 0.6rem;
  opacity: 0.75;
}

/* ---- Album compact nav (iPhone / narrow): grid gets majority of sheet ---- */
@media (max-width: 520px) {
  /* Overlay safe-area padding: see shared rule after .set-picker-overlay
     (must win over that rule's padding: 16px). */
  .album-panel,
  .set-picker-panel {
    max-height: none;
    height: 100%;
  }
  .album-panel {
    padding: 10px 12px 12px;
    border-radius: 18px;
  }
  .album-header {
    margin-bottom: 6px;
    gap: 8px;
  }
  .album-header h2 {
    font-size: 1.05rem;
    line-height: 1.2;
  }
  .album-banner {
    margin: 0 0 6px;
    padding: 6px 10px;
    font-size: 0.82rem;
  }
  .album-tabs {
    gap: 4px;
    margin: 0 0 6px;
    max-height: min(26vh, 200px);
    padding: 0 0 2px;
    scrollbar-gutter: auto;
  }
  .album-era {
    border-radius: 10px;
  }
  .album-era-toggle {
    gap: 6px;
    padding: 8px 10px;
    min-height: 40px;
    font-size: 0.88rem;
  }
  .album-era-count {
    font-size: 0.72rem;
  }
  .album-era-body {
    padding: 0 8px 8px;
  }
  .album-era-sets {
    gap: 6px;
  }
  .album-set-pill {
    padding: 6px 10px;
    min-height: 34px;
    font-size: 0.78rem;
  }
  .album-set-pill-count {
    font-size: 0.7rem;
  }
  .album-grid {
    gap: 8px;
    padding: 4px 4px 10px;
  }
}

/* ---- Set picker overlay (TCGP tiles) ---- */
.set-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background:
    radial-gradient(circle at 50% 40%, rgba(92, 107, 192, 0.22), transparent 45%),
    rgba(9, 17, 31, 0.86);
  backdrop-filter: blur(3px);
  animation: albumFadeIn 0.2s ease both;
}
.set-picker-overlay[hidden] { display: none; }

.set-picker-panel {
  width: min(100%, 720px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.95), transparent 35%),
    linear-gradient(155deg, #fffdf4 0%, #fff8e7 56%, #f6ecd2 100%);
  border: 3px solid #c6973e;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
  transform: scale(0.9);
  opacity: 0;
}
.set-picker-panel.is-open {
  animation: albumPanelIn 0.4s cubic-bezier(0.22, 0.9, 0.3, 1) both;
}

.set-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 14px 18px 10px;
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(255, 253, 244, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(198, 151, 62, 0.22);
}
.set-picker-header h2 {
  margin: 0;
  font-size: clamp(1.2rem, 3.2vw, 1.55rem);
  font-weight: 950;
  letter-spacing: -0.03em;
  color: #182b42;
}

/* Shared overlay safe-area — MUST follow .set-picker-overlay / -panel / -header bases
   so their padding/radius are not overridden (cascade bug that left picker under the notch). */
@media (max-width: 520px) {
  .album-overlay,
  .set-picker-overlay {
    align-items: stretch;
    padding:
      max(65px, calc(env(safe-area-inset-top) + 6px))
      10px
      max(8px, env(safe-area-inset-bottom))
      10px;
  }
  .set-picker-panel {
    border-radius: 18px;
    padding: 10px 12px 12px;
  }
  .set-picker-header {
    padding: 0;
    margin: 0 0 6px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    position: relative;
    top: auto;
  }
}

.set-picker-jumps {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  flex: 0 0 auto;
  padding: 10px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255, 248, 231, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(198, 151, 62, 0.18);
}
.set-era-chip {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 14px;
  min-height: 44px;
  max-width: min(100%, 280px);
  border-radius: 16px;
  border: 2px solid rgba(28, 42, 58, 0.14);
  background: rgba(255, 255, 255, 0.85);
  color: #243447;
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  cursor: pointer;
  line-height: 1.2;
  box-shadow: 0 2px 6px rgba(28, 42, 58, 0.08);
  white-space: normal;
  text-align: center;
}
.set-era-chip:hover {
  border-color: rgba(198, 151, 62, 0.55);
}
.set-era-chip.is-active {
  background: linear-gradient(180deg, #ffe082 0%, #ffd54f 100%);
  border-color: #c6973e;
  color: #1a2433;
  box-shadow: 0 0 0 2px rgba(255, 213, 79, 0.35);
}
.set-era-chip:focus-visible {
  outline: 3px solid #ffd54f;
  outline-offset: 2px;
}

.set-picker-tiles {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px 8px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 10px;
}

.set-era {
  /* flex-shrink:0 — open era tiles must not crush sibling headers in the scroll column */
  flex: 0 0 auto;
  border-radius: 16px;
  border: 2px solid rgba(28, 42, 58, 0.1);
  background: rgba(255, 255, 255, 0.45);
  overflow: hidden;
}
.set-era-toggle {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 14px 14px;
  min-height: 44px;
  height: auto;
  flex-shrink: 0;
  box-sizing: border-box;
  border: 0;
  background: rgba(255, 253, 244, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  text-align: left;
  color: #182b42;
}
.set-era-toggle:hover {
  background: rgba(255, 248, 225, 0.95);
}
.set-era-chevron {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-right: 3px solid #314457;
  border-bottom: 3px solid #314457;
  transform: rotate(-45deg);
  transition: transform 0.22s ease;
  margin-top: -4px;
}
.set-era.is-open .set-era-chevron {
  transform: rotate(45deg);
  margin-top: 2px;
}
.set-era-label {
  flex: 1 1 auto;
  font-size: clamp(1.05rem, 2.8vw, 1.25rem);
  font-weight: 950;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.set-era-count {
  flex: 0 0 auto;
  font-size: 0.85rem;
  font-weight: 800;
  color: #6a7a8a;
}
.set-era-body {
  display: none;
  padding: 0;
}
.set-era.is-open .set-era-body {
  display: block;
}
.set-era-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 12px 14px;
}
@media (min-width: 640px) {
  .set-era-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.set-tile {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin: 0;
  padding: 10px;
  border-radius: 16px;
  border: 2.5px solid rgba(28, 42, 58, 0.14);
  background: #fffdf8;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 4px 12px rgba(28, 42, 58, 0.1);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.set-tile:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--tile-accent, var(--set-accent, #ffd54f)) 65%, #263238);
}
.set-tile.is-selected {
  border-color: color-mix(in srgb, var(--tile-accent, var(--set-accent, #ffd54f)) 75%, #263238);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--tile-accent, var(--set-accent, #ffd54f)) 40%, transparent),
    0 8px 18px rgba(28, 42, 58, 0.16);
  background: color-mix(in srgb, var(--tile-accent, var(--set-accent, #ffd54f)) 22%, #fff);
}
.set-tile-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f5c518;
  color: #1a2433;
  font-weight: 900;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
  z-index: 1;
}
.set-tile-art {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 7;
  border-radius: 10px;
  overflow: hidden;
  background: #eceff1;
  border: 1.5px solid color-mix(in srgb, var(--tile-accent, var(--set-accent, #ffd54f)) 40%, transparent);
}
.set-tile-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.set-tile-daily,
.daily-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: #d4a84b;
  color: #1b2a4a;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.4;
}
.daily-pill[hidden] { display: none; }
.set-tile-fav {
  position: absolute;
  z-index: 3;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 248, 231, 0.92);
  color: #1b2a4a;
  font-size: 1.15rem;
  line-height: 1;
}
.set-tile-fav.is-on { color: #c62828; }
.set-tile-god {
  position: absolute;
  z-index: 3;
  top: 6px;
  left: 6px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 248, 231, 0.92);
  color: #1b2a4a;
}
.set-tile-god svg {
  width: 20px;
  height: 20px;
  display: block;
  overflow: visible;
}
.set-tile-god .gem,
.set-tile-god .gem-facet {
  fill: none;
  stroke: currentColor;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.set-tile-god .gem { stroke-width: 1.6; }
.set-tile-god .gem-facet { stroke-width: 1.05; }
.set-tile-god.is-on {
  color: #a56b00;
  background: #fff1c2;
}
.set-tile-god.is-on .gem {
  fill: currentColor;
  stroke: #6e4700;
  stroke-width: 1.15;
}
.set-tile-god.is-on .gem-facet {
  stroke: rgba(255, 248, 220, 0.92);
  stroke-width: 1;
}
.set-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.fav-btn {
  appearance: none;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #1b2a4a;
  background: #fff8e7;
  color: #1b2a4a;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.fav-btn.is-on {
  background: #d4a84b;
  color: #1b2a4a;
}
@media (max-width: 520px) {
  .fav-btn { width: 44px; height: 44px; flex-basis: 44px; font-size: 1.35rem; }
}
.set-tile-label {
  font-size: 0.82rem;
  font-weight: 900;
  color: #182b42;
  line-height: 1.25;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  /* clip only if somehow longer than 2 lines; never ellipsis-truncate to an abbr */
  overflow: hidden;
  text-overflow: clip;
  word-break: break-word;
  hyphens: auto;
}
.set-tile-meta {
  font-size: 0.68rem;
  font-weight: 700;
  color: #5a6a7a;
}
.set-picker-actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: rgba(255, 253, 244, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(198, 151, 62, 0.22);
  box-shadow: 0 -8px 24px rgba(28, 42, 58, 0.08);
}
.set-picker-actions .btn-primary {
  min-width: min(100%, 240px);
  min-height: 48px;
  font-size: 1.05rem;
}

/* ---- Album era accordion (Nova v1) ---- */
.album-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 10px;
  flex: 0 0 auto;
  max-height: min(34vh, 280px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 2px 2px 4px;
  scrollbar-gutter: stable;
}
.album-era {
  flex: 0 0 auto;
  border-radius: 14px;
  border: 1.5px solid rgba(28, 42, 58, 0.12);
  background: rgba(255, 255, 255, 0.55);
  overflow: hidden;
}
.album-era-toggle {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  min-height: 44px;
  height: auto;
  flex-shrink: 0;
  box-sizing: border-box;
  border: 0;
  background: transparent;
  color: #1a2433;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  cursor: pointer;
  text-align: left;
  line-height: 1.2;
}
.album-era-toggle:hover {
  background: rgba(255, 213, 79, 0.18);
}
.album-era-chevron {
  flex: 0 0 auto;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2.5px solid #314457;
  border-bottom: 2.5px solid #314457;
  transform: rotate(-45deg);
  transition: transform 0.18s ease;
  margin: 0 2px 0 4px;
}
.album-era.is-open .album-era-chevron {
  transform: rotate(45deg);
  margin-top: -2px;
}
.album-era-label {
  flex: 1 1 auto;
  min-width: 0;
}
.album-era-count {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 800;
  color: #5a6b7d;
}
.album-era-body {
  display: none;
  padding: 0 10px 10px;
}
.album-era.is-open .album-era-body {
  display: block;
}
.album-era-sets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.album-set-pill {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px 12px;
  min-height: 40px;
  max-width: 100%;
  border-radius: 16px;
  border: 1.5px solid rgba(28, 42, 58, 0.16);
  background: rgba(255, 255, 255, 0.85);
  color: #314457;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  line-height: 1.25;
  white-space: normal;
  text-align: left;
}
.album-set-pill-name {
  font-weight: 900;
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: clip;
  word-break: break-word;
}
.album-set-pill-count {
  font-size: 0.75rem;
  font-weight: 800;
  opacity: 0.85;
}
.album-set-pill:hover {
  border-color: color-mix(in srgb, var(--tab-accent, var(--set-accent, #ffd54f)) 55%, #263238);
}
.album-set-pill.is-active {
  background: color-mix(in srgb, var(--tab-accent, var(--set-accent, #ffd54f)) 42%, #fff);
  border-color: color-mix(in srgb, var(--tab-accent, var(--set-accent, #ffd54f)) 70%, #263238);
  color: #152033;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--tab-accent, var(--set-accent, #ffd54f)) 35%, transparent);
}
.album-set-pill:focus-visible,
.album-era-toggle:focus-visible {
  outline: 3px solid var(--tab-accent, var(--set-accent, #ffd54f));
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .album-era-chevron { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .set-picker-overlay { animation: albumFadeIn 0.2s ease both; }
  .set-picker-panel.is-open { animation: albumPanelFade 0.2s ease both; }
  .set-tile { transition: none; }
  .set-era-chevron { transition: none; }
}

/* Nova theme: patterns are static CSS; keep attachment calm under reduced motion */
@media (prefers-reduced-motion: reduce) {
  html, body {
    background-attachment: scroll;
  }
  .card.is-dealing { animation: none; }
}

.app[hidden],
.gate[hidden],
.win-actions [hidden] { display: none !important; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 50% 18%, rgba(212, 168, 75, 0.28), transparent 42%),
    var(--chrome-cream);
  color: var(--chrome-navy);
}
.gate-title {
  align-items: center;
  justify-content: center;
  gap: 22px;
  text-align: center;
  padding: 32px 20px 48px;
}
.lockup-stack {
  position: relative;
  width: 120px;
  height: 86px;
}
.lockup-stack span {
  position: absolute;
  left: 18px;
  width: 72px;
  height: 100px;
  border-radius: 8px;
  border: 3px solid var(--chrome-navy);
  background: #1b2a4a;
}
.lockup-stack span:nth-child(1) { transform: rotate(-14deg) translateX(-18px); background: #c62828; }
.lockup-stack span:nth-child(2) { transform: rotate(0deg); background: #1565c0; }
.lockup-stack span:nth-child(3) { transform: rotate(12deg) translateX(18px); background: #2e7d32; }
.lockup {
  margin: 0;
  font-family: "Memory Display", "Avenir Next", "Trebuchet MS", sans-serif;
  font-size: clamp(3.2rem, 12vw, 6rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.03em;
}
.lockup span { display: block; }
.title-play {
  min-width: 180px;
  min-height: 56px;
  font-size: 1.35rem;
}
.title-gear { min-height: 44px; }

.gate-table { background: var(--chrome-cream); }
.table-head, .table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  flex-shrink: 0;
}
.table-head h2 { margin: 0; font-size: 1.25rem; }
.table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 16px 12px;
}
.table-scroll h3 {
  margin: 14px 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.roster, .board-picks, .era-row, .shelf {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.portrait, .board-pick, .sleeve-card, .era-chip {
  appearance: none;
  border: 2px solid transparent;
  background: #fff;
  color: var(--chrome-navy);
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}
.portrait {
  flex: 0 0 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
}
.portrait img { width: 56px; height: 56px; object-fit: contain; }
.portrait span, .sleeve-card span { font-size: 0.72rem; text-align: center; line-height: 1.2; }
.portrait.is-on, .board-pick.is-on, .sleeve-card.is-on, .era-chip.is-on {
  border-color: var(--chrome-gold);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--chrome-gold) 55%, transparent);
}
.board-pick {
  flex: 0 0 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
}
.board-pick em { font-style: normal; font-size: 0.68rem; font-weight: 700; color: var(--muted); }
.mini-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), 8px);
  gap: 3px;
  justify-content: center;
  margin-bottom: 4px;
}
.mini-grid i {
  display: block;
  width: 8px;
  height: 11px;
  border-radius: 2px;
  background: var(--chrome-navy);
}
.era-chip {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  white-space: nowrap;
}
.sleeve-card {
  flex: 0 0 104px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
}
.sleeve-card img {
  width: 100%;
  aspect-ratio: 512 / 716;
  object-fit: cover;
  border-radius: 8px;
  background: #1b2a4a;
}
.table-foot .btn-primary { width: min(100%, 420px); margin: 0 auto; min-height: 52px; font-size: 1.15rem; }
.table-foot .btn-primary:disabled { opacity: 0.45; }

.music-disc {
  appearance: none;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #1b2a4a;
  cursor: pointer;
  background: linear-gradient(#e53935 0 46%, #1b2a4a 46% 54%, #f7f7f7 54% 100%);
  box-shadow: inset 0 0 0 2px #1b2a4a, 0 1px 3px rgba(27, 42, 74, 0.25);
  position: relative;
  --disc-angle: 0deg;
  transform: rotate(var(--disc-angle));
}
.music-disc::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #1b2a4a;
  box-shadow: 0 0 0 2px #fff;
}
.music-disc.is-playing {
  animation: spinDisc 1.8s linear infinite;
}
@keyframes spinDisc {
  from { transform: rotate(var(--disc-angle)); }
  to { transform: rotate(calc(var(--disc-angle) + 360deg)); }
}
@media (prefers-reduced-motion: reduce) {
  .music-disc.is-playing { animation: none; }
}

.intro {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0) 46%),
    linear-gradient(180deg, #d9f6ee 0%, #e7f4ff 46%, #f6e9fb 100%);
  color: #1c2a3a;
  cursor: pointer;
  pointer-events: auto;
}
.intro-stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.intro-art {
  --spin: 0deg;
  position: absolute;
  z-index: 1;
  width: calc(var(--slot) * var(--art-scale, 1));
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 14px 16px rgba(28, 50, 80, 0.18));
  opacity: 0;
  animation: introArtIn 0.85s cubic-bezier(0.16, 1, 0.3, 1) var(--delay, 0s) forwards;
}
.intro-art-a { --slot: min(40vw, 360px); --spin: -14deg; left: max(4%, calc(50% - 430px)); top: max(calc(env(safe-area-inset-top) + 4px), 2%, calc(50% - 390px)); --delay: 0.02s; }
.intro-art-b { --slot: min(24vw, 200px); --spin: 8deg; left: calc(50% - min(12vw, 100px)); top: max(calc(env(safe-area-inset-top) + 2px), 1%, calc(50% - 430px)); --delay: 0.1s; }
.intro-art-c { --slot: min(38vw, 340px); --spin: 12deg; right: max(4%, calc(50% - 420px)); top: max(calc(env(safe-area-inset-top) + 4px), 2%, calc(50% - 370px)); --delay: 0.06s; }
.intro-art-d { --slot: min(32vw, 280px); --spin: -10deg; left: max(2%, calc(50% - 500px)); top: calc(50% - min(16vw, 140px)); --delay: 0.14s; }
.intro-art-e { --slot: min(30vw, 260px); --spin: 11deg; right: max(2%, calc(50% - 480px)); top: calc(50% - min(8vw, 60px)); --delay: 0.18s; }
.intro-art-f { --slot: min(40vw, 360px); --spin: -8deg; left: max(4%, calc(50% - 440px)); bottom: max(calc(env(safe-area-inset-bottom) + 8px), 6%, calc(50% - 420px)); --delay: 0.22s; }
.intro-art-g { --slot: min(38vw, 340px); --spin: 9deg; right: max(4%, calc(50% - 420px)); bottom: max(calc(env(safe-area-inset-bottom) + 8px), 8%, calc(50% - 400px)); --delay: 0.26s; }
.intro-art-h { --slot: min(22vw, 180px); --spin: -12deg; left: calc(50% - min(6vw, 40px)); bottom: max(calc(env(safe-area-inset-bottom) + 6px), 2%, calc(50% - 460px)); --delay: 0.3s; }
.intro-logo {
  display: block;
  width: min(78vw, 460px);
  height: auto;
  margin: 0;
  opacity: 0;
  animation: introLine 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}
.intro-banner {
  margin: 12px 0 0;
  padding: 6px 16px 7px;
  border-radius: 3px;
  background: #e3350d;
  color: #fff;
  font-size: clamp(0.82rem, 3.3vw, 1.08rem);
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1;
  text-transform: uppercase;
  opacity: 0;
  animation: introLine 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.34s forwards;
}
.intro-stack {
  position: relative;
  width: min(42vw, 200px);
  margin-top: 36px;
  aspect-ratio: 63 / 88;
}
.intro-card {
  position: absolute;
  inset: 0;
  border-radius: 8% / 6%;
  overflow: hidden;
  box-shadow: 0 16px 28px rgba(20, 40, 80, 0.28);
  opacity: 0;
}
.intro-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.intro-card-under {
  transform: translate(14%, -9%) rotate(6deg);
  animation: introCardUnder 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.28s forwards;
}
.intro-card-front {
  transform: rotate(-4deg);
  z-index: 1;
  animation: introCardFront 0.75s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
}
.intro-gloss {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.45) 48%, transparent 60%);
  transform: translateX(-130%);
  animation: introGloss 0.75s ease 0.95s forwards;
}
.intro-tap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(22px, 5vh, calc(env(safe-area-inset-bottom) + 10px));
  z-index: 3;
  margin: 0;
  padding: 12px;
  border: 0;
  background: transparent;
  color: #3e4e5e;
  text-shadow: 0 0 10px #fff, 0 0 18px #fff;
  font: inherit;
  font-size: clamp(1.05rem, 4.2vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  animation: introTap 1.6s ease-in-out infinite;
}
.intro-install {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 4;
  margin: 0;
  text-align: center;
  color: #3e4e5e;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.35;
  text-shadow: 0 0 8px #fff;
}
.intro-install[hidden] { display: none; }
body.is-ios-browser .intro-tap {
  bottom: max(56px, calc(env(safe-area-inset-bottom) + 40px));
}
.intro.is-done {
  animation: introLeave 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.intro.is-done .intro-stage,
.intro.is-done .intro-tap {
  animation: introLift 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes introArtIn {
  from { opacity: 0; transform: translateY(16px) rotate(var(--spin)) scale(0.92); }
  to { opacity: 1; transform: rotate(var(--spin)); }
}
@keyframes introCardUnder {
  from { opacity: 0; transform: translate(28%, -28%) rotate(14deg) scale(0.9); }
  to { opacity: 1; transform: translate(14%, -9%) rotate(6deg); }
}
@keyframes introCardFront {
  from { opacity: 0; transform: translateY(28px) rotate(-12deg) scale(0.86); }
  to { opacity: 1; transform: rotate(-4deg); }
}
@keyframes introGloss {
  to { transform: translateX(130%); }
}
@keyframes introLine {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes introTap {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes introLeave {
  to { opacity: 0; }
}
@keyframes introLift {
  to { opacity: 0; transform: translateY(-24px) scale(1.04); }
}
@media (prefers-reduced-motion: reduce) {
  .board-wrap.is-god-live::before { animation: none; opacity: 0; }
  .intro-art,
  .intro-logo,
  .intro-banner,
  .intro-card,
  .intro-gloss,
  .intro-tap {
    animation: none;
    opacity: 1;
  }
  .intro-art { transform: rotate(var(--spin)); }
  .intro-card-under { transform: translate(14%, -9%) rotate(6deg); }
  .intro-card-front { transform: rotate(-4deg); }
  .intro.is-done,
  .intro.is-done .intro-stage,
  .intro.is-done .intro-tap {
    animation: introLeave 0.25s linear forwards;
  }
}
.toolbar .set-chip { margin: 0; max-width: min(52vw, 280px); font-size: 0.85rem; min-height: 36px; }
.seat { border-radius: 14px; }

.card.is-dealing {
  animation: dealIn 0.42s cubic-bezier(0.2, 0.85, 0.2, 1) both;
}
@keyframes dealIn {
  from { opacity: 0; transform: translateY(24px) scale(0.94); }
  to { opacity: 1; transform: none; }
}
.win-share-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--chrome-navy, #1B2A4A);
  cursor: pointer;
}
.win-share-icon:hover {
  background: color-mix(in srgb, var(--chrome-navy) 8%, transparent);
}
.win-share-icon:active {
  transform: scale(0.96);
}
.win-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: min(100%, 280px);
  margin: 0 auto;
}
.win-actions .btn-primary,
.win-actions .btn-outline-gold,
.win-actions .btn-ghost-navy {
  width: 100%;
  min-height: 52px;
  font-size: 1.08rem;
  padding: 12px 16px;
  border-radius: 999px;
  font-weight: 850;
  cursor: pointer;
}
.btn-outline-gold {
  appearance: none;
  border: 2.5px solid var(--chrome-gold, #D4A84B);
  background: #fffef6;
  color: #3e2723;
  box-shadow: none;
}
.btn-outline-gold:hover { filter: brightness(1.03); }
.btn-outline-gold:active { transform: translateY(1px); }
.btn-ghost-navy {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--chrome-navy, #1B2A4A);
  text-decoration: underline;
  text-underline-offset: 3px;
  box-shadow: none;
  font-weight: 800;
}
.btn-ghost-navy:hover {
  color: color-mix(in srgb, var(--chrome-navy) 80%, #c6973e);
}


/* ===== Portfolio (adult Have / Want) ===== */
.portfolio-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  gap: 8px;
}
.portfolio-body[hidden] { display: none !important; }

.portfolio-chrome {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 4px 0 6px;
  background: linear-gradient(180deg, #fffdf4 70%, rgba(255, 253, 244, 0));
}
.portfolio-chrome-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.portfolio-seg { flex: 0 1 auto; min-width: 0; }
.portfolio-seg .seg-btn {
  min-height: 36px;
  padding: 0 14px;
  font-weight: 850;
  color: color-mix(in srgb, var(--chrome-navy) 55%, #8a7040);
  background: color-mix(in srgb, var(--chrome-wash) 70%, #fff);
  border: 1.5px solid color-mix(in srgb, var(--chrome-navy) 16%, transparent);
}
.portfolio-seg .seg-btn.is-active,
.portfolio-seg .seg-btn.active {
  background: var(--chrome-navy);
  color: #fff8e7;
  border-color: var(--chrome-gold);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--chrome-gold) 70%, transparent),
    0 2px 0 color-mix(in srgb, var(--chrome-navy) 35%, transparent);
}
.portfolio-counts {
  margin: 0;
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  color: color-mix(in srgb, var(--chrome-navy) 70%, #8a7040);
  letter-spacing: -0.01em;
}
.portfolio-refresh[hidden] { display: none !important; }
.portfolio-add {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.portfolio-empty {
  color: #715018;
  background: rgba(255, 241, 188, 0.78);
  border: 1px solid rgba(147, 104, 32, 0.35);
}
.portfolio-empty[hidden] { display: none !important; }

.portfolio-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 2px 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.port-row,
.port-pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--chrome-cream) 70%, #fff);
  border: 1px solid color-mix(in srgb, var(--chrome-navy) 14%, transparent);
  box-shadow: 0 1px 3px rgba(27, 42, 74, 0.06);
  min-height: 56px;
}
.port-row-art {
  width: 40px;
  height: 56px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid color-mix(in srgb, var(--chrome-navy) 18%, transparent);
  flex: 0 0 auto;
  background: #fff;
}
.port-row-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.port-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.port-row-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 850;
  color: var(--chrome-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
}
/* Price is the feature: never ellipsize / shrink */
.port-row-price {
  flex: 0 0 auto;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  font-size: 0.98rem;
  font-weight: 950;
  letter-spacing: -0.02em;
  color: var(--chrome-navy);
  font-variant-numeric: tabular-nums;
}
.port-row-meta {
  font-size: 0.78rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--chrome-navy) 62%, #8a7040);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.port-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

/* Compact single status toggle (Have / Want / Add) */
.port-status {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  min-height: 44px;
  min-width: 44px;
  max-width: 96px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--chrome-navy) 22%, transparent);
  background: #fffef9;
  color: var(--chrome-navy);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: -0.01em;
  cursor: pointer;
}
.port-status.is-have {
  background: var(--chrome-navy);
  color: #fff8e7;
  border-color: var(--chrome-gold);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--chrome-gold) 55%, transparent);
}
.port-status.is-want {
  background: var(--chrome-cream);
  color: var(--chrome-navy);
  border-color: var(--chrome-gold);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--chrome-gold) 45%, transparent);
}

.port-chip {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  min-height: 36px;
  min-width: 44px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--chrome-navy) 22%, transparent);
  background: #fffef9;
  color: var(--chrome-navy);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: -0.01em;
  cursor: pointer;
}
.port-chip.is-active,
.port-chip[aria-pressed="true"] {
  background: var(--chrome-navy);
  border-color: var(--chrome-gold);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--chrome-gold) 55%, transparent);
  color: #fff8e7;
}
.port-chip-clear {
  font-size: 0.72rem;
  min-width: 44px;
  padding: 0 10px;
  background: #f3f0e6;
  color: var(--chrome-navy);
  border-color: color-mix(in srgb, var(--chrome-navy) 28%, transparent);
}
.port-chip-clear.is-active,
.port-chip-clear[aria-pressed="true"] {
  background: #ece7da;
  color: var(--chrome-navy);
  border-color: color-mix(in srgb, var(--chrome-navy) 40%, transparent);
  box-shadow: none;
}
.port-buy {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 2px solid var(--chrome-navy);
  background: var(--chrome-gold);
  color: var(--chrome-navy);
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--chrome-navy) 35%, transparent);
}
.port-buy:active { transform: translateY(1px); box-shadow: none; }

.portfolio-attr {
  flex: 0 0 auto;
  margin: 0;
  padding: 4px 2px 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--chrome-navy) 55%, #8a7040);
  text-align: center;
  letter-spacing: 0.01em;
  line-height: 1.35;
  max-width: 100%;
}
.portfolio-asof {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 2px 2px;
  font-size: 0.7rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--chrome-navy) 48%, #8a7040);
  text-align: center;
}
.portfolio-asof[hidden] { display: none !important; }

.album-detail-port { display: none !important; }
.album-detail-port[hidden] { display: none !important; }
.album-detail-port .port-chip {
  min-height: 44px;
  background: #fffef9;
  color: var(--chrome-navy);
  border: 1.5px solid color-mix(in srgb, var(--chrome-navy) 28%, transparent);
  opacity: 1;
  pointer-events: auto;
}
.album-detail-port .port-chip.is-active,
.album-detail-port .port-chip[aria-pressed="true"] {
  background: var(--chrome-navy);
  color: #fff8e7;
  border-color: var(--chrome-gold);
}

.portfolio-picker {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(9, 17, 31, 0.55);
  border-radius: inherit;
}
.portfolio-picker[hidden] { display: none !important; }
.portfolio-picker-sheet {
  display: flex;
  flex-direction: column;
  width: min(100%, 520px);
  max-height: min(86dvh, 720px);
  overflow: hidden;
  padding: 14px 14px 12px;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.95), transparent 35%),
    linear-gradient(155deg, #fffdf4 0%, #fff8e7 56%, #f6ecd2 100%);
  border: 3px solid #c6973e;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
  color: var(--chrome-navy);
}
.portfolio-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.portfolio-picker-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 950;
  letter-spacing: -0.02em;
}
.portfolio-picker-search {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 10px;
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 12px;
  border: 1.5px solid color-mix(in srgb, var(--chrome-navy) 22%, transparent);
  background: #fffef9;
  color: var(--chrome-navy);
  font-size: 1rem;
  font-weight: 650;
}
.portfolio-picker-tabs {
  flex: 0 0 auto;
  max-height: 160px;
  margin-bottom: 8px;
}
/* .portfolio-picker-results → see .portfolio-picker-grid */
.port-pick-empty {
  margin: 12px 8px;
  text-align: center;
  font-weight: 750;
  color: color-mix(in srgb, var(--chrome-navy) 65%, #8a7040);
}

@media (max-width: 520px) {
  .album-header-lead { gap: 6px; }
  .album-mode-seg .seg-btn { padding: 0 10px; min-height: 34px; font-size: 0.82rem; }
  .portfolio-chrome { gap: 3px; padding-bottom: 4px; }
  .portfolio-chrome-row { gap: 6px; }
  .portfolio-seg .seg-btn { padding: 0 10px; min-height: 34px; font-size: 0.82rem; }
  .portfolio-add { min-height: 34px; padding: 0 10px; font-size: 0.78rem; }
  .portfolio-counts { font-size: 0.72rem; }
  .port-row { gap: 8px; padding: 8px; }
  .port-row-actions { gap: 6px; }
  .port-status { min-width: 52px; max-width: 88px; padding: 0 10px; font-size: 0.74rem; }
  .port-buy { min-width: 44px; padding: 0 12px; }
  .port-row-name { font-size: 0.88rem; }
  .port-row-price { font-size: 0.95rem; }
  .port-row-meta { font-size: 0.72rem; }
  /* Stack price under name if ultra-tight, still never clip $ */
  .port-row-top {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .port-row-price {
    flex: 1 0 auto;
    text-align: left;
    width: 100%;
    margin-top: 1px;
  }
  .port-row-values {
    flex: 1 0 auto;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    margin-top: 1px;
  }
  .port-row-values-sep { display: none; }
  .port-row-market,
  .port-row-paid {
    width: 100%;
  }
  .port-row-market { font-size: 0.95rem; }
  .port-paid-btn { font-size: 0.88rem; padding-left: 0; }
}

/* ---- Portfolio paid (CAD) + Find online — Nova layout lock ---- */
.port-row-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.port-row-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}
.port-row.is-have-row .port-row-sub {
  /* meta + paid share the second line; paid never truncates */
  align-items: center;
}
.port-row-meta {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--chrome-navy) 62%, #8a7040);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.port-paid-btn {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: 999px;
  border: 2px solid var(--chrome-navy);
  background: var(--chrome-gold);
  color: var(--chrome-navy);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--chrome-navy) 35%, transparent);
}
.port-paid-btn.is-set:active {
  transform: translateY(1px);
  box-shadow: none;
}
.port-paid-btn.is-empty {
  background: transparent;
  border-style: dashed;
  border-color: color-mix(in srgb, var(--chrome-navy) 35%, transparent);
  color: color-mix(in srgb, var(--chrome-navy) 70%, #8a7040);
  box-shadow: none;
  font-weight: 800;
  font-size: 0.82rem;
}
.port-paid-btn:focus-visible {
  outline: 2px solid var(--chrome-gold);
  outline-offset: 2px;
}
.port-paid-add { display: none !important; } /* legacy */
.port-paid-edit {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #fffef9;
  border: 2px solid var(--chrome-navy);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--chrome-gold) 55%, transparent);
}
.port-paid-prefix {
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--chrome-navy);
  flex: 0 0 auto;
}
.port-paid-input {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 6px 4px;
  min-height: 36px;
  min-width: 64px;
  max-width: 110px;
  width: 5em;
  border: none;
  background: transparent;
  color: var(--chrome-navy);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.port-paid-input:focus { outline: none; }

/* Want: secondary text control (not gold primary) */
.port-find {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  min-height: 44px;
  min-width: 44px;
  padding: 0 8px;
  border: none;
  background: transparent;
  color: color-mix(in srgb, var(--chrome-navy) 72%, #4a6a9a);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 8px;
}
.port-find:focus-visible {
  outline: 2px solid var(--chrome-gold);
  outline-offset: 1px;
}
.port-find:active { opacity: 0.75; }

/* Hide legacy gold Buy pill if any leftover markup */
.port-buy { display: none !important; }

/* Dormant market slot (SHOW_MARKET) */
.port-row-market {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  color: var(--chrome-navy);
}

@media (max-width: 520px) {
  .port-row-sub { gap: 4px 6px; }
  .port-paid-btn { padding: 0 10px; font-size: 0.84rem; }
  .port-find { font-size: 0.72rem; padding: 0 4px; max-width: 110px; white-space: normal; line-height: 1.15; text-align: left; }
  .port-row-meta { font-size: 0.72rem; max-width: 42%; }
}

/* Guide (approx CAD from US$ × BoC FX) — secondary, left of paid */
.port-row-guide {
  flex: 0 0 auto;
  white-space: nowrap;
  overflow: visible;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--chrome-navy) 55%, #8a7040);
}
.port-row-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}
@media (max-width: 520px) {
  .port-row-guide {
    width: 100%;
    order: 2;
    font-size: 0.74rem;
  }
  .port-row.is-have-row .port-paid-btn,
  .port-row.is-have-row .port-paid-edit {
    order: 3;
  }
  .port-row-meta { order: 1; }
}

/* ---- Portfolio GRID (Nova) ---- */
.portfolio-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0 0 8px;
  background: linear-gradient(180deg, #fffdf4 75%, rgba(255, 253, 244, 0));
}
.portfolio-filter-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.portfolio-filter-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: color-mix(in srgb, var(--chrome-navy) 65%, #8a7040);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.portfolio-filter-select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 36px;
  max-width: min(52vw, 220px);
  padding: 0 28px 0 10px;
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--chrome-navy) 18%, transparent);
  background:
    linear-gradient(45deg, transparent 50%, var(--chrome-navy) 50%) calc(100% - 14px) / 6px 6px no-repeat,
    linear-gradient(135deg, var(--chrome-navy) 50%, transparent 50%) calc(100% - 10px) / 6px 6px no-repeat,
    #fffef9;
  background-position:
    calc(100% - 14px) calc(50% - 1px),
    calc(100% - 10px) calc(50% - 1px),
    0 0;
  color: var(--chrome-navy);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 750;
}
.portfolio-rarity-seg {
  flex-wrap: nowrap;
  max-width: 100%;
  min-width: 0;
}
.portfolio-rarity-seg .seg-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  font-weight: 850;
  font-size: 0.82rem;
  flex: 0 0 auto;
  white-space: nowrap;
}
@media (max-width: 430px) {
  .portfolio-rarity-seg .seg-btn {
    padding: 0 8px;
    font-size: 0.78rem;
    min-height: 44px;
    min-width: 44px;
  }
}
.portfolio-filter-clear {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1.5px dashed color-mix(in srgb, var(--chrome-navy) 28%, transparent);
  background: transparent;
  color: var(--chrome-navy);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}
.portfolio-filter-clear[hidden] { display: none !important; }
.portfolio-empty-clear {
  appearance: none;
  border: none;
  background: none;
  color: var(--chrome-navy);
  font: inherit;
  font-weight: 900;
  text-decoration: underline;
  cursor: pointer;
  min-height: 44px;
  padding: 0 4px;
}

.portfolio-list,
.portfolio-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 2px 2px 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  align-content: start;
}
@media (min-width: 521px) and (max-width: 899px) {
  .portfolio-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
}
@media (min-width: 900px) {
  .portfolio-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
}

.port-cell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 8px;
  border: 2px solid rgba(198, 151, 62, 0.55);
  background: #fffdf6;
  box-shadow: 0 3px 8px rgba(28, 42, 58, 0.12);
  /* Do not clip paid / guide / Find — art clips itself */
  overflow: visible;
}
.port-cell-art-btn {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 6px 6px 0 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.9), transparent 55%),
    linear-gradient(180deg, #fff8e7 0%, #f3e7c8 100%);
  cursor: pointer;
  position: relative;
  width: 100%;
  /* ~70% of cell: 5:7 art on phone columns; body stays fully visible below */
  aspect-ratio: 5 / 7;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.port-cell-art {
  display: block;
  width: 92%;
  height: 92%;
  object-fit: contain;
  pointer-events: none;
}
.port-cell-owned {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--chrome-navy);
  color: #fff8e7;
  font-size: 0.72rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1.5px var(--chrome-gold);
}
.port-cell-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px 10px;
  min-width: 0;
  flex: 0 0 auto;
}
.port-cell-name {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--chrome-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  min-height: 28px;
}
.port-cell-meta {
  font-size: 0.72rem;
  font-weight: 750;
  color: color-mix(in srgb, var(--chrome-navy) 62%, #8a7040);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 1em;
}
.port-cell-meta-empty { min-height: 0; }
.port-cell-guide {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--chrome-navy) 55%, #8a7040);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.port-cell-foot {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}
.port-cell .port-paid-btn {
  width: 100%;
  justify-content: center;
}
.port-cell .port-find {
  width: 100%;
  min-height: 44px;
  text-align: left;
  padding: 8px 2px;
  white-space: normal;
  line-height: 1.2;
}
.port-cell .port-paid-edit {
  width: 100%;
  justify-content: flex-start;
}

/* ---- Share + toast ---- */
.set-picker-share-link {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  margin: 0 auto;
  padding: 4px 8px;
  min-height: 36px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 750;
  color: var(--chrome-navy, #1B2A4A);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.set-picker-share-link:hover {
  color: color-mix(in srgb, var(--chrome-navy) 80%, #c6973e);
}
.game-toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  transform: translateX(-50%) translateY(12px);
  z-index: 400;
  margin: 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--chrome-navy, #1B2A4A);
  color: #fff8e7;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.game-toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Add picker grid (Nova polish) ---- */
.portfolio-picker-chrome {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0 0 8px;
  background: linear-gradient(180deg, #fffdf4 80%, rgba(255, 253, 244, 0));
}
.portfolio-picker-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.portfolio-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 12px;
  align-content: start;
}
@media (min-width: 521px) and (max-width: 900px) {
  .portfolio-picker-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 901px) {
  .portfolio-picker-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
}
.port-pick-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--chrome-cream) 70%, #fff);
  border: 1px solid color-mix(in srgb, var(--chrome-navy) 12%, transparent);
  box-shadow: 0 1px 3px rgba(27, 42, 74, 0.06);
}
.port-pick-art {
  width: 100%;
  aspect-ratio: 63 / 88;
  object-fit: cover;
  border-radius: 8px;
  background: #eceff1;
  pointer-events: none;
}
.port-pick-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.port-pick-name {
  font-size: 0.82rem;
  font-weight: 850;
  color: var(--chrome-navy);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.port-pick-meta {
  font-size: 0.7rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--chrome-navy) 60%, #8a7040);
}
.port-pick-status {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}
.port-pick-status .port-chip {
  flex: 1 1 0;
  min-height: 32px;
  padding: 0 8px;
  font-size: 0.72rem;
}
.portfolio-picker-hint {
  margin: 0;
  padding: 4px 2px 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--chrome-navy) 65%, #8a7040);
  text-align: center;
}
.portfolio-picker-more {
  margin: 4px auto 8px;
  min-height: 40px;
  padding: 0 16px;
}
.portfolio-picker-more[hidden] { display: none !important; }
.port-status-chip {
  appearance: none;
  border: 1.5px solid color-mix(in srgb, var(--chrome-navy) 22%, transparent);
  border-radius: 999px;
  min-height: 32px;
  padding: 0 10px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 850;
  background: #fff;
  color: var(--chrome-navy);
  cursor: pointer;
  flex: 0 0 auto;
}
.port-status-chip.is-have {
  background: color-mix(in srgb, #66bb6a 22%, #fff);
  border-color: #66bb6a;
}
.port-status-chip.is-want {
  background: color-mix(in srgb, #5c6bc0 18%, #fff);
  border-color: #5c6bc0;
}
.album-detail-port { display: none !important; }

