/* Bestpardy: deliberately plain. Blue board, yellow text, black borders. */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }
body {
  background: #2a3698;
  color: #fff;
  font: 13px/1.35 Verdana, Arial, Helvetica, sans-serif;
}
a { color: #ffff5f; }
h1 { margin: 0 0 8px; font-size: 18px; }
h2 { margin: 0 0 6px; font-size: 14px; }
p { margin: 0 0 6px; }
code, kbd { padding: 0 2px; background: #fff; color: #000; font-family: monospace; }
.muted { color: #666; }
.hint { color: #555; font-size: 11px; }
.center { text-align: center; }
.centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}
.big { font-size: 24px; font-weight: bold; }
.top-gap { margin-top: 8px; }

/* controls */

.btn {
  display: inline-block;
  padding: 4px 8px;
  border: 2px solid #000;
  background: #efefef;
  color: #000;
  font: inherit;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: #ffff5f; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { background: #ffff5f; }
.btn.good { background: #99ff99; }
.btn.bad { background: #ff9999; }
.btn.small { padding: 2px 5px; font-size: 11px; }
.btn.ghost { background: transparent; color: #fff; border-color: #fff; }
.btn.ghost:hover { background: #fff; color: #000; }

label { display: block; margin: 0 0 6px; font-size: 11px; }
input, select, textarea {
  display: block;
  width: 100%;
  padding: 4px 5px;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  font: inherit;
}
textarea { font-family: monospace; font-size: 11px; }
.stack { display: grid; gap: 8px; }
.form-error { padding: 4px 6px; border: 2px solid #000; background: #ff9999; color: #000; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 6px 0; }
.button-row select { width: auto; min-width: 10rem; }

/* simple pages */

.centered-page { display: grid; place-items: center; min-height: 100dvh; padding: 12px; }
.page-card {
  width: 100%;
  max-width: 22rem;
  padding: 16px;
  border: 3px solid #000;
  background: #efefef;
  color: #000;
}
.page-card a, .page-card .muted, .page-card .hint { color: #000; }

/* dashboard */

.dashboard-page { padding: 10px; }
.dashboard-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
}
.dashboard-header h1 { margin: 0; }
.dashboard-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.dashboard-nav form { margin: 0; }
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: start;
  gap: 8px;
  max-width: 1200px;
}
.card { padding: 10px; border: 2px solid #000; background: #efefef; color: #000; }
.card .btn { background: #fff; }
.card .btn:hover { background: #ffff5f; }
.card .btn.primary { background: #ffff5f; }
.card .btn.bad { background: #ff9999; }
.game-code-big { margin: 2px 0 6px; font: bold 40px/1 monospace; letter-spacing: 4px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.card-head h2 { margin: 0; }
#board-json { min-height: 24rem; }
.status-line { min-height: 1.2em; margin: 4px 0 0; font-size: 11px; }
.status-line.ok { color: #060; }
.status-line.err { color: #900; }
.board-items { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.board-items li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 0;
  border-bottom: 1px solid #999;
}
.board-link { padding: 0; border: 0; background: none; color: #000; font: inherit; text-align: left; cursor: pointer; }
.board-link span { margin-left: 6px; color: #555; font-size: 11px; }
.board-list { grid-column: 1 / -1; }

/* big screen */

.table-page { height: 100dvh; overflow: hidden; }
.table-shell { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 6px; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; }
.game-code { font: bold 22px/1 monospace; letter-spacing: 3px; }
.phase-label { color: #ffff5f; font-weight: bold; }
.selected-label { color: #ddd; }
.top-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }

.table-main { display: flex; flex: 1; gap: 6px; min-height: 0; }
.stage { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; min-height: 0; }
.stage-body { flex: 1; min-height: 0; }
.side { display: flex; flex-direction: column; gap: 6px; width: 230px; min-height: 0; overflow: auto; }
.side details { padding: 4px 6px; border: 2px solid #000; background: #efefef; color: #000; }
.side details summary { font-size: 11px; font-weight: bold; cursor: pointer; }
.side details input, .side details select { margin: 4px 0; padding: 2px 4px; border-width: 1px; font-size: 11px; }
.side details .btn { padding: 2px 4px; font-size: 11px; }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.button-grid.three { grid-template-columns: 1fr 1fr 1fr; }

.scores { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 6px; }
.scores .muted { color: #ddd; }
.score-team {
  min-width: 112px;
  padding: 4px 10px;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  text-align: center;
}
.score-team.selected { background: #ffff5f; }
.score-team.has-word { outline: 3px solid #ffff5f; }
.score-team.offline { opacity: 0.65; }
.score-team .name {
  display: block;
  max-width: 14rem;
  overflow: hidden;
  font-size: 12px;
  font-weight: bold;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.score-team .value { display: block; margin-top: 2px; padding: 2px 6px; background: #2a3698; color: #fff; font-size: 20px; font-weight: bold; }
.score-team .value.negative { color: #ff9999; }

.last-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 6px;
  border: 2px solid #000;
  background: #efefef;
  color: #000;
  font-size: 11px;
}
.last-result .btn { padding: 1px 4px; border-width: 1px; background: #fff; color: #000; }
.lr-question { font-weight: bold; }

.private { padding: 6px 8px; border: 2px solid #000; background: #ffff5f; color: #000; }
.private-label { margin: 0 0 3px; font-size: 10px; font-weight: bold; text-transform: uppercase; }
.private-question-text { margin: 0; font-size: 15px; font-weight: bold; line-height: 1.25; }
.private-bonus { margin: 3px 0 0; padding-top: 3px; border-top: 1px solid #000; font-size: 12px; }

/* board */

.board-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 6), minmax(0, 1fr));
  gap: 2px;
  height: 100%;
  border: 2px solid #000;
  background: #000;
}
.board-cat, .board-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 2px;
  overflow: hidden;
  border: 0;
  text-align: center;
}
.board-cat {
  background: #2a3698;
  color: #fff;
  font-size: var(--cat-size, 14px);
  font-weight: bold;
  line-height: 1.05;
  text-transform: uppercase;
}
.board-cell {
  background: #2a3698;
  color: #ffff5f;
  font-family: inherit;
  font-size: var(--value-size, 24px);
  font-weight: bold;
  cursor: pointer;
}
.board-cell:hover { background: #35409d; }
.board-cell:disabled { opacity: 1; cursor: default; }
.board-cell.used, .board-cell.used:disabled { background: #151b4b; color: #151b4b; pointer-events: none; }

/* clue */

.clue-stage { display: flex; height: 100%; }
.clue-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  padding: 6px;
  border: 3px solid #ffff5f;
  background: #2a3698;
}
.clue-card.centered { justify-content: center; text-align: center; }
.clue-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.clue-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 11px; }
.clue-category { font-weight: bold; text-transform: uppercase; }
.clue-value { color: #ffff5f; font-size: 14px; font-weight: bold; }
.tag { padding: 0 3px; border: 1px solid #fff; font-size: 9px; text-transform: uppercase; }
.timer { color: #ffff5f; font: bold 22px/1 monospace; }
.timer.low { color: #ff9999; }
.timer.done { color: #fff; font-size: 12px; }
.timer.paused, .player-timer.paused { color: #ddd; }
.timer.paused::after, .player-timer.paused::after {
  content: " pausad";
  font: bold 11px Verdana, Arial, Helvetica, sans-serif;
  text-transform: uppercase;
}
.clue-answer-wrap.pausable { cursor: pointer; }
.clue-answer-wrap {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 0;
  padding: 4px;
  overflow: hidden;
}
.clue-answer { font-weight: bold; line-height: 1.15; text-align: center; white-space: pre-wrap; }
.clue-answer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.clue-question {
  max-height: 35%;
  padding-top: 4px;
  overflow: hidden;
  border-top: 3px dotted #fff;
  color: #ffff5f;
  font-weight: bold;
  text-align: center;
}
.clue-status { min-height: 1.2em; font-size: 11px; text-align: center; }
.wager-stage { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; }

/* player */

.player-shell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 100dvh;
  max-width: 34rem;
  margin: 0 auto;
  padding: 8px;
}
.player-header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.player-team { font-size: 20px; font-weight: bold; }
.player-score { color: #ffff5f; font-size: 22px; font-weight: bold; }
.player-stage { display: flex; flex: 1; flex-direction: column; justify-content: center; gap: 6px; }
.player-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 2px solid #000;
  background: #2a3698;
}
.player-card.centered { justify-content: center; min-height: 40vh; }
.player-card .clue-meta { justify-content: center; margin: 0; }
.player-clue-text {
  overflow-wrap: anywhere;
  font-size: 18px;
  font-weight: bold;
  line-height: 1.25;
  text-align: center;
}
.player-clue-text img { max-width: 100%; max-height: 30vh; object-fit: contain; }
.player-question {
  padding-top: 6px;
  border-top: 3px dotted #fff;
  color: #ffff5f;
  font-weight: bold;
  line-height: 1.2;
  text-align: center;
}
.player-timer { color: #ffff5f; font: bold 32px/1 monospace; text-align: center; }
.player-timer.low { color: #ff9999; }
.big-grab {
  width: 100%;
  min-height: 30vh;
  border: 4px solid #000;
  background: #ffff5f;
  color: #000;
  font: bold 34px/1 Verdana, Arial, Helvetica, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
.big-grab:active { background: #e6e600; }
.big-grab:disabled { opacity: 0.5; cursor: default; }
.grab-note { margin: 0; color: #ddd; font-size: 11px; text-align: center; }
.wager-box { display: grid; gap: 6px; }
.wager-box input { font-size: 24px; font-weight: bold; text-align: center; }
.wager-box .btn { padding: 8px; font-size: 18px; }
.player-board { height: min(55vh, 26rem); }
.player-board .board-cat { font-size: clamp(8px, 2vw, 13px); }
.player-board .board-cell { font-size: clamp(12px, 3.5vw, 22px); }

.team-details { border: 2px solid #000; background: #efefef; color: #000; }
.team-details summary { padding: 3px 6px; font-weight: bold; cursor: pointer; }
.team-panel { display: grid; gap: 6px; padding: 6px; }
.team-details .btn { padding: 2px 5px; border-color: #000; background: #fff; color: #000; font-size: 11px; }
.team-details .btn:hover { background: #ffff5f; }
.team-card { padding-top: 6px; border-top: 1px solid #999; }
.team-card h2 { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; }
.team-card-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.team-card-name { font-weight: bold; }
.member-list, .request-list { display: grid; gap: 2px; margin: 4px 0 0; padding: 0; list-style: none; }
.member-row, .request-row, .other-team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 12px;
}
.you { margin-left: 4px; color: #060; font-size: 10px; }
.request-row { padding: 2px 4px; border: 1px solid #000; background: #ffff5f; }
.other-teams { display: grid; gap: 2px; }
.other-team-row { padding: 2px 0; border-bottom: 1px solid #ccc; }
.connection { padding: 3px 6px; border: 2px solid #000; background: #ffff5f; color: #000; font-size: 11px; text-align: center; }

.join-gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.6);
}
.join-gate .page-card { max-width: 22rem; }

/* rules */

.rules-body { display: grid; gap: 2px; margin-top: 4px; }
.rule-row { display: grid; grid-template-columns: 1fr 84px; align-items: center; gap: 4px; font-size: 10px; }
.rule-row label { margin: 0; color: #000; font-size: 10px; }
.rule-row input, .rule-row select { width: 100%; padding: 1px 2px; border-width: 1px; font-size: 10px; }
.rule-row input[type="checkbox"] { width: auto; justify-self: start; }
.rule-note { grid-column: 1 / -1; margin: 2px 0 0; color: #555; font-size: 9px; }

/* toasts and banner */

.toasts {
  position: fixed;
  bottom: 12px;
  left: 50%;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(90vw, 30rem);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast { padding: 4px 8px; border: 2px solid #000; background: #efefef; color: #000; font-size: 12px; }
.toast.error { background: #ff9999; }
.toast.good { background: #99ff99; }

.new-banner {
  position: fixed;
  top: 8px;
  left: 50%;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border: 2px solid #000;
  background: #efefef;
  color: #000;
  font-size: 11px;
  transform: translateX(-50%);
}
.new-banner .btn { border-color: #000; background: #fff; color: #000; }

@media (max-width: 760px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .table-page { height: auto; min-height: 100dvh; overflow: auto; }
  .table-shell { height: auto; min-height: 100dvh; }
  .table-main { flex-direction: column; }
  .side { width: auto; }
  .stage-body { min-height: 60vh; }
  .game-code { font-size: 18px; }
}
