/* Party lobbies share the Ritual Paint Win95 / Y2K chrome. */
:root {
  --face: #c0c0c0;
  --hi: #fff;
  --sh: #404040;
  --navy: #000080;
  --ink: #111;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  min-height: 100dvh;
  background: #c0c0c0;
  color: var(--ink);
  font: 12px/1.35 Tahoma, "MS Sans Serif", Arial, sans-serif;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 1px dotted #000; outline-offset: 2px; }
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  padding: 4px 6px 4px 8px;
  font-weight: 700;
}
.titlebar .t { flex: 1; }
.menubar {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  padding: 2px 4px;
  min-height: 24px;
}
.menubar a, .menubar button.menu {
  color: #111;
  background: transparent;
  border: 0;
  text-decoration: none;
  padding: 2px 7px;
}
.menubar a:hover, .menubar button.menu:hover { background: #000080; color: #fff; }
.room-wait { display: flex; flex-direction: column; gap: 8px; min-height: 100%; }
.room-wait[hidden] { display: none !important; }
.room-wait .key { font-size: 42px; letter-spacing: 3px; }
.room-count { margin: 0; font: 700 16px/1.3 Tahoma, Arial, sans-serif; }
.room-start { min-height: 52px; font: 700 18px/1 Tahoma, Arial, sans-serif; }
.room-wait .players {
  flex: 1;
  min-height: 140px;
  margin: 0;
  align-content: start;
  background: #fff;
  border: 2px solid;
  border-color: #404040 #fff #fff #404040;
  padding: 4px;
}
.mode-tabs { display: flex; gap: 3px; padding: 4px 6px 0; }
.mode-tab {
  font-weight: 700;
  font-size: 10px;
  text-decoration: none;
  color: #111;
  background: #a8a8a8;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  padding: 4px 8px;
}
.mode-tab.on { background: #c0c0c0; border-color: #404040 #fff #fff #404040; }
.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
}
.stage { min-width: 0; min-height: 0; overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.chat {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  background: #c0c0c0;
}
.chat h2 {
  margin: 0;
  padding: 6px 8px 2px;
  font-size: 11px;
  letter-spacing: 0.4px;
}
.chat-log {
  flex: 1;
  min-height: 120px;
  margin: 4px 8px;
  padding: 6px;
  list-style: none;
  overflow: auto;
  background: #fff;
  border: 2px solid;
  border-color: #404040 #fff #fff #404040;
}
.chat-log li { margin: 0 0 6px; overflow-wrap: anywhere; }
.chat-log .system { color: #000080; font-style: italic; }
.chat form { display: flex; gap: 4px; padding: 0 8px 8px; }
.chat input[type="text"] { flex: 1; min-width: 0; }
.chat-note { margin: 0 8px 8px; color: #333; }
.panel, .inset, dialog {
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  padding: 8px;
}
.inset {
  border-color: #404040 #fff #fff #404040;
  background: #fff;
}
.hub-grid, .room-grid { display: grid; gap: 8px; }
@media (min-width: 860px) {
  .hub-grid { grid-template-columns: 1.2fr 0.8fr; align-items: start; }
}
fieldset { border: 2px solid; border-color: #fff #404040 #404040 #fff; margin: 0 0 8px; padding: 8px; }
legend { padding: 0 4px; font-weight: 700; }
label { display: grid; gap: 3px; margin-bottom: 8px; font-size: 11px; font-weight: 700; }
.choices { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.choices label { display: flex; align-items: center; gap: 4px; margin: 0; font-weight: 400; }
input[type="text"], input[type="search"], textarea, input[type="color"], input[type="range"] {
  width: 100%;
  background: #fff;
  border: 2px solid;
  border-color: #404040 #fff #fff #404040;
  padding: 4px 6px;
  font-size: 16px;
}
textarea { min-height: 88px; resize: vertical; }
.btn {
  background: #c0c0c0;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  padding: 4px 10px;
  color: #111;
}
.btn:hover:not(:disabled) { background: #d7d7d7; }
.btn:active:not(:disabled), .btn.on {
  border-color: #404040 #fff #fff #404040;
  box-shadow: inset 1px 1px #808080;
}
.btn:disabled { color: #808080; }
.btn.tiny { padding: 1px 6px; font-size: 11px; }
#roomPalette { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 6px 0; }
#roomPalette[hidden] { display: none !important; }
#roomPalette .swatch {
  width: 22px; height: 22px; padding: 0;
  border: 2px solid; border-color: #fff #404040 #404040 #fff;
}
#roomPalette .swatch.on { outline: 1px solid #000; }
#roomPalette input[type="color"] {
  width: 36px; height: 22px; padding: 0; flex: 0 0 auto;
}
.filmstrip { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.filmstrip .btn { min-height: 28px; }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.key {
  font: 700 28px/1 "Arial Black", Tahoma, sans-serif;
  letter-spacing: 2px;
  color: #000080;
  margin: 0;
}
.meta { margin: 4px 0; }
.players, .public-list, .score-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.players li, .public-list li, .score-list li {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  background: #fff;
  border: 2px solid;
  border-color: #404040 #fff #fff #404040;
}
.public-list li { align-items: flex-start; flex-wrap: wrap; }
.public-list code { font-weight: 700; color: #000080; }
.players .away { color: #666; }
.playbar { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.playbar p { margin: 0; font-weight: 700; }
.clock { font: 700 22px/1 Tahoma, Arial, sans-serif; color: #000080; min-width: 3.4em; text-align: right; }
.live-board { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.live-board h2 { margin: 0; font-size: 11px; }
.live-board .score-list { display: flex; flex-wrap: wrap; gap: 4px; }
.live-board .score-list li { width: auto; min-width: 120px; }
.timer-track { height: 8px; background: #808080; border: 2px solid; border-color: #404040 #fff #fff #404040; }
.timer-track i { display: block; height: 100%; width: 0; background: #000080; }
.prompt {
  margin: 0;
  padding: 8px;
  background: #ffffc0;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  font-weight: 700;
}
.board-wrap { display: grid; gap: 6px; }
.board-view {
  overflow: auto;
  touch-action: none;
  overscroll-behavior: contain;
  max-height: none;
  flex: 1;
  min-height: 0;
  background: #808080;
  border: 2px solid;
  border-color: #404040 #fff #fff #404040;
}
canvas#board {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: #fff;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
}
canvas#board.pixels-crisp { image-rendering: pixelated; }
.tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatches { display: flex; gap: 3px; }
.swatches button {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
}
.size { display: flex; align-items: center; gap: 4px; min-width: 140px; font-weight: 400; }
.size input { font-size: 12px; }
.reveal-controls { display: flex; gap: 6px; align-items: center; }
.reveal-caption { min-height: 2.6em; margin: 0; font-size: 16px; }
.status {
  border-top: 2px solid #fff;
  padding: 3px 8px;
  font-size: 11px;
  background: #c0c0c0;
}
dialog { max-width: 420px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog h2 { margin: 0 0 8px; font-size: 14px; color: #000080; }
dialog p { margin: 0 0 8px; }
@media (min-width: 801px) {
  html, body { height: 100dvh; overflow: hidden; }
  .shell { height: 100dvh; max-height: 100dvh; overflow: hidden; }
  .workspace { flex: 1; min-height: 0; }
  .stage { min-height: 0; overflow: auto; }
  #hub { min-height: 100%; }
  .hub-grid { align-items: stretch; min-height: 100%; }
  .hub-grid > .panel, .hub-grid > form.panel { height: 100%; }
  #play { display: flex; flex-direction: column; min-height: 0; height: 100%; }
  #room:not([hidden]) { flex: 1; min-height: 0; }
  #play[hidden] { display: none !important; }
  .board-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .board-view { display: flex; align-items: center; justify-content: center; }
  canvas#board { width: auto; max-width: 100%; max-height: 100%; height: auto; }
}
@media (max-width: 800px) {
  .shell { height: 100dvh; overflow: hidden; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(168px, 36dvh); min-height: 0; }
  .chat { border-left: 0; border-top: 2px solid #fff; }
  .stage { padding: 6px; min-height: 0; }
  #play { overflow: auto; min-height: 0; }
  .board-view { max-height: 28dvh; }
  #reveal, #scoreboard { flex: 0 0 auto; }
  #keepMine { width: 100%; min-height: 44px; margin: 6px 0; }
  #keepMine[hidden] { display: none !important; }
  .tools { position: sticky; bottom: 0; background: #c0c0c0; padding: 4px 0; z-index: 2; }
  .tools .btn { min-height: 44px; min-width: 44px; font-size: 12px; }
  .swatches button, #roomPalette .swatch { width: 32px; height: 32px; }
  .filmstrip .btn { min-height: 44px; }
  html, body { max-width: 100%; }
  .titlebar .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menubar { flex-wrap: wrap; overflow: hidden; }
  .mode-tabs { flex-wrap: wrap; }
  .size { min-width: 0; }
  .hub-grid, .panel, .stage, .chat, form, fieldset { min-width: 0; max-width: 100%; }
  .shell { padding-bottom: env(safe-area-inset-bottom); }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; animation: none !important; }
  .btn, dialog, .mode-tab { transition: none; }
}
html, body, .chat-log, .board-view, .stage, dialog {
  --scrollbar-thumb: #404040;
  --scrollbar-track: #c0c0c0;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: auto;
}
.btn, .mode-tab, dialog, input, textarea, select { border-radius: 0; }
@supports not (scrollbar-color: auto) {
  .chat-log::-webkit-scrollbar,
  .board-view::-webkit-scrollbar,
  .stage::-webkit-scrollbar {
    width: 16px;
    height: 16px;
  }
  .chat-log::-webkit-scrollbar-thumb,
  .board-view::-webkit-scrollbar-thumb,
  .stage::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); }
  .chat-log::-webkit-scrollbar-track,
  .board-view::-webkit-scrollbar-track,
  .stage::-webkit-scrollbar-track { background: var(--scrollbar-track); }
}
/* Stay grey if a site skin is forced onto this document. */
html.rr-halloween body.rr-halloween {
  color-scheme: light;
  background: #c0c0c0;
  background-image: none;
  color: #111;
  accent-color: #000080;
}
html.rr-halloween body.rr-halloween ::selection { background: #000080; color: #fff; }
html.rr-halloween:has(body) {
  color-scheme: light;
  --rr-g: #161616;
  --rr-bg: #c0c0c0;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
