:root {
  --bg: #0c0e12;
  --bg-elev: #141821;
  --text: #e8eaef;
  --muted: #8b93a7;
  --accent: #5b8cff;
  --accent-soft: rgba(91, 140, 255, 0.15);
  --border: rgba(255, 255, 255, 0.08);
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  position: relative;
  overflow-x: clip;
}

img,
video,
svg {
  max-width: 100%;
  height: auto;
}

.bg-grid {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% -20%, black 40%, transparent 70%);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  color: #8cb0ff;
}

.site-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.site-header-home {
  flex-direction: column;
  align-items: stretch;
  gap: 0.85rem;
  padding-bottom: 1rem;
}

.site-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-header-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-small {
  padding: 0.4rem 0.85rem;
  font-size: 0.88rem;
}

.home-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.55);
}

.home-nav-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-width: 0;
}

.home-nav-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  flex: 0 0 auto;
}

.home-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
}

.home-nav-links a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.2rem 0.35rem;
  border-radius: 6px;
}

.home-nav-links a:hover {
  color: var(--accent);
  background: rgba(91, 140, 255, 0.1);
}

.home-nav-more {
  margin-left: auto;
  position: relative;
}

.home-nav-more summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.home-nav-more summary::-webkit-details-marker {
  display: none;
}

.home-nav-more[open] summary {
  color: var(--text);
}

.home-nav-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 11rem;
  padding: 0.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.home-nav-more-menu a {
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.home-nav-more-menu a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.home-events {
  margin: 0 0 1.35rem;
  padding: 1.1rem 1.2rem;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid rgba(88, 166, 255, 0.45);
  background: linear-gradient(
    135deg,
    rgba(88, 166, 255, 0.12) 0%,
    rgba(34, 197, 94, 0.06) 50%,
    var(--bg-elev) 100%
  );
  box-shadow: 0 12px 40px rgba(88, 166, 255, 0.1);
}

.home-events[hidden] {
  display: none !important;
}

.home-events-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #93c5fd;
}

.home-events-title {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
}

.home-events-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.home-events-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.45);
}

/* Discord event cover art is 800×320 (5:2). */
.home-events-banner {
  width: 100%;
  aspect-ratio: 800 / 320;
  background: rgba(15, 23, 42, 0.65);
}

.home-events-cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-events-card-body {
  flex: 1;
  min-width: 0;
  padding: 0.85rem;
}

.home-events-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.6rem;
  margin-bottom: 0.25rem;
}

.home-events-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  color: var(--muted);
}

.home-events-badge-live {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.home-events-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.home-events-countdown {
  margin: 0 0 0.35rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.02em;
}

.home-events-countdown-soon {
  color: #93c5fd;
}

.home-events-countdown-live {
  color: #86efac;
}

.home-events-when,
.home-events-location,
.home-events-desc {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.home-events-cta {
  margin-top: 0.5rem;
}

.home-set-chase {
  order: 5;
  margin: 0 0 1.5rem;
  padding: 1.25rem 1.35rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(120, 180, 255, 0.22);
  background: linear-gradient(135deg, rgba(30, 42, 68, 0.92), rgba(18, 22, 32, 0.95));
}

.home-set-chase[hidden] {
  display: none !important;
}

.home-set-chase-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8ab4ff;
}

.home-set-chase-title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.home-set-chase-lead {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.45;
}

.home-set-chase-bars {
  display: grid;
  gap: 0.85rem;
}

.home-set-chase-bar-label {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.home-set-chase-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.home-set-chase-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b9bd5, #8ab4ff);
  transition: width 0.35s ease;
}

.home-set-chase-fill-personal {
  background: linear-gradient(90deg, #6bcf8e, #9ee6b4);
}

.home-set-chase-meta {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

#home-set-chase-claim {
  margin-top: 0.85rem;
}

/* App dashboard — fixed thin Discord event bar (full viewport top) */
:root {
  --app-events-bar-height: 0px;
}

body.has-app-events-bar {
  padding-top: var(--app-events-bar-height);
}

body.has-app-events-bar .sidebar {
  top: var(--app-events-bar-height);
  height: calc(100vh - var(--app-events-bar-height));
}

@media (max-width: 880px) {
  body.has-app-events-bar .sidebar {
    height: auto;
  }
}

.app-events-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  height: var(--app-events-bar-height, 36px);
  border-bottom: 1px solid rgba(88, 166, 255, 0.45);
  background: linear-gradient(
    90deg,
    rgba(15, 23, 42, 0.97) 0%,
    rgba(30, 58, 95, 0.95) 50%,
    rgba(15, 23, 42, 0.97) 100%
  );
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.app-events-bar[hidden] {
  display: none !important;
}

.app-events-bar-inner {
  display: flex;
  align-items: center;
  gap: 0.55rem 0.75rem;
  height: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1rem;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.app-events-bar-inner:hover {
  color: var(--text);
  background: rgba(88, 166, 255, 0.06);
}

.app-events-bar-badge {
  flex-shrink: 0;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.1rem 0.38rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  color: var(--muted);
}

.app-events-bar-badge-live {
  background: rgba(34, 197, 94, 0.25);
  color: #86efac;
}

.app-events-bar-title {
  flex-shrink: 1;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-events-bar-countdown {
  flex-shrink: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.app-events-bar-countdown-soon {
  color: #93c5fd;
}

.app-events-bar-countdown-live {
  color: #86efac;
}

.app-events-bar-meta {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-events-bar-cta {
  flex-shrink: 0;
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: #93c5fd;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .app-events-bar-meta {
    display: none;
  }
  .app-events-bar-cta {
    font-size: 0.68rem;
  }
}

.referral-promo {
  margin: 0 0 1.35rem;
  padding: 1.1rem 1.2rem;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid rgba(192, 132, 252, 0.4);
  background: linear-gradient(
    135deg,
    rgba(192, 132, 252, 0.14) 0%,
    rgba(91, 140, 255, 0.08) 55%,
    var(--bg-elev) 100%
  );
  box-shadow: 0 12px 40px rgba(192, 132, 252, 0.12);
}

.referral-promo-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #e9d5ff;
}

.referral-promo-title {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
}

.referral-promo-text {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 42rem;
}

.referral-promo-text strong {
  color: var(--text);
}

.home-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0 0 2.5rem;
}

.home-feature-card {
  display: block;
  padding: 1rem 1rem 0.95rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.home-feature-card:hover {
  transform: translateY(-2px);
  border-color: rgba(129, 140, 248, 0.45);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.2);
}

.home-feature-card-shop {
  border-color: rgba(251, 191, 36, 0.35);
  background: linear-gradient(165deg, rgba(251, 191, 36, 0.08), var(--bg-elev));
}

.home-feature-icon {
  display: block;
  font-size: 1.25rem;
  margin-bottom: 0.45rem;
  color: var(--accent);
}

.home-feature-card h3 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}

.home-feature-card p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.logo {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.logo:hover {
  color: var(--accent);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  font-size: 0.95rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}

.nav a:hover {
  color: var(--text);
}

.nav-cta {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--accent) !important;
}

.nav-cta:hover {
  background: rgba(91, 140, 255, 0.28);
  color: #b6ceff !important;
}

main {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.hero {
  padding: 2.5rem 0 3rem;
}

.hero-kicker {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  max-width: 18ch;
}

.hero-lead {
  margin: 0 0 1.75rem;
  max-width: 52ch;
  color: var(--muted);
  font-size: 1.1rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn-primary {
  background: var(--accent);
  color: #0a0c10 !important;
  border-color: transparent;
}

.btn-primary:hover {
  background: #7a9fff;
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--bg-elev);
  border-color: var(--border);
  color: var(--text) !important;
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: #1a2030;
}

.hero-note {
  margin: 0;
  max-width: 52ch;
  font-size: 0.85rem;
  color: var(--muted);
}

.hero-note code {
  font-family: var(--mono);
  font-size: 0.82em;
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}

.legal-strip {
  margin-top: 2rem;
  padding: 1.75rem 1.5rem;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--border);
}

.legal-strip h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.legal-strip p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.legal-links {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}

.legal-links a {
  font-weight: 600;
}

.prose {
  padding-top: 0.5rem;
  padding-bottom: 3rem;
}

.prose h1 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.prose .meta {
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.prose h2 {
  margin: 2rem 0 0.65rem;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.prose h3 {
  margin: 1.35rem 0 0.5rem;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

#player-guide {
  scroll-margin-top: 5rem;
}

.player-guide-on-home {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  padding-bottom: 1rem;
}

.player-guide-on-home > .guide-kicker {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.player-guide-on-home > h2 {
  margin-top: 0;
}

.player-guide-on-home .back-to-top {
  margin-top: 2rem;
  font-size: 0.95rem;
}

.player-guide-on-home .back-to-top a {
  color: var(--muted);
}

.player-guide-on-home .back-to-top a:hover {
  color: var(--accent);
}

.redirect-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.redirect-main {
  position: relative;
  z-index: 1;
  padding: 2rem;
  max-width: 28rem;
  text-align: center;
  color: var(--muted);
}

.redirect-main a {
  font-weight: 600;
}

.redirect-main p {
  margin: 0 0 1rem;
}

.prose p,
.prose li {
  color: #c2c8d6;
}

.prose ul {
  padding-left: 1.25rem;
}

.prose ol {
  padding-left: 1.25rem;
  color: #c2c8d6;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}

.site-footer {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text);
}

/* =========================================================================
   App / dashboard surface (collection.html)
   ========================================================================= */

.app-body {
  min-height: 100vh;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  min-height: 100vh;
  max-width: 1320px;
  margin: 0 auto;
  gap: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 1.25rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: linear-gradient(180deg, rgba(20, 24, 33, 0.95), rgba(12, 14, 18, 0.95));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(6px);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar-logo {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

.brand-lockup:hover {
  color: var(--text);
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(160, 254, 255, 0.25), 0 4px 14px rgba(0, 0, 0, 0.35);
}

.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
}

.site-header .brand-lockup .brand-logo {
  width: 40px;
  height: 40px;
}

.site-header .brand-name {
  font-size: 1.2rem;
}

.sidebar-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-direction: column;
  padding: 8px;
}

.sidebar-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1 1 auto;
  overflow-y: auto;
}

.sidebar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-nav > .sidebar-section:first-child {
  margin-top: 0.35rem;
}

.sidebar-section {
  margin: 1.5rem 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.6rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
  cursor: pointer;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.sidebar-link.is-active {
  background: var(--accent-soft);
  border-color: rgba(91, 140, 255, 0.35);
  color: var(--text);
}

.sidebar-link.is-soon {
  pointer-events: none;
  opacity: 0.55;
}

.sidebar-link-icon {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
  color: var(--accent);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.nav-icon svg {
  width: 1.05rem;
  height: 1.05rem;
}

.nav-icon--collection { color: #4ade80; background: rgba(74, 222, 128, 0.12); }
.nav-icon--pokedex { color: #c4b5fd; background: rgba(196, 181, 253, 0.12); }
.nav-icon--packs { color: #7dd3fc; background: rgba(125, 211, 252, 0.12); }
.nav-icon--craft { color: #fbbf24; background: rgba(251, 191, 36, 0.12); }
.nav-icon--deck { color: #fb923c; background: rgba(251, 146, 60, 0.12); }
.nav-icon--trades { color: #2dd4bf; background: rgba(45, 212, 191, 0.12); }
.nav-icon--auctions { color: #f472b6; background: rgba(244, 114, 182, 0.12); }
.nav-icon--leaderboard { color: #fcd34d; background: rgba(252, 211, 77, 0.12); }
.nav-icon--shop { color: #a5f3fc; background: rgba(165, 243, 252, 0.14); }
.nav-icon--settings { color: #94a3b8; background: rgba(148, 163, 184, 0.12); }
.nav-icon--topgg { color: #f87171; background: rgba(248, 113, 113, 0.12); }
.nav-icon--invite { color: #86efac; background: rgba(134, 239, 172, 0.12); }
.nav-icon--discord { color: #93c5fd; background: rgba(147, 197, 253, 0.12); }
.nav-icon--guide,
.nav-icon--terms,
.nav-icon--privacy { color: #a1a1aa; background: rgba(161, 161, 170, 0.1); }

.sidebar-link.is-active .nav-icon {
  box-shadow: 0 0 0 1px currentColor;
}

.sidebar-link-text {
  flex: 1 1 auto;
}

.sidebar-link-external .sidebar-link-text::after {
  content: "↗";
  margin-left: 0.35rem;
  font-size: 0.75em;
  opacity: 0.55;
}

.sidebar-pill {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.sidebar-user {
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
  font-size: 0.9rem;
}

.sidebar-user-loading {
  color: var(--muted);
  padding: 0.3rem 0;
}

.sidebar-user-signedout p {
  margin: 0 0 0.65rem;
  color: var(--muted);
}

.btn-block {
  width: 100%;
}

.sidebar-user-signedin {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
}

.sidebar-user-profile {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.sidebar-balances {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  width: 100%;
}

.sidebar-balances[hidden] {
  display: none !important;
}

.sidebar-balance {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  min-width: 0;
}

.sidebar-balance--pd {
  border-color: rgba(91, 140, 255, 0.35);
  color: #93c5fd;
}

.sidebar-balance--cr {
  border-color: rgba(192, 132, 252, 0.35);
  color: #d8b4fe;
}

.sidebar-balance-icon {
  flex-shrink: 0;
  font-size: 0.85em;
}

.sidebar-balance-value {
  white-space: nowrap;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  object-fit: cover;
  flex: 0 0 auto;
}

/* Discord user row (auctions seller, trades partner, bid list, etc.) */
.pokepon-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.pokepon-user-chip-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-elev);
}

.pokepon-user-chip-avatar--ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
}

.pokepon-user-chip-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.pokepon-user-chip-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pokepon-user-chip-handle {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pokepon-user-chip--sm .pokepon-user-chip-avatar,
.pokepon-user-chip--sm .pokepon-user-chip-avatar--ph {
  width: 26px;
  height: 26px;
  font-size: 0.72rem;
}

.auction-tile {
  position: relative;
}

.auction-spotlight-badge {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  z-index: 2;
  font-size: 1rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.auction-spotlight-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--muted);
  align-self: flex-end;
}

.auction-tile-seller {
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}

.auction-detail-seller {
  margin: 0.65rem 0 0.35rem;
}

.auction-bid-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.auction-bid-row + .auction-bid-row {
  margin-top: 0.45rem;
}

.trade-list-user {
  margin-bottom: 0.35rem;
}

.trade-room-partner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.trade-room-header h2 {
  margin: 0;
}

.sidebar-user-text {
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar-user-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-hint {
  color: var(--muted);
  font-size: 0.78rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
}

.btn-link:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
}

/* ----- Main panel ------------------------------------------------------- */

.app-main {
  padding: 2rem 2rem 4rem;
  min-width: 0;
}

.page-head {
  margin-bottom: 1.5rem;
}

.page-head h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: -0.02em;
}

.page-lead {
  margin: 0;
  color: var(--muted);
  max-width: 56ch;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.toolbar-search {
  position: relative;
  flex: 1 1 320px;
  display: flex;
  align-items: center;
}

.toolbar-search .search-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  font-size: 1.05rem;
  pointer-events: none;
}

#search-input,
.toolbar-search-input,
.toolbar-search input[type="search"] {
  width: 100%;
  padding: 0.7rem 2.4rem 0.7rem 2.4rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.12s ease, background 0.12s ease;
}

#search-input::placeholder,
.toolbar-search-input::placeholder,
.toolbar-search input[type="search"]::placeholder {
  color: var(--muted);
}

#search-input:focus,
.toolbar-search-input:focus,
.toolbar-search input[type="search"]:focus {
  border-color: rgba(91, 140, 255, 0.6);
  background: #1a2030;
}

.search-clear {
  position: absolute;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}

.search-clear:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}

.collection-bulk-sell-btn {
  flex: 0 0 auto;
  align-self: center;
  white-space: nowrap;
  font-size: 0.9rem;
  padding: 0.55rem 1rem;
  border-radius: 12px;
}

.collection-bulk-sell-btn.is-active {
  border-color: rgba(91, 140, 255, 0.75);
  color: var(--text);
  background: rgba(91, 140, 255, 0.14);
}

.toolbar-sort {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1 1 100%;
}

.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--muted);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.chip:hover {
  color: var(--text);
}

.chip.is-active {
  background: var(--accent-soft);
  color: #d3deff;
  border-color: rgba(91, 140, 255, 0.5);
}

.collection-status {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 1rem;
}

.collection-status.state-error {
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.08);
  color: #ffd0d0;
}

.collection-status.state-empty {
  background: rgba(91, 140, 255, 0.06);
  border-color: rgba(91, 140, 255, 0.25);
  color: #cfdcff;
}

.collection-status.state-auth {
  background: rgba(91, 140, 255, 0.06);
  border-color: rgba(91, 140, 255, 0.25);
  color: #cfdcff;
}

.collection-status code {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}

.collection-status .muted {
  color: var(--muted);
  font-size: 0.85em;
}

/* ----- Card grid -------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr));
  gap: 1rem;
}

.collection-evo-sections {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  margin-top: 1.75rem;
}

.collection-evo-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.collection-evo-heading {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.collection-evo-grid {
  margin-top: 0;
}

.card-grid.collection-dup-groups {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* `display:flex` on this bar overrides the default `[hidden]` rule — toggle with `.is-open`. */
.bulk-sell-bar {
  display: none;
  position: sticky;
  bottom: 0.75rem;
  z-index: 30;
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

.bulk-sell-bar.is-open {
  display: flex;
}

.bulk-sell-bar[hidden] {
  display: none !important;
}

.bulk-sell-left {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
}

.bulk-sell-total {
  color: var(--text);
  font-weight: 650;
}

.bulk-sell-hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.bulk-sell-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.bulk-sell-actions {
  display: flex;
  gap: 0.6rem;
  flex-shrink: 0;
}

.card-tile-wrap.is-bulk-unsellable .card-tile {
  opacity: 0.42;
  filter: grayscale(0.35);
}

.card-tile-wrap.is-bulk-unsellable .card-tile:hover {
  transform: none;
  box-shadow: none;
}

.card-tile-wrap.is-bulk-selected .card-tile {
  border-color: rgba(91, 140, 255, 0.75);
  box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.22);
}

.card-tile-bulk-check {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  z-index: 3;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.65);
  color: var(--text);
  display: grid;
  place-items: center;
  font-weight: 800;
  pointer-events: none;
}

.card-tile-bulk-check.is-on {
  background: rgba(91, 140, 255, 0.75);
  border-color: rgba(91, 140, 255, 0.9);
  color: #0b1020;
}

.card-tile-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  position: relative;
}

.card-tile-fav {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 2;
  font-size: 1rem;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85));
}

.modal-image {
  position: relative;
}

.modal-favorite-btn {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 2;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.55);
  color: #fde68a;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.modal-favorite-btn:hover:not(:disabled) {
  transform: scale(1.06);
  background: rgba(0, 0, 0, 0.75);
  border-color: #fde68a;
}

.modal-favorite-btn.is-favorite {
  background: rgba(120, 53, 15, 0.75);
  border-color: #fbbf24;
}

.modal-favorite-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.picker-card.is-favorite {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.picker-fav {
  margin-left: 0.25rem;
}

.card-tile-copy {
  appearance: none;
  width: 100%;
  margin: 0;
  padding: 0.35rem 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.card-tile-copy:hover {
  background: rgba(91, 140, 255, 0.12);
  border-color: rgba(91, 140, 255, 0.45);
  color: var(--text);
}

.card-tile {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 14px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease,
    background 0.12s ease;
  position: relative;
  overflow: hidden;
}

.card-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% -20%, rgba(91, 140, 255, 0.18), transparent 70%);
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

.card-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(91, 140, 255, 0.45);
  box-shadow: 0 12px 30px -16px rgba(91, 140, 255, 0.45);
}

.card-tile:hover::before {
  opacity: 1;
}

.card-tile-img {
  display: block;
  width: 100%;
  aspect-ratio: 245 / 342;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
}

.card-tile-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.card-tile-name {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-tile-sub {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-tile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.card-tile-rarity {
  margin-left: auto;
  padding: 0.05rem 0.45rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.72rem;
}

.card-tile.rarity-common .card-tile-rarity { color: #cbd5e1; }
.card-tile.rarity-uncommon .card-tile-rarity { color: #86efac; }
.card-tile.rarity-rare .card-tile-rarity { color: #93c5fd; }
.card-tile.rarity-ultra .card-tile-rarity { color: #c4b5fd; }
.card-tile.rarity-hyper .card-tile-rarity { color: #fda4af; }
.card-tile.rarity-secret .card-tile-rarity { color: #fde68a; }
.card-tile.rarity-special .card-tile-rarity { color: #f0abfc; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.pager-info {
  color: var(--muted);
  font-size: 0.9rem;
}

.pager .btn-ghost[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ----- Modal ------------------------------------------------------------ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 310;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 18px;
  max-width: 880px;
  width: 100%;
  max-height: calc(100vh - 3rem);
  overflow: auto;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6);
}

#card-modal .modal-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#card-modal .modal-grid {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  align-items: stretch;
}

#card-modal .modal-aside {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

#card-modal .modal-aside .modal-image img {
  max-height: min(48vh, 400px);
  width: auto;
  max-width: 100%;
  margin-inline: auto;
  display: block;
}

#card-modal .modal-aside .modal-footer {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  box-shadow: none;
  gap: 0.75rem;
}

#card-modal .modal-aside .modal-footer-sell-main,
#card-modal .modal-aside .modal-footer-evo {
  flex-direction: column;
  align-items: stretch;
}

#card-modal .modal-aside .modal-footer-evo {
  border-top: 1px solid var(--border);
  border-left: none;
  padding-top: 0.75rem;
  padding-left: 0;
}

#card-modal .modal-aside .modal-sell-actions,
#card-modal .modal-aside .modal-footer-evo .btn {
  width: 100%;
}

@media (min-width: 720px) {
  #card-modal .modal-aside {
    position: sticky;
    top: 1.25rem;
    align-self: start;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    padding-right: 0.15rem;
  }
}

.modal-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.5);
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.modal-close:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.8);
}

.modal-grid {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
}

.modal-image img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

#card-modal .modal-body {
  flex: 1;
  min-height: 0;
  gap: 0;
}

.modal-body-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-right: 0.15rem;
}

.modal-footer {
  flex-shrink: 0;
  margin-top: 0.65rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: 0 -12px 24px rgba(0, 0, 0, 0.22);
}

/* Enforce sell → evolve → grade even if an old cached collection.html has different DOM order */
.modal-footer > .modal-sell {
  order: 1;
}

.modal-footer > .modal-footer-evo {
  order: 2;
}

.modal-footer > .modal-grade {
  order: 3;
}

.modal-footer-sell-main,
.modal-footer-evo {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.modal-footer-sell-copy {
  flex: 1;
  min-width: 0;
}

.modal-footer-evo {
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border);
}

.modal-footer-evo-main {
  flex: 1;
  min-width: 0;
}

.modal-footer-evo-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.modal-footer .modal-sell {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.modal-footer .modal-sell-desc {
  margin: 0;
  font-size: 0.78rem;
}

.modal-footer .modal-sell-heading {
  margin-bottom: 0.2rem;
}

.modal-footer .modal-sell-quote {
  margin-bottom: 0.35rem;
}

.modal-footer .modal-sell-actions {
  flex-shrink: 0;
}

/* Collection card modal: sell + evolve stack under the image (not side-by-side). */
@media (min-width: 640px) {
  #card-modal .modal-aside .modal-footer {
    display: flex;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .modal-footer-sell-main,
  .modal-footer-evo {
    flex-direction: column;
  }

  .modal-footer .modal-sell-actions,
  .modal-footer-evo .btn {
    width: 100%;
  }
}

.modal-set {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.modal-title {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}

.modal-rarity {
  margin: 0;
  font-weight: 600;
  font-size: 0.9rem;
}

.modal-rarity.rarity-common { color: #cbd5e1; }
.modal-rarity.rarity-uncommon { color: #86efac; }
.modal-rarity.rarity-rare { color: #93c5fd; }
.modal-rarity.rarity-ultra { color: #c4b5fd; }
.modal-rarity.rarity-hyper { color: #fda4af; }
.modal-rarity.rarity-secret { color: #fde68a; }
.modal-rarity.rarity-special { color: #f0abfc; }

.modal-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem 1rem;
  margin: 0;
}

.modal-stats > div {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
}

.modal-stats dt {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-stats dd {
  margin: 0.2rem 0 0;
  font-weight: 600;
}

.modal-stats code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
}

.modal-stats .modal-id-row {
  grid-column: 1 / -1;
}

.modal-id-dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  word-break: break-all;
}

.btn-copy-inline {
  flex-shrink: 0;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
}

.modal-attacks {
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}

.modal-attacks h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-attacks ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.modal-attacks li {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
}

.atk-row {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.atk-name {
  font-weight: 600;
}

.atk-cost {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.atk-dmg {
  margin-left: auto;
  font-family: var(--mono);
  color: #fda4af;
}

.atk-text {
  margin: 0.3rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.modal-obtained {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: pre-line;
}

.modal-sell {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.modal-sell-heading {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-sell-desc {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

.modal-sell-quote {
  margin: 0 0 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
}

.modal-sell-block {
  margin: 0 0 0.5rem;
  font-size: 0.86rem;
  line-height: 1.45;
  color: #fda4af;
}

.modal-sell-warn {
  margin: 0 0 0.65rem;
  font-size: 0.84rem;
  line-height: 1.45;
}

.modal-sell-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

#modal-sell-btn.btn-primary {
  background: #dc2626;
  color: #fff !important;
}

#modal-sell-btn.btn-primary:hover:not(:disabled) {
  background: #ef4444;
  transform: translateY(-1px);
}

#modal-sell-btn.btn-primary:disabled {
  background: #7f1d1d;
  color: rgba(255, 255, 255, 0.55) !important;
  cursor: not-allowed;
  transform: none;
}

.modal-sell-msg {
  margin: 0.55rem 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.modal-sell-msg.is-error {
  color: #fda4af;
}

.modal-sell-msg.is-ok {
  color: #86efac;
}

.modal-footer .modal-sell:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.modal-footer .modal-grade {
  margin-top: 0;
  padding-top: 0.85rem;
  padding-bottom: 0;
  border-top: 1px solid var(--border);
  border-bottom: none;
}

.modal-grade-heading {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-grade-desc {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.modal-grade-summary {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.modal-footer-grade-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-grade-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.modal-grade-msg {
  margin: 0.35rem 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.modal-grade-msg.is-error {
  color: #fda4af;
}

.modal-grade-msg.is-ok {
  color: #86efac;
}

.card-tile-img--slab,
.modal-img--slab {
  object-fit: contain;
  background: rgba(0, 0, 0, 0.2);
}

.card-tile-grade {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  z-index: 2;
  min-width: 1.6rem;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: rgba(196, 30, 58, 0.92);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.modal-evolve {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.modal-evolve-heading {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-evolve-desc {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

.modal-evolve-stages {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.modal-evolve-block {
  margin: 0 0 0.5rem;
  font-size: 0.86rem;
  line-height: 1.45;
  color: #fda4af;
}

.modal-evolve-targets {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.2rem;
  scroll-snap-type: x proximity;
}

.modal-evo-target {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  flex: 0 0 min(240px, 82vw);
  scroll-snap-align: start;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  overflow: hidden;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.modal-evo-target.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.modal-evo-target-hit {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.55rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.modal-evo-target-hit:hover,
.modal-evo-target-hit:focus-visible {
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}

.modal-evo-target-pick {
  flex-shrink: 0;
  align-self: center;
  margin-right: 0.45rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.78rem;
  cursor: pointer;
}

.modal-evo-target-pick:hover,
.modal-evo-target-pick:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.modal-evo-target-hit img {
  width: 44px;
  height: 62px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.modal-evo-target-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.modal-evo-target-name {
  font-weight: 600;
}

.modal-evo-target-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.modal-evo-target-hint {
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.evo-focus-modal {
  z-index: 320;
}

.evo-focus-card .modal-evo-back {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 3;
}

.evo-focus-card {
  max-width: 820px;
}

.evo-focus-next-section {
  margin-top: 0.5rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.evo-focus-next-heading {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.evo-focus-next-targets {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: min(42vh, 280px);
  overflow-y: auto;
}

.evo-focus-next-targets .modal-evo-target {
  flex: none;
  width: 100%;
  max-width: none;
}

.evo-focus-cost {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: #fde68a;
}

.evo-focus-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.evo-focus-actions[hidden] {
  display: none !important;
}

body.evo-focus-open #card-modal .modal-card {
  filter: brightness(0.55);
}

/* Keep sell / back actions clickable above the evolution preview overlay */
body.evo-focus-open #card-modal .modal-aside .modal-footer {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  width: min(280px, calc(100vw - 3rem));
  z-index: 325;
  margin: 0;
  filter: none;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.55);
}

.modal-evolve-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.modal-evolve-msg {
  margin: 0.55rem 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.modal-evolve-msg.is-error {
  color: #fda4af;
}

.modal-evolve-msg.is-ok {
  color: #86efac;
}

body.modal-open {
  overflow: hidden;
}

/* ----- Deck editor ------------------------------------------------------ */

body.deck-editor-active .page-head {
  display: none;
}

body.deck-editor-active .app-main {
  padding-top: 0.25rem;
}

.deck-workspace {
  position: sticky;
  top: 0;
  z-index: 12;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem 1rem;
  background: var(--bg-elev);
  border: 1px solid rgba(91, 140, 255, 0.28);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.deck-workspace-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.85rem;
}

.deck-workspace-title {
  margin: 0;
  font-size: 1.05rem;
}

.deck-workspace-meta {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.deck-fill-count {
  font-weight: 600;
  color: var(--text);
}

.deck-selected-hint strong {
  color: var(--accent);
}

.deck-workspace-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.deck-picker-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.deck-picker-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  user-select: none;
  border-bottom: 1px solid transparent;
}

.deck-picker-panel[open] .deck-picker-summary {
  border-bottom-color: var(--border);
}

.deck-picker-summary::-webkit-details-marker {
  display: none;
}

.deck-picker-summary::before {
  content: "▸";
  color: var(--accent);
  transition: transform 0.15s ease;
}

.deck-picker-panel[open] .deck-picker-summary::before {
  transform: rotate(90deg);
}

.deck-picker-inner {
  padding: 0.85rem 1rem 1rem;
}

.deck-picker-lead {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
}

.deck-picker-toolbar {
  margin-bottom: 0.75rem;
}

@keyframes deck-slot-pop {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(134, 239, 172, 0.5);
  }
  35% {
    transform: scale(1.03);
    box-shadow: 0 0 0 4px rgba(134, 239, 172, 0.35);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(134, 239, 172, 0);
  }
}

.deck-slot.is-just-added {
  animation: deck-slot-pop 0.85s ease;
  border-color: rgba(134, 239, 172, 0.65);
}

.deck-status,
.deck-picker-status {
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.45;
}
.deck-status.state-auth,
.deck-picker-status.state-auth {
  background: rgba(91, 140, 255, 0.08);
  border: 1px solid rgba(91, 140, 255, 0.25);
}
.deck-status.state-error,
.deck-picker-status.state-error {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
}
.deck-status.state-info,
.deck-picker-status.state-info {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}
.deck-status.state-empty,
.deck-picker-status.state-empty {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}

.deck-bench {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 0;
}

.deck-slot {
  position: relative;
  background: var(--bg-elev);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem 0.65rem 0.65rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  min-height: 180px;
  text-align: center;
}

@media (min-width: 900px) {
  .deck-bench {
    grid-template-columns: repeat(6, 1fr);
    gap: 0.55rem;
  }

  .deck-slot {
    min-height: 150px;
    padding: 0.55rem 0.45rem 0.45rem;
  }

  .deck-slot-img {
    width: 72px;
  }

  .deck-slot-name {
    font-size: 0.78rem;
  }

  .deck-slot-label {
    font-size: 0.72rem;
  }
}

.deck-slot:hover {
  border-color: rgba(91, 140, 255, 0.35);
}

.deck-slot.is-selected {
  border-color: rgba(91, 140, 255, 0.7);
  box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.18);
  background: rgba(91, 140, 255, 0.04);
}

.deck-slot.is-filled {
  border-color: rgba(134, 239, 172, 0.35);
}

.deck-slot.is-filled.is-selected {
  border-color: rgba(91, 140, 255, 0.7);
}

.deck-slot-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.deck-slot-lead {
  color: #fde68a;
}

.deck-slot-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  flex: 1;
  justify-content: center;
  min-width: 0;
  width: 100%;
}

.deck-slot-img {
  width: 110px;
  height: auto;
  border-radius: 8px;
  pointer-events: none;
}

.deck-slot-name {
  font-size: 0.88rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.deck-slot-hp {
  font-size: 0.78rem;
  color: var(--muted);
}

.deck-slot-empty {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

.deck-slot-clear {
  appearance: none;
  width: 100%;
  margin: auto 0 0;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(248, 113, 113, 0.25);
  background: rgba(248, 113, 113, 0.1);
  color: #fda4af;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.deck-slot-clear:hover {
  background: rgba(248, 113, 113, 0.25);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.deck-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.25rem 0 0.5rem;
}

.deck-save-hint {
  font-size: 0.82rem;
  color: var(--muted);
}

.deck-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.deck-picker-head {
  margin-bottom: 0.75rem;
}

.deck-picker-head h2 {
  font-size: 1.15rem;
  margin: 0 0 0.2rem;
}

.deck-picker-head .page-lead {
  margin: 0;
}

/* Picker tile overrides */
.picker-tile {
  position: relative;
}

.picker-tile.is-in-deck {
  opacity: 0.55;
  pointer-events: none;
}

.picker-tile.is-ineligible {
  opacity: 0.35;
  pointer-events: none;
}

.picker-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.15rem 0.4rem;
  color: var(--muted);
}

/* ----- Responsive ------------------------------------------------------- */

/* Tablet / narrow desktop — keep sidebar, give main column room to shrink */
@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: minmax(188px, 220px) minmax(0, 1fr);
  }

  .app-main {
    padding: 1.5rem 1.25rem 3rem;
  }

  .toolbar-search {
    flex: 1 1 100%;
  }
}

/* Phone / small tablet — slide-out nav, single column layouts */
@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    height: auto;
    max-height: none;
    padding: 0.75rem 1rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
    transition: box-shadow 0.22s ease;
  }

  .sidebar.is-open {
    position: fixed;
    top: 0;
    left: 0;
    width: min(288px, 92vw);
    height: 100dvh;
    max-height: 100dvh;
    padding: 1rem 1rem 1.25rem;
    border-bottom: none;
    border-right: 1px solid var(--border);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.45);
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .sidebar-nav,
  .sidebar-user {
    display: none;
  }

  .sidebar.is-open .sidebar-nav,
  .sidebar.is-open .sidebar-user {
    display: flex;
  }

  .sidebar.is-open .sidebar-nav {
    flex-direction: column;
    padding-top: 0.5rem;
  }

  .app-shell:has(.sidebar.is-open)::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(6, 8, 12, 0.55);
    pointer-events: auto;
  }

  .app-main {
    padding: 1rem 0.85rem 2.75rem;
    min-height: 100vh;
  }

  .toolbar {
    gap: 0.65rem;
  }

  .toolbar-sort {
    width: 100%;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
    gap: 0.65rem;
  }

  .modal {
    padding: 0;
    align-items: stretch;
  }

  .modal-card {
    max-height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .modal-grid,
  #card-modal .modal-grid {
    grid-template-columns: 1fr;
    overflow: visible;
    max-width: 100%;
    box-sizing: border-box;
  }

  #card-modal .modal-card {
    max-height: 100dvh;
    max-width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-sizing: border-box;
  }

  #card-modal .modal-aside {
    position: static;
    max-height: none;
    overflow: visible;
    max-width: 100%;
  }

  #card-modal .modal-body {
    overflow: visible;
  }

  #card-modal .modal-body-scroll {
    overflow: visible;
    min-height: auto;
  }

  #card-modal .modal-aside .modal-image img {
    width: 100%;
    max-width: 280px;
    margin-inline: auto;
  }

  .modal-close {
    position: absolute;
    top: calc(0.5rem + env(safe-area-inset-top, 0px));
    right: 0.5rem;
    width: 42px;
    height: 42px;
    font-size: 1.35rem;
    z-index: 5;
  }

  .evo-focus-card {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .evo-focus-card .modal-evo-back {
    position: sticky;
    top: 0.5rem;
    z-index: 5;
    margin-left: 0.5rem;
    margin-bottom: -2rem;
  }

  .deck-bench {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr));
  }

  .deck-workspace {
    position: static;
  }

  .deck-workspace-actions {
    width: 100%;
  }

  .deck-workspace-actions .btn {
    flex: 1 1 auto;
  }

  .pager {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.15rem;
  }

  .nav {
    width: 100%;
    gap: 0.4rem 0.85rem;
    font-size: 0.9rem;
  }

  .home-nav {
    display: none;
  }

  .site-header-cta {
    width: 100%;
    justify-content: stretch;
  }

  .site-header-cta .btn {
    flex: 1 1 0;
    text-align: center;
    padding: 0.4rem 0.5rem;
    font-size: 0.82rem;
  }

  .hero {
    display: flex;
    flex-direction: column;
    padding-top: 1.25rem;
    padding-bottom: 2rem;
  }

  .hero-kicker { order: 1; }
  .hero h1 { order: 2; }
  .hero-lead { order: 3; }
  .hero-actions { order: 4; }
  .home-features { order: 5; margin-top: 0.5rem; }
  .home-events { order: 6; }
  .referral-promo { order: 7; }
  .hero-note { order: 8; }

  .home-features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .home-feature-card {
    padding: 0.85rem 0.85rem 0.75rem;
  }

  .home-feature-card h3 {
    font-size: 0.92rem;
  }

  .home-feature-card p {
    font-size: 0.78rem;
  }
}

@media (max-width: 600px) {
  .home-features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  body {
    font-size: 1rem;
  }

  .app-main {
    padding: 0.85rem 0.75rem 2.5rem;
  }

  .page-head h1 {
    font-size: clamp(1.35rem, 6vw, 1.75rem);
  }

  .toolbar-search {
    flex: 1 1 100%;
  }

  .chip {
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 118px), 1fr));
    gap: 0.5rem;
  }

  .modal-stats {
    grid-template-columns: 1fr;
  }

  .modal-title {
    font-size: 1.35rem;
    padding-right: 2.25rem;
  }

  .deck-slot {
    min-height: 150px;
  }
}

@media (max-width: 400px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Short viewports (phone landscape, small windows) — stack panels, limit scroll regions */
@media (max-height: 520px) and (orientation: landscape) {
  .app-main {
    padding-top: 0.65rem;
    padding-bottom: 1.5rem;
  }

  .page-head {
    margin-bottom: 0.85rem;
  }

  .page-head h1 {
    font-size: 1.35rem;
  }

  .modal {
    padding: 0.35rem;
    align-items: center;
  }

  .modal-card {
    max-height: calc(100dvh - 0.75rem);
    border-radius: 12px;
  }

  #card-modal .modal-grid {
    grid-template-columns: minmax(140px, 34%) minmax(0, 1fr);
    overflow: hidden;
  }

  #card-modal .modal-aside .modal-image img {
    max-height: min(36vh, 220px);
  }

  .deck-bench {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .deck-slot {
    min-height: 0;
    padding: 0.35rem 0.3rem;
  }

  .deck-slot-img {
    width: 52px;
  }
}

/* Crafting */
.craft-subtabs {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0.35rem;
  background: rgba(15, 12, 28, 0.65);
  border-radius: 12px;
  border: 1px solid rgba(168, 85, 247, 0.22);
}

.craft-page .craft-subtabs {
  position: sticky;
  top: 0.5rem;
  z-index: 20;
  backdrop-filter: blur(8px);
}

.craft-subtab {
  flex: 1;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted, #9ca3af);
  font: 600 0.9rem/1.2 "DM Sans", system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.craft-subtab.is-active {
  background: rgba(168, 85, 247, 0.2);
  color: #f3e8ff;
}

.craft-subtab:hover:not(.is-active) {
  color: #e9d5ff;
}

.assembly-workspace .assembly-station {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.assembly-board-wrap {
  width: 100%;
  max-width: 520px;
}

.assembly-board {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 200px;
  padding: 1rem;
  border-radius: 16px;
  background: rgba(12, 10, 22, 0.6);
  border: 1px dashed rgba(168, 85, 247, 0.35);
}

.assembly-board.layout-quad {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 3 / 4;
  max-width: 320px;
  margin: 0 auto;
}

.assembly-board.layout-horizontal_halves {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
  aspect-ratio: 7 / 5;
  max-width: 480px;
  margin: 0 auto;
}

.assembly-board.orientation-landscape.is-complete .assembly-complete-img,
.assembly-board.orientation-landscape.layout-horizontal_halves:not(.is-complete) {
  transform: rotate(-90deg);
  transform-origin: center center;
}

.assembly-board.orientation-landscape.layout-horizontal_halves:not(.is-complete) {
  width: min(70vw, 280px);
  height: min(85vw, 400px);
  margin: 2rem auto;
}

.assembly-slot {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.assembly-slot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.assembly-slot-img.is-placed {
  animation: assembly-place 0.4s ease;
}

@keyframes assembly-place {
  from {
    opacity: 0;
    transform: scale(0.85) rotate(0deg);
  }
  to {
    opacity: 1;
  }
}

.assembly-slot-empty {
  font-size: 1.5rem;
  color: rgba(168, 85, 247, 0.5);
}

.assembly-result-ghost {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.assembly-result-ghost img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.assembly-board-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 1rem;
}

.assembly-board-meta {
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.assembly-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
}

.assembly-cost {
  width: 100%;
  text-align: center;
  margin: 0;
}

.assembly-board.is-complete {
  border-style: solid;
  border-color: rgba(74, 222, 128, 0.45);
  box-shadow: 0 0 32px rgba(74, 222, 128, 0.12);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0.5rem;
  min-height: 0;
}

.assembly-puzzle {
  display: grid;
  gap: 2px;
  width: 100%;
  flex: 1 1 auto;
  min-height: 180px;
  overflow: hidden;
  border-radius: 10px;
  background: #0a0812;
}

.assembly-board.is-complete.layout-quad .assembly-puzzle {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 3 / 4;
  max-width: 320px;
  margin: 0 auto;
}

.assembly-board.is-complete.layout-horizontal_halves .assembly-puzzle {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
  aspect-ratio: 7 / 5;
  max-width: 480px;
  margin: 0 auto;
}

.assembly-puzzle-cell {
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  background: rgba(0, 0, 0, 0.35);
}

.assembly-puzzle-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.assembly-puzzle-img.is-crop-quadrant {
  width: 200%;
  height: 200%;
  max-width: none;
  max-height: none;
}

.assembly-board.is-complete .assembly-board-meta,
.assembly-board-meta {
  flex-shrink: 0;
}

.assembly-complete {
  grid-column: 1 / -1;
  text-align: center;
  padding: 1rem;
}

.assembly-complete-img {
  max-width: 100%;
  max-height: 360px;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.assembly-tile.is-flying {
  opacity: 0.35;
  transform: scale(0.92);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.card-tile-assembly {
  display: grid;
  gap: 2px;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 8px;
}

.card-tile-assembly.layout-horizontal_halves {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
  aspect-ratio: 7 / 5;
}

.card-tile-assembly.orientation-landscape {
  transform: rotate(-90deg);
  transform-origin: center center;
  margin: 0.5rem auto;
  width: 88%;
}

.card-tile-assembly-cell {
  overflow: hidden;
  background: #0a0812;
}

.card-tile-assembly-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#card-modal .modal-image .modal-assembly-composite {
  width: 100%;
  max-width: 260px;
  max-height: min(52vh, 420px);
  margin-inline: auto;
  aspect-ratio: 3 / 4;
}

#card-modal .modal-image .modal-assembly-composite.layout-horizontal_halves {
  aspect-ratio: 7 / 5;
  max-width: 320px;
}

#card-modal .modal-image .modal-img[hidden] {
  display: none !important;
}

.craft-picker-grid .grid-empty,
#assembly-card-grid .grid-empty {
  grid-column: 1 / -1;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted, #9ca3af);
  font-size: 0.95rem;
}

.craft-workspace {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Author `display:flex` above overrides the default `[hidden]` rule — force panels off. */
.craft-workspace[hidden],
.craft-status[hidden] {
  display: none !important;
}

.craft-pipeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.75rem 0;
}

.craft-node {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.75rem 1rem;
  padding: 0.65rem 0;
  border-radius: 12px;
  transition: background 0.15s ease;
}

.craft-node.is-active {
  background: rgba(168, 85, 247, 0.06);
}

.craft-node.is-ready .craft-node-badge {
  background: rgba(168, 85, 247, 0.35);
  border-color: rgba(168, 85, 247, 0.65);
}

.craft-node-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0.15rem;
}

.craft-node-badge {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

.craft-node-line {
  flex: 1;
  width: 2px;
  min-height: 1.5rem;
  margin: 0.35rem 0;
  background: linear-gradient(
    to bottom,
    rgba(168, 85, 247, 0.45),
    rgba(91, 140, 255, 0.25)
  );
  border-radius: 2px;
}

.craft-node-body {
  min-width: 0;
}

.craft-node-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.craft-node-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.craft-step-count {
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 500;
}

.craft-node-hint {
  margin: 0 0 0.55rem;
  font-size: 0.88rem;
}

.craft-slot-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 0.5rem;
  max-width: 640px;
}

.craft-slot-row--single {
  grid-template-columns: minmax(100px, 140px);
  max-width: 160px;
}

.craft-slot-card {
  position: relative;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--bg-elev);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  min-height: 0;
  text-align: center;
}

.craft-slot-card.is-empty {
  cursor: pointer;
  appearance: none;
  color: var(--muted);
  min-height: 7.5rem;
  justify-content: center;
}

.craft-slot-card.is-empty:hover {
  border-color: rgba(168, 85, 247, 0.45);
  color: var(--text);
}

.craft-slot-card.is-filled {
  border-style: solid;
  border-color: rgba(168, 85, 247, 0.4);
}

.craft-slot-card--trainer {
  max-width: 140px;
}

.craft-slot-index {
  position: absolute;
  top: 0.25rem;
  left: 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  z-index: 1;
}

.craft-slot-img {
  display: block;
  width: 100%;
  aspect-ratio: 245 / 342;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: none;
  outline: none;
}

.craft-slot-caption {
  font-size: 0.68rem;
  line-height: 1.2;
  padding: 0 0.1rem;
  overflow: hidden;
}

.craft-slot-name {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.craft-slot-empty-label {
  font-size: 1.5rem;
  line-height: 1;
  opacity: 0.5;
}

.craft-slot-clear {
  position: absolute;
  top: 0.2rem;
  right: 0.25rem;
  border: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  z-index: 2;
}

.craft-slot-clear:hover {
  background: rgba(168, 85, 247, 0.75);
}

.craft-output-slot {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: var(--bg-elev);
  margin: 0.35rem 0 0.75rem;
  max-width: 420px;
}

.craft-output-placeholder {
  margin: 0;
  font-size: 0.9rem;
}

.craft-output-result {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.craft-output-pack-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.craft-pack-art {
  max-width: 120px;
  border-radius: 10px;
  border: none;
  outline: none;
}

.craft-output-meta {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
}

.btn-craft-main {
  max-width: 220px;
}

.craft-msg.is-error {
  color: #fda4af;
  margin-top: 0.5rem;
}

.craft-output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.craft-pack-id {
  font-size: 0.82rem;
  word-break: break-all;
}

.craft-output-discord {
  margin-top: 0.45rem;
  font-size: 0.82rem;
  line-height: 1.35;
}

.craft-output-verify {
  margin-top: 0.35rem;
  font-size: 0.82rem;
}

.craft-output-verify.is-warn {
  color: #fda4af;
}

.craft-picker-panel {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.craft-picker-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.craft-picker-head .page-lead {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.craft-picker-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.craft-rarity-select {
  flex: 0 1 auto;
  min-width: 10rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.12s ease;
}

.craft-rarity-select:focus {
  border-color: rgba(91, 140, 255, 0.6);
}

.craft-picker-grid {
  margin-top: 0.5rem;
}

.craft-picker-tile.card-tile.is-selected {
  border-color: rgba(168, 85, 247, 0.65);
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.35);
}

.craft-picker-tile.card-tile img {
  border: none;
  outline: none;
}

.craft-uses-meter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  background: linear-gradient(
    135deg,
    rgba(76, 29, 149, 0.35),
    rgba(30, 27, 75, 0.55)
  );
  border: 1px solid rgba(168, 85, 247, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.craft-uses-meter-label {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #c4b5fd;
}

.craft-uses-meter-track {
  display: flex;
  flex: 1;
  gap: 0.2rem;
  min-width: 0;
}

.craft-uses-meter-seg {
  flex: 1;
  height: 0.38rem;
  border-radius: 3px;
  background: rgba(55, 55, 65, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.35);
}

.craft-uses-meter-seg.is-filled {
  background: linear-gradient(180deg, #a855f7, #6d28d9);
  border-color: rgba(196, 181, 253, 0.45);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.55);
}

.craft-uses-meter-count {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #ede9fe;
}

.craft-uses-meter--slot {
  margin-top: 0.25rem;
  padding: 0.22rem 0.35rem;
  gap: 0.3rem;
}

.craft-uses-meter--slot .craft-uses-meter-label {
  font-size: 0.58rem;
}

.craft-uses-meter--slot .craft-uses-meter-seg {
  height: 0.3rem;
}

.craft-uses-meter--slot .craft-uses-meter-count {
  font-size: 0.65rem;
}

.craft-picker-tile .craft-uses-meter {
  margin-top: 0.3rem;
}

@media (min-width: 720px) {
  .craft-pipeline {
    padding-left: 0.25rem;
  }
}

/* Packs browser */
.packs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
}

.packs-pack-tile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  padding: 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 12, 18, 0.65);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

.packs-pack-tile:hover {
  border-color: rgba(196, 181, 253, 0.4);
  background: rgba(24, 20, 36, 0.8);
  transform: translateY(-1px);
}

.packs-pack-art {
  width: 100%;
  max-height: 7rem;
  object-fit: contain;
  margin-bottom: 0.55rem;
}

.packs-pack-art--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5rem;
  font-size: 2rem;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
}

.packs-pack-name {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.packs-pack-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.packs-pack-price {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #c4b5fd;
}

.packs-detail-toolbar {
  margin-bottom: 0.85rem;
}

.packs-back-btn {
  padding-left: 0.35rem;
}

.packs-detail-layout {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 960px) {
  .packs-detail-layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  }
}

.packs-detail-main {
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 12, 18, 0.55);
}

.packs-detail-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.packs-detail-art {
  width: 6rem;
  height: 6rem;
  object-fit: contain;
  flex-shrink: 0;
}

.packs-detail-cards {
  padding: 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 12, 18, 0.55);
  max-height: min(85vh, 900px);
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.packs-cards-head {
  margin-bottom: 0.65rem;
}

.packs-cards-title {
  margin: 0;
  font-size: 1rem;
}

.packs-cards-meta {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
}

.toolbar--compact {
  margin-bottom: 0.65rem;
  gap: 0.55rem;
}

.toolbar--compact .toolbar-search {
  flex: 1 1 100%;
}

.packs-cards-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.packs-card-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.45rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.packs-card-row:hover,
.packs-card-row.is-active {
  background: rgba(88, 28, 135, 0.18);
  border-color: rgba(168, 85, 247, 0.35);
}

.packs-card-thumb {
  width: 2.4rem;
  height: 3.2rem;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.25);
}

.packs-card-thumb--empty {
  background: rgba(255, 255, 255, 0.05);
}

.packs-card-text {
  flex: 1;
  min-width: 0;
}

.packs-card-name {
  display: block;
  font-weight: 600;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.packs-card-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
}

.packs-card-odds {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #c4b5fd;
}

.packs-layout {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 900px) {
  .packs-layout {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  }
}

.packs-catalog {
  position: sticky;
  top: 1rem;
  align-self: start;
}

.packs-toolbar {
  margin-bottom: 0.65rem;
}

.packs-catalog-meta {
  font-size: 0.82rem;
  margin: 0 0 0.5rem;
}

.packs-catalog-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: min(70vh, 640px);
  overflow-y: auto;
}

.packs-catalog-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(12, 12, 18, 0.55);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.packs-catalog-item:hover {
  border-color: rgba(196, 181, 253, 0.35);
  background: rgba(24, 20, 36, 0.75);
}

.packs-catalog-item.is-active {
  border-color: rgba(168, 85, 247, 0.65);
  background: rgba(88, 28, 135, 0.22);
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.25);
}

.packs-catalog-art {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
}

.packs-catalog-art--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: rgba(255, 255, 255, 0.04);
}

.packs-catalog-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

.packs-catalog-name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.packs-catalog-sub {
  font-size: 0.72rem;
}

.packs-catalog-price {
  font-size: 0.72rem;
  font-weight: 700;
  color: #c4b5fd;
  flex-shrink: 0;
}

.packs-detail-placeholder {
  padding: 2rem 1rem;
  text-align: center;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 12px;
}

.packs-detail-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.packs-detail-art {
  width: 5.5rem;
  height: 5.5rem;
  object-fit: contain;
  flex-shrink: 0;
}

.packs-detail-head h2 {
  margin: 0 0 0.35rem;
}

.packs-detail-desc {
  margin: 0 0 0.35rem;
  color: var(--text-muted, #a1a1aa);
}

.packs-notes {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  color: var(--text-muted, #a1a1aa);
}

.packs-notes li {
  margin-bottom: 0.25rem;
}

.packs-tiers {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 720px) {
  .packs-tiers {
    grid-template-columns: 1fr 1fr;
  }
}

.packs-tier-block h3 {
  font-size: 0.9rem;
  margin: 0 0 0.45rem;
}

.packs-tier-table-wrap {
  overflow-x: auto;
}

.packs-tier-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.packs-tier-table th,
.packs-tier-table td {
  padding: 0.35rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.packs-tier-table th {
  color: var(--text-muted, #a1a1aa);
  font-weight: 600;
}

.packs-cards-section {
  margin-top: 0.5rem;
}

.packs-card-toolbar {
  margin-bottom: 0.75rem;
}

.packs-card-grid .packs-odds-tile {
  min-height: 100%;
}

.packs-odds-stats {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  display: grid;
  gap: 0.2rem;
}

.packs-odds-stats dt {
  color: var(--text-muted, #a1a1aa);
  font-weight: 600;
}

.packs-odds-stats dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.packs-odds-highlight {
  font-weight: 700;
  color: #c4b5fd;
}

.packs-card-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.packs-status {
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.88rem;
}

.packs-status.state-error {
  background: rgba(127, 29, 29, 0.35);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.packs-detail-error {
  color: #fca5a5;
}

.packs-detail-loading {
  padding: 2rem 0;
  text-align: center;
}

.packs-modal-footer {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-top: 0.5rem;
}

.packs-modal-pack-heading,
.packs-modal-odds-heading {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c4b5fd;
}

.packs-modal-pack-name {
  margin: 0;
  font-weight: 600;
  font-size: 0.92rem;
}

.packs-modal-pack-meta {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
}

.packs-modal-odds-list {
  margin: 0;
  display: grid;
  gap: 0.35rem;
  font-size: 0.78rem;
}

.packs-modal-odds-list dt {
  color: var(--text-muted, #a1a1aa);
  font-weight: 600;
}

.packs-modal-odds-list dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

/* —— Pokédex —— */
.pokedex-page .page-head {
  margin-bottom: 1rem;
}

.pokedex-toolbar {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* Column layout: don't let the search row stretch vertically (toolbar-search defaults to flex-grow: 1). */
.pokedex-toolbar .toolbar-search {
  flex: 0 0 auto;
}

.pokedex-toolbar .toolbar-sort {
  margin: 0;
}

.pokedex-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.pokedex-filter-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted, #a1a1aa);
  letter-spacing: 0.04em;
}

.pokedex-select {
  min-width: 12rem;
  max-width: 100%;
  flex: 1 1 14rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(167, 139, 250, 0.25);
  background: rgba(15, 15, 25, 0.85);
  color: inherit;
  font: inherit;
}

.pokedex-number-input {
  width: 5.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(167, 139, 250, 0.25);
  background: rgba(15, 15, 25, 0.85);
  color: inherit;
  font: inherit;
}

.pokedex-type-chips,
.pokedex-rarity-chips {
  flex-wrap: wrap;
}

.card-tile-owned {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 2;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(34, 197, 94, 0.92);
  color: #052e16;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.pokedex-modal-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

.pokedex-owned-panel {
  width: 100%;
}

.pokedex-owned-heading {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #86efac;
}

.pokedex-owned-hint {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
}

.pokedex-owned-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 10rem;
  overflow-y: auto;
}

.pokedex-owned-item {
  font-size: 0.8rem;
}

.pokedex-owned-link {
  color: #c4b5fd;
  text-decoration: none;
}

.pokedex-owned-link:hover {
  text-decoration: underline;
}

.pokedex-owned-grade,
.pokedex-owned-fav {
  margin-left: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted, #a1a1aa);
}

/* Staging environment (api-staging / local :8081) */
html.pokepon-staging-active body {
  padding-top: 2.75rem;
}

#pokepon-staging-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  color: #1a1208;
  background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 50%, #fbbf24 100%);
  border-bottom: 2px solid #b45309;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.pokepon-staging-banner__tag {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fef3c7;
  background: #92400e;
  border-radius: 4px;
}

.pokepon-staging-banner__text {
  flex: 1 1 12rem;
  text-align: center;
  max-width: 42rem;
}

.pokepon-staging-banner__exit {
  color: #1a1208;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.pokepon-staging-banner__exit:hover {
  color: #451a03;
}
