/* Bingo's page-specific finish, loaded after the shared Olympia theme. */
:root {
  --bingo-surface: color-mix(in srgb, var(--card) 94%, var(--page-deep));
  --bingo-inset: color-mix(in srgb, var(--card-dark) 86%, var(--card));
  --bingo-edge: color-mix(in srgb, var(--line-bright) 26%, var(--line));
}

main {
  max-width: 1180px;
  gap: 20px;
  padding-top: 18px;
}

.tool-banner {
  width: 100%;
  border-radius: 18px;
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--purple) 18%, var(--card-dark)), var(--card-dark) 70%);
}

.tool-banner img {
  max-height: 220px;
  object-fit: contain;
  filter: none;
}

.page-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 2px 4px 4px;
}

.section-kicker {
  color: var(--line-bright);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.page-intro h1 {
  margin: 6px 0 5px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.08;
}

.page-intro p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

.intro-link {
  flex: none;
  padding: 11px 15px;
  border: 1px solid var(--bingo-edge);
  border-radius: 10px;
  background: var(--bingo-surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.intro-link:hover { border-color: var(--line-bright); }

.panel {
  border: 1px solid var(--bingo-edge);
  border-radius: 16px;
  background: var(--bingo-surface);
  box-shadow: 0 16px 38px var(--shadow);
}

.tool-layout { gap: 20px; grid-template-columns: minmax(0, 1fr) 320px; }
.panel { padding: 24px; }
.panel-heading { gap: 5px; margin-bottom: 18px; }
.panel-heading h2,
.recommendations h2 { font-family: Georgia, "Times New Roman", serif; font-size: 29px; line-height: 1.12; text-shadow: none; }
.panel-heading p { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.5; }
.board-panel .panel-heading { grid-template-columns: 1fr auto; }
.board-panel .panel-heading h2,
.board-panel .panel-heading p { grid-column: 1; }
.board-panel .panel-heading .panel-action { grid-column: 2; grid-row: 1 / span 2; align-self: center; }

.bingo-board {
  gap: 5px;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--line-bright) 55%, var(--line));
  border-radius: 15px;
  background: color-mix(in srgb, var(--line-bright) 34%, var(--card-dark));
  box-shadow: 0 12px 30px var(--shadow);
}

.bingo-tile {
  border-width: 1px;
  border-radius: 10px;
  background: #d9b760;
  border-color: #ebd28e;
  box-shadow: inset 0 -3px 0 rgba(90, 57, 19, .13);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.bingo-tile:hover { transform: translateY(-2px); }
.bingo-tile.selected { outline: 3px solid var(--text); outline-offset: -5px; }
.bingo-tile:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.bingo-tile.preview-line,
.bingo-board.has-plan-lines .bingo-tile.preview-line {
  outline: 3px solid #fff8dc;
  outline-offset: -5px;
  filter: none;
  opacity: 1;
  z-index: 2;
}

.board-planner {
  display: grid;
  gap: 14px;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--bingo-edge);
  border-radius: 12px;
  background: var(--bingo-inset);
}
.board-planner-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; }
.board-planner-heading h3 {
  margin: 4px 0 3px;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
}
.board-planner-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.board-planner-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.board-planner-tools button,
.line-assignment button,
.plan-slot,
.line-option {
  border: 1px solid var(--bingo-edge);
  border-radius: 9px;
  background: var(--bingo-surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}
.board-planner-tools button { min-height: 38px; padding: 7px 10px; white-space: nowrap; }
.board-planner-tools #suggestBestLines { background: var(--purple-deep); color: #fff8ec; }
.board-planner-tools button:hover,
.line-assignment button:hover,
.plan-slot:not(:disabled):hover,
.line-option:hover { border-color: var(--line-bright); }
.line-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.line-option {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 5px;
  min-width: 0;
  min-height: 55px;
  padding: 8px 10px;
  text-align: left;
}
.line-option:nth-child(9), .line-option:nth-child(10) { grid-column: span 2; }
.line-option strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-option small { grid-column: 1; color: var(--muted); font-size: 11px; font-weight: 600; }
.line-option em { grid-column: 2; grid-row: 1; color: var(--yellow); font-size: 11px; font-style: normal; }
.line-option b { grid-column: 2; grid-row: 2; color: var(--yellow); font-size: 10px; white-space: nowrap; }
.line-option.is-selected { border-color: var(--line-bright); box-shadow: 0 0 0 2px color-mix(in srgb, var(--line-bright) 24%, transparent); }
.line-option.primary { border-left: 4px solid #58b7c1; }
.line-option.backup { border-left: 4px solid #b988b1; }
.line-option.third { border-left: 4px solid #e2b843; }
.line-option.fallback { border-left: 4px solid #cf7658; }
.line-selection-actions { display: grid; gap: 10px; }
.plan-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.plan-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
  min-height: 40px;
  padding: 7px 9px;
  text-align: left;
}
.plan-slot span { color: var(--muted); font-size: 10px; }
.plan-slot strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-slot:disabled { cursor: default; opacity: .6; }
.plan-slot.primary { border-left: 4px solid #58b7c1; }
.plan-slot.backup { border-left: 4px solid #b988b1; }
.plan-slot.third { border-left: 4px solid #e2b843; }
.plan-slot.fallback { border-left: 4px solid #cf7658; }
.selected-line-info { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
.selected-line-info span { color: var(--muted); }
.line-picker-hint { margin: 0; color: var(--muted); font-size: 12px; }
.line-assignment { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.line-assignment button { min-height: 36px; padding: 7px 8px; }
.line-assignment button.active { border-color: var(--line-bright); background: var(--purple-deep); color: #fff8ec; }
.board-planner .line-advice { margin: 0; }

/* The plan slots double as the color key; markers sit against the board. */
.board-planner { gap: 12px; margin-top: 0; padding: 15px; }
.board-planner-heading h3 { font-size: 19px; }
.plan-slots { gap: 6px; }
.plan-slot-wrap {
  display: flex;
  min-width: 0;
  border: 1px solid var(--bingo-edge);
  border-left: 4px solid var(--slot-color);
  border-radius: 9px;
  background: var(--bingo-surface);
}
.plan-slot-wrap.primary { --slot-color: #58b7c1; }
.plan-slot-wrap.backup { --slot-color: #b988b1; }
.plan-slot-wrap.third { --slot-color: #e2b843; }
.plan-slot-wrap.fallback { --slot-color: #cf7658; }
.plan-slot-wrap.is-active { border-color: var(--line-bright); border-left-color: var(--slot-color); box-shadow: 0 0 0 2px color-mix(in srgb, var(--line-bright) 22%, transparent); }
.plan-slot-wrap .plan-slot {
  display: grid;
  flex: 1;
  gap: 2px;
  min-height: 49px;
  padding: 6px 9px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.plan-slot-wrap .plan-slot span { font-size: 10px; }
.plan-slot-wrap .plan-slot strong { font-size: 12px; }
.plan-slot-clear {
  flex: none;
  width: 26px;
  border: 0;
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 19px;
}
.plan-slot-clear:hover { color: var(--text); background: color-mix(in srgb, var(--line-bright) 15%, transparent); }
.board-line-layout {
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr);
  grid-template-rows: 30px auto;
  gap: 4px;
  align-items: stretch;
  min-width: 0;
}
.board-axis-label { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.column-line-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; padding: 0 6px; }
.row-line-controls { display: grid; grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 5px; padding: 6px 0; }
.board-line-layout .bingo-board { min-width: 0; }
.line-marker {
  display: grid;
  place-items: center;
  min-width: 0;
  border: 1px solid var(--bingo-edge);
  border-radius: 7px;
  background: var(--bingo-surface);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
}
.line-marker:hover, .line-marker:focus-visible, .line-marker.is-selected { border-color: var(--line-bright); color: var(--text); outline: 2px solid color-mix(in srgb, var(--line-bright) 20%, transparent); }
.line-marker.primary { background: #58b7c1; color: #15272b; }
.line-marker.backup { background: #b988b1; color: #2c192b; }
.line-marker.third { background: #e2b843; color: #35280b; }
.line-marker.fallback { background: #cf7658; color: #35180e; }
.diagonal-line-controls { display: flex; justify-content: center; gap: 7px; padding-left: 39px; }
.diagonal-line-controls .line-marker { min-height: 31px; padding: 5px 11px; }

.board-legend { justify-content: flex-start; gap: 8px; margin-top: 18px; }
.board-legend span {
  padding: 6px 9px;
  border: 1px solid var(--bingo-edge);
  border-radius: 999px;
  background: var(--bingo-inset);
  font-size: 10px;
  letter-spacing: .03em;
}
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; }
.board-export-actions { justify-content: flex-start; margin-top: 18px; }

.panel-action,
.board-export-actions button,
.status-buttons button,
.secondary-action,
.line-actions button,
.line-card-actions button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--bingo-edge);
  border-radius: 9px;
  background: var(--bingo-inset);
  color: var(--text);
  box-shadow: none;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.board-export-actions button:first-child,
#suggestBestLines { background: var(--purple-deep); color: #fff8ec; }
.panel-action:hover,
.board-export-actions button:hover,
.status-buttons button:hover,
.secondary-action:hover,
.line-actions button:hover,
.line-card-actions button:hover { border-color: var(--line-bright); transform: translateY(-1px); }

.editor-panel { gap: 14px; }
.editor-panel > .panel-heading { margin-bottom: 0; }
.editor-panel > .panel-heading .section-kicker { margin-bottom: 2px; }
.editor-panel > .panel-heading h2 { color: var(--text); }
.editor-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--bingo-edge);
  border-radius: 11px;
  background: var(--bingo-inset);
}
.editor-section h3 {
  margin: 0;
  color: var(--yellow);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .02em;
}
.editor-panel label { font-size: 12px; letter-spacing: .02em; }
.editor-panel label small { color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0; }
.editor-panel input,
.stepper-control { min-height: 43px; border-radius: 9px; }
.stepper-control input { border-radius: 0; }
.amount-grid { grid-template-columns: 1fr; }
.amount-grid label { gap: 6px; }
.status-buttons { gap: 7px; }
.status-buttons button { min-height: 44px; }
.status-buttons button.active { border-color: var(--line-bright); background: var(--purple-deep); color: #fff8ec; }
.secondary-action { width: 100%; }
.planning-card { padding: 17px; border: 1px solid var(--bingo-edge); border-radius: 11px; background: var(--bingo-inset); }
.planning-card strong { color: var(--yellow); text-shadow: none; }
.planning-card small { font-weight: 500; line-height: 1.45; }

.recommendations summary { padding: 22px 24px; }
.recommendations summary p { font-size: 14px; font-weight: 500; }
.recommendations .line-suggestions { padding: 0 24px 24px; }
.line-card {
  padding: 16px;
  border: 1px solid var(--bingo-edge);
  border-left: 4px solid var(--yellow);
  border-radius: 11px;
  background: var(--bingo-inset);
}
.line-title b { color: var(--yellow); }

:root[data-theme="light"] .bingo-tile:not(.done):not(.reserved):not(.closed) { color: #332414; }
:root[data-theme="light"] .planning-card,
:root[data-theme="light"] .editor-section,
:root[data-theme="light"] .line-card,
:root[data-theme="light"] .board-legend span,
:root[data-theme="light"] .board-planner { background: #fffaf1; }

@media (max-width: 860px) {
  .tool-layout { grid-template-columns: 1fr; }
  .amount-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  main { gap: 15px; padding-inline: 12px; }
  .tool-banner img { max-height: 150px; }
  .page-intro { align-items: start; flex-direction: column; gap: 12px; }
  .intro-link { display: none; }
  .panel { padding: 15px; }
  .board-panel .panel-heading { grid-template-columns: 1fr; }
  .board-panel .panel-heading .panel-action { grid-column: 1; grid-row: auto; justify-self: start; }
  .amount-grid { grid-template-columns: 1fr; }
  .editor-section { padding: 13px; }
  .board-legend { justify-content: center; }
  .board-export-actions { justify-content: center; }
  .board-planner { padding: 12px; }
  .board-planner-heading { align-items: start; flex-direction: column; }
  .board-planner-tools { justify-content: flex-start; }
  .line-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .line-option:nth-child(9), .line-option:nth-child(10) { grid-column: span 1; }
  .plan-slots, .line-assignment { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board-line-layout { grid-template-columns: 27px minmax(0, 1fr); grid-template-rows: 26px auto; gap: 3px; }
  .column-line-controls, .row-line-controls { gap: 3px; padding: 0; }
  .column-line-controls { padding-left: 3px; padding-right: 3px; }
  .row-line-controls { padding-top: 3px; padding-bottom: 3px; }
  .line-marker { font-size: 10px; border-radius: 5px; }
  .diagonal-line-controls { padding-left: 30px; }
  .recommendations summary { padding: 18px; }
  .recommendations .line-suggestions { padding: 0 18px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .bingo-tile,
  .panel-action,
  .board-export-actions button,
  .status-buttons button,
  .secondary-action,
  .line-actions button,
  .line-card-actions button { transition: none; }
}
