/* ===== DREAMROOMS 3D — style.css ===== */

/* ─── ROOT VARS ─── */
:root {
  --c-yellow: #f0d96c;
  --c-dark-yellow: #d8c86b;
  --c-black: #0a0a0a;
  --c-dark: #0e1726;
  --c-blue: #5e7cff;
  --c-pink: #ff8ccf;
  --c-teal: #8fffd8;
  --c-red: #ff4444;
  --font-mono: 'Share Tech Mono', 'Courier New', monospace;
  --font-vt: 'VT323', monospace;
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }
body { font-family: var(--font-mono); color: #fff; cursor: default; }
button { cursor: pointer; border: none; outline: none; font-family: var(--font-mono); }

.hidden { display: none !important; }

/* ─── LOADING SCREEN ─── */
#loading-screen {
  position: fixed; inset: 0; z-index: 1000;
  background: #000;
  display: flex; align-items: center; justify-content: center;
}
.loading-inner {
  text-align: center; width: 360px;
}
.loading-logo {
  font-family: var(--font-vt);
  font-size: 72px;
  color: var(--c-yellow);
  letter-spacing: 8px;
  text-shadow: 0 0 30px rgba(240,217,108,0.8), 0 0 60px rgba(240,217,108,0.4);
  animation: pulse-glow 2s ease-in-out infinite;
}
.loading-sub {
  font-size: 13px;
  color: rgba(240,217,108,0.6);
  letter-spacing: 4px;
  margin-bottom: 40px;
}
.loading-bar-wrap {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.08);
  margin-bottom: 14px;
  overflow: hidden;
}
.loading-bar {
  height: 100%;
  width: 0%;
  background: var(--c-yellow);
  box-shadow: 0 0 10px var(--c-yellow);
  transition: width 0.08s linear;
}
.loading-text {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 2px;
  height: 18px;
  margin-bottom: 20px;
}
.loading-warning {
  font-size: 11px;
  color: var(--c-red);
  letter-spacing: 3px;
  opacity: 0.7;
}

/* ─── MAIN MENU ─── */
#main-menu {
  position: fixed; inset: 0; z-index: 900;
  background: #000;
  display: flex; align-items: center; justify-content: center;
}
.menu-bg-anim {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(240,217,108,0.03) 0px, transparent 1px, transparent 80px),
    repeating-linear-gradient(90deg, rgba(240,217,108,0.02) 0px, transparent 1px, transparent 80px);
  animation: grid-drift 20s linear infinite;
}
@keyframes grid-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 80px, 80px 0; }
}
.menu-content {
  position: relative; z-index: 1;
  text-align: center; padding: 40px;
  max-width: 480px; width: 100%;
}
.menu-title {
  font-family: var(--font-vt);
  font-size: 80px;
  letter-spacing: 6px;
  margin-bottom: 4px;
  line-height: 1;
}
.title-dream {
  color: var(--c-yellow);
  text-shadow: 0 0 20px rgba(240,217,108,0.8);
  animation: pulse-glow 2.5s ease-in-out infinite;
}
.title-rooms {
  color: #fff;
  opacity: 0.85;
}
.menu-subtitle {
  font-family: var(--font-vt);
  font-size: 24px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 8px;
  margin-bottom: 8px;
}
.menu-tagline {
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  letter-spacing: 1.5px;
  line-height: 1.8;
  margin-bottom: 36px;
}
.menu-buttons {
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 30px;
}
.menu-btn {
  background: transparent;
  border: 1px solid rgba(240,217,108,0.3);
  color: var(--c-yellow);
  font-size: 14px;
  letter-spacing: 3px;
  padding: 12px 24px;
  text-transform: uppercase;
  transition: all 0.2s ease;
  position: relative;
}
.menu-btn:hover {
  border-color: var(--c-yellow);
  background: rgba(240,217,108,0.08);
  box-shadow: 0 0 20px rgba(240,217,108,0.2), inset 0 0 20px rgba(240,217,108,0.05);
  letter-spacing: 5px;
}
.menu-btn.secondary {
  border-color: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.4);
  font-size: 12px;
}
.menu-btn.secondary:hover {
  border-color: rgba(255,255,255,0.4);
  color: rgba(255,255,255,0.7);
  background: transparent;
  box-shadow: none;
  letter-spacing: 3px;
}
.menu-footer {
  font-size: 11px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 2px;
}

/* ─── PANELS ─── */
.panel {
  position: fixed; inset: 0; z-index: 950;
  background: rgba(0,0,0,0.95);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px;
  gap: 20px;
}
.panel-title {
  font-family: var(--font-vt);
  font-size: 36px;
  color: var(--c-yellow);
  letter-spacing: 6px;
  margin-bottom: 10px;
}
#discoveries-content {
  max-height: 50vh;
  overflow-y: auto;
  width: 100%;
  max-width: 500px;
}
.discovery-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 10px 0;
  font-size: 12px;
  letter-spacing: 1px;
}
.disc-name { color: var(--c-yellow); font-size: 13px; }
.disc-meta { color: rgba(255,255,255,0.3); text-align: right; font-size: 10px; }
.about-text {
  max-width: 420px;
  line-height: 2;
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  text-align: center;
  letter-spacing: 1px;
}
.about-text p.dim { color: rgba(255,255,255,0.25); font-size: 11px; }

/* ─── GAME SCREEN ─── */
#game-screen {
  position: fixed; inset: 0; z-index: 100;
  background: #000;
}
#three-canvas {
  position: absolute; inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* ─── CRT / VHS OVERLAYS ─── */
.scanlines {
  position: absolute; inset: 0; z-index: 200;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  animation: scanline-roll 8s linear infinite;
}
@keyframes scanline-roll {
  from { background-position: 0 0; }
  to { background-position: 0 300px; }
}
.vhs-overlay {
  position: absolute; inset: 0; z-index: 201;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 99px,
      rgba(255,255,255,0.003) 99px,
      rgba(255,255,255,0.003) 100px
    );
  opacity: 0.4;
}
.noise-overlay {
  position: absolute; inset: 0; z-index: 202;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' 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)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  animation: noise-anim 0.15s steps(1) infinite;
}
@keyframes noise-anim {
  0%   { background-position: 0 0; }
  10%  { background-position: -50px 25px; }
  20%  { background-position: 25px -50px; }
  30%  { background-position: 50px 50px; }
  40%  { background-position: -25px 75px; }
  50%  { background-position: 75px -25px; }
  60%  { background-position: -75px -50px; }
  70%  { background-position: 25px 100px; }
  80%  { background-position: -100px 25px; }
  90%  { background-position: 50px -75px; }
  100% { background-position: 0 0; }
}
.vignette {
  position: absolute; inset: 0; z-index: 203;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.7) 100%);
}
.chromatic-aberration {
  position: absolute; inset: 0; z-index: 204;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 0.1s;
}
.chromatic-aberration.active {
  opacity: 1;
  background:
    radial-gradient(ellipse at 48% 50%, rgba(255,0,0,0.04) 0%, transparent 70%),
    radial-gradient(ellipse at 52% 50%, rgba(0,0,255,0.04) 0%, transparent 70%);
  animation: chrom-pulse 0.15s ease-in-out 3;
}
@keyframes chrom-pulse {
  0%   { opacity: 1; transform: translateX(-2px); }
  50%  { opacity: 0.5; transform: translateX(2px); }
  100% { opacity: 1; transform: translateX(0); }
}
#transition-overlay {
  position: absolute; inset: 0; z-index: 500;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
#transition-overlay.active { opacity: 1; pointer-events: all; }

/* ─── CROSSHAIR ─── */
#crosshair {
  position: absolute; inset: 0; z-index: 210;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.ch-h, .ch-v {
  position: absolute;
  background: rgba(255,255,255,0.5);
}
.ch-h { width: 14px; height: 1px; }
.ch-v { width: 1px; height: 14px; }

/* ─── HUD ─── */
#hud {
  position: absolute; inset: 0; z-index: 300;
  pointer-events: none;
  font-size: 11px;
  letter-spacing: 2px;
}
.hud-block {
  position: absolute;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(240,217,108,0.15);
  padding: 8px 12px;
  backdrop-filter: blur(2px);
  min-width: 110px;
}
.hud-tl { top: 16px; left: 16px; }
.hud-tr { top: 16px; right: 16px; text-align: right; }
.hud-bl { bottom: 50px; left: 16px; }
.hud-br { bottom: 50px; right: 16px; min-width: 130px; }
.hud-label {
  color: rgba(240,217,108,0.5);
  font-size: 9px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.hud-value {
  color: var(--c-yellow);
  font-size: 14px;
  font-family: var(--font-vt);
  margin-bottom: 6px;
}
.hud-value:last-child { margin-bottom: 0; }
.sanity-track {
  height: 4px;
  background: rgba(255,255,255,0.1);
  margin-top: 4px;
  overflow: hidden;
}
.sanity-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--c-red) 0%, var(--c-yellow) 50%, var(--c-teal) 100%);
  background-size: 200% 100%;
  background-position: 0% 0;
  transition: width 0.5s ease, background-position 0.5s ease;
}

/* ─── ROOM NAME ─── */
#room-name {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 310;
  font-family: var(--font-vt);
  font-size: 38px;
  letter-spacing: 8px;
  text-align: center;
  color: rgba(255,255,255,0.8);
  text-shadow: 0 0 30px rgba(255,255,255,0.4);
  pointer-events: none;
  opacity: 0;
}
#room-name.show-anim {
  animation: room-name-fade 4s ease-in-out forwards;
}
@keyframes room-name-fade {
  0%   { opacity: 0; transform: translate(-50%, calc(-50% + 10px)); }
  15%  { opacity: 1; transform: translate(-50%, -50%); }
  70%  { opacity: 0.9; }
  100% { opacity: 0; transform: translate(-50%, calc(-50% - 8px)); }
}

/* ─── NOTIFICATION ─── */
#notification {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 350;
  font-size: 13px;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.8);
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 8px 20px;
  text-align: center;
  pointer-events: none;
  animation: notif-appear 0.3s ease;
}
@keyframes notif-appear {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ─── ELEVATOR UI ─── */
#elevator-ui {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  pointer-events: all;
}
.elev-panel {
  background: rgba(0,0,0,0.88);
  border: 1px solid rgba(240,217,108,0.4);
  box-shadow: 0 0 30px rgba(240,217,108,0.15), inset 0 0 40px rgba(0,0,0,0.5);
  padding: 20px 30px;
  text-align: center;
  min-width: 220px;
}
.elev-title {
  font-family: var(--font-vt);
  font-size: 20px;
  letter-spacing: 6px;
  color: rgba(240,217,108,0.6);
  margin-bottom: 6px;
}
.elev-floor-display {
  font-family: var(--font-vt);
  font-size: 56px;
  color: var(--c-yellow);
  text-shadow: 0 0 20px rgba(240,217,108,0.8);
  margin: 4px 0;
  letter-spacing: 4px;
}
.elev-buttons {
  display: flex;
  gap: 12px;
  margin: 10px 0 8px;
}
.elev-btn {
  flex: 1;
  background: rgba(240,217,108,0.08);
  border: 1px solid rgba(240,217,108,0.35);
  color: var(--c-yellow);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 2px;
  padding: 10px 8px;
  transition: all 0.2s;
}
.elev-btn:hover {
  background: rgba(240,217,108,0.18);
  box-shadow: 0 0 15px rgba(240,217,108,0.2);
}
.elev-btn:active {
  background: rgba(240,217,108,0.3);
  transform: scale(0.97);
}
.elev-hint {
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 2px;
}

/* ─── CONTROLS HINT ─── */
#controls-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.2);
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 2s ease;
}

/* ─── POINTER LOCK PROMPT ─── */
#click-to-play {
  position: absolute; inset: 0; z-index: 600;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.ctp-inner { text-align: center; }
.ctp-title {
  font-family: var(--font-vt);
  font-size: 40px;
  letter-spacing: 8px;
  color: var(--c-yellow);
  text-shadow: 0 0 20px rgba(240,217,108,0.6);
  animation: blink-anim 1.2s step-end infinite;
}
.ctp-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 3px;
  margin-top: 10px;
}

/* ─── GLOBAL ANIMATIONS ─── */
.blink { animation: blink-anim 1.2s step-end infinite; }
@keyframes blink-anim {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 20px rgba(240,217,108,0.7), 0 0 40px rgba(240,217,108,0.3); }
  50%       { text-shadow: 0 0 30px rgba(240,217,108,1.0), 0 0 60px rgba(240,217,108,0.5); }
}

/* ─── EVENT CLASSES ─── */
.flicker-event #three-canvas { animation: flicker-anim 0.1s ease-in-out 8 alternate; }
@keyframes flicker-anim {
  0%   { opacity: 1; }
  50%  { opacity: 0.3; }
  100% { opacity: 0.9; }
}
.glitch-event { filter: hue-rotate(30deg) saturate(2); }
.glitch-event .scanlines { animation: glitch-scan 0.05s step-end infinite; }
@keyframes glitch-scan {
  0%  { transform: translateY(0) scaleX(1); }
  25% { transform: translateY(2px) scaleX(1.002); }
  50% { transform: translateY(-2px) scaleX(0.998); }
  75% { transform: translateY(1px) scaleX(1.001); }
}
.noclip-event #three-canvas { animation: noclip-warp 0.3s ease-in-out; }
@keyframes noclip-warp {
  0%   { transform: scale(1) skew(0deg); opacity: 1; }
  30%  { transform: scale(1.05) skew(2deg); opacity: 0.5; }
  60%  { transform: scale(0.95) skew(-2deg); opacity: 0.3; }
  100% { transform: scale(1) skew(0deg); opacity: 1; }
}
.ultra-rare #three-canvas { animation: ultra-pulse 0.5s ease-in-out 4; }
@keyframes ultra-pulse {
  0%, 100% { filter: brightness(1) saturate(1); }
  50%       { filter: brightness(1.5) saturate(2) hue-rotate(180deg); }
}

/* ─── MOBILE TOUCH CONTROLS ─── */
#mobile-controls {
  position: absolute;
  bottom: 60px;
  left: 0;
  right: 0;
  z-index: 320;
  pointer-events: none;
  display: none;
}
@media (max-width: 768px) {
  #mobile-controls { display: flex; justify-content: space-between; padding: 0 20px; }
  #crosshair { display: none; }
  .hud-block { font-size: 9px; padding: 5px 8px; }
  .hud-value { font-size: 12px; }
  #controls-hint { display: none; }
}
.dpad {
  display: grid;
  grid-template-columns: 44px 44px 44px;
  grid-template-rows: 44px 44px 44px;
  gap: 4px;
  pointer-events: all;
}
.dpad-btn {
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.dpad-btn:active { background: rgba(255,255,255,0.15); }
.dpad-up    { grid-column: 2; grid-row: 1; }
.dpad-left  { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down  { grid-column: 2; grid-row: 3; }

/* Scrollbar styles */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); }
::-webkit-scrollbar-thumb { background: rgba(240,217,108,0.3); }
