/* console.css */
body { padding: 0; display: flex; flex-direction: column; min-height: 100vh; }

#app-header {
  background: var(--bg2);
  border-bottom: 2px solid var(--accent);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

#app-header h1 {
  font-size: 1.2rem;
  color: var(--accent);
  white-space: nowrap;
}

#event-name-display {
  font-size: 1rem;
  color: var(--text);
  flex: 1;
}

#round-indicator {
  font-size: 0.9rem;
  padding: 0.2em 0.7em;
  border-radius: 20px;
  background: var(--accent);
  color: #000;
  font-weight: 700;
}

#nav-tabs {
  display: flex;
  gap: 0;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  color: var(--text-muted);
  border-radius: 0;
  border-bottom: 3px solid transparent;
  padding: 0.6em 1.4em;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}
.tab-btn:hover:not(:disabled) { color: var(--text); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

#main-content {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Setup tab */
.setup-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.setup-section h2 {
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.form-row label {
  font-size: 0.9rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 80px;
}

.form-row input, .form-row select {
  flex: 1;
  min-width: 120px;
}

#player-table-wrap { overflow-x: auto; margin-top: 0.5rem; }

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

.player-row td { font-size: 0.85rem; }

.btn-xs {
  font-size: 0.75rem;
  padding: 0.2em 0.5em;
}

#tsv-import-area {
  width: 100%;
  height: 80px;
  font-family: monospace;
  font-size: 0.85rem;
  resize: vertical;
}

/* Round tabs common */
.round-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.round-header h2 {
  font-size: 1.1rem;
  color: var(--accent);
}

.q-number {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

/* 1st round grid */
#block-select-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
  align-items: center;
}

#r1-settings {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  margin-bottom: 0.8rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

#r1-settings label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

#r1-settings input[type=number] {
  width: 60px;
}

#r1-player-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.r1-player-card {
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  min-width: 100px;
  max-width: 130px;
  text-align: center;
  transition: border-color 0.2s, opacity 0.2s;
}

.r1-player-card.winner {
  border-color: var(--accent);
  background: #2a1e00;
}

.r1-player-card.resting {
  opacity: var(--rest-opacity);
}

.r1-player-card.combo-cand {
  box-shadow: var(--combo-glow);
  border-color: #fa0;
}

.r1-player-card.temp-correct { border-color: var(--success); background: #0a2a0a; }
.r1-player-card.temp-wrong { border-color: var(--danger); background: #2a0a0a; }

.r1-player-id { font-size: 0.7rem; color: var(--text-muted); }
.r1-player-name { font-size: 0.9rem; font-weight: 600; margin: 0.2rem 0; }
.r1-circles { font-size: 1.1rem; letter-spacing: 2px; margin: 0.2rem 0; }
.r1-circle-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #555;
  display: inline-block;
  margin: 0 2px;
  vertical-align: middle;
  background: transparent;
}
.r1-circle-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
}

.r1-btn-row {
  display: flex;
  gap: 0.3rem;
  justify-content: center;
  flex-wrap: wrap;
}

.r1-btn-row button {
  font-size: 0.75rem;
  padding: 0.2em 0.5em;
}

.btn-correct { background: #1a5a1a; color: #fff; }
.btn-correct:hover:not(:disabled) { background: #2a7a2a; }
.btn-correct.active { background: var(--success); color: #000; font-weight: 700; }

.btn-wrong { background: #5a1a1a; color: #fff; }
.btn-wrong:hover:not(:disabled) { background: #7a2a2a; }
.btn-wrong.active { background: var(--danger); color: #fff; font-weight: 700; }

.btn-pass { background: #3a3a1a; color: #ccc; }
.btn-pass:hover:not(:disabled) { background: #5a5a2a; }
.btn-pass.active { background: #aa0; color: #000; font-weight: 700; }

.r1-action-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

/* 2nd round */
#r2-player-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.r2-player-card {
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  min-width: 110px;
  text-align: center;
}

.r2-player-card .q-btns {
  display: flex;
  gap: 0.3rem;
  justify-content: center;
  margin-top: 0.3rem;
}

#r2-score-table-wrap { overflow-x: auto; margin-bottom: 0.8rem; }

#proximity-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem;
  margin-bottom: 0.8rem;
}

#proximity-section h3 { font-size: 0.9rem; color: var(--accent); margin-bottom: 0.5rem; }

#proximity-order-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.proximity-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: grab;
}

.proximity-item:active { cursor: grabbing; }

/* Final round */
#final-player-select {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.final-player-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.7rem;
}

.final-player-option.confirmed { opacity: 0.4; }

#final-action-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.final-result-btn {
  padding: 0.3em 0.7em;
  font-size: 0.85rem;
}

#final-current-ranking {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem;
  margin-bottom: 0.8rem;
}

#final-current-ranking h3 { font-size: 0.9rem; color: var(--accent); margin-bottom: 0.5rem; }

.final-rank-row {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.3rem;
  align-items: center;
}

.final-rank-num {
  font-size: 0.85rem;
  color: var(--text-muted);
  width: 28px;
  text-align: right;
}

.final-rank-name {
  flex: 1;
  font-size: 0.9rem;
}

.final-rank-confirmed { color: var(--accent); font-weight: 700; }

/* Utilities bar */
#utilities {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 0.5rem 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

#utilities button { font-size: 0.8rem; padding: 0.25em 0.6em; }

/* Debug panel */
#debug-panel {
  background: var(--bg);
  border-top: 1px solid var(--border);
  font-family: monospace;
  font-size: 0.75rem;
}

#debug-toggle {
  width: 100%;
  background: var(--bg2);
  color: var(--text-muted);
  text-align: left;
  border-radius: 0;
  padding: 0.3em 1em;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}

#debug-content {
  max-height: 200px;
  overflow-y: auto;
  padding: 0.5rem 1rem;
  white-space: pre-wrap;
  word-break: break-all;
  color: #8f8;
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: #000a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
}

.modal-box h3 { margin-bottom: 0.7rem; color: var(--accent); }
.modal-box p { margin-bottom: 1rem; font-size: 0.9rem; }

.modal-btn-row { display: flex; gap: 0.5rem; justify-content: flex-end; }

/* Notification toast */
#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--bg3);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  z-index: 2000;
  transition: opacity 0.4s;
  pointer-events: none;
}

#toast.hidden { opacity: 0; }

.start-round-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
  align-items: center;
}
