[hidden] { display: none !important; }

:root {
  --fg: #e3d8c4;
  --dim: #9a8f7c;
  --accent: #d2691e;
  --accent2: #e8a33d;
  --panel: rgba(18, 12, 6, 0.82);
  --edge: rgba(210, 105, 30, 0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--fg);
  font: 15px/1.45 Tahoma, Verdana, "DejaVu Sans", sans-serif;
  overflow: hidden;
}

#backdrop {
  position: fixed;
  inset: 0;
  background: #000 url("../data/kknd2.jpg") center / cover no-repeat;
  filter: brightness(0.45) saturate(0.85);
}

#launcher {
  position: relative;
  max-width: 520px;
  max-height: 100vh;
  overflow-y: auto;
  margin: 0 auto;
  padding: 5vh 16px 24px;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: 40px;
  letter-spacing: 0.1em;
  color: #fff;
  text-shadow: 0 0 14px var(--accent), 2px 2px 0 #000;
}
h1 span { display: block; font-size: 18px; letter-spacing: 0.5em; color: var(--accent2); text-shadow: 1px 1px 0 #000; }

.tagline { margin: 6px 0 20px; color: var(--dim); }

.panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 2px;
  padding: 14px 18px;
  margin-bottom: 14px;
  text-align: left;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.6);
}
.panel h2 { margin: 0 0 8px; font-size: 16px; color: var(--accent2); letter-spacing: 0.06em; }

label { display: block; color: var(--dim); margin-bottom: 4px; }

input#nick, input#password {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--edge);
  outline: none;
}
input:focus { border-color: var(--accent2); }
#password-row { margin-top: 10px; }

button {
  font: bold 14px Tahoma, Verdana, sans-serif;
  color: #fff;
  background: linear-gradient(#b5561a, #6e300b);
  border: 1px solid var(--accent2);
  padding: 7px 14px;
  cursor: pointer;
}
button:hover:not(:disabled) { background: linear-gradient(#d0682a, #85400f); }
button:disabled { opacity: 0.45; cursor: default; }
button#host { width: 100%; margin-top: 12px; padding: 10px; font-size: 16px; letter-spacing: 0.15em; text-transform: uppercase; }

#status { min-height: 1.4em; margin: 8px 0 0; color: var(--accent2); font-size: 13px; }

#games { list-style: none; margin: 0; padding: 0; }
#games li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid rgba(210, 105, 30, 0.2);
}
#games li:first-child { border-top: 0; }
.game-name { font-weight: bold; color: #fff; }
.game-meta { grid-column: 1; font-size: 12px; color: var(--dim); }
#games button { grid-row: 1 / span 2; grid-column: 2; }
.dim { color: var(--dim); font-size: 13px; margin: 0; }

.hint { color: var(--dim); font-size: 12px; }
.hint a, .helplink { color: var(--accent2); }
kbd { border: 1px solid var(--dim); padding: 0 4px; border-radius: 2px; font-size: 11px; }

/* covers the start page while the game loads */
#loading {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}
#loading .panel { width: min(480px, 85vw); margin: 0; text-align: center; }
#loading-text { margin: 0 0 10px; }
#loading .bar { height: 6px; background: rgba(255, 255, 255, 0.15); }
#loading-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

#canvas {
  position: fixed;
  display: block;
  outline: none;
  background: #000;
  z-index: 1;
  image-rendering: pixelated;
  touch-action: none;
}

/* the game draws its own cursor. A transparent image as well as "none": Firefox doesn't always
   hide the pointer over the canvas with "none" alone (e.g. while it is captured). */
html.playing, html.playing body, html.playing #canvas {
  cursor: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR4nGNgYGBgAAAABQABpfZFQAAAAABJRU5ErkJggg==") 0 0, none;
}
html.playing #crash, html.playing #toast, html.playing #voice { cursor: default; }

#crash {
  position: fixed;
  top: 30vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 90vw);
  z-index: 3;
}
#crash h2 { margin: 0 0 8px; color: var(--accent2); }
#crash p { word-break: break-word; white-space: pre-wrap; max-height: 40vh; overflow: auto; }

#toast {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  background: var(--panel);
  border: 1px solid var(--accent2);
  padding: 8px 14px;
  max-width: 90vw;
}

/* voice chat (placed by voice.js): faint until the mouse is on it or somebody talks */
#voice {
  position: fixed;
  top: 6px;
  left: 6px;
  z-index: 3;
  font-size: 12px;
  opacity: 0.55;
  transition: opacity 0.2s;
}
#voice:hover, #voice:has(.talking) { opacity: 0.95; }
.voice-buttons { display: flex; gap: 4px; }
#voice button { font-size: 12px; padding: 3px 8px; }
#voice-mic.on { background: linear-gradient(#3f8a2a, #1f4f12); border-color: #8fd16a; }
#voice-peers { list-style: none; margin: 4px 0 0; padding: 0; }
#voice-peers li { padding: 1px 6px; background: var(--panel); text-shadow: 1px 1px 0 #000; }
#voice-peers li.talking { color: #8fd16a; }
#voice-peers li.talking::before { content: "\25B6  "; }

/* help page */
body.doc { overflow: auto; background: #0b0703; }
.help { max-width: 980px; margin: 0 auto; padding: 24px 16px 60px; }
.help h1 { text-align: left; font-size: 30px; }
.help h2 { margin: 0 0 10px; color: #fff; font-size: 19px; }
.help h3 { margin: 16px 0 6px; color: var(--accent2); font-size: 15px; }
.help table { border-collapse: collapse; width: 100%; margin: 6px 0; }
.help td { border-top: 1px solid #3a2a1a; padding: 4px 8px 4px 0; vertical-align: top; }
.help td:first-child { white-space: nowrap; width: 1%; }
.help .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 0 24px; }
