:root {
  --bg-color: #ffffff;
  --text-color: #1a1a1a;
  --font-size: 15px;
  --green: #4caf50;
  --red: #e53935;
  --purple: #8e24aa;
  --accent: #1565c0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #eef1f5;
  color: var(--text-color);
  font-size: var(--font-size);
}

.hidden { display: none !important; }

.topbar {
  background: #12263a;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  flex-wrap: wrap;
  gap: 8px;
}
.topbar-title { font-weight: bold; font-size: 1.1em; }
.topbar-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-btn {
  background: #1e3a56;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85em;
}
.nav-btn:hover { background: #2c5279; }

#app {
  max-width: 900px;
  margin: 20px auto;
  padding: 0 12px;
}

.card {
  background: var(--bg-color);
  color: var(--text-color);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  margin-bottom: 16px;
}

.screen { display: none; }
.screen.active { display: block; }

h2 { margin-top: 0; }

input[type="text"], input[type="color"] {
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 1em;
  margin: 6px 0;
}

select {
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: #607d8b;
  color: white;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.95em;
  margin: 4px 4px 4px 0;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); }
.btn-secondary { background: #9e9e9e; }
.btn-small { padding: 6px 10px; font-size: 0.85em; }

.btn-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
}
.info-icon {
  color: var(--accent);
  font-weight: bold;
  cursor: help;
  border: 1px solid var(--accent);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75em;
}

.error-text { color: var(--red); font-weight: bold; }
.hint-text { color: #666; font-size: 0.9em; }

.room-code {
  font-size: 2.5em;
  font-weight: bold;
  letter-spacing: 0.15em;
  text-align: center;
  padding: 20px;
  background: #f0f0f0;
  border-radius: 10px;
  margin: 14px 0;
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.board-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.timer-text {
  margin-left: 12px;
  font-family: monospace;
  font-size: 1.1em;
  color: #444;
}

.bingo-banner {
  text-align: center;
  font-size: 1.8em;
  font-weight: bold;
  color: var(--purple);
  background: #f3e5f5;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}

.board-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.board-own { flex: 2; min-width: 280px; }
.board-opponent {
  flex: 1;
  min-width: 220px;
  background: var(--bg-color);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.grid {
  display: grid;
  gap: 5px;
  width: 100%;
}
.grid-cell {
  background: var(--bg-color);
  color: var(--text-color);
  border: 2px solid #ccc;
  border-radius: 6px;
  padding: 6px;
  text-align: center;
  cursor: pointer;
  font-weight: bold;
  font-size: var(--font-size);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70px;
  word-break: break-word;
  user-select: none;
}
.grid-small .grid-cell {
  min-height: 40px;
  font-size: 0.7em;
  cursor: default;
  padding: 3px;
}
.cell-white { background: var(--bg-color); color: var(--text-color); }
.cell-green { background: var(--green); color: white; }
.cell-red { background: var(--red); color: white; }
.cell-purple { background: var(--purple); color: white; }

.challenge-round { font-size: 1.2em; font-weight: bold; margin-top: 6px; }
.challenge-timer { font-size: 2.2em; font-family: monospace; margin: 10px 0; }
.challenge-score { font-size: 1.1em; font-weight: bold; margin-top: 12px; }

.challenge-task {
  padding: 10px;
  border-radius: 8px;
  border: 2px solid #ccc;
  margin-bottom: 8px;
  cursor: pointer;
  font-weight: bold;
}

.pool-list {
  list-style: none;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 6px;
}
.pool-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid #eee;
}
.pool-list li:last-child { border-bottom: none; }
.pool-remove-btn {
  background: var(--red);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  padding: 2px 8px;
}

.pool-add-row { display: flex; gap: 6px; margin-top: 10px; }
.pool-add-row input { flex: 1; }

.score-list {
  list-style: none;
  padding: 0;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 10px;
}
.score-list li { padding: 6px 10px; border-bottom: 1px solid #eee; }
.score-list li.category-header {
  font-weight: bold;
  background: #f0f0f0;
}

.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-content {
  max-width: 500px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-actions { margin-top: 14px; }

@media (max-width: 600px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .board-layout { flex-direction: column; }
}
