@font-face {
  font-family: "Vatsal-logo";
  src: url("../../assets/data/vatsal-logo-font.ttf") format("truetype");
  font-display: swap;
}

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&display=swap');

/* ===========================
   RESET & ROOT
=========================== */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #080808;
  --surface: #111111;
  --border: rgba(255,255,255,0.08);
  --text: #ffffff;
  --muted: rgba(255,255,255,0.38);
  --accent: #ffffff;
  --red: #ff3b3b;
  --green: #39ff87;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Mono', monospace;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* subtle noise texture on body */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* ===========================
   VATSAL HEADER
=========================== */

.vatsal-header {
  margin: 0;
  padding: 12px 20px;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

.vatsal-home {
  font-family: "Vatsal-logo" !important;
  color: var(--text) !important;
  text-decoration: none;
}

/* ===========================
   GAME WRAPPER
=========================== */

#game {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px 40px;
  position: relative;
  z-index: 1;
  width: 100%;
}

.hidden { display: none !important; }

/* ===========================
   MENU SCREEN
=========================== */

#menuScreen {
  width: 100%;
  max-width: 560px;
  text-align: center;
  animation: fadeUp 0.5s ease;
}

.menu-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(4rem, 15vw, 8rem);
  line-height: 0.9;
  letter-spacing: 0.06em;
  color: #fff;
  margin-bottom: 14px;
}

.menu-sub {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 40px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.mode-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
  color: white;
  font-family: 'Space Mono', monospace;
}

.mode-card:hover {
  border-color: rgba(255,255,255,0.4);
  background: #1a1a1a;
  transform: translateY(-3px);
}

.mode-card:active { transform: translateY(0); }

.mode-digit {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3.5rem;
  line-height: 1;
  color: #fff;
}

.mode-label {
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
}

.mode-hint {
  font-size: 0.58rem;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.08em;
}

.menu-rules {
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  line-height: 1.7;
}

/* ===========================
   PLAY SCREEN
=========================== */

#playScreen {
  width: 100%;
  max-width: 560px;
  text-align: center;
  animation: fadeUp 0.3s ease;
}

/* HUD */
#hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding: 0 4px;
}

#livesDisplay {
  display: flex;
  gap: 6px;
}

.heart {
  font-size: 1.1rem;
  transition: opacity 0.3s, transform 0.3s;
}

.heart.alive { color: var(--red); opacity: 1; }
.heart.dead  { color: rgba(255,255,255,0.12); opacity: 0.4; transform: scale(0.8); }

#hudScore {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.8rem;
  line-height: 1;
  transition: transform 0.15s;
}

#hudScore.pop { transform: scale(1.25); }

#speedDisplay {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  min-width: 52px;
  text-align: right;
}

/* Number display */
#number {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 120px;
  line-height: 1;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 40ms linear;
  letter-spacing: 0.08em;
  color: #fff;
}

#number.error-flash {
  color: var(--red);
  text-shadow: 0 0 30px rgba(255,59,59,0.6);
}

/* Input */
#inputBox {
  display: none;
  margin-top: 28px;
  animation: fadeIn 0.15s ease;
}

#input {
  background: none;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3.5rem;
  text-align: center;
  width: 260px;
  outline: none;
  letter-spacing: 0.16em;
  caret-color: white;
  transition: border-color 0.2s;
}

#input:focus { border-bottom-color: rgba(255,255,255,0.7); }

#inputHint {
  margin-top: 10px;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

#inputBox.shake {
  animation: shake 0.35s ease;
}

/* Meta bar */
#meta {
  margin-top: 32px;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ===========================
   RESULT SCREEN
=========================== */

#resultScreen {
  width: 100%;
  max-width: 560px;
  text-align: center;
  animation: fadeUp 0.4s ease;
  padding-bottom: 20px;
}

.result-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(3rem, 12vw, 6rem);
  letter-spacing: 0.08em;
  color: #fff;
  margin-bottom: 24px;
}

#resultScore {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(5rem, 20vw, 10rem);
  line-height: 1;
  color: #fff;
  margin-bottom: 8px;
}

#resultMeta {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 20px;
  text-transform: uppercase;
}

#resultRemark {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.06em;
  margin-bottom: 36px;
  min-height: 24px;
}

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

.result-btn {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 14px 28px;
  border-radius: 8px;
  cursor: pointer;
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.6);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  text-transform: uppercase;
}

.result-btn.primary {
  background: #fff;
  color: #000;
  border-color: #fff;
  font-weight: 700;
}

.result-btn:hover:not(.primary) {
  border-color: rgba(255,255,255,0.5);
  color: #fff;
}

.result-btn.primary:hover {
  background: #e0e0e0;
}

/* footer slot inside result */
#footerSlot {
  margin-top: 20px;
}

/* ===========================
   FOOTER OVERRIDES
=========================== */

.vatsal-related {
  background: transparent;
}

.vatsal-related-title,
.vatsal-footer,
.vatsal-footer a {
  font-family: "Vatsal-logo" !important;
  color: rgba(255,255,255,0.7) !important;
}

/* ===========================
   ANIMATIONS
=========================== */

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes shake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-8px); }
  40%  { transform: translateX(8px); }
  60%  { transform: translateX(-5px); }
  80%  { transform: translateX(5px); }
  100% { transform: translateX(0); }
}

/* ===========================
   MOBILE
=========================== */

@media (max-width: 480px) {
  .mode-grid { gap: 8px; }
  .mode-card { padding: 18px 8px; }
  .mode-digit { font-size: 2.8rem; }

  #number { font-size: 90px; height: 100px; }

  #input { font-size: 3rem; width: 220px; }

  .result-actions { flex-direction: column; align-items: center; }
  .result-btn { width: 200px; }
}
