/* Styling modeled on company.wizards.com: light pages, deep-purple ink (#290D4A),
   purple-blue accent (#6E64DA), bright blue highlight (#0291FF), soft blue-violet
   gradients, system font stack, sentence-case headings. */
:root {
  --bg: #ffffff;
  --bg-soft: #f7f7fb;
  --bg-panel: #ffffff;
  --bg-input: #ffffff;
  --border: #e4e3ee;
  --border-hi: #c9c6e4;
  --ink: #290d4a;
  --ink-deep: #0f051c;
  --text: #2c2b33;
  --text-dim: #646375;
  --accent: #6e64da;
  --accent-active: #a49fda;
  --blue: #0291ff;
  --blue-bright: #02bdff;
  --good: #15803d;
  --warn: #b45309;
  --bad: #dc2626;
  --grad: linear-gradient(120deg, #02bdff, #6e64da 60%, #9a8ce8);
  --sans: -apple-system, system-ui, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }

/* Dark html background so nothing white ever shows below/past the footer */
html { background: var(--ink-deep); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 1.6rem 1.75rem 1.1rem;
  background:
    radial-gradient(ellipse 65% 110% at 12% -30%, rgba(2, 189, 255, 0.14), transparent),
    radial-gradient(ellipse 55% 100% at 88% -25%, rgba(110, 100, 218, 0.14), transparent);
}
.brand h1.site-title {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.health { font-size: 0.78rem; color: var(--text-dim); padding-bottom: 0.3rem; }
.health.ready { color: var(--good); }
.health.error { color: var(--warn); }

.tabs { padding: 0 1.75rem; border-bottom: 1px solid var(--border); }
.tab {
  background: none; border: none; color: var(--text-dim);
  font-family: var(--sans); font-size: 0.95rem; font-weight: 600;
  padding: 0.7rem 1.1rem; cursor: pointer;
  border-bottom: 3px solid transparent;
}
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab:hover { color: var(--ink); }

main { padding: 1.5rem 1.75rem 3rem; max-width: 1200px; margin: 0 auto; width: 100%; flex: 1; }
.panel.hidden { display: none; }

h2 { font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }

.controls {
  display: flex; gap: 1rem; align-items: end; margin-bottom: 1.2rem; flex-wrap: wrap;
}
.controls label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; color: var(--text-dim); font-weight: 600; }
select, textarea {
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border-hi); border-radius: 8px;
  font: inherit; padding: 0.55rem 0.65rem;
}
select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(110, 100, 218, 0.15); }
select { min-width: 220px; }
.preset-select { width: 100%; margin-bottom: 0.5rem; color: var(--text-dim); }

button.primary {
  background: #472b8f;
  color: #fff;
  font-weight: 700;
  border: none; border-radius: 999px;
  padding: 0.65rem 1.7rem; cursor: pointer;
  transition: background 120ms ease;
}
button.primary:hover:not(:disabled) { background: #56379f; }
/* Disabled is the same fully solid purple — only the cursor changes */
button.primary:disabled { background: #472b8f; cursor: not-allowed; }
button.secondary {
  background: #fff; color: var(--accent);
  border: 2px solid var(--accent); border-radius: 999px;
  padding: 0.45rem 1.2rem; cursor: pointer; font-weight: 700;
}
button.secondary:hover { background: rgba(110, 100, 218, 0.08); }

.deck-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 800px) { .deck-grid { grid-template-columns: 1fr; } }
.deck-col h2 { font-size: 1rem; margin: 0 0 0.45rem; }
textarea {
  width: 100%; min-height: 260px; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem;
}
textarea.goal { min-height: 120px; font-family: var(--sans); font-size: 0.95rem; }
.hint { color: var(--text-dim); font-size: 0.8rem; }

.deck-feedback { margin-top: 0.5rem; font-size: 0.82rem; }
.deck-feedback .issue-error { color: var(--bad); }
.deck-feedback .issue-warning { color: var(--warn); }
.deck-feedback .ok { color: var(--good); }

.curve-bars { display: flex; align-items: flex-end; gap: 4px; height: 60px; margin: 0.5rem 0 0.25rem; }
.curve-bar { flex: 1; background: var(--grad); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; opacity: 0.9; }
.curve-bar span {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  font-size: 0.65rem; color: var(--text-dim);
}
.curve-labels { display: flex; gap: 4px; font-size: 0.65rem; color: var(--text-dim); }
.curve-labels div { flex: 1; text-align: center; }

.status { color: var(--accent); font-size: 0.88rem; min-height: 1.4rem; margin: 0.75rem 0; font-weight: 600; }
.status.error { color: var(--bad); }

table.sim-table {
  width: 100%; border-collapse: collapse; margin: 1rem 0;
  font-size: 0.85rem; background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(41, 13, 74, 0.06);
}
.sim-table th, .sim-table td { padding: 0.5rem 0.8rem; text-align: left; border-bottom: 1px solid var(--border); }
.sim-table tr:first-child th { font-weight: 700; color: var(--ink); background: var(--bg-soft); }
.sim-table th { color: var(--text-dim); font-weight: 500; }
.sim-table td.num { font-variant-numeric: tabular-nums; }
.metric-label { cursor: help; border-bottom: 1px dotted var(--text-dim); }
.metric-label sup { font-size: 0.65em; color: var(--accent); margin-left: 2px; }

.prose {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px;
  padding: 1rem 1.3rem; margin: 1rem 0;
}
.prose:empty { display: none; }
.prose h1, .prose h2, .prose h3 { font-size: 1rem; margin: 1rem 0 0.4rem; color: var(--ink); }
.prose ul { padding-left: 1.3rem; }
.prose code { background: #ecebf5; padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.85em; }

.verdict-card {
  background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: 14px;
  border-top: 4px solid transparent;
  border-image: var(--grad) 1;
  border-image-slice: 1 0 0 0;
  padding: 1.3rem 1.5rem; margin: 1.5rem 0;
  box-shadow: 0 4px 18px rgba(41, 13, 74, 0.1);
}
.verdict-card h2 { margin-top: 0; }
.verdict-card h3 { font-weight: 700; color: var(--ink); font-size: 0.9rem; }
.prob-bar-wrap { margin: 1rem 0; }
.prob-bar {
  display: flex; height: 36px; border-radius: 8px; overflow: hidden;
  font-weight: 700; font-size: 0.9rem;
}
.prob-a { background: var(--accent); color: #fff; display: flex; align-items: center; padding-left: 0.8rem; }
.prob-b { background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: flex-end; padding-right: 0.8rem; flex: 1; }
.ci-note { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.35rem; }

.badge {
  display: inline-block; background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.12rem 0.75rem; font-size: 0.78rem; margin-right: 0.4rem; font-weight: 600;
  color: var(--text);
}
.badge.beatdown { border-color: var(--accent); color: var(--accent); }

.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
@media (max-width: 800px) { .kv-grid { grid-template-columns: 1fr; } }
.kv-grid h3 { margin: 0 0 0.3rem; font-size: 0.9rem; color: var(--text-dim); }

.interaction-list { margin: 0.75rem 0; padding-left: 1.2rem; font-size: 0.88rem; }
.caveats { font-size: 0.8rem; color: var(--text-dim); border-top: 1px solid var(--border); margin-top: 1rem; padding-top: 0.6rem; }

.suggestion-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 1rem 0; }
.suggestion-table th, .suggestion-table td { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.suggestion-table th { color: var(--ink); font-weight: 700; }
.verified-yes { color: var(--good); }
.verified-no { color: var(--bad); }
.alt-list { color: var(--text-dim); font-size: 0.8rem; margin: 0.25rem 0 0; padding-left: 1rem; }

.card-name { color: var(--accent); cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
.card-name:hover { color: var(--accent-active); }
.card-tooltip { position: fixed; z-index: 50; pointer-events: none; }
.card-tooltip img { width: 244px; border-radius: 12px; box-shadow: 0 10px 34px rgba(15, 5, 28, 0.45); }
.card-tooltip.hidden { display: none; }

.resim-compare td.better { color: var(--good); }
.resim-compare td.worse { color: var(--bad); }

.steps {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.9rem 1.3rem; margin-bottom: 1.2rem; font-size: 0.9rem;
}
.steps h2 { margin: 0.2rem 0 0.5rem; font-size: 1.05rem; }
.steps ol { margin: 0.3rem 0; padding-left: 1.3rem; }
.steps li { margin: 0.35rem 0; }
.steps a { color: #472b8f; font-weight: 700; }
.steps code { background: #ecebf5; padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.85em; }

.log-paths { margin: 0.4rem 0; font-size: 0.78rem; color: var(--text-dim); }
.log-paths code { user-select: all; }
.file-btn {
  display: inline-block; background: #472b8f; color: #fff; font-weight: 700;
  border-radius: 999px; padding: 0.45rem 1.2rem; cursor: pointer; margin: 0.4rem 0.6rem 0.2rem 0;
}
.file-btn:hover { background: #56379f; }
.log-status { margin-top: 0.4rem; font-size: 0.88rem; font-weight: 600; min-height: 1.2rem; }
.log-status.info { color: #472b8f; }
.log-status.ok { color: var(--good); }
.log-status.error { color: var(--bad); }

.decklist-pre {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.8rem 1rem; font-size: 0.8rem; line-height: 1.45;
  max-height: 300px; overflow-y: auto; white-space: pre-wrap; margin: 0.6rem 0;
}
.deck-issues { margin: 0.5rem 0; font-size: 0.82rem; }
.copy-deck.copied { border-color: var(--good); color: var(--good); }

.history-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.7rem 0.9rem; margin: 0.4rem 0;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px;
}
.history-summary { cursor: pointer; flex: 1; font-weight: 600; color: var(--ink); }
.history-summary:hover { color: #472b8f; }
.history-when { color: var(--text-dim); font-weight: 400; font-size: 0.78rem; margin-left: 0.6rem; }
.history-del { font-size: 0.75rem; padding: 0.25rem 0.8rem; }

footer {
  /* Dark purple gradient band */
  background: linear-gradient(135deg, #472b8f, #290d4a 60%, #0f051c);
  color: rgba(255, 255, 255, 0.92);
  margin-top: 2.5rem;
  padding: 0.5rem 1.75rem;
  font-size: 0.72rem;
}
footer a { color: #fff; }
footer p { max-width: 1200px; margin: 0.25rem auto; }
