/* Prediction Pool Scoring Calculator — page styles.
   Builds on /legal.css (fonts, colour tokens, header/footer). Only adds what the
   interactive tool needs. Same green/amber system as the rest of the site — no
   separate visual language. */

:root {
  --brand-tint: #ecf4eb;
  --brand-tint-2: #f4f9f3;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(16, 40, 16, 0.06);
}

/* Wider well for the interactive area; prose still reads at a comfortable width. */
.container-wide {
  max-width: 1080px;
}

.nav {
  justify-content: space-between;
}
.nav-links {
  display: flex;
  gap: 20px;
  font-size: 14px;
}
.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
}
.nav-links a:hover {
  color: var(--brand-dark);
}

.crumbs {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 18px;
}
.crumbs a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}
.crumbs a:hover {
  color: var(--brand);
}

/* Keep long prose sections readable rather than stretched across 1080px. */
.prose,
.rules-section,
.cta-section {
  max-width: 760px;
}
.prose h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  margin: 22px 0 6px;
  color: var(--text);
}
.prose code {
  background: var(--brand-tint);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 13.5px;
  word-break: break-all;
}
.prose-note {
  font-style: italic;
  color: var(--text-muted);
  margin-top: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Layout: form + result ──────────────────────────────────────────────── */
.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin: 8px 0 44px;
}
.result-col {
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 16px;
}
@media (max-width: 860px) {
  .tool-layout {
    grid-template-columns: 1fr;
  }
  .result-col {
    position: static;
  }
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.panel-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--text);
}
.hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 6px 0 14px;
  line-height: 1.55;
}

/* ── Form ───────────────────────────────────────────────────────────────── */
fieldset {
  border: none;
  border-top: 1px solid var(--border);
  padding: 16px 0 6px;
  margin: 0;
}
fieldset:first-of-type {
  border-top: none;
  padding-top: 4px;
}
legend {
  font-family: var(--display);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brand);
  padding: 0;
}
.legend-sub {
  color: var(--text-muted);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
  margin-top: 10px;
}
@media (max-width: 480px) {
  .field-grid {
    grid-template-columns: 1fr;
  }
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.field-sub {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-muted);
}
.field input[type='number'],
.field select {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--text);
  background: #fff;
  border: 1px solid #d6dbd6;
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}
.field input:focus-visible,
.field select:focus-visible,
.btn:focus-visible,
.tie-move:focus-visible,
.doc:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.field-check {
  flex-direction: row;
  align-items: flex-start;
  gap: 9px;
}
.field-check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--brand);
  flex: none;
}

/* Tie-break list */
.tie-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.tie-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-top: 1px solid var(--border);
  background: #fff;
}
.tie-item:first-child {
  border-top: none;
}
.tie-item input[type='checkbox'] {
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
  flex: none;
}
.tie-name {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.tie-off {
  background: #fafafa;
}
.tie-off .tie-name {
  color: var(--text-muted);
  text-decoration: line-through;
}
.tie-ctrl {
  display: flex;
  gap: 4px;
}
.tie-move {
  border: 1px solid #d6dbd6;
  background: #fff;
  border-radius: 7px;
  width: 28px;
  height: 28px;
  font-size: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
}
.tie-move:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand);
}
.tie-move:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.form-actions {
  margin-top: 18px;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-sm {
  font-size: 13px;
  padding: 7px 13px;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-dark);
  color: #fff;
}
.btn-secondary {
  background: var(--brand-tint);
  color: var(--brand-dark);
  border-color: rgba(45, 122, 42, 0.25);
}
.btn-secondary:hover {
  background: #e0ecdf;
  color: var(--brand-dark);
}
.btn-ghost {
  background: #fff;
  color: var(--text-secondary);
  border-color: #d6dbd6;
}
.btn-ghost:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

/* ── Result panel ───────────────────────────────────────────────────────── */
.eyebrow-tight {
  margin-bottom: 4px;
}
.result-headline {
  font-size: 20px;
  margin-bottom: 14px;
}
.result-panel {
  background: linear-gradient(180deg, var(--brand-tint-2), #fff 120px);
}
.scoring-table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0 14px;
  font-size: 14.5px;
}
.scoring-table th,
.scoring-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}
.scoring-table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}
.scoring-table td {
  color: var(--text-secondary);
}
.scoring-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
  width: 72px;
}
.rationale {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0 0 16px;
}
.sw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 560px) {
  .sw-grid {
    grid-template-columns: 1fr;
  }
}
.sw {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
}
.sw h3 {
  font-family: var(--display);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 7px;
}
.sw ul {
  margin: 0;
  padding-left: 16px;
  font-size: 13px;
  line-height: 1.5;
}
.sw li + li {
  margin-top: 6px;
}
.sw-strength {
  background: var(--brand-tint);
  border-color: rgba(45, 122, 42, 0.18);
}
.sw-strength h3 {
  color: var(--brand-dark);
}
.sw-weakness {
  background: var(--amber-bg);
  border-color: rgba(180, 83, 9, 0.18);
}
.sw-weakness h3 {
  color: var(--amber);
}

/* ── Simulation ─────────────────────────────────────────────────────────── */
.est-tag {
  display: inline-block;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--amber);
  background: var(--amber-bg);
  border-radius: 6px;
  padding: 1px 6px;
  margin-left: 4px;
  vertical-align: middle;
}
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0 18px;
}
@media (max-width: 400px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }
}
.metric {
  background: var(--brand-tint-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
}
.metric-value {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}
.metric-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 5px;
  line-height: 1.4;
}
.metric-cmp {
  color: var(--text-muted);
}
.dist-title {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text);
}
.bars {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.bar-row {
  display: grid;
  grid-template-columns: 44px 1fr 40px;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.bar-key {
  font-variant-numeric: tabular-nums;
}
.bar-track {
  background: var(--brand-tint);
  border-radius: 6px;
  height: 14px;
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4d9a4a, var(--brand));
  border-radius: 6px;
  transition: width 0.3s ease;
  min-width: 2px;
}
.bar-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
}
.dist-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 10px 0 0;
  line-height: 1.5;
}

/* ── Rules documents ────────────────────────────────────────────────────── */
.rules-section h2,
.prose h2,
.cta-section h2 {
  scroll-margin-top: 16px;
}
.doc-block {
  margin: 18px 0 8px;
}
.doc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.doc-head h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  margin: 0;
}
.doc-sub {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 13px;
}
.doc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.doc {
  font-family: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  background: #fbfdfb;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}
.doc-short {
  background: var(--brand-tint-2);
}

/* ── Comparison table ───────────────────────────────────────────────────── */
.table-scroll {
  overflow-x: auto;
  margin: 14px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.cmp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 560px;
}
.cmp-table th,
.cmp-table td {
  padding: 11px 13px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.cmp-table thead th {
  background: var(--brand-tint-2);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}
.cmp-table tbody th {
  font-weight: 700;
  color: var(--text);
}
.cmp-table td {
  color: var(--text-secondary);
}
.cmp-table tbody tr:last-child th,
.cmp-table tbody tr:last-child td {
  border-bottom: none;
}
.pip {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
}
.pip-high {
  background: var(--brand-tint);
  color: var(--brand-dark);
}
.pip-mid {
  background: #eef2ff;
  color: #3730a3;
}
.pip-low {
  background: #f3f4f6;
  color: #4b5563;
}

/* ── CTA ────────────────────────────────────────────────────────────────── */
.cta-card {
  background: linear-gradient(150deg, #3a8838, #1b4e19);
  color: #fff;
  border-radius: var(--radius);
  padding: 28px 26px;
  margin: 8px 0;
}
.cta-card h2 {
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: 24px;
  margin: 0 0 12px;
}
.cta-card p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  line-height: 1.65;
}
.cta-card a {
  color: #ffe08a;
}
.cta-clarify {
  font-size: 13px !important;
  color: rgba(255, 255, 255, 0.72) !important;
  margin-top: 10px;
}
.cta-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.cta-card .btn-primary {
  background: #fff;
  color: var(--brand-dark);
}
.cta-card .btn-primary:hover {
  background: #ffe08a;
  color: var(--brand-dark);
}
.cta-card .btn-ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}
.cta-card .btn-ghost:hover {
  border-color: #fff;
  color: #fff;
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #14311a;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Print: clean, paper-friendly rules sheet ───────────────────────────── */
/* Printing yields the recommendation + the generated rules only — the form,
   simulation, marketing CTA, and the long explainer prose are dropped. */
@media print {
  header,
  footer,
  .nav-links,
  .crumbs,
  .eyebrow,
  .lead,
  .form-panel,
  .sim-panel,
  .doc-actions,
  .cta-section,
  .prose,
  .toast {
    display: none !important;
  }
  .tool-layout {
    display: block;
    margin: 0;
  }
  .result-col {
    position: static;
  }
  .panel {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }
  .result-panel {
    background: #fff;
  }
  .doc {
    border: 1px solid #ccc;
    background: #fff;
    white-space: pre-wrap;
  }
  body {
    background: #fff;
  }
  a {
    color: #000;
    text-decoration: none;
  }
  .prose,
  .rules-section {
    max-width: none;
  }
}
