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

html, body {
  height: 100%;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a14 100%);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

#video {
  display: none;
}

#game {
  display: none;
  background: #000;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  max-width: 100vw;
  max-height: 100vh;
}

#game.active { display: block; }

#start-screen,
#error-screen {
  text-align: center;
  padding: 2rem;
  max-width: 560px;
}

#start-screen h1 {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, #ff6b9d 0%, #ffd166 50%, #06d6a0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.tagline {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

.mode-select {
  display: inline-flex;
  margin-bottom: 1.5rem;
  padding: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mode-btn {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s ease, background 0.2s ease, transform 0.1s ease;
  font-family: inherit;
  white-space: nowrap;
}

.mode-btn:hover { opacity: 1; }
.mode-btn.active {
  background: linear-gradient(135deg, #06d6a0, #118ab2);
  opacity: 1;
}
.mode-btn.active[data-mode="hard"] {
  background: linear-gradient(135deg, #ff6b6b, #c9184a);
}
.mode-btn:active { transform: scale(0.97); }

/* Game-select buttons share the mode-btn look but with their own active gradient */
.game-btn {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s ease, background 0.2s ease, transform 0.1s ease;
  font-family: inherit;
  white-space: nowrap;
}
.game-btn:hover { opacity: 1; }
.game-btn.active {
  background: linear-gradient(135deg, #ff6b9d, #ff8e53);
  opacity: 1;
}
.game-btn:active { transform: scale(0.97); }

#start-btn,
#retry-btn {
  display: block;
  margin: 0 auto;
  font-size: 1.5rem;
  padding: 1rem 3rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff6b9d, #ff8e53);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(255, 107, 157, 0.4);
  transition: transform 0.1s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

#start-btn:hover:not(:disabled),
#retry-btn:hover { transform: scale(1.05); box-shadow: 0 12px 32px rgba(255, 107, 157, 0.55); }
#start-btn:active,
#retry-btn:active { transform: scale(0.97); }
#start-btn:disabled { opacity: 0.6; cursor: progress; }

.hint {
  margin-top: 1.5rem;
  font-size: 0.95rem;
  opacity: 0.6;
}

#model-status {
  margin-top: 1rem;
  margin-bottom: 0;
  font-size: 0.85rem;
  opacity: 0.55;
  font-style: italic;
}

#model-status .error-detail {
  display: block;
  margin-top: 0.4rem;
  font-style: normal;
  font-size: 0.75rem;
  opacity: 0.7;
  color: #ff8e8e;
}

#start-screen.hidden,
#error-screen.hidden { display: none; }

#error-screen h2 { margin-bottom: 1rem; color: #ff6b9d; }
#error-screen p { margin-bottom: 2rem; opacity: 0.85; }

#fullscreen-toggle,
#home-btn {
  position: fixed;
  top: 14px;
  z-index: 100;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s ease, transform 0.1s ease;
}

#fullscreen-toggle { right: 14px; }
#home-btn { right: 130px; }

#fullscreen-toggle:hover,
#home-btn:hover { background: rgba(0, 0, 0, 0.75); }
#fullscreen-toggle:active,
#home-btn:active { transform: scale(0.95); }
#fullscreen-toggle.is-fullscreen { background: rgba(255, 107, 157, 0.4); }
