:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #1e293b;
  --accent: #10b981;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

a {
  color: #a7f3d0;
}

a:hover {
  text-decoration: none;
}

.section-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.status-card {
  display: none;
  font-weight: 600;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, #111827, #0b1220);
}

.status-card.error {
  border-color: #f97316;
  color: #fed7aa;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.15), #0b1220);
}

.skeleton {
  background: linear-gradient(90deg, #1f2937 25%, #273449 37%, #1f2937 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.card {
  background: linear-gradient(135deg, #111827, #0b1220);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

#grids-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.card h1,
.card h2,
.card h3,
.card p {
  margin: 0;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
}

.badge-type {
  background: #ef4444;
}
.badge-pos {
  background: #334155;
  border: 1px solid rgba(255,255,255,0.08);
}
.badge-pos.ut { background: #e74c3c; }
.badge-pos.hj { background: #c084fc; }
.badge-pos.co { background: #22d3ee; }
.badge-pos.bt { background: #f472b6; }
.badge-pos.sb { background: #f59e0b; }
.badge-pos.bb { background: #38bdf8; }

.accordion-badges {
  display: contents;
}

.card-title {
  font-weight: 800;
  letter-spacing: 0.01em;
}

.card-legend {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 6px 0 10px 0;
  font-size: 12px;
  color: var(--muted);
}

.card-legend .sw {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid #64748b;
}

.title {
  text-align: center;
  margin-bottom: 6px;
}

.subtitle {
  text-align: center;
  color: var(--muted);
  margin-bottom: 18px;
  font-size: 14px;
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.legend-color,
.sw {
  width: 16px;
  height: 16px;
  border: 1px solid #64748b;
  border-radius: 3px;
}

.section-title {
  text-align: center;
  font-weight: 700;
  margin: 10px 0;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 2px;
  max-width: 640px;
  margin: 0 auto;
  background: #0f172a;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.hand-cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border-radius: 3px;
  border: 1px solid #334155;
  color: #fff;
}

.hand-cell.background {
  background: #475569;
  color: #cbd5e1;
}

.hand-cell.always { background-color: #22c55e; color: #fff; }
.hand-cell.mixed { background: linear-gradient(90deg, #f59e0b 50%, #334155 50%); color: #fff; }
.hand-cell.fold { background-color: #475569; color: #94a3b8; }
.hand-cell.fourbet-call { background-color: #dc2626; color: #fff; }
.hand-cell.fourbet-fold { background-color: #2563eb; color: #fff; }
.hand-cell.call { background-color: #7c3aed; color: #fff; }
.hand-cell.cold-call { background-color: #f472b6; color: #fff; }
.hand-cell.mixed-4b-call { background: linear-gradient(90deg, #dc2626 50%, #7c3aed 50%); }
.hand-cell.mixed-4b-fold { background: linear-gradient(90deg, #2563eb 50%, #7c3aed 50%); }
.hand-cell.mixed-fold-4b { background: linear-gradient(90deg, #7c3aed 50%, #2563eb 50%); }
.hand-cell.mixed-4b-fold-fold { background: linear-gradient(90deg, #2563eb 50%, #475569 50%); }
.hand-cell.mixed-call-fold { background: linear-gradient(90deg, #7c3aed 50%, #475569 50%); }
.hand-cell.mixed-cold-call-fold { background: linear-gradient(90deg, #f472b6 50%, #475569 50%); }
.hand-cell.mixed-call-cold-call { background: linear-gradient(90deg, #7c3aed 50%, #f472b6 50%); }
.hand-cell.mixed-fourbet-fold-cold-call { background: linear-gradient(90deg, #2563eb 50%, #f472b6 50%); }
.hand-cell.mixed-4b-cold-call { background: linear-gradient(90deg, #dc2626 50%, #f472b6 50%); }

.legend-color.always { background-color: #22c55e; }
.legend-color.mixed { background: linear-gradient(90deg, #f59e0b 50%, #334155 50%); }
.legend-color.fold { background-color: #475569; }
.legend-color.fourbet-call { background-color: #dc2626; }
.legend-color.fourbet-fold { background-color: #2563eb; }
.legend-color.call { background-color: #7c3aed; }
.legend-color.cold-call { background-color: #f472b6; }
.legend-color.mixed-4b-call { background: linear-gradient(90deg, #dc2626 50%, #7c3aed 50%); }
.legend-color.mixed-4b-fold { background: linear-gradient(90deg, #2563eb 50%, #7c3aed 50%); }
.legend-color.mixed-fold-4b { background: linear-gradient(90deg, #7c3aed 50%, #2563eb 50%); }
.legend-color.mixed-call-fold { background: linear-gradient(90deg, #7c3aed 50%, #475569 50%); }
.legend-color.mixed-cold-call-fold { background: linear-gradient(90deg, #f472b6 50%, #475569 50%); }
.legend-color.mixed-call-cold-call { background: linear-gradient(90deg, #7c3aed 50%, #f472b6 50%); }
.legend-color.mixed-fourbet-fold-cold-call { background: linear-gradient(90deg, #2563eb 50%, #f472b6 50%); }
.legend-color.mixed-4b-cold-call { background: linear-gradient(90deg, #dc2626 50%, #f472b6 50%); }

.hidden {
  display: none !important;
}

.grid-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.badge {
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(129, 140, 248, 0.35);
  color: #c7d2fe;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #a7f3d0;
  text-decoration: none;
  font-weight: 700;
}

.back-link:hover {
  color: #5eead4;
}

.cta-card {
  text-align: center;
  text-align: center;
}

.cta-link {
  color: #a7f3d0;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.cta-link:hover {
  color: #5eead4;
}

.accordion {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  cursor: pointer;
  background: linear-gradient(135deg, #162032, #0f172a);
  border-bottom: 1px solid #1f2937;
}

.accordion-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.accordion-titlewrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.accordion-subtitle {
  margin: 4px 0 0 0;
  color: var(--muted);
  font-size: 13px;
}

.accordion-params {
  margin: 8px 0 0 0;
  color: var(--muted);
  font-size: 12px;
}

.accordion-chevron {
  transition: transform 0.2s ease;
}

.accordion-header[aria-expanded=\"true\"] .accordion-chevron {
  transform: rotate(90deg);
}

.accordion-content {
  padding: 14px 18px 18px 18px;
  background: linear-gradient(135deg, #111827, #0b1220);
}

@media (max-width: 768px) {
  .chart-grid {
    max-width: 100%;
  }
}

/* Poker Strategy API-driven layout (ranges-strategy.css port) */
.poker-container {
  min-height: 100vh;
  background-color: #2c3e50;
  padding: 2rem;
}

.poker-content {
  max-width: 80rem;
  margin: 0 auto;
}

/* Header */
.poker-header {
  background-color: #3d5266;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.poker-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.poker-header-icon {
  width: 1rem;
  height: 1rem;
  background: linear-gradient(to bottom right, #60a5fa, #2563eb);
  border-radius: 0.125rem;
}

.poker-header h1 {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 500;
}

.poker-header-meta {
  color: #d1d5db;
  font-size: 0.8rem;
}

/* Collapsible sections */
.collapsible-section {
  background-color: #34495e;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 1rem;
}

.section-header {
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: background-color 0.2s;
  background-color: #34495e;
}

.section-header:hover {
  background-color: #3d5266;
}

.section-header-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.section-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.section-badge {
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  color: #ffffff;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
}

.section-title {
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 400;
}

.section-subtitle {
  color: #d1d5db;
  font-size: 0.8rem;
}

.section-params {
  color: #9ca3af;
  font-size: 0.75rem;
}

.section-content {
  padding: 0.5rem 1rem 1rem;
  background-color: #1f2933;
}

.section-chevron {
  color: #9ca3af;
  transition: transform 0.2s ease;
}

.section-header[aria-expanded="true"] .section-chevron {
  transform: rotate(90deg);
}

/* Leaf subsections (optional, for nested items) */
.subsection-item {
  background-color: #3d5266;
  border-radius: 0.25rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.subsection-item:hover {
  background-color: #445a70;
}

.subsection-item:last-child {
  margin-bottom: 0;
}

.position-badge {
  background-color: #dc2626;
  color: #ffffff;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.subsection-text {
  color: #ffffff;
  font-size: 0.875rem;
}

/* Range chart container and title */
.range-chart-container {
  background-color: #34495e;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-top: 1rem;
}

.range-chart-title {
  color: #ffffff;
  text-align: center;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
}

/* Poker hand grid */
.poker-grid {
  display: inline-grid;
  grid-template-columns: repeat(13, 2.5rem);
  gap: 0.125rem;
  margin: 0 auto;
}

.poker-hand {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(55, 65, 81, 0.3);
  font-family: monospace;
}

/* Tie poker-hand states to existing range colors */
.poker-hand.background {
  background: #475569;
  color: #cbd5e1;
}

.poker-hand.always {
  background-color: #22c55e;
}

.poker-hand.mixed {
  background: linear-gradient(90deg, #f59e0b 50%, #334155 50%);
}

.poker-hand.fold {
  background-color: #475569;
  color: #94a3b8;
}

.poker-hand.fourbet-call {
  background-color: #dc2626;
}

.poker-hand.fourbet-fold {
  background-color: #2563eb;
}

.poker-hand.call {
  background-color: #7c3aed;
}

.poker-hand.cold-call {
  background-color: #f472b6;
}

.poker-hand.mixed-4b-call {
  background: linear-gradient(90deg, #dc2626 50%, #7c3aed 50%);
}

.poker-hand.mixed-4b-fold {
  background: linear-gradient(90deg, #2563eb 50%, #7c3aed 50%);
}

.poker-hand.mixed-fold-4b {
  background: linear-gradient(90deg, #7c3aed 50%, #2563eb 50%);
}

.poker-hand.mixed-4b-fold-fold {
  background: linear-gradient(90deg, #2563eb 50%, #475569 50%);
}

.poker-hand.mixed-call-fold {
  background: linear-gradient(90deg, #7c3aed 50%, #475569 50%);
}

.poker-hand.mixed-cold-call-fold {
  background: linear-gradient(90deg, #f472b6 50%, #475569 50%);
}

.poker-hand.mixed-call-cold-call {
  background: linear-gradient(90deg, #7c3aed 50%, #f472b6 50%);
}

.poker-hand.mixed-fourbet-fold-cold-call {
  background: linear-gradient(90deg, #2563eb 50%, #f472b6 50%);
}

.poker-hand.mixed-4b-cold-call {
  background: linear-gradient(90deg, #dc2626 50%, #f472b6 50%);
}

@media (max-width: 768px) {
  .poker-container {
    padding: 1rem;
  }

  .poker-grid {
    grid-template-columns: repeat(13, 1.75rem);
  }

  .poker-hand {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.625rem;
  }

  .range-chart-container {
    padding: 1rem;
  }
}
