/* style.css — EscapeVR UI */

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

:root {
  --accent: #00FF41;
  --bg-dark: #0a0a0f;
  --bg-panel: rgba(5, 10, 20, 0.92);
  --text: #e0e8f0;
  --border: rgba(0, 255, 65, 0.3);
  --danger: #FF4444;
  --gold: #FFD700;
}

body {
  background: #000;
  font-family: 'Courier New', Courier, monospace;
  color: var(--text);
  overflow: hidden;
  user-select: none;
}

/* ── Canvas ─────────────────────────────────────────────────── */
#canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
}

/* ── Lobby ───────────────────────────────────────────────────── */
#lobby {
  position: fixed; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #0a0a1a 0%, #000 70%);
  z-index: 100;
  gap: 0;
}

.lobby-title {
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(0,255,65,0.6), 0 0 60px rgba(0,255,65,0.3);
  margin-bottom: 0.2em;
  animation: titlePulse 3s ease-in-out infinite;
}
@keyframes titlePulse {
  0%,100% { text-shadow: 0 0 20px rgba(0,255,65,0.5), 0 0 40px rgba(0,255,65,0.2); }
  50%      { text-shadow: 0 0 40px rgba(0,255,65,0.9), 0 0 80px rgba(0,255,65,0.5); }
}

.lobby-subtitle {
  font-size: 0.9rem;
  color: rgba(0,255,65,0.5);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 2.5em;
}

.lobby-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 2.5rem;
  width: min(480px, 92vw);
  box-shadow: 0 0 60px rgba(0,255,65,0.08), inset 0 0 40px rgba(0,0,0,0.5);
}

.panel-section {
  margin-bottom: 1.5rem;
}
.panel-section:last-child { margin-bottom: 0; }

.panel-section h3 {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(0,255,65,0.6);
  margin-bottom: 0.8rem;
  border-bottom: 1px solid rgba(0,255,65,0.2);
  padding-bottom: 0.4rem;
}

.row { display: flex; gap: 0.6rem; align-items: center; }

input[type="text"], input[type="number"], select {
  background: rgba(0,20,10,0.8);
  border: 1px solid rgba(0,255,65,0.25);
  border-radius: 6px;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 0.8rem;
  outline: none;
  transition: border-color 0.2s;
  flex: 1;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 8px rgba(0,255,65,0.2); }
select option { background: #0a0a1a; }

.btn {
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 1rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn:hover { background: rgba(0,255,65,0.12); box-shadow: 0 0 12px rgba(0,255,65,0.3); }
.btn-primary {
  background: rgba(0,255,65,0.15);
  font-size: 1.05rem;
  padding: 0.7rem 1.4rem;
  letter-spacing: 0.08em;
  width: 100%;
}
.btn-primary:hover { background: rgba(0,255,65,0.3); transform: translateY(-1px); }
.btn-join { border-color: #00D4FF; color: #00D4FF; }
.btn-join:hover { background: rgba(0,212,255,0.12); box-shadow: 0 0 12px rgba(0,212,255,0.3); }

.separator {
  text-align: center;
  color: rgba(255,255,255,0.2);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  margin: 1.2rem 0;
  position: relative;
}
.separator::before, .separator::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: rgba(255,255,255,0.1);
}
.separator::before { left: 0; }
.separator::after  { right: 0; }

#status-join {
  font-size: 0.78rem;
  color: rgba(0,212,255,0.7);
  margin-top: 0.5rem;
  min-height: 1.2em;
}

.controls-hint {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.3);
  text-align: center;
  margin-top: 1.2rem;
  line-height: 1.8;
  letter-spacing: 0.05em;
}

/* ── Game UI ─────────────────────────────────────────────────── */
#game-ui {
  display: none;
  pointer-events: none;
}

#crosshair {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.7);
  font-size: 1.4rem;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 0 4px rgba(0,0,0,0.8);
}

#hud-top {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.8rem 1rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
  pointer-events: none;
}

.hud-chip {
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.75);
  backdrop-filter: blur(4px);
}
.hud-chip.accent { border-color: var(--border); color: var(--accent); }

#toast {
  position: fixed;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(0,0,0,0.85);
  border: 1px solid rgba(0,255,65,0.3);
  border-radius: 8px;
  padding: 0.6rem 1.4rem;
  font-size: 0.95rem;
  color: var(--text);
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
  max-width: 500px;
  text-align: center;
  backdrop-filter: blur(8px);
  z-index: 50;
  white-space: pre-wrap;
}

#hint-e {
  position: fixed;
  bottom: 30%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(255,215,0,0.4);
  border-radius: 6px;
  padding: 0.4rem 1rem;
  font-size: 0.88rem;
  color: var(--gold);
  display: none;
  pointer-events: none;
  animation: hintBlink 1.5s ease-in-out infinite;
  z-index: 50;
}
@keyframes hintBlink {
  0%,100% { opacity: 1; } 50% { opacity: 0.55; }
}

#hint-code {
  position: fixed;
  bottom: 12%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  border: 1px solid rgba(0,255,65,0.5);
  border-radius: 8px;
  padding: 0.5rem 1.5rem;
  font-size: 0.82rem;
  color: var(--accent);
  display: none;
  pointer-events: none;
  z-index: 50;
  text-align: center;
  line-height: 1.7;
}

#inventory {
  position: fixed;
  bottom: 1rem; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 0.3rem 1rem;
  font-size: 1.1rem;
  min-width: 80px;
  text-align: center;
  pointer-events: none;
  color: var(--gold);
}

#minimap {
  position: fixed;
  bottom: 1rem; right: 1rem;
  width: 140px; height: 140px;
  border: 1px solid rgba(0,255,65,0.3);
  border-radius: 8px;
  opacity: 0.8;
  pointer-events: none;
  background: #0a0a0a;
}

#room-code-display {
  position: fixed;
  top: 0.8rem; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(0,212,255,0.4);
  border-radius: 20px;
  padding: 0.3rem 1rem;
  font-size: 0.75rem;
  color: #00D4FF;
  display: none;
  pointer-events: all;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 60;
}
#room-code-display:hover { background: rgba(0,212,255,0.1); }

/* ── Win Screen ──────────────────────────────────────────────── */
#win-screen {
  position: fixed; inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.92);
  z-index: 200;
  animation: fadeIn 1s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.win-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  color: var(--accent);
  text-shadow: 0 0 40px rgba(0,255,65,0.8);
  margin-bottom: 0.5em;
  animation: winPop 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes winPop { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.win-subtitle { font-size: 1.2rem; color: rgba(255,255,255,0.6); margin-bottom: 0.5em; }
#win-time { font-size: 1.8rem; color: var(--gold); margin-bottom: 2em; }

.win-buttons { display: flex; gap: 1rem; }

/* ── Chat log ────────────────────────────────────────────────── */
#chat-log {
  position: fixed;
  bottom: 5rem; left: 1rem;
  width: 260px;
  pointer-events: none;
  z-index: 40;
}
.chat-msg {
  background: rgba(0,0,0,0.7);
  border-left: 2px solid var(--accent);
  padding: 0.3rem 0.6rem;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.8);
  border-radius: 0 4px 4px 0;
  animation: fadeIn 0.3s ease;
}

/* ── Loading overlay ─────────────────────────────────────────── */
#loading {
  position: fixed; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 300;
  transition: opacity 0.5s;
}
#loading.hidden { opacity: 0; pointer-events: none; }
.loading-bar-wrap {
  width: 300px;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 1.5rem;
}
.loading-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  animation: loadBar 1.5s ease forwards;
  box-shadow: 0 0 8px var(--accent);
}
@keyframes loadBar { to { width: 100%; } }
.loading-text { color: rgba(0,255,65,0.6); font-size: 0.85rem; letter-spacing: 0.2em; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }
