:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #162033;
  --muted: #647084;
  --line: #d9e1ec;
  --blue: #2457d6;
  --blue-dark: #15388f;
  --green: #0c7a5a;
  --yellow: #ffd166;
  --red: #b42318;
  --shadow: 0 18px 50px rgba(28, 43, 73, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 34px;
  background: #10182a;
  color: #fff;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.site-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #dbe7ff;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.site-nav-link:hover,
.site-nav-link.is-active {
  background: #eef3ff;
  color: #15388f;
}

.eyebrow {
  margin: 0 0 4px;
  color: #8fb2ff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 8px;
  font-size: 22px;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.status-pill {
  min-width: 170px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #dbe7ff;
  text-align: center;
}

.is-analyzing {
  cursor: progress;
}

.analysis-overlay[hidden] {
  display: none;
}

.analysis-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 24, 42, 0.46);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.analysis-dialog {
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(440px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.analysis-dialog strong {
  display: block;
  color: #162033;
  font-size: 17px;
}

.analysis-dialog p {
  margin: 4px 0 0;
  font-size: 13px;
}

.analysis-spinner {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 4px solid #dbe6fb;
  border-top-color: var(--blue);
  border-radius: 999px;
  animation: analysis-spin 0.8s linear infinite;
}

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

.shell {
  display: grid;
  grid-template-columns: minmax(420px, 620px) minmax(0, 1fr);
  align-items: start;
  gap: 22px;
  width: min(1480px, calc(100% - 34px));
  margin: 22px auto 42px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-panel {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 22px;
  min-width: 0;
}

.panel-heading p {
  margin-bottom: 0;
}

.setup-step {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border: 1px solid #dbe4f1;
  border-radius: 8px;
  background: #fbfdff;
}

.setup-step-action {
  background: #f4f8ff;
}

.step-heading {
  display: flex;
  align-items: start;
  gap: 12px;
}

.step-heading > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.step-heading h3,
.step-heading p {
  margin-bottom: 0;
}

.step-heading p {
  font-size: 13px;
}

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

.strategy-info {
  display: grid;
  align-content: center;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid #c7d7fb;
  border-radius: 8px;
  background: #f4f8ff;
}

.strategy-info strong {
  display: block;
  margin-bottom: 4px;
  color: #27344d;
  font-size: 13px;
  text-transform: uppercase;
}

.strategy-info span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

label {
  display: grid;
  gap: 7px;
  color: #27344d;
  font-size: 13px;
  font-weight: 800;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

legend {
  padding: 0 6px;
  color: #27344d;
  font-size: 13px;
  font-weight: 900;
}

fieldset p {
  margin-bottom: 12px;
  font-size: 13px;
}

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

.denomination-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #d6deeb;
  border-radius: 7px;
  background: #fff;
  color: #27344d;
  font-size: 12px;
  font-weight: 850;
}

.denomination-option input {
  width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 130px;
  padding: 12px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 87, 214, 0.14);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 7px;
  padding: 0 15px;
  border: 1px solid transparent;
  font-weight: 850;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-button {
  background: var(--blue);
  color: #fff;
}

.primary-button:hover {
  background: var(--blue-dark);
}

.secondary-button,
.file-button {
  background: #eef3ff;
  border-color: #c8d6fb;
  color: #163f9f;
}

.upload-box {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px dashed #b9c6d8;
  border-radius: 8px;
  background: #f8fbff;
}

.upload-box p {
  margin-bottom: 0;
  font-size: 13px;
}

.paytable-upload-box {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.paytable-upload-box h3,
.paytable-upload-box p {
  margin-bottom: 0;
}

.paytable-upload-box .extract-output {
  grid-column: 1 / -1;
}

.file-button input {
  display: none;
}

code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #e9eef7;
  color: #162033;
}

.paytable-editor-block {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.paytable-tools {
  display: block;
}

.paytable-tools h3,
.paytable-tools p {
  margin-bottom: 0;
}

.paytable-grid {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.paytable-machine-table {
  border: 0;
  border-radius: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  overflow: visible;
  background: #fff;
}

.paytable-machine-table th,
.paytable-machine-table td {
  width: 96px;
  min-width: 96px;
  padding: 8px;
  text-align: center;
}

.paytable-machine-table thead th {
  background: #eef3ff;
}

.paytable-machine-table th:first-child {
  width: 70px;
  min-width: 70px;
  background: #eef3ff;
  text-align: center;
}

.paytable-grid input {
  width: 100%;
  min-height: 38px;
  padding: 0 8px;
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.paytable-disabled-cell {
  background: #f1f5fb;
  color: #a3afc2;
  font-weight: 850;
}

.cards-editor-block {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.cards-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.cards-tool-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.cards-tools h3,
.cards-tools p {
  margin-bottom: 0;
}

.cards-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.card-editor-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 76px;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.card-label {
  min-height: 42px;
  display: flex;
  align-items: center;
  color: #27344d;
  font-weight: 900;
}

.card-numbers-field,
.card-bet-field {
  gap: 5px;
  min-width: 0;
}

.card-numbers-field span,
.card-bet-field span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.card-numbers-field > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.card-spot-count {
  color: #173f9d;
  font-size: 10px;
  font-weight: 900;
  text-transform: none;
  white-space: nowrap;
}

.icon-delete-button {
  grid-column: 1 / -1;
  justify-self: end;
  min-height: 42px;
  padding: 0 12px;
  border-color: #f1b7b2;
  background: #fff1f0;
  color: var(--red);
}

.card-picker-details {
  grid-column: 1 / -1;
  border: 1px solid #d9e3f2;
  border-radius: 8px;
  background: #f8fbff;
}

.card-picker-details summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: #27344d;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.card-picker-details summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.card-picker-board {
  display: grid;
  grid-template-columns: repeat(var(--keno-cols), minmax(0, 1fr));
  gap: 4px;
  padding: 0 12px 12px;
}

.card-picker-number {
  min-height: 30px;
  padding: 0;
  border: 1px solid #d7e1ef;
  border-radius: 5px;
  background: #fff;
  color: #40506a;
  font-size: 11px;
  font-weight: 850;
}

.card-picker-number:hover {
  border-color: #9fb6ed;
  background: #eef3ff;
}

.card-picker-number.is-selected {
  border-color: #173f9d;
  background: #173f9d;
  color: #fff;
}

.extract-output {
  display: none;
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 7px;
  background: #10182a;
  color: #dfe8ff;
  white-space: pre-wrap;
}

.report-panel {
  position: sticky;
  top: 22px;
  align-self: start;
  min-width: 0;
  min-height: 520px;
  padding: 22px;
}

.empty-state {
  display: grid;
  place-content: center;
  min-height: 320px;
  text-align: center;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.story-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid #c7d7fb;
  border-radius: 8px;
  background: #f4f8ff;
}

.story-card h3 {
  margin-bottom: 0;
  font-size: 20px;
}

.story-card p {
  margin-bottom: 0;
  color: #27344d;
}

.ai-abstract-box {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding: 14px;
  border: 1px solid #b9c9f0;
  border-radius: 8px;
  background: #ffffff;
}

.ai-abstract-box[hidden] {
  display: none;
}

.ai-abstract-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ai-abstract-heading strong {
  color: var(--ink);
}

.ai-abstract-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-abstract-box ul {
  margin: 0;
  padding-left: 18px;
  color: #27344d;
}

.ai-abstract-box li + li {
  margin-top: 5px;
}

.ai-caution {
  font-size: 13px;
  font-weight: 800;
}

.metric {
  min-height: 92px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbff;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-value {
  display: block;
  margin-top: 9px;
  font-size: 23px;
  line-height: 1.1;
}

.help-term {
  display: inline;
  border-bottom: 1px dotted currentColor;
  color: inherit;
  cursor: help;
}

.help-term:focus {
  outline: 2px solid rgba(36, 87, 214, 0.35);
  outline-offset: 2px;
  border-radius: 3px;
}

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

.chart-card {
  display: grid;
  gap: 11px;
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.chart-card h4 {
  margin: 0;
  color: #27344d;
  font-size: 15px;
}

.chart-card p {
  margin: -4px 0 2px;
  font-size: 13px;
}

.plain-chart-row {
  display: grid;
  gap: 6px;
}

.plain-chart-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: #27344d;
  font-size: 13px;
  font-weight: 800;
}

.plain-chart-label strong {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.plain-chart-track {
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef8;
}

.plain-chart-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #2f7de1);
}

.session-simulation-block {
  display: grid;
  gap: 12px;
}

.session-note {
  border-left: 4px solid var(--green);
  background: #effaf5;
}

.sample-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.sample-action-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.session-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.session-summary-grid .metric {
  min-height: 76px;
  padding: 12px;
}

.session-summary-grid .metric-value {
  font-size: 18px;
}

.session-cashout td {
  background: #effaf5;
  color: #124936;
}

.session-bust td {
  background: #fff1f0;
  color: #7c1d16;
}

.session-lowwater td {
  background: #eef6ff;
  color: #18406f;
}

.session-active td {
  background: #fff9e6;
  color: #5f4308;
}

.sweep-negative-row td {
  color: #7c1d16;
}

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

.report-section {
  min-width: 0;
  margin-top: 22px;
}

.report-section:first-child {
  margin-top: 0;
}

.section-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.section-title-row p {
  margin-bottom: 0;
  font-size: 13px;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef3ff;
  color: #27344d;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.recommended-row td {
  background: #eaf7f1;
  color: #124936;
  font-weight: 850;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.note-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.note-list li {
  padding: 11px 12px;
  border-left: 4px solid var(--blue);
  border-radius: 5px;
  background: #f2f6ff;
  color: #27344d;
}

.goal-win-block {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.entry-plan {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.entry-plan > table {
  min-width: 640px;
}

.compact-entry-details {
  margin-top: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.compact-entry-details > table {
  min-width: 560px;
}

.keno-grid-report {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.keno-card-grid-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 12px;
}

.keno-grid-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #d8e2f0;
  border-radius: 8px;
  background: #ffffff;
}

.keno-grid-card-overlay {
  border-color: #b8c8ec;
  background: #f8fbff;
}

.keno-grid-card h4 {
  margin: 0;
  color: #1d2d48;
  font-size: 14px;
  line-height: 1.25;
}

.keno-grid-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.keno-number-grid {
  display: grid;
  grid-template-columns: repeat(var(--keno-cols), minmax(0, 1fr));
  gap: 3px;
  min-width: 0;
}

.keno-number-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 24px;
  min-width: 0;
  border: 1px solid #d9e3f2;
  border-radius: 4px;
  background: #f8fbff;
  color: #596985;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
}

.keno-number-cell.is-marked {
  border-color: #173f9d;
  background: #173f9d;
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.62);
}

.keno-number-cell.is-overlay-1 {
  border-color: #a8c1f4;
  background: #dce8ff;
  color: #183d9b;
}

.keno-number-cell.is-overlay-2 {
  border-color: #779cf0;
  background: #9fc2ff;
  color: #09245f;
}

.keno-number-cell.is-overlay-3 {
  border-color: #315fd0;
  background: #4f7ee8;
  color: #ffffff;
}

.keno-number-cell.is-overlay-many {
  border-color: #112765;
  background: #142a6f;
  color: #ffffff;
}

.keno-number-cell b {
  position: absolute;
  right: 2px;
  top: 2px;
  display: grid;
  place-items: center;
  min-width: 11px;
  height: 11px;
  padding: 0 2px;
  border-radius: 999px;
  background: #ffffff;
  color: #142a6f;
  font-size: 8px;
  line-height: 1;
}

.keno-grid-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 12px;
}

.keno-grid-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.keno-grid-legend i {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid #a8c1f4;
  border-radius: 3px;
}

.keno-grid-legend i.is-overlay-1 {
  background: #dce8ff;
}

.keno-grid-legend i.is-overlay-2 {
  background: #9fc2ff;
}

.keno-grid-legend i.is-overlay-3 {
  background: #4f7ee8;
}

.keno-grid-legend i.is-overlay-many {
  background: #142a6f;
}

.table-note,
.empty-inline {
  margin: 0;
  padding: 12px 13px;
  border-radius: 7px;
  background: #f7f9fd;
  color: #344258;
}

.recommendation-note {
  border-left: 4px solid var(--green);
  background: #effaf5;
}

.optimizer-note {
  border-left: 4px solid var(--blue);
  background: #f2f6ff;
}

.comparison-block {
  display: grid;
  gap: 12px;
}

.handpay-note {
  border-left: 4px solid var(--yellow);
  background: #fff9e6;
}

.math-check-block {
  display: grid;
  gap: 12px;
}

.check-watch-note {
  border-left: 4px solid var(--yellow);
  background: #fff9e6;
}

.check-review-note {
  border-left: 4px solid var(--red);
  background: #fff1f0;
}

.math-check-pass td,
.math-check-watch td,
.math-check-review td {
  color: #27344d;
}

.math-check-pass td:nth-child(2) {
  color: var(--green);
  font-weight: 900;
}

.math-check-watch td:nth-child(2) {
  color: #8a5a00;
  font-weight: 900;
}

.math-check-review td:nth-child(2) {
  color: var(--red);
  font-weight: 900;
}

.empty-inline {
  border: 1px solid #d9e1ec;
}

.handpay-chart {
  display: grid;
  gap: 10px;
}

.handpay-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.9fr) minmax(130px, 1.4fr) minmax(112px, 0.8fr);
  align-items: center;
  gap: 12px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.handpay-label,
.handpay-odds {
  display: grid;
  gap: 3px;
}

.handpay-label span,
.handpay-odds span {
  color: var(--muted);
  font-size: 12px;
}

.handpay-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf7;
}

.handpay-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #b7791f;
}

.bar-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 150px minmax(90px, 1fr) 90px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebf5;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--green);
}

.error-box {
  padding: 13px;
  border: 1px solid #f1b7b2;
  border-radius: 8px;
  background: #fff1f0;
  color: var(--red);
  font-weight: 750;
}

.method-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e8f6f1;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
}

.technical-details {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.technical-details summary {
  color: #27344d;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.technical-content {
  margin-top: 14px;
}

.report-accordion {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.report-accordion summary {
  display: grid;
  gap: 3px;
  padding: 14px 16px;
  color: #27344d;
  font-weight: 900;
  cursor: pointer;
}

.report-accordion summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.accordion-body {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
}

.explain-shell {
  width: min(1180px, calc(100% - 34px));
  margin: 22px auto 48px;
}

.explain-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 28px;
  align-items: stretch;
  min-height: 430px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.explain-hero-copy {
  display: grid;
  align-content: center;
  justify-items: start;
}

.explain-hero-copy h2 {
  max-width: 760px;
  font-size: 36px;
  line-height: 1.05;
}

.explain-hero-copy p {
  max-width: 700px;
  font-size: 16px;
}

.explain-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  border-radius: 7px;
  font-weight: 850;
  margin-top: 8px;
  text-decoration: none;
}

.overlap-illustration {
  position: relative;
  display: grid;
  align-content: center;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid #c7d7fb;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.68)),
    repeating-linear-gradient(0deg, #e8eef8 0, #e8eef8 1px, transparent 1px, transparent 34px),
    repeating-linear-gradient(90deg, #e8eef8 0, #e8eef8 1px, transparent 1px, transparent 34px),
    #f6f9ff;
}

.keno-card-diagram {
  position: absolute;
  display: grid;
  grid-template-columns: repeat(3, 44px);
  gap: 8px;
  width: 178px;
  padding: 14px;
  border: 1px solid #b8c8ec;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(28, 43, 73, 0.14);
}

.keno-card-diagram strong {
  grid-column: 1 / -1;
  color: #27344d;
}

.keno-card-diagram span {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid #d5deee;
  border-radius: 999px;
  background: #edf3ff;
  color: #183d9b;
  font-weight: 900;
}

.keno-card-diagram span:nth-child(2),
.keno-card-diagram span:nth-child(3),
.keno-card-diagram span:nth-child(5) {
  background: #e8f6f1;
  color: #0c6249;
}

.card-a {
  left: 28px;
  top: 44px;
}

.card-b {
  right: 28px;
  bottom: 124px;
}

.overlap-caption {
  position: absolute;
  left: 34px;
  right: 34px;
  bottom: 24px;
  display: grid;
  gap: 4px;
  padding: 13px;
  border: 1px solid #d9e1ec;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.overlap-caption span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.explain-band {
  margin-top: 22px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.explain-title {
  margin-bottom: 16px;
}

.step-grid,
.control-map,
.caution-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.step-card,
.control-node {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbff;
}

.step-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: #15388f;
  color: #fff;
  font-weight: 900;
}

.step-card p,
.control-node span,
.caution-grid p,
.explain-list {
  margin-bottom: 0;
}

.control-node {
  display: grid;
  gap: 7px;
}

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

.control-node strong {
  color: #27344d;
}

.control-node span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.explain-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.84fr);
  gap: 24px;
  align-items: center;
}

.explain-split.reverse {
  grid-template-columns: minmax(330px, 0.84fr) minmax(0, 1fr);
}

.matrix-visual {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  padding: 16px;
  border: 1px solid #c7d7fb;
  border-radius: 8px;
  background: #f6f9ff;
}

.matrix-label,
.matrix-cell {
  display: grid;
  place-items: center;
  min-height: 44px;
  border-radius: 7px;
  font-weight: 900;
}

.matrix-label {
  color: #516079;
}

.matrix-cell {
  background: #e9eef7;
  color: #27344d;
}

.matrix-cell.diagonal {
  background: #15388f;
  color: #fff;
}

.matrix-cell.strong {
  background: #0c7a5a;
  color: #fff;
}

.matrix-cell.mid {
  background: #ffd166;
  color: #4f3900;
}

.matrix-cell.weak {
  background: #ffffff;
  color: #647084;
  border: 1px solid #d9e1ec;
}

.matrix-note {
  grid-column: 1 / -1;
  margin: 6px 0 0;
  font-size: 13px;
}

.flow-visual {
  display: grid;
  grid-template-columns: 1fr 42px 1fr 42px 1fr 42px 1.25fr;
  align-items: center;
  gap: 8px;
}

.flow-step,
.flow-output,
.flow-arrow {
  display: grid;
  place-items: center;
  min-height: 76px;
  border-radius: 8px;
  font-weight: 900;
  text-align: center;
}

.flow-step {
  border: 1px solid #c7d7fb;
  background: #eef3ff;
  color: #15388f;
}

.flow-arrow {
  color: #647084;
}

.flow-output {
  background: #0c7a5a;
  color: #fff;
}

.explain-list {
  display: grid;
  gap: 9px;
  padding-left: 18px;
  color: #344258;
}

.caution-band {
  border-color: #d8c17b;
  background: #fffdf3;
}

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

.caution-grid p {
  padding: 14px;
  border-left: 4px solid #b7791f;
  border-radius: 7px;
  background: #ffffff;
  color: #344258;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .report-panel {
    position: static;
  }

  .metric-grid,
  .chart-grid,
  .session-summary-grid,
  .denomination-options,
  .split,
  .step-grid,
  .control-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-grid,
  .session-summary-grid,
  .split,
  .explain-hero,
  .explain-split,
  .explain-split.reverse {
    grid-template-columns: 1fr;
  }

  .flow-visual {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .topbar {
    display: grid;
    padding: 22px 18px;
  }

  h1 {
    font-size: 26px;
    line-height: 1.1;
  }

  .topbar-actions {
    justify-content: start;
  }

  .shell,
  .explain-shell {
    width: min(1480px, calc(100% - 20px));
    margin-top: 14px;
    margin-bottom: 28px;
  }

  .input-panel,
  .report-panel {
    padding: 14px;
  }

  .setup-step {
    padding: 13px;
  }

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

  .paytable-upload-box {
    grid-template-columns: 1fr;
  }

  .paytable-upload-box .file-button {
    justify-self: stretch;
  }

  .denomination-options {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  }

  .button-row,
  .cards-tool-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button-row > button,
  .cards-tool-buttons > button,
  .file-button {
    width: 100%;
  }

  .step-grid,
  .control-map,
  .caution-grid {
    grid-template-columns: 1fr;
  }

  .explain-hero,
  .explain-band {
    padding: 18px;
  }

  .explain-hero-copy h2 {
    font-size: 28px;
  }

  .overlap-illustration {
    min-height: 500px;
  }

  .card-a,
  .card-b {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .card-a {
    top: 24px;
  }

  .card-b {
    bottom: 128px;
  }

  .matrix-visual {
    gap: 4px;
    padding: 10px;
  }

  .matrix-label,
  .matrix-cell {
    min-height: 34px;
    font-size: 12px;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .handpay-row {
    grid-template-columns: 1fr;
  }

  .cards-tools {
    display: grid;
  }

  .cards-tool-buttons {
    justify-content: stretch;
  }

  .card-editor-row {
    grid-template-columns: 1fr;
  }

  .card-label {
    min-height: auto;
  }

  .entry-plan > table,
  .compact-entry-details > table {
    min-width: 540px;
  }

  .keno-card-grid-list {
    grid-template-columns: 1fr;
  }

  .keno-grid-card {
    padding: 10px;
  }

  .keno-number-grid {
    gap: 2px;
  }

  .keno-number-cell {
    min-height: clamp(20px, 6.2vw, 24px);
    border-radius: 3px;
    font-size: 9px;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding: 18px 14px;
  }

  .site-nav,
  .topbar-actions {
    width: 100%;
  }

  .site-nav-link,
  .status-pill {
    flex: 1 1 100%;
    justify-content: center;
  }

  .section-title-row {
    display: grid;
    align-items: start;
  }

  .metric-grid {
    gap: 8px;
  }

  .metric {
    min-height: 76px;
    padding: 11px;
  }

  .metric-value {
    font-size: 19px;
  }

  th,
  td {
    padding: 9px;
  }
}

@media (max-width: 340px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .analysis-spinner {
    animation: none;
  }
}
