@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;800&family=Outfit:wght@300;400;600&display=swap');

:root {
  --color-bg: #050505;
  --color-text-light: #e0e0e0;
  --color-text-dim: #7f7f7f;
  --color-accent: #8b0000; /* Dark Red */
  --color-accent-bright: #ff3333;
  --color-panel: rgba(8, 8, 8, 0.85);
  --color-border: rgba(139, 0, 0, 0.15);
  --color-border-hover: rgba(255, 51, 51, 0.4);
  --font-title: 'Cinzel', serif;
  --font-ui: 'Outfit', sans-serif;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--color-bg);
  color: var(--color-text-light);
  font-family: var(--font-ui);
  cursor: default;
}

#canvas-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* Glassmorphic Screens */
.overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.92);
  transition: opacity 0.8s ease, visibility 0.8s ease;
  opacity: 0;
  visibility: hidden;
}

.overlay-screen.active {
  opacity: 1;
  visibility: visible;
}

/* Vignette Overlay (Always visible in game, increases claustrophobia) */
#vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(circle, transparent 40%, rgba(0,0,0,0.92) 95%);
  transition: background 0.3s ease;
}

#vignette.danger {
  background: radial-gradient(circle, transparent 30%, rgba(139,0,0,0.5) 75%, rgba(0,0,0,0.98) 98%);
  animation: heartbeat-vignette 1.2s infinite alternate;
}

@keyframes heartbeat-vignette {
  0% { opacity: 0.8; }
  100% { opacity: 1.0; }
}

/* Main Menu Styling */
#main-menu {
  background: radial-gradient(circle at center, rgba(15, 5, 5, 0.95) 0%, rgba(2, 1, 1, 0.99) 100%);
}

#menu-content {
  text-align: center;
  max-width: 600px;
  padding: 40px;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(139, 0, 0, 0.1);
}

.game-title {
  font-family: var(--font-title);
  font-size: 3.5rem;
  letter-spacing: 0.6rem;
  color: var(--color-accent-bright);
  text-shadow: 0 0 15px rgba(139, 0, 0, 0.6);
  margin-bottom: 5px;
  text-transform: uppercase;
}

.game-subtitle {
  font-size: 0.9rem;
  color: var(--color-text-dim);
  letter-spacing: 0.4rem;
  text-transform: uppercase;
  margin-bottom: 40px;
}

/* Buttons */
.btn {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 15px auto;
  padding: 14px 28px;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.15rem;
  text-transform: uppercase;
  color: var(--color-text-light);
  background-color: transparent;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.btn:hover {
  background-color: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent-bright);
  box-shadow: 0 0 15px rgba(255, 51, 51, 0.3);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

/* Options / Settings */
.settings-group {
  margin: 25px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 320px;
}

.settings-label {
  font-size: 0.85rem;
  letter-spacing: 0.1rem;
  text-transform: uppercase;
  color: var(--color-text-dim);
}

.selector {
  display: flex;
  gap: 5px;
  background: rgba(0, 0, 0, 0.4);
  padding: 3px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.selector-btn {
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05rem;
  text-transform: uppercase;
  background: transparent;
  color: var(--color-text-dim);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.selector-btn.active {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(139, 0, 0, 0.3);
}

/* HUD System */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 30px;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#hud.active {
  opacity: 1;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.hud-stat-box {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 10px 18px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
}

.hud-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1rem;
  color: var(--color-text-dim);
  margin-bottom: 2px;
}

.hud-stat-val {
  font-family: var(--font-title);
  font-size: 1.2rem;
  letter-spacing: 0.1rem;
  color: var(--color-accent-bright);
}

.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
}

.stamina-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 200px;
}

.stamina-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.5);
}

.stamina-bar-fill {
  width: 100%;
  height: 100%;
  background: var(--color-accent-bright);
  box-shadow: 0 0 8px var(--color-accent-bright);
  transition: width 0.1s linear;
}

.inventory-slot {
  width: 70px;
  height: 70px;
  background: rgba(0,0,0,0.7);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.inventory-icon {
  max-width: 40px;
  max-height: 40px;
  font-size: 1.8rem;
  color: var(--color-text-light);
}

.inventory-label {
  position: absolute;
  bottom: 4px;
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  color: var(--color-text-dim);
  text-align: center;
  width: 100%;
}

/* Crosshair and Prompts */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 4;
}

#crosshair.hovering {
  width: 14px;
  height: 14px;
  border: 1px solid var(--color-accent-bright);
  background-color: transparent;
  box-shadow: 0 0 8px var(--color-accent-bright);
}

#interact-prompt {
  position: absolute;
  top: 56%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  color: #fff;
  font-size: 0.9rem;
  letter-spacing: 0.1rem;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.75);
  padding: 6px 16px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

#interact-prompt.active {
  opacity: 1;
}

/* Day Transition Screen */
#day-screen {
  background: #000;
  z-index: 15;
}

.day-title {
  font-family: var(--font-title);
  font-size: 4rem;
  color: var(--color-accent-bright);
  letter-spacing: 0.8rem;
  margin-bottom: 20px;
  animation: creep-fade 2.5s infinite alternate;
}

.day-subtitle {
  font-size: 1.1rem;
  letter-spacing: 0.3rem;
  color: var(--color-text-dim);
  text-transform: uppercase;
}

@keyframes creep-fade {
  0% {
    opacity: 0.8;
    text-shadow: 0 0 5px rgba(139, 0, 0, 0.5);
  }
  100% {
    opacity: 1;
    text-shadow: 0 0 25px rgba(255, 51, 51, 0.8);
  }
}

/* Jumpscare Screen */
#jumpscare-screen {
  background: #000;
  z-index: 20;
}

#jumpscare-face {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

#jumpscare-blood {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: radial-gradient(circle, transparent 20%, rgba(139, 0, 0, 0.85) 100%);
  animation: shake 0.1s infinite;
}

@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(0px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  75% { transform: translate(2px, 1px) rotate(-1deg); }
  90% { transform: translate(-1px, -1px) rotate(1deg); }
  100% { transform: translate(1px, -2px) rotate(0deg); }
}

/* Instructions & Endings Screen */
.results-box {
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--color-border);
  padding: 30px;
  border-radius: 8px;
  max-width: 450px;
  width: 90%;
  text-align: center;
  margin-bottom: 25px;
}

.results-title {
  font-family: var(--font-title);
  font-size: 2rem;
  letter-spacing: 0.2rem;
  color: var(--color-accent-bright);
  margin-bottom: 15px;
}

.results-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text-light);
  margin-bottom: 20px;
}

.controls-guide {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  text-align: left;
  margin: 15px auto;
  max-width: 280px;
  line-height: 1.8;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 15px;
}

/* Hiding Vignette */
#hiding-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 15%, rgba(0,0,0,0.95) 70%, #000 100%);
  opacity: 0;
  transition: opacity 0.5s ease;
}

#hiding-overlay.active {
  opacity: 1;
}

/* Loading Overlay */
#loading-screen {
  background: #000;
  z-index: 100;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 51, 51, 0.1);
  border-top: 3px solid var(--color-accent-bright);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
