/* --- Global Variables & Reset --- */
:root {
  --bg-color: #0d0d0d;
  --text-color: #ffffff;
  --primary-neon: #39ff14; /* Neon Green */
  --secondary-neon: #ff007f; /* Neon Pink */
  --tertiary-neon: #00f3ff; /* Neon Blue */
  --dark-accent: #1a1a1a;
  --font-pixel: 'Press Start 2P', cursive;
  --font-body: 'Inter', sans-serif;
  --transition: all 0.3s ease;
  --glow-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
  --glass-bg: rgba(26, 26, 26, 0.8);
}

body.light-mode {
  --bg-color: #f4f4f4;
  --text-color: #1a1a1a;
  --primary-neon: #2ecc71;
  --secondary-neon: #e91e63;
  --tertiary-neon: #00bcd4;
  --dark-accent: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.9);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  transition: var(--transition);
}

/* --- Retro CRT & Scanline Effects --- */
.crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%,
    rgba(0, 0, 0, 0.1) 50%
  ),
  radial-gradient(
    rgba(18, 16, 16, 0.15) 0%,
    rgba(0, 0, 0, 0.3) 100%
  );
  z-index: 1000;
  pointer-events: none;
  background-size: 100% 2px, 100% 100%;
}

.scanline {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100px;
  background: linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(0, 0, 0, 0) 100%
  );
  opacity: 0.1;
  z-index: 1001;
  pointer-events: none;
  animation: scanline 8s linear infinite;
}

@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

/* --- Container --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.text-center { text-align: center; }

/* --- Header & Nav --- */
header {
  height: 80px;
  display: flex;
  align-items: center;
  position: fixed;
  top: 0;
  width: 100%;
  background-color: var(--bg-color);
  z-index: 100;
  border-bottom: 2px solid var(--primary-neon);
  box-shadow: 0 4px 15px rgba(57, 255, 20, 0.2);
}

nav.container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo {
  font-family: var(--font-pixel);
  font-size: 1.2rem;
  color: var(--primary-neon);
  text-shadow: var(--glow-shadow);
  letter-spacing: 2px;
}

.nav-controls button {
  background: none;
  border: 1px solid var(--text-color);
  color: var(--text-color);
  padding: 8px;
  margin-left: 10px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 1.2rem;
  transition: var(--transition);
}

.nav-controls button:hover {
  background-color: var(--primary-neon);
  color: #000;
  border-color: var(--primary-neon);
}

/* --- Hero Section --- */
.hero-section {
  padding-top: 15rem;
  padding-bottom: 8rem;
  position: relative;
  text-align: center;
}

h1.glitch-text {
  font-family: var(--font-pixel);
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  color: var(--primary-neon);
  text-shadow: 3px 3px var(--secondary-neon);
  position: relative;
}

.hero-description {
  font-size: 1.2rem;
  margin-bottom: 2.5rem;
  color: #ccc;
  font-family: var(--font-body);
}

.btn {
  font-family: var(--font-pixel);
  padding: 18px 40px;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  border-radius: 0;
  text-decoration: none;
  display: inline-block;
  transition: var(--transition);
  margin-bottom: 1rem;
}

.btn-primary {
  background-color: var(--primary-neon);
  color: #000;
  box-shadow: 4px 4px 0 var(--secondary-neon);
}

.btn-primary:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--secondary-neon);
}

.btn-primary:active {
  transform: translate(0, 0);
  box-shadow: 2px 2px 0 var(--secondary-neon);
}

.cta-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sub-text {
  font-size: 0.8rem;
  color: var(--primary-neon);
  opacity: 0.8;
}

/* --- Background Blocks Animation --- */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.falling-block {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 2px solid;
  animation: fall linear infinite;
}

@keyframes fall {
  from { transform: translateY(-100px) rotate(0deg); }
  to { transform: translateY(110vh) rotate(360deg); }
}

/* --- Features Section --- */
.features-section {
  padding: 8rem 0;
  background-color: var(--dark-accent);
}

.grid.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 30px;
}

.card {
  background-color: var(--bg-color);
  border: 2px solid var(--primary-neon);
  padding: 30px;
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 10px 20px rgba(57, 255, 20, 0.2);
}

.card .icon {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

.card h3 {
  font-family: var(--font-pixel);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: var(--tertiary-neon);
}

.card p {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* --- Game Section --- */
.game-section {
  padding: 8rem 0;
}

.game-mode-selector button {
  margin: 0 10px;
}

.game-mode-selector button.active {
  background-color: var(--secondary-neon);
  color: #fff;
  box-shadow: 0 0 15px var(--secondary-neon);
}

.online-setup.hidden {
    display: none !important;
}

.online-setup label {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    color: #ccc;
    margin-right: 15px;
}

#my-peer-id {
    font-size: 1.1rem;
    text-shadow: 0 0 10px var(--tertiary-neon);
}

.game-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 50px;
  transition: all 0.5s ease;
}

.player-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.player-label {
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  color: var(--secondary-neon);
  margin-bottom: 20px;
  padding: 5px 15px;
  border: 1px solid var(--secondary-neon);
}

.game-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 40px;
  max-width: 900px;
  margin: 0 auto;
}

.player-container.hidden {
  display: none !important;
}

.game-wrapper.mode-classic .player-label {
  display: none;
}

.game-sidebar {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stat-box, .info-box {
  background: var(--dark-accent);
  border: 2px solid var(--tertiary-neon);
  padding: 15px;
  text-align: center;
}

.stat-box label, .info-box label {
  display: block;
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--tertiary-neon);
  margin-bottom: 10px;
}

.stat-box span {
  font-family: var(--font-pixel);
  font-size: 1.2rem;
  color: #fff;
}

#next-canvas {
  background: #000;
  border: 1px solid #333;
}

.info-box ul {
  list-style: none;
  text-align: left;
}

.info-box ul li {
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.info-box ul li span {
  color: var(--secondary-neon);
  font-weight: bold;
}

.game-board-wrapper {
  position: relative;
  border: 4px solid var(--primary-neon);
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.4);
  background-color: #000;
  line-height: 0;
}

#tetris-canvas {
  max-width: 100%;
  height: auto;
}

.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.game-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.overlay-content {
  text-align: center;
}

.overlay-content h2 {
  font-family: var(--font-pixel);
  color: var(--secondary-neon);
  margin-bottom: 2rem;
}

/* --- Mobile Controls --- */
.mobile-controls {
  display: none;
  grid-template-areas: 
    "left rotate right"
    "down space down";
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 30px;
  padding: 10px;
}

.mobile-controls button {
  background: var(--dark-accent);
  border: 2px solid var(--primary-neon);
  color: #fff;
  padding: 15px;
  font-family: var(--font-pixel);
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
}

/* --- About Section --- */
.about-section {
  padding: 6rem 0;
  background: var(--dark-accent);
}

.about-section h2 {
  font-family: var(--font-pixel);
  margin-bottom: 3rem;
  color: var(--primary-neon);
}

.about-content p {
  max-width: 700px;
  margin: 0 auto 1.5rem;
  font-size: 1.1rem;
}

/* --- Contact Section --- */
.contact-section {
  padding: 8rem 0;
}

.contact-section h2 {
  font-family: var(--font-pixel);
  margin-bottom: 2rem;
  color: var(--secondary-neon);
}

.contact-form {
  max-width: 600px;
  margin: 3rem auto 0;
  background: var(--dark-accent);
  padding: 40px;
  border: 2px solid var(--secondary-neon);
}

.form-group {
  margin-bottom: 25px;
}

.form-group label {
  display: block;
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  margin-bottom: 10px;
  color: var(--secondary-neon);
}

.form-group input, .form-group textarea {
  width: 100%;
  padding: 12px;
  background: var(--bg-color);
  border: 1px solid #444;
  color: #fff;
  font-family: var(--font-body);
  outline: none;
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--secondary-neon);
}

.btn-neon {
  background: none;
  border: 2px solid var(--secondary-neon);
  color: var(--secondary-neon);
  width: 100%;
}

.btn-neon:hover {
  background: var(--secondary-neon);
  color: #000;
  box-shadow: 0 0 15px var(--secondary-neon);
}

/* --- Location Section --- */
.location-section {
  padding: 8rem 0;
  background: var(--dark-accent);
}

.location-section h2 {
  font-family: var(--font-pixel);
  margin-bottom: 3rem;
  color: var(--tertiary-neon);
}

.map-mockup {
  width: 100%;
  height: 400px;
  background: #000;
  border: 4px solid var(--tertiary-neon);
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: 0 0 30px rgba(0, 243, 255, 0.3);
}

.map-mockup img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
}

.map-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  background: var(--tertiary-neon);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 243, 255, 0.7); }
  70% { box-shadow: 0 0 0 30px rgba(0, 243, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 243, 255, 0); }
}

.address-info .address {
  font-family: var(--font-pixel);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* --- Footer --- */
footer {
  padding: 4rem 0;
  border-top: 1px solid #333;
}

footer p {
  font-size: 0.8rem;
  opacity: 0.6;
}

.footer-tagline {
  font-family: var(--font-pixel);
  margin-top: 1rem;
  color: var(--primary-neon);
  font-size: 0.7rem !important;
  opacity: 1 !important;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  h1.glitch-text { font-size: 2rem; }
  .game-container { flex-direction: column; align-items: center; }
  .game-sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .sidebar-right { display: none; }
  .stat-box { flex: 1; min-width: 120px; }
  .mobile-controls { display: grid; }
  .chatbot-window { width: 280px; height: 400px; bottom: 70px; }
  .chatbot-toggle { width: 50px; height: 50px; font-size: 1.2rem; }
}

/* --- Chatbot Widget --- */
.chatbot-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
}

.chatbot-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--secondary-neon);
  border: 2px solid #000;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 0 15px var(--secondary-neon);
  transition: transform 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  outline: none;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
}

.chatbot-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 320px;
  height: 450px;
  background-color: var(--bg-color);
  border: 2px solid var(--primary-neon);
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform-origin: bottom right;
}

.chatbot-window.hidden {
  opacity: 0;
  transform: scale(0);
  pointer-events: none;
}

.chatbot-header {
  background-color: var(--primary-neon);
  color: #000;
  padding: 12px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chatbot-header h3 {
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  margin: 0;
}

.chatbot-close {
  background: none;
  border: none;
  color: #000;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  font-weight: bold;
}

.chatbot-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: rgba(0, 0, 0, 0.8);
}

.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}
.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--dark-accent);
  border-radius: 3px;
}

.message {
  max-width: 85%;
  font-size: 0.9rem;
  word-wrap: break-word;
}

.message p {
  margin: 0;
}

.message.bot {
  align-self: flex-start;
  color: var(--primary-neon);
}

.message.bot p {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  line-height: 1.5;
  text-shadow: 0 0 5px rgba(57, 255, 20, 0.3);
  margin-bottom: 5px;
}

.message.user {
  align-self: flex-end;
  background-color: var(--dark-accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px 12px 0 12px;
  border: 1px solid var(--tertiary-neon);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

.chatbot-input-container {
  display: flex;
  padding: 10px;
  border-top: 1px solid var(--primary-neon);
  background-color: #000;
}

#chatbot-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 8px;
  outline: none;
}

#chatbot-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

#chatbot-send {
  background: none;
  border: 1px solid var(--tertiary-neon);
  color: var(--tertiary-neon);
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  padding: 0 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#chatbot-send:hover {
  background: var(--tertiary-neon);
  color: #000;
  box-shadow: 0 0 10px var(--tertiary-neon);
}

.loader {
  display: inline-block;
  width: 10px;
  height: 10px;
  background-color: var(--primary-neon);
  animation: blink 1s infinite alternate;
}

@keyframes blink {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

