:root {
  --bg: #030303;
  --bg-soft: #0e0a08;
  --panel: rgba(20, 12, 10, 0.78);
  --panel-border: rgba(255, 115, 60, 0.28);
  --text: #fff5ec;
  --muted: rgba(255, 238, 227, 0.72);
  --accent: #ff6a00;
  --accent-soft: #ffb36d;
  --danger: #ff3b2f;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 106, 0, 0.14), transparent 24%),
    radial-gradient(circle at bottom, rgba(255, 59, 47, 0.12), transparent 30%),
    linear-gradient(180deg, #0a0706 0%, #020202 100%);
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 38px 38px;
  opacity: 0.24;
}

button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px;
}

#webcam {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.hud {
  position: fixed;
  inset: 24px 24px auto 24px;
  display: flex;
  gap: 12px;
  z-index: 20;
}

.hud-card {
  min-width: 138px;
  padding: 12px 16px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(24, 15, 12, 0.88), rgba(8, 6, 5, 0.82));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hud-card strong {
  display: block;
  margin-top: 3px;
  font-family: "Bebas Neue", sans-serif;
  font-size: 2rem;
  letter-spacing: 0.06em;
}

.hud-card--timer strong {
  color: var(--accent-soft);
}

.hud-card--status {
  margin-left: auto;
  min-width: 220px;
}

.hud-card--status strong {
  font-size: 1.4rem;
  letter-spacing: 0.03em;
}

.hud-label {
  display: inline-block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--muted);
}

.stage-wrap {
  position: relative;
  width: 100%;
  height: calc(100vh - 48px);
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 137, 73, 0.06), transparent 32%),
    linear-gradient(180deg, rgba(10, 8, 8, 0.9), rgba(3, 3, 3, 0.96));
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.overlay-screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  padding: 32px;
  text-align: center;
  background:
    radial-gradient(circle at center, rgba(255, 115, 60, 0.16), transparent 24%),
    linear-gradient(180deg, rgba(2, 2, 2, 0.74), rgba(2, 2, 2, 0.94));
  backdrop-filter: blur(8px);
}

.overlay-screen--active {
  display: flex;
}

.eyebrow {
  margin: 0;
  color: var(--accent-soft);
  font-size: 0.9rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(4.4rem, 10vw, 8.6rem);
  line-height: 0.95;
  letter-spacing: 0.08em;
}

h2 {
  font-size: clamp(3.4rem, 8vw, 6rem);
}

.lead {
  max-width: 700px;
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--muted);
}

.instructions,
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  width: min(860px, 100%);
}

.instructions p,
.result-grid div {
  margin: 0;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.instructions span,
.result-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-soft);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.24em;
}

.result-grid strong {
  font-family: "Bebas Neue", sans-serif;
  font-size: 3rem;
  letter-spacing: 0.05em;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.primary-button,
.ghost-button {
  min-width: 210px;
  padding: 14px 22px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.primary-button {
  background: linear-gradient(135deg, #ff8f3f, #ff4d00);
  color: #170805;
  box-shadow: 0 18px 42px rgba(255, 93, 19, 0.38);
}

.ghost-button {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-2px);
}

.helper,
.footer-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.footer-note {
  position: fixed;
  inset: auto 24px 24px 24px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(7, 7, 7, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
}

@media (max-width: 900px) {
  .app-shell {
    padding: 12px;
  }

  .hud {
    inset: 12px 12px auto 12px;
    flex-wrap: wrap;
  }

  .hud-card--status {
    margin-left: 0;
    min-width: 100%;
  }

  .stage-wrap {
    height: calc(100vh - 24px);
    border-radius: 22px;
  }

  .instructions,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .footer-note {
    inset: auto 12px 12px 12px;
    flex-direction: column;
  }
}
