:root {
  --bg-dark: #0d1017;
  --bg-light: #181d29;
  --accent: #ff2d55;
  --accent-light: #ff667b;
  --neutral: #f6f4f1;
  --ink: #101010;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  background: var(--bg-dark);
  color: var(--neutral);
  min-height: 100vh;
  overflow: hidden;
}

#threeCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
}

.overlay {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px;
}

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border: 4px solid var(--neutral);
  background: var(--bg-light);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.hud .brand {
  font-size: 1.2rem;
  color: var(--accent);
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.hint {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--neutral);
}

.badge {
  padding: 8px 18px;
  border: 4px solid var(--neutral);
  background: var(--accent);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
}

.playfield {
  position: relative;
  flex: 1;
  margin-top: 28px;
  border: 4px solid var(--neutral);
  background: transparent;
  overflow: hidden;
}

.crayon {
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 48px;
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  background: var(--neutral);
  color: var(--ink);
  border: 4px solid var(--ink);
  text-transform: uppercase;
  font-weight: 700;
  box-shadow: 8px 8px 0 var(--ink);
  user-select: none;
}

#drawCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#inputVideo {
  display: none;
}

.final-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 16, 23, 0.94);
}

.hidden {
  display: none !important;
}

.final-card {
  width: min(420px, 90vw);
  border: 4px solid var(--neutral);
  background: var(--bg-light);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-transform: uppercase;
  box-shadow: 10px 10px 0 var(--neutral);
}

.final-card h1 {
  margin: 0;
  font-size: 1.6rem;
  color: var(--accent);
}

.score-display {
  font-size: 4rem;
  font-weight: 700;
  line-height: 1;
}

.score-display span {
  color: var(--accent);
}

.score-message {
  font-size: 1.1rem;
  margin: 0;
  color: var(--neutral);
}

.final-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

button {
  font-family: inherit;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 1rem;
  padding: 14px;
  border: 4px solid var(--neutral);
  background: var(--accent);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 6px 6px 0 var(--ink);
  transition: transform 0.1s linear;
}

button:hover {
  transform: translate(-2px, -2px);
}

@media (max-width: 768px) {
  .hud {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .playfield {
    margin-top: 18px;
  }

  .crayon {
    top: 32px;
  }
}
