:root {
  --bg: #000022;
  --surface: #000022;
  --surface-2: #000022;
  --accent: #0000ff;
  --marked: #00ff00;
  --marked-bg: rgba(0, 255, 0, 0.15);
  --text: #ffffff;
  --text-dim: #ffffff;
  --danger: #ff0000;
  --gold: #ffff00;
  --row-win: #00ff00;
  --full-win: #ffff00;
  --empty-cell: #000022;
  --border: #ffffff;
  --info: #0000ff;
  --green: #00ff00;
  --red: #ff0000;
  --muted-border: #333355;
}

/* Ensure nav + article fit side-by-side (padding included in width) */
nav,
article {
  box-sizing: border-box;
}

/* bg-pattern disabled — layout main.css already sets background-color: #000022 on * */
.bg-pattern {
  display: none;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0;
  padding: 20px 16px 60px;
}

/* Banko page title — scoped to article, not the site header */
article .container > h1 {
  text-align: left;
  font-size: 2.6rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.5px;
  line-height: 1.1;
  padding: 20px 0 0;
}

article .container > p:first-of-type {
  text-align: left;
  color: #ffffff;
  font-size: 0.95rem;
  margin-top: 10px;
}

#setup-phase {
  max-width: 860px;
  margin: 0;
}

.setup-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 16px;
}

.setup-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
}

.setup-card h2 .num {
  background: var(--accent);
  color: #ffffff;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.plate-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.plate-tab {
  padding: 14px 22px;
  border-radius: 4px;
  background: var(--bg);
  border: 2px solid #ffffff;
  color: #ffffff;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  transition: 0.2s ease;
  position: relative;
}

.plate-tab:hover {
  border-color: var(--accent);
}

.plate-tab.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.plate-tab.has-data::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 10px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}

.col-hints {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.col-hint {
  text-align: center;
  font-size: 0.68rem;
  color: #ffffff;
  font-family: "JetBrains Mono", monospace;
}

.plate-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.plate-grid input {
  width: 100%;
  aspect-ratio: 1 / 1;
  text-align: center;
  background: var(--bg);
  border: 2px solid #ffffff;
  border-radius: 6px;
  color: #ffffff;
  font-family: "JetBrains Mono", monospace;
  font-size: 1.05rem;
  font-weight: 500;
  outline: none;
  transition: 0.2s ease;
  -moz-appearance: textfield;
}

.plate-grid input::-webkit-outer-spin-button,
.plate-grid input::-webkit-inner-spin-button,
#draw-input::-webkit-outer-spin-button,
#draw-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.plate-grid input::placeholder {
  color: #555577;
  font-size: 0.75rem;
}

.plate-grid input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.plate-grid input.filled {
  border-color: var(--green);
  color: #ffffff;
}

.setup-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 20px;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 28px;
  border-radius: 6px;
  border: 2px solid #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
  background: var(--bg);
  color: #ffffff;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  border-color: var(--green);
  color: var(--green);
  background: var(--bg);
}

.btn-primary:hover {
  background: rgba(0, 255, 0, 0.08);
}

.btn-secondary {
  border-color: #ffffff;
  color: #ffffff;
  background: var(--bg);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: #ffffff;
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--bg);
}

.btn-danger:hover {
  background: rgba(255, 0, 0, 0.08);
}

.btn-info {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--bg);
}

.btn-info:hover {
  background: rgba(0, 0, 255, 0.1);
}

.btn-sm {
  padding: 10px 16px;
  font-size: 0.85rem;
}

.scan-status {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 6px;
  font-size: 0.95rem;
  display: none;
}

.scan-status.loading {
  display: block;
  background: var(--bg);
  color: #ffffff;
  border: 2px solid var(--accent);
}

.scan-status.error {
  display: block;
  background: var(--bg);
  color: var(--danger);
  border: 2px solid var(--danger);
}

.scan-status.success {
  display: block;
  background: var(--bg);
  color: var(--green);
  border: 2px solid var(--green);
}

.scan-result {
  display: none;
  margin-top: 16px;
}

.scan-result-plate {
  background: var(--bg);
  border: 2px solid #ffffff;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 12px;
}

.scan-result-plate .plate-label {
  font-size: 0.95rem;
  color: #ffffff;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.scan-result-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
}

.scan-result-cell {
  aspect-ratio: 1.15 / 1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.95rem;
  font-weight: 700;
}

.scan-result-cell.empty {
  background: var(--bg);
  border: 1px solid var(--muted-border);
}

.scan-result-cell.number {
  background: var(--bg);
  color: var(--green);
  border: 2px solid var(--green);
}

#game-phase {
  display: none;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.draw-section {
  background: var(--bg);
  border: 2px solid #ffffff;
  border-radius: 6px;
  padding: 22px 24px;
  margin-bottom: 20px;
  text-align: center;
}

.draw-section h2 {
  font-size: 1rem;
  color: #ffffff;
  margin-bottom: 16px;
  font-weight: 500;
}

.draw-input-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

#draw-input {
  width: 150px;
  height: 76px;
  text-align: center;
  background: var(--bg);
  border: 2px solid #ffffff;
  border-radius: 6px;
  color: #ffffff;
  font-family: "JetBrains Mono", monospace;
  font-size: 2rem;
  font-weight: 700;
  outline: none;
  transition: 0.2s ease;
  -moz-appearance: textfield;
}

#draw-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.drawn-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  justify-content: center;
  max-height: 140px;
  overflow-y: auto;
  padding: 4px;
}

.drawn-num {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--bg);
  color: #ffffff;
  border: 3px solid #ffffff;
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.drawn-count {
  color: #ffffff;
  font-size: 0.95rem;
  margin-top: 12px;
}

.plates-container {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.game-plate {
  background: var(--bg);
  border: 2px solid #ffffff;
  border-radius: 6px;
  padding: 16px;
  transition: 0.25s ease;
}

.game-plate.row-winner {
  border-color: var(--gold);
}

.game-plate.full-winner {
  border-color: var(--green);
}

.plate-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}

.plate-name {
  font-weight: 700;
  font-size: 1rem;
  color: #ffffff;
}

.plate-status {
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--bg);
}

.plate-status.needs-more {
  color: #ffffff;
  border: 2px solid #ffffff;
}

.plate-status.one-away {
  color: var(--gold);
  border: 2px solid var(--gold);
}

.plate-status.row-complete {
  color: var(--gold);
  border: 2px solid var(--gold);
}

.plate-status.full-house {
  color: var(--green);
  border: 2px solid var(--green);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
}

.game-cell {
  aspect-ratio: 1.15 / 1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
  font-weight: 700;
  transition: 0.25s ease;
}

.game-cell.empty {
  background: var(--bg);
  border: 1px solid var(--muted-border);
}

.game-cell.number {
  background: var(--bg);
  color: #ffffff;
  border: 2px solid #ffffff;
}

.game-cell.marked {
  background: var(--bg);
  color: var(--gold);
  border: 2px solid var(--gold);
  animation: markPulse 0.35s ease;
}

.game-cell.row-done {
  background: #001a00;
  color: var(--green);
  border: 2px solid var(--green);
}

@keyframes markPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.bingo-alert {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
  padding: 16px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.bingo-modal {
  background: var(--bg);
  border: 2px solid var(--text);
  border-radius: 6px;
  padding: 40px 28px;
  text-align: center;
  animation: bounceIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 420px;
  width: 100%;
}

@keyframes bounceIn {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.bingo-modal h2 {
  font-size: 2.4rem;
  color: var(--text);
  margin-bottom: 10px;
}

.bingo-modal p {
  color: #ffffff;
  margin-bottom: 24px;
  line-height: 1.5;
}

.undo-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid #ffffff;
  color: #ffffff;
  font-size: 1.6rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: 0.2s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.undo-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
  color: #ffffff;
  font-size: 0.95rem;
}

.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 2px;
  background: #ffffff;
  opacity: 0.9;
}

#json-paste:empty::before {
  content: attr(data-placeholder);
  color: #555577;
  pointer-events: none;
}

#json-paste:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 1px var(--accent);
}

details summary {
  list-style: none;
}

details summary::-webkit-details-marker {
  display: none;
}

article a {
  color: inherit;
}

/* Mobile — match layout main.css breakpoint */
@media (max-width: 768px) {
  .container {
    margin: 0 auto;
  }

  article .container > h1 {
    text-align: center;
  }

  article .container > p:first-of-type {
    text-align: center;
  }

  #setup-phase {
    margin: 0 auto;
  }

  .setup-actions {
    justify-content: center;
  }
}

@media (max-width: 700px) {
  .container {
    padding: 16px 12px 50px;
  }

  article .container > h1 {
    font-size: 2.1rem;
  }

  .setup-card,
  .draw-section,
  .game-plate {
    padding: 18px;
  }

  .setup-card h2 .num {
    width: 44px;
    height: 44px;
    font-size: 0.95rem;
  }

  .plate-grid,
  .col-hints,
  .game-grid,
  .scan-result-grid {
    gap: 6px;
  }

  .plate-grid input,
  .game-cell,
  .scan-result-cell {
    font-size: 0.9rem;
  }

  #draw-input {
    width: 110px;
    height: 62px;
    font-size: 1.6rem;
  }

  .drawn-num {
    width: 44px;
    height: 44px;
    font-size: 0.95rem;
  }

  .undo-btn {
    width: 58px;
    height: 58px;
    font-size: 1.35rem;
  }
}

@media (max-width: 500px) {
  article .container > h1 {
    font-size: 1.8rem;
  }

  article .container > p:first-of-type {
    font-size: 0.9rem;
  }

  .plate-tab {
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  .plate-grid input {
    font-size: 0.8rem;
    border-radius: 5px;
  }

  .game-cell,
  .scan-result-cell {
    font-size: 0.8rem;
    border-radius: 5px;
  }

  #draw-input {
    width: 90px;
    height: 52px;
    font-size: 1.35rem;
  }

  .btn {
    padding: 11px 20px;
  }

  .bingo-modal {
    padding: 30px 20px;
    margin: 0 10px;
  }

  .bingo-modal h2 {
    font-size: 2rem;
  }

  .plate-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .scan-result-plate .plate-label {
    align-items: flex-start;
    flex-direction: column;
  }
}