/* Browser-only deployment: room panel on the main screen and on-screen controls on the touchscreen. */
#roomOverlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-family: inherit;
}
#roomOverlay .room-card {
  text-align: center;
  max-width: 640px;
  padding: 32px 40px;
  border: 2px solid #3cf;
  border-radius: 16px;
  background: rgba(10, 20, 40, 0.9);
}
#roomOverlay h1 {
  margin: 0 0 8px;
}
#roomOverlay .room-code {
  font-size: 2.4em;
  letter-spacing: 0.2em;
  color: #3cf;
}
#roomOverlay .room-qr {
  width: 300px;
  height: 300px;
  margin: 16px auto;
  background: #fff;
}
#roomOverlay .room-qr svg {
  width: 100%;
  height: 100%;
}
#roomOverlay .room-link {
  font-size: 0.8em;
  word-break: break-all;
  opacity: 0.8;
}
#roomOverlay button {
  margin-top: 16px;
  font-size: 1.4em;
  padding: 12px 32px;
  cursor: pointer;
}
#roomBadge {
  position: fixed;
  right: 12px;
  bottom: 8px;
  z-index: 9999;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 10px;
  border-radius: 6px;
}

/* Touchscreen: on-screen panel that replaces the physical switches */
.switch-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 16px;
  max-width: 720px;
  margin: 24px auto;
}
.switch-panel button,
.card-picker button {
  min-height: 72px;
  font-size: 1.1em;
  border-radius: 10px;
  border: 2px solid #888;
  background: #222;
  color: #eee;
  cursor: pointer;
}
.switch-panel button:active,
.card-picker button:active {
  transform: scale(0.97);
}
.card-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 16px;
  max-width: 640px;
  margin: 24px auto;
}
.card-picker button {
  min-height: 110px;
  font-family: monospace;
  white-space: pre-line;
}
.card-picker button.selected {
  border-color: #3cf;
}
@media (max-width: 600px) {
  .switch-panel {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Touchscreen on phones and small tablets (original layout targets a large embedded panel) */
@media (max-width: 900px) {
  html.touchscreen body { font-size: 18px; padding: 12px; overflow-x: hidden; }
  html.touchscreen h1 { font-size: 30px !important; line-height: 1.2; }
  html.touchscreen p, html.touchscreen li { font-size: 18px !important; }
  html.touchscreen .xy-centered-content { position: static !important; transform: none !important; width: auto !important; margin: 0 auto; }
  html.touchscreen .start-game-button { font-size: 28px !important; width: 100% !important; padding: 16px !important; }
  html.touchscreen .red-button-circle { width: 140px !important; height: 140px !important; font-size: 18px !important; }
  html.touchscreen .keypad-container { width: 100% !important; max-width: 360px; }
  html.touchscreen .keypad-display, html.touchscreen #keypadDisplay { font-size: 36px !important; }
  html.touchscreen .keypad-button { font-size: 32px !important; min-height: 64px; }
  html.touchscreen .styled-question-button { width: 100% !important; font-size: 18px !important; margin: 8px 0 !important; padding: 14px !important; }
  html.touchscreen .switch-panel button { min-height: 60px; font-size: 15px; }
  html.touchscreen .card-picker { grid-template-columns: 1fr; }
  html.touchscreen .card-picker button { min-height: 80px; font-size: 15px; }
}
