/* Handdrawn — paper-and-ink theme. NOT pixel art: no image-rendering hacks. */

@font-face {
  font-family: "Handdrawn";
  src: url("assets/fonts/PatrickHand-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --paper: #f2ecd8;
  --paper-dark: #e4dcc4;
  --ink: #2b2b2b;
  --blue: #2b5aa6;
  --red: #b23a2e;
  --green: #3d7a3f;
  --gray: #8a8578;
  --strip-h: 12.5%; /* 72px of 768 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #cfc7ad;
  font-family: "Handdrawn", "Segoe Print", "Comic Sans MS", cursive;
  color: var(--ink);
}

#hd-shell {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

#hd-stage {
  container-type: size;
  position: relative;
  width: min(1024px, 96vw, calc((100vh - 24px) * 1024 / 768));
  aspect-ratio: 1024 / 768;
  background: var(--paper);
  border: 0.4cqw solid var(--ink);
  border-radius: 0.8cqw;
  box-shadow: 0 0.8cqw 2.4cqw rgba(43, 43, 43, 0.35);
  overflow: hidden;
}

#hd-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

/* ---------------- HUD safe-zone strips (not drawable) ---------------- */

.hd-hud {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--strip-h);
  display: flex;
  align-items: center;
  gap: 1.2cqw;
  padding: 0 1.6cqw;
  pointer-events: none; /* children re-enable as needed */
  z-index: 5;
}

#hd-hud-top { top: 0; border-bottom: 0.2cqw dashed var(--pencil, #8a8578); }
#hd-hud-bottom { bottom: 0; border-top: 0.2cqw dashed #8a8578; }

.hd-brand { font-size: 3cqw; color: #2b5aa6; letter-spacing: 0.1cqw; }

.hd-chip {
  font-size: 2.2cqw;
  background: rgba(255, 255, 255, 0.55);
  border: 0.18cqw solid #2b2b2b;
  border-radius: 0.8cqw;
  padding: 0.2cqw 1cqw;
  white-space: nowrap;
}

.hd-category { color: #b23a2e; font-size: 2.6cqw; }
.hd-timer.low { color: #b23a2e; }

.hd-players {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6cqw 1.4cqw;
  font-size: 1.9cqw;
  max-width: 46%;
  max-height: 100%;
  overflow: hidden;
}
.hd-player { white-space: nowrap; }
.hd-player.drawer { color: #2b5aa6; }
.hd-player.me { text-decoration: underline; }
.hd-player .hd-score { color: #3d7a3f; }

.hd-tools {
  display: flex;
  gap: 0.8cqw;
  pointer-events: auto;
  margin: 0 auto;
}
.hd-tool {
  width: 4.4cqw;
  height: 4.4cqw;
  border-radius: 50%;
  border: 0.25cqw solid #2b2b2b;
  cursor: pointer;
}
.hd-tool[data-tool="ink-black"] { background: #2b2b2b; }
.hd-tool[data-tool="ink-blue"] { background: #2b5aa6; }
.hd-tool[data-tool="ink-red"] { background: #b23a2e; }
.hd-tool[data-tool="erase"] {
  background: var(--paper-dark);
  background-image: repeating-linear-gradient(45deg, #8a8578 0 0.4cqw, transparent 0.4cqw 1cqw);
}
.hd-tool.active { outline: 0.4cqw solid #c9a227; }

.hd-guessbox {
  display: flex;
  gap: 0.6cqw;
  pointer-events: auto;
  margin-left: auto;
}
#hd-guess-input {
  font-family: inherit;
  font-size: 2.2cqw;
  width: 26cqw;
  padding: 0.4cqw 1cqw;
  border: 0.2cqw solid #2b2b2b;
  border-radius: 0.8cqw;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
}
#hd-guess-input:disabled { background: #d8d2bc; color: #9a9a9a; }
#hd-guess-send {
  font-family: inherit;
  font-size: 2.4cqw;
  border: 0.2cqw solid #2b2b2b;
  border-radius: 0.8cqw;
  background: #2b5aa6;
  color: #f2ecd8;
  cursor: pointer;
  padding: 0.2cqw 1.2cqw;
}

.hd-guessbox.muted #hd-guess-input { background: #d8d2bc; }

/* ---------------- Callout (Close! / Correct! / Rebuke) ---------------- */

#hd-callout {
  position: absolute;
  top: 16%;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  font-size: 5cqw;
  padding: 0.4cqw 3cqw;
  border: 0.3cqw solid #2b2b2b;
  border-radius: 1.2cqw;
  background: rgba(255, 255, 255, 0.9);
  z-index: 8;
  pointer-events: none;
}
#hd-callout.close { color: #2b5aa6; }
#hd-callout.correct { color: #3d7a3f; }
#hd-callout.rebuke { color: #9a9a9a; }

/* ---------------- Overlays ---------------- */

#hd-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: rgba(228, 220, 196, 0.6);
}
#hd-overlay.hidden { display: none; }

.hd-panel {
  background: var(--paper);
  border: 0.35cqw solid #2b2b2b;
  border-radius: 1.2cqw;
  box-shadow: 0 0.6cqw 1.8cqw rgba(43, 43, 43, 0.3);
  padding: 2.4cqw 3cqw;
  min-width: 62cqw;
  max-width: 88cqw;
  max-height: 92%;
  overflow: auto;
  text-align: center;
}
.hd-panel-lite { background: rgba(242, 236, 216, 0.96); }

.hd-logo {
  font-size: 7cqw;
  color: #2b5aa6;
  transform: rotate(-1.5deg);
  margin-bottom: 0.4cqw;
}
.hd-tagline { font-size: 2.2cqw; color: #8a8578; margin-bottom: 1.8cqw; }

.hd-cols { display: flex; gap: 2cqw; justify-content: center; text-align: left; }

.hd-box {
  border: 0.2cqw solid #2b2b2b;
  border-radius: 1cqw;
  padding: 1.4cqw 1.8cqw;
  min-width: 26cqw;
}
.hd-box legend { font-size: 2.2cqw; padding: 0 0.8cqw; }

.hd-field { display: block; font-size: 2cqw; margin-bottom: 1.2cqw; }
.hd-field input, .hd-field select {
  display: block;
  width: 100%;
  font-family: inherit;
  font-size: 2.2cqw;
  margin-top: 0.3cqw;
  padding: 0.4cqw 0.9cqw;
  border: 0.2cqw solid #2b2b2b;
  border-radius: 0.7cqw;
  background: #fff;
  color: var(--ink);
}
.hd-code-input { text-transform: uppercase; letter-spacing: 0.4cqw; }

.hd-btn {
  font-family: inherit;
  font-size: 2.4cqw;
  padding: 0.5cqw 2cqw;
  border: 0.25cqw solid #2b2b2b;
  border-radius: 1cqw;
  background: #2b5aa6;
  color: #f2ecd8;
  cursor: pointer;
  transform: rotate(-0.5deg);
}
.hd-btn:hover { background: #3d6fc4; }
.hd-btn:disabled { background: #9a9a9a; cursor: default; }
.hd-btn-ghost { background: transparent; color: #2b2b2b; }
.hd-btn-ghost:hover { background: rgba(43, 43, 43, 0.08); }

.hd-error { color: #b23a2e; font-size: 2cqw; margin-top: 1cqw; }

/* Lobby */
.hd-lobby-code-label { font-size: 2cqw; letter-spacing: 0.3cqw; color: #8a8578; }
.hd-lobby-code {
  font-size: 8cqw;
  letter-spacing: 1.4cqw;
  color: #b23a2e;
  margin: 0.4cqw 0 1cqw;
}
.hd-lobby-settings { font-size: 2.2cqw; color: #8a8578; margin-bottom: 1.2cqw; }
.hd-lobby-players {
  list-style: none;
  font-size: 2.6cqw;
  margin: 0 auto 1.6cqw;
  max-width: 44cqw;
  text-align: left;
}
.hd-lobby-players li { padding: 0.2cqw 0; }
.hd-lobby-players .host-mark { color: #c9a227; }
.hd-lobby-players .ready-mark { color: #3d7a3f; }
.hd-lobby-players .waiting-mark { color: #9a9a9a; }
.hd-lobby-actions { display: flex; gap: 1.4cqw; justify-content: center; }

/* Reveal */
.hd-reveal-label { font-size: 2.2cqw; color: #8a8578; letter-spacing: 0.3cqw; }
.hd-reveal-word { font-size: 6cqw; color: #3d7a3f; margin: 0.6cqw 0 1.4cqw; }
#hd-reveal-scores { font-size: 2.4cqw; }

/* Results */
.hd-results-label { font-size: 2.4cqw; color: #8a8578; letter-spacing: 0.3cqw; }
.hd-winners { font-size: 5cqw; color: #c9a227; margin: 0.6cqw 0 1.2cqw; }
#hd-final-scores { font-size: 2.6cqw; margin-bottom: 1.6cqw; }

.hidden { display: none !important; }
