:root {
  color-scheme: dark;
  --bg: #11100d;
  --panel: #1a1712;
  --panel-2: #231f18;
  --ink: #f5ead7;
  --muted: #a89b88;
  --line: #3b3428;
  --amber: #e8b75a;
  --cyan: #59c9d6;
  --green: #6fd17e;
  --red: #e96c61;
  --paper: #efe3c8;
  --shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(232, 183, 90, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(232, 183, 90, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 15% 10%, rgba(89, 201, 214, 0.18), transparent 34rem),
    radial-gradient(circle at 82% 22%, rgba(232, 183, 90, 0.13), transparent 28rem),
    var(--bg);
  background-size: 44px 44px, 44px 44px, auto, auto, auto;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.control-deck,
.market-section,
.model-section {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(35, 31, 24, 0.96), rgba(26, 23, 18, 0.94));
  box-shadow: 0 22px 60px var(--shadow);
}

.control-deck {
  padding: 22px;
}

.market-section,
.model-section {
  margin-top: 18px;
  padding: 22px;
}

.brand-row,
.section-head,
.match-console,
.market-grid,
.notes-grid {
  display: grid;
  gap: 18px;
}

.brand-row {
  grid-template-columns: 1fr auto;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

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

h1 {
  max-width: 760px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 7vw, 5.8rem);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(1.35rem, 3vw, 2.4rem);
  line-height: 1.05;
}

h3 {
  font-size: 1rem;
  color: var(--paper);
}

.eyebrow,
.status-chip,
.field-note,
.meter-scale,
.stat-grid span,
.table-head span,
th,
dt {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.eyebrow {
  margin-bottom: 6px;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: #12100d;
  font-size: 0.78rem;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 14px var(--green);
}

.match-console {
  grid-template-columns: minmax(320px, 0.86fr) minmax(340px, 1fr);
  padding-top: 22px;
}

.input-panel,
.result-panel,
.threshold-card,
.sizing-card,
.notes-grid p {
  border: 1px solid var(--line);
  background: rgba(17, 16, 13, 0.72);
}

.input-panel,
.result-panel {
  padding: 16px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

fieldset + fieldset {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

legend {
  margin-bottom: 12px;
  color: var(--paper);
  font-weight: 700;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #0d0c0a;
  color: var(--ink);
  padding: 10px 11px;
}

input:focus,
select:focus {
  outline: 2px solid rgba(89, 201, 214, 0.55);
  outline-offset: 2px;
}

.field-note {
  margin-top: 10px;
  font-size: 0.78rem;
}

.result-panel {
  display: grid;
  gap: 14px;
}

.meter-card {
  border: 1px solid var(--line);
  padding: 14px;
  background: linear-gradient(180deg, rgba(239, 227, 200, 0.06), rgba(239, 227, 200, 0.02));
}

.meter-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

#probability-output {
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 6vw, 4.6rem);
  font-weight: 700;
  line-height: 0.9;
}

.meter {
  position: relative;
  height: 18px;
  margin-top: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(233, 108, 97, 0.22), rgba(232, 183, 90, 0.14), rgba(111, 209, 126, 0.23));
  overflow: hidden;
}

.meter-fill {
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--amber), var(--green));
  transform-origin: left center;
  transition: width 180ms ease;
}

.meter-midline {
  position: absolute;
  left: 50%;
  top: -4px;
  width: 1px;
  height: 26px;
  background: rgba(245, 234, 215, 0.6);
}

.meter-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.72rem;
}

.recommendation-card {
  border-left: 5px solid var(--amber);
  background: rgba(232, 183, 90, 0.1);
  padding: 14px;
}

.recommendation-card h2 {
  margin-bottom: 6px;
}

.recommendation-card.on {
  border-left-color: var(--green);
  background: rgba(111, 209, 126, 0.1);
}

.recommendation-card.against {
  border-left-color: var(--red);
  background: rgba(233, 108, 97, 0.1);
}

.recommendation-card.skip,
.recommendation-card.neutral {
  border-left-color: var(--amber);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat-grid div {
  border: 1px solid var(--line);
  padding: 10px;
  background: rgba(13, 12, 10, 0.78);
}

.stat-grid span,
.stat-grid strong {
  display: block;
}

.stat-grid strong {
  margin-top: 4px;
  color: var(--paper);
  font-size: 1.15rem;
}

.section-head {
  grid-template-columns: 1fr minmax(260px, 0.72fr);
  align-items: end;
  margin-bottom: 18px;
}

.section-head p:not(.eyebrow) {
  color: var(--muted);
}

.section-head.compact {
  grid-template-columns: 1fr;
}

.market-grid {
  grid-template-columns: 0.68fr 1.32fr;
}

.threshold-card,
.sizing-card,
.notes-grid p {
  padding: 16px;
}

dl {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
}

dl div {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

dt {
  font-size: 0.78rem;
}

dd {
  margin: 4px 0 0;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 700;
}

.table-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: right;
}

th:first-child,
td:first-child {
  text-align: left;
}

td {
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.skip-text {
  color: var(--muted);
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.notes-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.notes-grid p {
  color: var(--muted);
}

@media (max-width: 880px) {
  .brand-row,
  .match-console,
  .section-head,
  .market-grid,
  .notes-grid {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 10px;
  }

  .control-deck,
  .market-section,
  .model-section {
    padding: 14px;
  }

  .field-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .status-chip {
    width: max-content;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
