/* MIB · The Game — mobile-first space arcade */

:root {
  --bg-deep: #03020a;
  --bg-mid: #0a0820;
  --bg-glow: #1a0f3a;
  --ink: #f4f1ea;
  --ink-dim: #a09c92;
  --phosphor: #b6ff2e;
  --phosphor-soft: rgba(182, 255, 46, 0.18);
  --danger: #ff3860;
  --hairline: rgba(244, 241, 234, 0.14);

  --font-display: "IBM Plex Sans Thai", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Sukhumvit Set", "Noto Sans Thai", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--font-display);
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 50% 30%, var(--bg-glow) 0%, var(--bg-mid) 35%, var(--bg-deep) 75%);
  overflow: hidden;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ============== HUD ============== */
.hud {
  position: absolute;
  top: max(env(safe-area-inset-top), 14px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  pointer-events: none;
  z-index: 5;
  font-family: var(--font-mono);
}

.hud-score {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-shadow: 0 0 14px rgba(0, 0, 0, 0.85), 0 0 28px rgba(0, 0, 0, 0.6);
  background: rgba(3, 2, 10, 0.32);
  padding: 4px 14px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.hud-unit {
  font-size: 14px;
  color: var(--ink-dim);
  margin-left: 4px;
  font-weight: 400;
}

.hud-best {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--ink-dim);
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.85);
  font-family: var(--font-display);
}
.hud-best span {
  color: var(--phosphor);
  margin-left: 6px;
  font-weight: 600;
}

/* ============== Screens ============== */
.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: rgba(3, 2, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.35s ease both;
}

.hidden {
  display: none !important;
}

.screen-inner {
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.brand-logo {
  width: 140px;
  height: auto;
  margin-bottom: 24px;
  filter: drop-shadow(0 0 18px rgba(182, 255, 46, 0.25));
}

.title {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 12px;
  color: var(--ink);
  text-shadow: 0 0 18px rgba(182, 255, 46, 0.35);
}

.subtitle {
  font-size: 16px;
  color: var(--ink-dim);
  margin: 0 0 36px;
  letter-spacing: 0.01em;
  line-height: 1.45;
}

.over-label {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.32em;
  color: var(--danger);
  margin: 0 0 28px;
}

/* Buttons */
.btn-primary, .btn-secondary {
  display: block;
  width: 100%;
  padding: 18px 20px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.18s ease;
  text-decoration: none;
  text-align: center;
}

.btn-primary {
  background: var(--phosphor);
  color: var(--bg-deep);
  box-shadow: 0 0 24px var(--phosphor-soft), 0 0 0 1px var(--phosphor) inset;
  margin-bottom: 12px;
}
.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 0 12px var(--phosphor-soft);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--hairline);
  margin-bottom: 16px;
}
.btn-secondary:active {
  transform: scale(0.97);
  background: rgba(244, 241, 234, 0.04);
}

.cta-register {
  padding: 14px 16px;
  text-align: center;
}
.cta-register .cta-line-1 {
  display: block;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}
.cta-register .cta-line-2 {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.78;
}

/* Score row on game over */
.score-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 32px;
}
.score-block {
  flex: 1;
  padding: 16px 12px;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: rgba(244, 241, 234, 0.02);
}
.score-block-label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  margin: 0 0 8px;
  font-weight: 500;
}
.score-block-value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}
.score-block:first-child .score-block-value {
  color: var(--phosphor);
}

.hint {
  font-size: 13px;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
  margin: 16px 0 0;
  animation: pulse 1.6s ease-in-out infinite;
}
.hint-small {
  font-size: 11px;
  letter-spacing: 0.06em;
  margin-top: 24px;
  opacity: 0.55;
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

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

/* Larger devices: keep things mobile-feeling */
@media (min-width: 600px) and (orientation: landscape) {
  .title { font-size: 36px; }
  .subtitle { margin-bottom: 24px; }
  .screen-inner { max-width: 380px; }
}
