/* --- GLOBAL STYLES & FONT SETUP --- */
:root {
  /* THEME: Monochrome Pulse */
  --background-dark: #101010;     /* Near Black */
  --surface-glass: rgba(16, 16, 16, 0.75); /* Black glass */
  --border-glow: rgba(0, 123, 255, 0.6); /* Blue glow */
  --primary-accent: #007BFF;    /* Bright Blue */
  --primary-hover: #3395FF;
  --secondary-accent: #333333;   /* Dark Gray */
  --secondary-hover: #444444;
  --text-primary: #FFFFFF;
  --text-secondary: #A0A0A0;
  --text-error: #FF6B6B;
  --text-success: #50E3C2;
  --font-sans: 'Lexend', sans-serif;
}

body {
  height: 100vh; margin: 0; background-color: var(--background-dark);
  color: var(--text-primary); font-family: var(--font-sans);
  overflow: hidden; position: relative;
}

/* --- Animated Grid Background --- */
body::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-image: 
    linear-gradient(var(--secondary-accent) 1px, transparent 1px),
    linear-gradient(to right, var(--secondary-accent) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: pan-background 60s linear infinite;
  mask-image: radial-gradient(ellipse 100% 100% at 50% 50%, black 60%, transparent 100%);
  opacity: 0.3;
}
/* --- END: Animated Grid Background --- */


/* --- GAME & VIDEO STYLING --- */
#game-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
canvas { display: block; width: 100%; height: 100%; }

#video-overlay { 
  position:absolute; 
  width: 624px; 
  height: 351px; 
  z-index:20;
  border-radius: 8px; overflow: hidden; 
  border: 2px solid var(--border-glow);
  box-shadow: 0 0 30px rgba(0, 123, 255, 0.5);
  background: #000;
  transition: opacity 0.3s, visibility 0.3s;
}
#video-overlay.video-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
#youtube-player { width:100%; height:100%; }

/* --- In-Game HUD (Reskinned) --- */
#ingame-hud {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 20;
  background-color: var(--surface-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--secondary-accent);
  border-radius: 9999px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  padding: 0.5rem 1rem;
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
#ingame-hud.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}
#ingame-hud-balance {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- ENTRY POINT (Reskinned) --- */
#entry-container {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; justify-content: center;
  align-items: center; 
  background-color: rgba(16, 16, 16, 0.5); 
  backdrop-filter: blur(8px);
  z-index: 30; text-align: center; padding: 2rem;
  transition: opacity 0.5s ease-out, visibility 0.5s;
}
#entry-container.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.entry-content { 
  max-width: 500px;
  background-color: var(--surface-glass);
  border: 1px solid var(--secondary-accent);
  padding: 2.5rem 3rem;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
.entry-title { 
  font-size: 4rem; 
  margin: 0 0 1rem 0; 
  color: var(--text-primary);
  font-weight: 700;
}
.entry-subtitle { 
  font-size: 1.25rem; 
  color: var(--text-secondary); 
  margin-bottom: 2.5rem; 
  font-weight: 400;
}
.button-entry {
  padding: 1rem 2.5rem; font-size: 1.5rem; font-weight: 700;
  background-color: var(--primary-accent); color: white;
  border: none; border-radius: 8px; cursor: pointer;
  box-shadow: 0 5px 20px rgba(0, 123, 255, 0.4);
  transition: all 0.2s ease-in-out;
}
.button-entry:hover { 
  transform: translateY(-3px); 
  box-shadow: 0 8px 30px rgba(0, 123, 255, 0.6); 
  background-color: var(--primary-hover);
}

/* --- UI PANEL (Reskinned) --- */
#ui-panel {
  width: 360px; height: 100vh; 
  background-color: var(--surface-glass);
  backdrop-filter: blur(12px);
  border-left: 1px solid var(--secondary-accent);
  box-shadow: -5px 0 25px rgba(0,0,0, 0.3);
  display: flex; flex-direction: column; z-index: 40; position: fixed;
  right: 0; top: 0; transform: translateX(0);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: auto;
}
#ui-panel.hidden { transform: translateX(100%); pointer-events: none; }

.button-toggle {
  position: absolute; top: 20px; right: 20px; width: 50px; height: 50px;
  border-radius: 50%; 
  background-color: var(--surface-glass);
  backdrop-filter: blur(10px);
  color: var(--text-primary); 
  border: 1px solid var(--secondary-accent);
  font-size: 1.5rem; z-index: 1000; cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3); 
  transition: all 0.2s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.button-toggle:hover { 
  background-color: var(--primary-accent); 
  transform: translateY(-2px); 
  box-shadow: 0 0 15px var(--primary-accent);
}

/* --- FORMS & CONTENT (Reskinned) --- */
.panel-header { 
  padding: 1.5rem; 
  border-bottom: 1px solid var(--secondary-accent);
  text-align: center;
}
.logo-text { 
  margin: 0; 
  font-weight: 700;
  font-size: 1.8rem;
  color: var(--text-primary);
}
.panel-content { padding: 1.5rem; overflow-y: auto; flex-grow: 1; }

.form-group { margin-bottom: 1.25rem; }
.form-group:last-child { margin-bottom: 0; }

label { 
  display: block; font-weight: 500; 
  margin-bottom: 0.5rem; 
  color: var(--text-secondary); 
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
  width: 100%; padding: 0.85rem; 
  background-color: var(--background-dark);
  border: 1px solid var(--secondary-accent); 
  border-radius: 6px; color: var(--text-primary);
  font-size: 1rem; box-sizing: border-box; 
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus { 
  outline: none; 
  border-color: var(--primary-accent); 
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3); 
}
.button-group { display: flex; gap: 1rem; }
button {
  width: 100%; padding: 0.85rem; font-size: 1rem; font-weight: 700;
  border-radius: 6px; border: none; cursor: pointer; 
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.1s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
button:disabled { 
  background-color: var(--secondary-accent); 
  cursor: not-allowed; opacity: 0.6; 
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
.button-primary { 
  background-color: var(--primary-accent); 
  color: white; 
  box-shadow: 0 4px 15px -5px var(--primary-accent);
}
.button-primary:hover:not(:disabled) { 
  background-color: var(--primary-hover); 
  box-shadow: 0 4px 20px -5px var(--primary-hover);
}
.button-secondary { 
  background-color: var(--secondary-accent); 
  color: var(--text-primary); 
}
.button-secondary:hover:not(:disabled) { 
  background-color: var(--secondary-hover); 
}
.button-danger {
  background-color: var(--text-error);
  color: white;
  box-shadow: 0 4px 15px -5px var(--text-error);
}
.button-danger:hover:not(:disabled) {
  background-color: #FF8A8A;
  box-shadow: 0 4px 20px -5px #FF8A8A;
}

.button-google {
  background-color: #FFFFFF;
  color: #333333;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  border: 1px solid #DDDDDD;
}
.button-google:hover {
  background-color: #F8F8F8;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}
.button-google svg {
  width: 20px;
  height: 20px;
}

.auth-separator {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-secondary);
  margin: 1.5rem 0;
}
.auth-separator::before,
.auth-separator::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--secondary-accent);
}
.auth-separator:not(:empty)::before {
  margin-right: .5em;
}
.auth-separator:not(:empty)::after {
  margin-left: .5em;
}

/* --- User Panel Styles --- */
.welcome-message { 
  display: flex; justify-content: space-between; align-items: center; 
  margin-bottom: 1.5rem; flex-wrap: wrap; 
  color: var(--text-secondary);
}
.welcome-message strong {
  color: var(--text-primary);
}
.welcome-message a { color: var(--text-secondary); text-decoration: none; }
.welcome-message a:hover { color: var(--primary-accent); text-decoration: underline; }

#currency-display {
  padding: 0.25rem 0.75rem; 
  background-color: var(--background-dark);
  border-radius: 9999px; 
  border: 1px solid var(--secondary-accent);
  font-weight: 700; display: flex; 
  align-items: center; gap: 0.5rem; margin: 0 1rem;
  color: var(--text-primary);
}
.hub-section, .room-section {
    border-top: 1px solid var(--secondary-accent); 
    margin-top: 1.5rem; 
    padding-top: 1.5rem;
}
.hub-section h3, .room-section h3 {
  color: var(--text-primary);
  font-weight: 700;
  margin-top: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--secondary-accent);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
}

.purchase-info { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 1rem; text-align: center; }
.feedback { color: var(--text-error); margin: 1rem 0 0 0; min-height: 1.25em; text-align: center; }
.feedback-success { color: var(--text-success); }


/* --- NEW: MAIN SCREEN GAME LAUNCHER STYLES --- */
#hub-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Aligns items to the left */
  justify-content: flex-start; /* Aligns content to the top */
  width: 100%;
  height: 100vh; /* Takes full viewport height */
  padding: 5rem 3rem; /* Padding from top-left corner */
  box-sizing: border-box;
  position: relative; /* ADVOCATE FIX: This makes the z-index apply correctly. */
  z-index: 5; /* Sits above background AND #game-container, but below panel */
}

.launcher-title {
  font-size: 3.5rem; /* Slightly smaller title */
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: 0 0 15px rgba(255,255,255,0.3);
  margin: 0 0 2rem 0; /* Less bottom margin */
  width: 100%; /* Ensures it aligns with the grid */
  flex-shrink: 0; /* Prevents title from shrinking */
}

.game-launcher-grid {
  display: grid;
  /* ADVOCATE FIX: Changed to 2 columns and a smaller max-width */
  grid-template-columns: repeat(2, 1fr); /* 2 columns */
  gap: 1.5rem; /* Tighter gap */
  width: 100%;
  max-width: 900px; /* Max width for 2 cards */
  overflow-y: auto; 
  max-height: calc(100% - 6rem); 
  padding-right: 1rem; /* Space for the scrollbar */
}

/* ADVOCATE FIX: Add a media query for smaller screens to stack the 2 cards */
@media (max-width: 768px) {
  .game-launcher-grid {
    grid-template-columns: 1fr; /* 1 column on mobile */
    max-width: 450px;
    padding-right: 0.5rem;
  }
  #hub-container {
    padding: 3rem 1rem;
    align-items: center; /* Center content on mobile */
  }
  .launcher-title {
    text-align: center;
  }
}


.game-card {
  background-color: var(--surface-glass);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid var(--secondary-accent);
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  transition: all 0.2s ease-in-out;
}
.game-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary-accent);
  box-shadow: 0 10px 30px rgba(0, 123, 255, 0.4);
}
.game-card-image {
  height: 160px; /* Smaller card image height */
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--secondary-accent);
  opacity: 0.8;
  transition: opacity 0.2s ease;
}
.game-card:hover .game-card-image {
  opacity: 1;
}

.game-card-content {
  padding: 1.25rem; /* Tighter padding */
}
.game-card-content h4 {
  margin: 0 0 0.75rem 0;
  font-size: 1.25rem; /* Smaller font */
  color: var(--text-primary);
}
.game-card-content p {
  margin: 0 0 1.5rem 0;
  color: var(--text-secondary);
  font-size: 0.9rem; /* Smaller font */
  line-height: 1.5;
  min-height: 4.5em; /* Ensures cards are same height (3 lines of text) */
}
/* New style for placeholder cards */
.game-card.placeholder {
  opacity: 0.6;
}
.game-card.placeholder:hover {
  transform: translateY(0);
  border-color: var(--secondary-accent);
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  cursor: default;
}

.game-card-join-form {
  border-top: 1px solid var(--secondary-accent);
  padding-top: 1.25rem; /* Tighter padding */
}
/* --- END: GAME LAUNCHER STYLES --- */


/* --- CHAT WIDGET (Reskinned) --- */
#chat-widget {
  position: absolute; bottom: 20px; left: 20px; width: 340px; z-index: 25;
  background-color: var(--surface-glass);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  border: 1px solid var(--secondary-accent);
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  padding: 1rem; box-sizing: border-box; opacity: 1; transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
#chat-widget.hidden { opacity: 0; transform: translateY(20px); pointer-events: none; }
#chat-log { 
  height: 200px; overflow-y: auto; margin-bottom: 1rem; 
  background-color: rgba(16, 16, 16, 0.5);
  border-radius: 6px; padding: 0.75rem; 
  font-size: 0.95rem;
}
#chat-input { width: 100%; }
.video-control-button {
  position: absolute; bottom: 10px; right: 10px; width: 36px; height: 36px;
  padding: 6px; 
  background-color: var(--surface-glass);
  border: 1px solid var(--secondary-accent); 
  color: white;
  border-radius: 6px; cursor: pointer; z-index: 20;
  opacity: 0; transition: opacity 0.3s; pointer-events: auto;
}
#video-overlay:hover .video-control-button { opacity: 1; }
.video-control-button svg { width: 100%; height: 100%; }
.playback-controls { display: flex; gap: 1rem; align-items: center; }
.playback-controls button { width: auto; flex-shrink: 0; padding: 0.5rem 1rem; }
.playback-controls input[type="range"] { width: 100%; }

/* --- MODAL STYLES (Reskinned) --- */
.modal-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(16, 16, 16, 0.5);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
  opacity: 1;
  transition: opacity 0.2s ease-in-out;
}
.modal-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}
.modal-content {
  width: 90%;
  max-width: 600px;
  background-color: var(--surface-glass);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  border: 1px solid var(--secondary-accent);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--secondary-accent);
}
.modal-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.5rem;
}
.modal-close-button {
  font-size: 2rem;
  font-weight: 300;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: auto;
}
.modal-close-button:hover {
  color: var(--primary-accent);
}
.modal-grid {
  padding: 1.75rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1.25rem;
}
/* REMOVED customization-wardrobe-grid */
.modal-grid p {
  color: var(--text-secondary);
  text-align: center;
  grid-column: 1 / -1;
}

/* --- Item Card Styles (Reskinned) --- */
.item-card-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.item-card {
  background-color: var(--background-dark);
  border: 1px solid var(--secondary-accent);
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}
.item-card:hover:not(.wardrobe-item) {
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  border-color: var(--primary-accent);
}
.wardrobe-item:hover {
   border-color: var(--primary-hover);
}
.item-card-preview {
  width: 100%;
  height: 100px;
  object-fit: scale-down; 
  image-rendering: pixelated;
  background-color: rgba(42, 61, 34, 0.8); /* Game grass color */
  border-radius: 6px;
  margin-bottom: 0.5rem;
}
.item-card-name {
  font-weight: 700;
  color: var(--text-primary);
  margin: 0.5rem 0;
  font-size: 0.9rem;
}
.item-card-price {
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}
.item-unequip-button {
  width: auto;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  margin-top: 0.5rem;
  background-color: var(--text-error);
  color: white;
}
.item-unequip-button:hover {
  background-color: #FF8A8A;
}

/* --- Background Animation Keyframes --- */
@keyframes pan-background {
  0% { background-position: 0 0; }
  100% { background-position: 1000px 1000px; }
}
