* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #111;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

#stage { position: fixed; inset: 0; }

#video, #drawing, #overlay, #face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#video {
  object-fit: cover;
  transform: scaleX(-1); /* mirror, so it feels like a mirror */
  opacity: 0.55;
  transition: opacity 0.3s;
}
body[data-mode="face"] #video { opacity: 0.9; }

#face { touch-action: none; cursor: crosshair; }

#status {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  font-size: 22px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  transition: background 0.2s;
}
#status.drawing { background: rgba(40, 170, 90, 0.85); }
#status.cleared { background: rgba(230, 120, 30, 0.9); }

/* ---- Mode bar ---- */
#modebar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
}
#modebar button {
  padding: 12px 24px;
  font-size: 22px;
  font-weight: 700;
  white-space: nowrap;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
}
#modebar button[aria-pressed="true"] { background: #ffd23f; color: #2b1055; }
#modebar button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
#modebar kbd {
  margin-left: 6px;
  font-family: inherit;
  font-size: 14px;
  opacity: 0.6;
}

/* ---- Face paint palette ---- */
#palette {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border-radius: 28px;
  background: rgba(0, 0, 0, 0.6);
}
.swatch {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.5);
  font-size: 24px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s;
}
.swatch.eraser { background: #eee; }
.swatch.selected { border-color: #fff; transform: scale(1.15); box-shadow: 0 0 0 3px #ffd23f; }
.wash {
  height: 48px;
  padding: 0 18px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #2b1055;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

/* ---- In-game hints ---- */
.hints {
  position: fixed;
  top: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 18px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.55);
  font-size: 18px;
  font-weight: 600;
  pointer-events: none;
}
.hints span { display: inline-block; width: 1.6em; font-size: 22px; }

/* Leave room for the hints on smaller screens */
@media (max-width: 900px) {
  #status { top: auto; bottom: 96px; }
  body[data-mode="face"] #status { bottom: 200px; }
}

/* ---- Home page ---- */
#home {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4vw;
  padding: 24px 5vw 0;
  background: linear-gradient(160deg, #2b1055, #7597de);
  overflow: hidden;
}
#home-photo {
  align-self: flex-end;
  height: min(92vh, 1200px);
  max-width: 45vw;
  object-fit: contain;
  object-position: bottom;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.35));
}
#home-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  padding-bottom: 24px;
}
#home h1 {
  font-size: clamp(48px, 8vw, 104px);
  line-height: 1;
  color: #ffd23f;
  text-shadow: 0 4px 0 #2b1055;
}
.tagline { font-size: clamp(22px, 2.6vw, 32px); font-weight: 600; }
.game-buttons { display: flex; flex-direction: column; gap: 16px; margin-top: 10px; }
.game-buttons button {
  padding: 18px 40px;
  font-size: clamp(24px, 2.8vw, 34px);
  font-weight: 800;
  text-align: left;
  border: none;
  border-radius: 999px;
  background: #ffd23f;
  color: #2b1055;
  cursor: pointer;
  box-shadow: 0 6px 0 #c99a00;
  touch-action: manipulation;
  transition: transform 0.1s;
}
.game-buttons button:hover { transform: translateY(-2px); }
.game-buttons button:active { transform: translateY(3px); box-shadow: 0 3px 0 #c99a00; }
.game-buttons button:disabled { opacity: 0.6; cursor: wait; transform: none; }
.game-buttons button:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
#home-note { font-size: 18px; opacity: 0.8; }

/* Tall or narrow screens: photo underneath, text on top */
@media (max-aspect-ratio: 4/5) {
  #home { flex-direction: column-reverse; justify-content: space-between; padding-top: 6vh; }
  #home-text { align-items: center; text-align: center; }
  #home-photo { max-width: 90vw; height: auto; max-height: 55vh; align-self: center; }
}
