* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 1rem;
  background: #0f1419;
  color: #e7ecf3;
  line-height: 1.4;
}

main {
  max-width: 32rem;
  margin: 0 auto;
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 1rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.page-header h1 {
  margin: 0;
  min-width: 0;
}

.page-header-action {
  width: auto;
  margin: 0;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.panel {
  background: #1a2332;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.hidden {
  display: none !important;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: #9fb0c7;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  font-size: 1.1rem;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f1419;
  color: #e7ecf3;
  margin-bottom: 0.75rem;
}

select {
  width: 100%;
  font-size: 1.1rem;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f1419;
  color: #e7ecf3;
  margin-bottom: 0.75rem;
}

.play-stage {
  position: relative;
}

body[data-page="play"] .reveal-layout {
  padding: 0;
  background: transparent;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.panel-toolbar-meta {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.panel-toolbar h2.panel-toolbar-meta {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9fb0c7;
}

.panel-toolbar-menu {
  position: relative;
  flex-shrink: 0;
}

.game-menu {
  position: relative;
}

.game-menu-toggle {
  width: auto;
  min-width: 2.25rem;
  margin: 0;
  padding: 0.35rem 0.55rem;
  background: transparent;
  color: #9fb0c7;
  font-size: 1.35rem;
  line-height: 1;
  border-radius: 8px;
}

.game-menu-toggle:hover {
  color: #e7ecf3;
  background: #334155;
}

.game-menu-dropdown {
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  min-width: 11rem;
  background: #1a2332;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 0.35rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.game-menu-item {
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.75rem;
  text-align: left;
  background: transparent;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 8px;
}

.game-menu-item:hover {
  background: #334155;
}

.game-menu-item.danger-text {
  color: #f87171;
}

button {
  width: 100%;
  font-size: 1.1rem;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 10px;
  background: #3b82f6;
  color: white;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.secondary {
  background: #334155;
}

button.danger {
  background: #dc2626;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 25, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.confirm-dialog {
  width: 100%;
  max-width: 22rem;
  margin: 0;
}

.confirm-dialog h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 1rem;
}

.confirm-actions button {
  margin-top: 0;
}

.room-code {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-align: center;
  margin: 0.5rem 0 1rem;
}

.room-title {
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 0.75rem;
}

.status {
  color: #9fb0c7;
  font-size: 0.95rem;
}

.prompt {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.timer {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin: 0.25rem 0 0.75rem;
  color: #fbbf24;
}

.wager-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.wager-btn {
  width: auto;
  min-width: 2.75rem;
  margin-top: 0;
  padding: 0.65rem 0.85rem;
  background: #334155;
}

.wager-btn.selected {
  background: #3b82f6;
  box-shadow: 0 0 0 2px #93c5fd;
}

.wager-btn.used {
  opacity: 0.55;
  background: #1e293b;
  color: #64748b;
  cursor: not-allowed;
}

.wager-btn.used:disabled {
  opacity: 0.55;
}

.answer-override {
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 0.15em;
}

td.correct {
  color: #4ade80;
  font-weight: 600;
}

td.incorrect {
  color: #f87171;
  font-weight: 600;
}

td.no-answer {
  color: #64748b;
  font-style: italic;
  font-weight: 400;
}

.points-gain {
  color: #4ade80;
}

.points-loss {
  color: #f87171;
}

.round-points-earned {
  color: #4ade80;
  font-weight: 600;
}

.total-score {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.score-updated {
  color: #4ade80;
  transition: color 0.4s ease;
}

.position-cell {
  color: #94a3b8;
  font-weight: 600;
  white-space: nowrap;
}

#round-countdown {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fbbf24;
  margin-bottom: 0.75rem;
}

.reveal-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: transparent;
}

.reveal-question-card,
.reveal-scoreboard-card {
  background: #1a2332;
  border-radius: 12px;
  padding: 1rem;
}

.reveal-scoreboard-heading {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9fb0c7;
  margin: 0 0 0.5rem;
}

.reveal-prompt {
  margin-bottom: 0;
}

.reveal-answer-block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #334155;
}

.reveal-answer-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9fb0c7;
  margin-bottom: 0.35rem;
}

.reveal-answer {
  font-size: 1.35rem;
  font-weight: 700;
  color: #4ade80;
  margin: 0;
}

.reveal-answer-pending {
  font-size: 1.35rem;
  color: #64748b;
  margin: 0;
}

.reveal-answer-block.is-pending .reveal-answer-label {
  margin-bottom: 0.15rem;
}

.reveal-scoreboard-card table {
  margin-top: 0.5rem;
}

.reveal-scoreboard-card button {
  margin-top: 1rem;
}

#scores-panel .scores-card {
  margin-top: 0;
  padding: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#scores-panel .scores-card button {
  margin-top: 0;
}

.scores-heading {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9fb0c7;
  margin: 0 0 0.5rem;
}

#wait-host-btn:disabled,
#wait-host-scores-btn:disabled {
  opacity: 0.55;
  cursor: default;
  background: #334155;
}

.value-animating {
  color: #fbbf24;
  font-weight: 700;
}

td.total-score.value-animating {
  color: #4ade80;
}

.answer-pending {
  color: #64748b;
}

.pending-dots span {
  animation: pending-dot 1.2s infinite both;
}

.pending-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.pending-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pending-dot {
  0%,
  80%,
  100% {
    opacity: 0.2;
  }
  40% {
    opacity: 1;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0;
  border-bottom: 1px solid #334155;
}

.correct {
  color: #4ade80;
}

.incorrect {
  color: #f87171;
}

.error {
  color: #f87171;
  margin-top: 0.5rem;
}

.entry-main {
  max-width: 32rem;
}

.entry-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.entry-card {
  margin-bottom: 0;
}

.entry-heading {
  font-size: 1.25rem;
  margin: 0 0 1rem;
}

.entry-mode-toggle {
  margin-top: 0;
}

.lobby-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lobby-room-name {
  font-size: 1.35rem;
  font-weight: 700;
  text-align: left;
  margin: 0 0 1rem;
}

.lobby-section-heading {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9fb0c7;
  margin: 0 0 0.75rem;
}

.lobby-field {
  margin-bottom: 0.75rem;
}

.lobby-field:last-of-type {
  margin-bottom: 0;
}

.lobby-field-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: #9fb0c7;
}

.lobby-field-value {
  display: block;
}

.lobby-field-code .lobby-room-code {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  margin: 0;
  text-align: left;
}

.lobby-readonly {
  display: block;
  font-size: 1.1rem;
  color: #e7ecf3;
  padding: 0.75rem 0;
}

.lobby-room-panel .host-only#start-btn {
  margin-top: 1rem;
}

.lobby-cta {
  margin-top: 0;
  padding-top: 0.75rem;
}

.lobby-cta-hint {
  margin: 0 0 0.75rem;
  color: #9fb0c7;
  font-size: 0.95rem;
  text-align: center;
}

.lobby-cta button {
  width: 100%;
}

.lobby-players-table {
  margin-top: 0;
}

.lobby-players-table th,
.lobby-players-table td {
  vertical-align: middle;
}

.lobby-players-table .name-cell-inner,
.lobby-players-table .status-cell-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  vertical-align: middle;
}

.lobby-host-star {
  color: #fbbf24;
  font-size: 0.95rem;
  line-height: 1;
}

.lobby-ready-mark {
  display: inline-block;
  line-height: 1;
}

.lobby-ready-yes {
  color: #4ade80;
  font-weight: 700;
}

.lobby-ready-no {
  color: #5a6a82;
}

#start-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.lobby-players-panel .status {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.status-cell-inner .status-indicator {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-connected {
  background: #4ade80;
}

.status-away {
  background: #fbbf24;
}

.status-disconnected {
  background: #f87171;
}

.status-label {
  color: #e7ecf3;
  font-size: 0.95rem;
}
