:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

.hero {
  padding: 2rem 1.5rem;
  background: linear-gradient(135deg, #334155 0%, #0f172a 100%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 3vw, 3rem);
}

.hero p {
  margin: 0;
  max-width: 42rem;
  line-height: 1.6;
  color: #cbd5e1;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem !important;
}

.btn-primary {
  background: linear-gradient(135deg, #22c55e, #16a34a) !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.3);
}

.btn.secondary,
a.btn.secondary {
  background: rgba(51, 65, 85, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.getting-started-list {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.8;
  color: #cbd5e1;
}

.getting-started-list a {
  color: #93c5fd;
}

.site-nav {
  display: flex;
  gap: 0.75rem;
}

.site-nav a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.65);
}

.site-nav a.active,
.site-nav a:hover {
  border-color: rgba(96, 165, 250, 0.65);
  color: #fff;
}

a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 0.75rem;
  padding: 0.7rem 1rem;
  font-weight: 600;
  color: #f8fafc;
  background: rgba(51, 65, 85, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.layout {
  display: grid;
  gap: 1.5rem;
  padding: 1.5rem;
}

.panel {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 1rem;
  padding: 1.5rem;
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.panel-header h2 {
  margin: 0;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
  width: min(100%, 42rem);
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.95rem;
  color: #cbd5e1;
}

.filters input,
.filters select {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.95);
  color: #e2e8f0;
}

.cards-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.card-item {
  display: contents;
}

.detail-panel {
  min-height: 28rem;
}

.card-game-stats,
.easy-mode-stats {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.22);
  font-size: 0.9rem;
  line-height: 1.55;
  color: #cbd5e1;
}

.card-game-stats h3,
.easy-mode-stats h3 {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #86efac;
}

.card-game-stats ul,
.easy-mode-stats ul {
  margin: 0;
  padding-left: 1.15rem;
}

.card-game-stats li,
.easy-mode-stats li {
  margin: 0.2rem 0;
}

@media (min-width: 1000px) {
  .layout {
    grid-template-columns: 1.8fr 1fr;
    align-items: start;
  }

  .layout > .panel:first-child {
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
  }

  .detail-panel {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
}

.demo-card {
  padding: 0;
  border: none;
  background: transparent;
  display: block;
  overflow: visible;
}

.json-output {
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #bae6fd;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
}

.footer-panel {
  margin: 0 1.5rem 1.5rem;
}

/* ——— TCG app shell (play + deck builder) ——— */
.tcg-app {
  background: #0c0e12;
  min-height: 100vh;
  color: #e8eaed;
}

.app-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  padding: 0.65rem 1.25rem;
  background: rgba(12, 14, 18, 0.98);
  border-bottom: 1px solid rgba(56, 189, 248, 0.22);
  position: sticky;
  top: 0;
  z-index: 100;
}

.cosmic-topbar {
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(16px);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.topbar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-tagline {
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
  letter-spacing: 0.01em;
}

.brand-mark-gradient {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, #22d3ee, #6366f1);
  box-shadow: 0 10px 30px rgba(34, 211, 238, 0.2);
  font-size: 1.1rem;
}

.topbar-pills a {
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.topbar-pills a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

.topbar-pills a.active {
  color: #a5f3fc;
  background: rgba(34, 211, 238, 0.15);
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.1);
  border-bottom-color: rgba(34, 211, 238, 0.35);
}

.topbar-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
}

.topbar-brand-link:hover .brand-name,
.topbar-brand-link:hover .brand-hub {
  color: #38bdf8;
}

.brand-hub {
  color: #fff;
}

.brand-game {
  color: #38bdf8;
  font-weight: 700;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: #f1f5f9;
}

.brand-mark {
  font-size: 1.35rem;
}

.topbar-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  flex: 1;
}

.topbar-nav a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.88rem;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}

.topbar-nav a:hover,
.topbar-nav a.active {
  color: #e2e8f0;
  border-bottom-color: #38bdf8;
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  border: none;
  text-decoration: none;
  font-family: inherit;
}

.btn-accent {
  background: linear-gradient(180deg, #1e2836 0%, #151a22 100%);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 2px 12px rgba(56, 189, 248, 0.15);
}

.btn-accent:hover {
  filter: brightness(1.08);
}

.btn-ghost {
  background: rgba(30, 41, 59, 0.8);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.btn-ghost:hover,
.btn-ghost.active {
  border-color: rgba(99, 102, 241, 0.5);
  color: #fff;
}

.tcg-panel {
  background: rgba(12, 18, 32, 0.92);
  border: 1px solid rgba(100, 120, 180, 0.12);
  border-radius: 0.75rem;
  padding: 1rem 1.15rem;
}

.tcg-main {
  padding: 0.85rem 1rem 1.5rem;
  max-width: 1800px;
  margin: 0 auto;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

/* ——— Lore ribbon (Eight Currents) ——— */
.tcg-lore-ribbon {
  padding: 0.55rem 1.25rem 0.75rem;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(12, 14, 18, 0.6));
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}

.tcg-lore-ribbon-copy {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.45;
  max-width: 72rem;
}

.tcg-current-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
}

.tcg-current-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  cursor: default;
}

.tcg-current-pill[data-current='Verdant'] { border-color: rgba(74, 222, 128, 0.35); }
.tcg-current-pill[data-current='Emberborn'] { border-color: rgba(251, 146, 60, 0.35); }
.tcg-current-pill[data-current='Tidebound'] { border-color: rgba(56, 189, 248, 0.35); }
.tcg-current-pill[data-current='Gale'] { border-color: rgba(103, 232, 249, 0.35); }
.tcg-current-pill[data-current='Stonekin'] { border-color: rgba(214, 211, 209, 0.35); }
.tcg-current-pill[data-current='Umbral'] { border-color: rgba(192, 132, 252, 0.35); }
.tcg-current-pill[data-current='Aether'] { border-color: rgba(232, 121, 249, 0.35); }
.tcg-current-pill[data-current='Forged'] { border-color: rgba(251, 191, 36, 0.35); }

.tcg-panel-lore {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: #94a3b8;
  line-height: 1.5;
  max-width: 42rem;
}
