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

/* ---------- BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  color: #0f0;
  font-family: 'Press Start 2P', monospace;
}

/* ---------- SCREEN SYSTEM ---------- */
.v-screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  background: #000;
  overflow: hidden;
}

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

.v-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px clamp(16px, 5vw, 40px);
  overflow-y: auto;
}

.v-body.center {
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ---------- VATSAL HEADER ---------- */
.vatsal-home {
  font-family: "Vatsal-logo" !important;
  font-size: 20px !important;
  color: #0a0 !important;
  text-decoration: none;
  pointer-events: all;
  cursor: pointer;
}

.vatsal-home:hover { color: #0f0 !important; }

/*.vatsal-header {
  border-bottom: 1px solid #0f02;
}*/

/* ---------- START SCREEN ---------- */
.snake-icon {
  font-size: clamp(50px, 12vw, 80px);
  margin-bottom: 16px;
  line-height: 1;
}

.game-title {
  font-size: clamp(1.8rem, 6vw, 3rem);
  color: #0f0;
  text-shadow: 0 0 20px #0f0, 0 0 40px #0f08;
  margin-bottom: 10px;
  letter-spacing: 4px;
}

.game-sub {
  font-size: clamp(0.5rem, 2vw, 0.7rem);
  color: #0a0;
  margin-bottom: 36px;
  letter-spacing: 2px;
}

.hint-text {
  font-size: 0.5rem;
  color: #060;
  margin-top: 16px;
  letter-spacing: 1px;
}

/* ---------- BUTTONS ---------- */
.action-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.6rem, 2vw, 0.75rem);
  padding: 14px 28px;
  background: #0f0;
  color: #000;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: .2s;
  width: min(280px, 90%);
  margin-top: 12px;
  letter-spacing: 2px;
}

.action-btn:hover { background: #0d0; transform: translateY(-2px); }
.action-btn:active { transform: scale(.97); }

.action-btn.ghost {
  background: transparent;
  color: #0a0;
  border: 2px solid #0a0;
}

.action-btn.ghost:hover { border-color: #0f0; color: #0f0; }

/* ---------- GAME SCREEN ---------- */
#gameScreen { background: #000; }

.game-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 8px;
  gap: 8px;
  overflow: hidden;
  height: 100%;
}

/* ---------- HUD (above canvas) ---------- */
.hud {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(400px, 95vw);
  padding: 8px 12px;
  border: 1px solid #0f03;
  border-radius: 6px;
  background: #0f010;
  flex-shrink: 0;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.hud-label {
  font-size: 0.45rem;
  color: #060;
  letter-spacing: 2px;
  margin-bottom: 2px;
}

.hud-val {
  font-size: clamp(0.7rem, 3vw, 1rem);
  color: #0f0;
  text-shadow: 0 0 8px #0f0;
}

.pause-btn {
  background: none;
  border: 1px solid #0f04;
  border-radius: 4px;
  color: #0a0;
  font-size: 1rem;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .2s;
  flex-shrink: 0;
}

.pause-btn:hover { border-color: #0f0; color: #0f0; }

/* ---------- CANVAS ---------- */
canvas {
  display: block;
  background: #050505;
  border: 3px solid #0f0;
  border-radius: 4px;
  box-shadow: 0 0 24px #0f04, 0 0 48px #0f02;
  /* width controlled by JS to fit viewport */
  touch-action: none;
  flex-shrink: 0;
}

/* ---------- MOBILE D-PAD ---------- */
.dpad {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  flex-shrink: 0;
}

.dpad-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dpad-btn {
  font-family: 'Press Start 2P', monospace;
  width: 52px;
  height: 52px;
  background: #0f015;
  border: 2px solid #0f04;
  border-radius: 8px;
  color: #0f0;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.dpad-btn:active { background: #0f0; color: #000; transform: scale(.93); }

.dpad-center {
  width: 52px;
  height: 52px;
}

/* ---------- PAUSE / OVER SCREENS ---------- */
.screen-title {
  font-size: clamp(1.4rem, 6vw, 2.2rem);
  color: #0f0;
  text-shadow: 0 0 20px #0f0;
  margin-bottom: 28px;
  letter-spacing: 4px;
}

.screen-title.fail {
  color: #f00;
  text-shadow: 0 0 20px #f00;
}

.result-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(280px, 90%);
  margin-bottom: 28px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid #0f03;
  border-radius: 4px;
  font-size: 0.6rem;
  color: #0a0;
}

.result-row strong {
  color: #0f0;
  font-size: 0.75rem;
}

/* ---------- FOOTER IN GAME OVER ---------- */
#overScreen .vatsal-related {
  width: min(400px, 92%);
  margin: 24px auto 0;
}

#overScreen .vatsal-related[hidden] { display: none !important; }

.vatsal-related-title { color: #0a0 !important; }

.vatsal-footer a { color: #060 !important; }

.related-card {
  border: 1px solid #0f03 !important;
  border-radius: 8px !important;
}

/* ---------- MOBILE SHOWS D-PAD ---------- */
@media (max-width: 768px) {
  .dpad { display: flex; }
  .hint-text { display: none; }
}