:root {
  --bg: #1a1612;
  --ink: #f4efe6;
  --muted: #8c8579;
  --accent: #e08a2a;
  --target: #6abf7a;
  --line: #2a2620;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  cursor: pointer;
}

/* HUD */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 1.1rem 1.5rem env(safe-area-inset-top, 1.1rem);
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 1.25rem;
  color: var(--muted);
  letter-spacing: 0.03em;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#hud.show { opacity: 1; }

#hud #score { color: var(--ink); }
#hud #timer { color: var(--accent); }

/* Screens */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 2rem 1.5rem;
  text-align: center;
  background: rgba(26, 22, 18, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.screen.active { display: flex; animation: fadein 0.3s ease; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wordmark {
  font-size: clamp(3.5rem, 12vw, 6rem);
  font-weight: 200;
  letter-spacing: -0.04em;
  margin-bottom: 0.6rem;
  color: var(--ink);
  line-height: 0.95;
}

h2 {
  font-size: 2rem;
  font-weight: 300;
  margin-bottom: 1.6rem;
  color: var(--muted);
  letter-spacing: -0.02em;
}

.rules {
  color: var(--muted);
  margin: 0 0 2rem;
  font-size: 1.05rem;
  max-width: 26rem;
  line-height: 1.5;
}

button {
  display: block;
  margin: 0.45rem auto;
  border: none;
  border-radius: 8px;
  padding: 0.9rem 2.5rem;
  font: inherit;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  min-width: 12rem;
  transition: filter 0.15s, transform 0.05s, background 0.15s;
  font-family: var(--sans);
}
.primary {
  background: var(--accent);
  color: var(--bg);
}
.primary:hover { filter: brightness(1.15); }
.primary:active { transform: translateY(1px); }
.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.ghost:hover { color: var(--ink); border-color: var(--muted); }
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* End screen result */
.result {
  margin: 0 0 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: center;
}
.result-row {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  font-size: 1.1rem;
}
.result-row .label {
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: lowercase;
  letter-spacing: 0.08em;
  min-width: 4rem;
  text-align: right;
}
.result-row .value {
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  min-width: 3ch;
  text-align: left;
}

.status {
  margin-top: 0.6rem;
  min-height: 1.4em;
  font-size: 0.9rem;
  color: var(--muted);
}

footer {
  position: fixed;
  bottom: 0.85rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  pointer-events: none;
  opacity: 0.55;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (max-width: 420px) {
  #hud { padding: 0.85rem 1rem; font-size: 1.1rem; }
  footer { font-size: 0.7rem; }
}
