/* ── Color scheme variables ───────────────────────────────────────────────── */
/* Solarized Light (default) */
:root {
  font-size: 112.5%; /* 18px base — scales all rem values */
  --bg:           #fdf6e3;  /* base3  – page bg & inner elements */
  --bg-alt:       #eee8d5;  /* base2  – panels, cards */
  --text:         #657b83;  /* base00 – body text */
  --text-em:      #586e75;  /* base01 – emphasized text */
  --text-muted:   #839496;  /* base0  – labels, secondary text */
  --border:       #93a1a1;  /* base1  – borders & muted text */
  --border-sub:   #d6cfbe;  /*        – subtle separators */
  --border-faint: #e5dfcf;  /*        – table row dividers */
  --shadow-card:  rgba(0,0,0,0.08);
  --shadow-tip:   rgba(0,0,0,0.20);
  --sim-dim:      #b9b4ac;
  --sim-sep:      #c5bda6;
  --badge-char:   #fde8e7;
  --badge-loc:    #eaf2e3;
  --badge-att:    #e8ebf8;
  --badge-evt:    #faf2e0;
  --badge-oth:    #efefef;
  --badge-mul:    #e8f0fa;
  --combo-poor:   #fdf0ef;
  color-scheme: light;
}

/* Solarized Dark — applied via system preference or explicit data-theme="dark" */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:           #002b36;
    --bg-alt:       #073642;
    --text:         #839496;
    --text-em:      #93a1a1;
    --text-muted:   #657b83;
    --border:       #586e75;
    --border-sub:   #1d4a59;
    --border-faint: #0e3d4e;
    --shadow-card:  rgba(0,0,0,0.30);
    --shadow-tip:   rgba(0,0,0,0.50);
    --sim-dim:      #2d4a58;
    --sim-sep:      #586e75;
    --badge-char:   #2c1414;
    --badge-loc:    #132211;
    --badge-att:    #161634;
    --badge-evt:    #221c07;
    --badge-oth:    #073642;
    --badge-mul:    #0d2038;
    --combo-poor:   #1e0e0e;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .chart-svg [fill="#839496"]   { fill:   var(--text-muted); }
  :root:not([data-theme="light"]) .chart-svg [fill="#93a1a1"]   { fill:   var(--border); }
  :root:not([data-theme="light"]) .chart-svg [fill="#d6cfbe"]   { fill:   var(--border-sub); }
  :root:not([data-theme="light"]) .chart-svg [stroke="#d6cfbe"] { stroke: var(--border-sub); }
  :root:not([data-theme="light"]) .chart-svg [stroke="#93a1a1"] { stroke: var(--border); }
}

:root[data-theme="dark"] {
  --bg:           #002b36;
  --bg-alt:       #073642;
  --text:         #839496;
  --text-em:      #93a1a1;
  --text-muted:   #657b83;
  --border:       #586e75;
  --border-sub:   #1d4a59;
  --border-faint: #0e3d4e;
  --shadow-card:  rgba(0,0,0,0.30);
  --shadow-tip:   rgba(0,0,0,0.50);
  --sim-dim:      #2d4a58;
  --sim-sep:      #586e75;
  --badge-char:   #2c1414;
  --badge-loc:    #132211;
  --badge-att:    #161634;
  --badge-evt:    #221c07;
  --badge-oth:    #073642;
  --badge-mul:    #0d2038;
  --combo-poor:   #1e0e0e;
  color-scheme: dark;
}
:root[data-theme="dark"] .chart-svg [fill="#839496"]   { fill:   var(--text-muted); }
:root[data-theme="dark"] .chart-svg [fill="#93a1a1"]   { fill:   var(--border); }
:root[data-theme="dark"] .chart-svg [fill="#d6cfbe"]   { fill:   var(--border-sub); }
:root[data-theme="dark"] .chart-svg [stroke="#d6cfbe"] { stroke: var(--border-sub); }
:root[data-theme="dark"] .chart-svg [stroke="#93a1a1"] { stroke: var(--border); }

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Georgia', serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
  width: 100%;
  max-width: clamp(560px, 50vw, 960px);
  position: relative;
}

#theme-toggle {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: 1px solid var(--border-sub);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

#theme-toggle:hover {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--text);
}

#theme-toggle:active {
  transform: scale(0.95);
}

.footer-spacer {
  flex: 1;
  min-height: 3rem;
  width: 100%;
}

footer {
  margin-top: 0;
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-sub);
  background: var(--panel-bg);
}
footer p { margin: 0; }
footer a { color: var(--text-muted); }
.footer-sep { margin: 0 0.6em; opacity: 0.5; }

header h1 {
  font-size: 2.5rem;
  color: #b58900;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 8px rgba(181,137,0,0.3);
}

header p {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.75rem 2rem;
  width: 100%;
  max-width: clamp(560px, 50vw, 960px);
  box-shadow: 0 4px 24px var(--shadow-card);
}

label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  letter-spacing: 0.03em;
}

.input-row {
  display: flex;
  gap: 0.75rem;
}


input[type="text"] {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.6rem 0.85rem;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus { border-color: #b58900; }
input[type="text"]::placeholder { color: var(--border); }

#deck-paste {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.6rem 0.85rem;
  color: var(--text);
  font-family: 'Georgia', serif;
  font-size: 0.85rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}
#deck-paste:focus { border-color: #b58900; }
#deck-paste::placeholder { color: var(--border); }

.paste-btn-row {
  display: flex;
  justify-content: center;
  margin-top: 0.75rem;
}

#load-paste-btn {
  font-size: 1rem;
  padding: 0.6rem 0;
  width: 60%;
}

.deck-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-sub);
  margin-bottom: 1rem;
}

.deck-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.4rem 0.9rem;
  font-family: 'Georgia', serif;
  font-size: 0.88rem;
  font-weight: normal;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}

.deck-tab:hover {
  background: none;
  color: var(--text);
}

.deck-tab:active {
  transform: none;
}

.deck-tab.active {
  color: #b58900;
  border-bottom-color: #b58900;
  font-weight: bold;
}

button {
  background: #b58900;
  color: var(--bg);
  border: none;
  border-radius: 5px;
  padding: 0.6rem 1.25rem;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, transform 0.1s;
}

button:hover { background: #cb4b16; }
button:active { transform: scale(0.97); }
button:disabled { background: var(--border); cursor: not-allowed; }

#status {
  margin-top: 1rem;
  font-size: 0.88rem;
  min-height: 1.2em;
  color: var(--text-muted);
}

#status.error   { color: #dc322f; }
#status.loading { color: var(--text-muted); font-style: italic; }

#setup-section {
  display: none;
  margin-top: 2rem;
  width: 100%;
  max-width: clamp(560px, 50vw, 960px);
}

.panel {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem 2rem 2rem;
  box-shadow: 0 4px 24px var(--shadow-card);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.panel-title {
  font-size: 1.1rem;
  color: #b58900;
  margin-bottom: 1rem;
}

.panel-subtitle {
  font-size: 0.82rem;
  color: var(--border);
  margin-top: -0.8rem;
}

/* ── Setup section ── */

.section-label {
  font-size: 0.75rem;
  font-family: sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b58900;
  margin-bottom: 0.6rem;
}

/* Hand */
.hand-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.hand-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hand-card.non-setup {
  opacity: 0.45;
}

.type-badge {
  font-family: sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.type-badge.Character  { background: var(--badge-char); color: #dc322f; }
.type-badge.Location   { background: var(--badge-loc);  color: #859900; }
.type-badge.Attachment { background: var(--badge-att);  color: #6c71c4; }
.type-badge.Event      { background: var(--badge-evt);  color: #b58900; }
.type-badge.other      { background: var(--badge-oth);  color: var(--text-muted); }

.cost-pill {
  font-family: sans-serif;
  font-size: 0.75rem;
  font-weight: bold;
  color: #b58900;
}

/* Setup combos */
.setups-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.setups-list::-webkit-scrollbar { width: 5px; }
.setups-list::-webkit-scrollbar-track { background: var(--bg); }
.setups-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.setup-combo {
  background: var(--bg);
  border: 1px solid var(--border-sub);
  border-radius: 5px;
  padding: 0.55rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.combo-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
}

.combo-card-name {
  font-size: 0.82rem;
  color: var(--text-em);
}

.combo-card-name + .combo-card-name::before {
  content: '·';
  margin-right: 0.35rem;
  color: var(--border);
}

.combo-total {
  font-family: sans-serif;
  font-size: 0.8rem;
  font-weight: bold;
  color: #b58900;
  white-space: nowrap;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
}

.dup-pill {
  color: #859900 !important;
  font-style: italic;
}

.dup-label {
  font-size: 0.72rem;
  font-style: italic;
  color: #859900;
}

.no-setups {
  color: var(--border);
  font-size: 0.88rem;
  font-style: italic;
}

/* Economy input */
.economy-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-size: 0.82rem;
  font-family: monospace;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 1.5rem;
}
.economy-textarea:focus { border-color: #b58900; }
.economy-textarea::placeholder { color: var(--border); }

/* Deck card table */
#deck-table-section {
  margin-top: 1rem;
}

.deck-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.deck-table th {
  text-align: left;
  color: var(--border);
  font-size: 0.7rem;
  font-family: sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--border-sub);
}

.deck-table th:not(:first-child) {
  text-align: center;
}

.deck-table td {
  padding: 0.25rem 0.5rem;
  color: var(--text-em);
  border-bottom: 1px solid var(--border-faint);
}

.deck-table td:not(:first-child) {
  text-align: center;
}

.deck-table tr:last-child td {
  border-bottom: none;
}

@font-face {
  font-family: 'thronesdb';
  src: url('https://raw.githubusercontent.com/ThronesDB/thronesdb/master/public/fonts/thronesdb.eot?irjt2b');
  src: url('https://raw.githubusercontent.com/ThronesDB/thronesdb/master/public/fonts/thronesdb.eot?irjt2b#iefix') format('embedded-opentype'),
       url('https://raw.githubusercontent.com/ThronesDB/thronesdb/master/public/fonts/thronesdb.ttf?irjt2b') format('truetype'),
       url('https://raw.githubusercontent.com/ThronesDB/thronesdb/master/public/fonts/thronesdb.woff?irjt2b') format('woff'),
       url('https://raw.githubusercontent.com/ThronesDB/thronesdb/master/public/fonts/thronesdb.svg?irjt2b#thronesdb') format('svg');
  font-weight: normal;
  font-style: normal;
}

[class^="icon-"], [class*=" icon-"] {
  font-family: 'thronesdb';

  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon-character::before    { content: "\e60f"; }
.icon-attachment::before   { content: "\e60d"; }
.icon-location::before     { content: "\e60e"; }
.icon-event::before        { content: "\e610"; }
.icon-military::before     { content: "\e605"; }
.icon-intrigue::before     { content: "\e602"; }
.icon-power::before        { content: "\e607"; }
.icon-stark::before        { content: "\e608"; }
.icon-lannister::before    { content: "\e603"; }
.icon-targaryen::before    { content: "\e609"; }
.icon-baratheon::before    { content: "\e600"; }
.icon-greyjoy::before      { content: "\e601"; }
.icon-tyrell::before       { content: "\e60a"; }
.icon-thenightswatch::before { content: "\e606"; }
.icon-martell::before      { content: "\e604"; }
.icon-neutral::before      { content: "\e612"; }

.deck-table-card-name .card-type-icon {
  margin-right: 0.4em;
  color: var(--border);
  font-size: 0.95em;
}

#card-image-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  display: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 18px var(--shadow-tip);
  width: 200px;
}

#card-image-tooltip img {
  display: none;
  width: 200px;
}

#card-image-tooltip .card-img-skeleton {
  width: 200px;
  height: 280px;
  background: linear-gradient(90deg, var(--bg-alt) 25%, var(--bg) 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: skeleton-sweep 1.2s ease-in-out infinite;
}

@keyframes skeleton-sweep {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.deck-table-card-name {
  cursor: default;
}

.deck-table tr.deck-table-type-sep td {
  font-size: 0.72rem;
  font-family: sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--border);
  padding: 0.6rem 0.5rem 0.2rem;
  border-bottom: 1px solid var(--border-sub);
  pointer-events: none;
}

.deck-table tr.deck-table-disabled input[type="checkbox"]:not(.armed-cb),
.deck-table input[type="checkbox"]:disabled {
  border-color: var(--border-sub);
  opacity: 0.35;
  cursor: not-allowed;
}

.deck-table input[type="checkbox"] {
  appearance: none;
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  cursor: pointer;
  position: relative;
  vertical-align: middle;
}

.deck-table input[type="checkbox"]:checked {
  background: #b58900;
  border-color: #b58900;
}

.deck-table input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 2px;
  top: -1px;
  width: 5px;
  height: 8px;
  border: 2px solid var(--bg);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* Config controls */
.config-controls {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}

.cfg-check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.cfg-check input[type="checkbox"] {
  appearance: none;
  width: 15px;
  height: 15px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}

.cfg-check input[type="checkbox"]:checked {
  background: #b58900;
  border-color: #b58900;
}

.cfg-check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 1px;
  width: 5px;
  height: 8px;
  border: 2px solid var(--bg);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.cfg-inline-num {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--text);
  margin-top: -0.1rem;
}

.cfg-inline-num input[type="number"] {
  width: 4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.2rem 0.4rem;
  color: #b58900;
  font-family: sans-serif;
  font-size: 0.88rem;
  font-weight: bold;
  text-align: center;
  outline: none;
}

.cfg-inline-num input[type="number"]:focus {
  border-color: #b58900;
}

.setup-combo.poor {
  border-left: 3px solid #dc322f;
  background: var(--combo-poor);
}

/* Sort criteria list */
#sort-criteria-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sort-criterion {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border-sub);
  border-radius: 4px;
  padding: 0.4rem 0.7rem;
  cursor: grab;
  user-select: none;
  color: var(--text);
  font-size: 0.88rem;
}

.sort-criterion:active { cursor: grabbing; }

.sort-criterion.drag-over {
  border-color: #b58900;
  background: var(--bg);
}

.sort-criterion-rank {
  font-family: sans-serif;
  font-size: 0.78rem;
  color: var(--border);
  min-width: 1.2em;
  text-align: right;
  flex-shrink: 0;
}

.sort-criterion-handle {
  color: var(--border);
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.sort-criterion-label {
  flex: 1;
}

.sort-criterion-hint {
  font-size: 0.75rem;
  color: var(--border);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 0.25rem;
}

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border-sub);
  border-radius: 5px;
  padding: 1rem 0.75rem;
  text-align: center;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: bold;
  color: #b58900;
  font-family: sans-serif;
  line-height: 1;
}

.stat-pct {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: sans-serif;
  margin-top: 0.2rem;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--border);
  margin-top: 0.35rem;
  font-family: sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-card.poor .stat-value { color: #dc322f; }
.stat-card.good .stat-value { color: #859900; }

.sim-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2.5rem 0;
}

.sim-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-sub);
  border-top-color: #b58900;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.sim-loading-text {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-style: italic;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* Simulation log */
.sim-log-details {
  margin-top: 1.5rem;
}

.sim-log-details > summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: sans-serif;
  padding: 0.4rem 0;
  user-select: none;
  letter-spacing: 0.03em;
}

.sim-log {
  margin-top: 0.5rem;
  max-height: 480px;
  overflow-y: auto;
  border: 1px solid var(--border-sub);
  border-radius: 4px;
}

.sim-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--bg-alt);
  font-family: sans-serif;
  font-size: 0.75rem;
}

.sim-row:last-child { border-bottom: none; }

.sim-row-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--border);
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.sim-hand, .sim-setup {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
}

.sim-row-badges {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.1rem;
}

.sim-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: bold;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  width: fit-content;
}

.sim-badge.poor     { background: var(--badge-char); color: #dc322f; }
.sim-badge.mulligan { background: var(--badge-mul);  color: #268bd2; }

.sim-hand          { color: var(--text); line-height: 1.7; }
.sim-setup         { line-height: 1.7; }
.sim-card-dim      { color: var(--sim-dim); }
.sim-card-cost     { color: var(--border); font-size: 0.7rem; margin-left: 2px; }
.sim-setup-total   { color: var(--text-muted); font-size: 0.72rem; margin-left: 5px; }
.sim-sep           { color: var(--sim-sep); margin: 0 3px; }
.sim-no-setup      { color: #dc322f; font-style: italic; }

.sim-card-normal   { color: #b58900; }

.sim-log-key {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 0.5rem 0.75rem;
  font-family: sans-serif;
  font-size: 0.75rem;
}
.sim-card-limited  { color: #6c71c4; }
.sim-card-key      { color: #b58900; }
.sim-card-economy  { color: #859900; }
.sim-card-avoidable{ color: #cb4b16; }
.sim-card-shadow   { color: #268bd2; }

/* Deck statistics charts */
.deck-chart-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.deck-chart-cell {
  flex: 1 1 0;
  min-width: 260px;
}
/* Page-level panels */
#how-it-works-panel,
#deck-input-panel {
  width: 100%;
  max-width: clamp(560px, 50vw, 960px);
}
#how-it-works-panel { margin: 2rem auto 0; }
#deck-input-panel   { margin-top: 1.5rem; }

/* Details summary headings */
.panel-summary {
  cursor: pointer;
  color: #b58900;
  font-size: 1.1rem;
  font-family: 'Georgia', serif;
  letter-spacing: 0.03em;
  user-select: none;
}

/* Info paragraphs inside how-it-works */
.info-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}
.info-text:first-of-type { margin-top: 0.75rem; }

/* Deck title widget */
#deck-title {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.deck-title-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.deck-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.deck-title-faction-icon {
  font-family: 'thronesdb';
  font-size: 1.4rem;
  line-height: 1;
}
.deck-title-name {
  font-family: 'Georgia', serif;
  font-size: 1.1rem;
  color: var(--text);
}
.deck-title-subtitle {
  font-size: 0.82rem;
  color: var(--border);
}

/* Initially-hidden detail sections */
#deck-table-details { margin-top: 1rem;   display: none; }
#config-details,
#sort-details,
#deck-stats-details { margin-top: 1.25rem; display: none; }

/* Analyze button wrapper */
#analyze-btn-wrapper {
  margin-top: 1.25rem;
  display: none;
  text-align: center;
}
#analyze-btn {
  font-size: 1rem;
  padding: 0.6rem 0;
  width: 60%;
}

/* Red Door requirement message */
#red-door-msg {
  display: none;
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: #b58900;
}

/* Deck charts container */
#deck-charts { margin-top: 0.5rem; }

/* Config hint text */
.cfg-hint {
  color: var(--border);
  font-size: 0.8rem;
}

/* "Poor setups are mulliganed" notice */
.cfg-poor-notice {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.95rem;
  font-weight: bold;
  color: #cb4b16;
  letter-spacing: 0.04em;
}

/* Section description */
.section-desc {
  font-size: 0.82rem;
  color: var(--border);
  margin: 1rem 0 1rem 0;
}

/* Deck table card legend */
.deck-legend {
  font-size: 0.78rem;
  color: var(--border);
  line-height: 1.8;
  margin-bottom: 0.75rem;
  margin-top: 0.75rem;
}

.deck-table-note {
  font-size: 0.78rem;
  color: #cb4b16;
  text-align: center;
  margin-top: 0.6rem;
  margin-bottom: 0;
}

/* SVG chart base */
.chart-svg {
  width: 100%;
  display: block;
  overflow: visible;
}
.chart-svg-mt { margin-top: 1.5rem; }

/* No-data placeholder */
.chart-no-data {
  color: var(--border);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem 0;
}

/* SVG chart series / legend groups */
[data-si] { transition: opacity 0.15s; }
[data-li] { cursor: pointer; transition: opacity 0.15s; }

/* SVG bar cursor */
.chart-bar { cursor: default; }

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 500px) {
  .input-row {
    flex-direction: column;
  }
  .input-row button {
    width: 100%;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
