:root {
  --bg: #0a0a0a;
  --green: #33ff66;
  --green-dim: #1a8a3e;
  --border: #2a3a2a;
  --muted: #889988;
  --font: 'JetBrains Mono', 'Courier New', monospace;
}

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

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--green);
  font-family: var(--font);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Text-only site (SEO/AI, no JS) */
.text-only-site {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
  line-height: 1.6;
}

.text-only-site h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.text-only-site h2 {
  margin-top: 30px;
  margin-bottom: 12px;
}

.text-only-site ul {
  margin-left: 20px;
  margin-bottom: 16px;
}

.text-only-site a {
  color: var(--green-dim);
}

.text-only-site nav {
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.text-only-site nav a {
  color: var(--green);
  text-decoration: none;
}

.text-only-site em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.85rem;
}

/* JS-only elements hidden by default */
.js-only { display: none !important; }

/* js-active is set on <html> by inline script in <head> to prevent FOUC */
html.js-active .text-only-site { display: none !important; }
html.js-active .js-only { display: flex !important; }
html.js-active .scene-container.js-only { display: block !important; }
html.js-active header.top-bar.js-only { display: flex !important; }

/* Loading screen — covers everything until JS removes it */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050505;
  color: var(--green);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 2px;
  text-shadow: 0 0 8px rgba(51, 255, 102, 0.4);
}

.loading-screen.hidden {
  display: none;
}

/* When JS is disabled (no js-active class), hide loading screen */
html:not(.js-active) .loading-screen {
  display: none;
}

/* Version toggle */
.version-toggle {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  align-items: center;
}

.version-toggle a {
  display: inline-block;
  padding: 4px 10px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: all 0.15s;
}

.version-toggle a.active {
  color: var(--green);
  border-color: var(--green-dim);
  text-shadow: 0 0 6px rgba(51, 255, 102, 0.3);
}

.version-toggle a:hover:not(.active) {
  color: var(--green-dim);
  border-color: var(--green-dim);
}

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: #050505;
  flex-wrap: wrap;
  gap: 12px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.menu {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}

.platform-switcher,
.lang-switcher {
  display: flex;
  gap: 4px;
}

/* ESC 3D key — absolute positioned below UNIX/DOS buttons */
.esc-key-3d-wrapper {
  position: absolute;
  top: 48px;
  left: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.esc-key-3d-wrapper canvas {
  cursor: pointer;
  display: block;
}

.lang-switcher {
  border-left: 1px solid var(--border);
  padding-left: 12px;
}

.version-toggle {
  border-left: 1px solid var(--border);
  padding-left: 12px;
}

.platform-btn,
.lang-btn {
  background: rgba(26, 138, 62, 0.08);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font);
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 1px;
  font-weight: 700;
  border-radius: 3px;
}

.platform-btn:hover,
.lang-btn:hover {
  border-color: var(--green-dim);
  color: var(--green);
}

.platform-btn.active,
.lang-btn.active {
  border-color: var(--green-dim);
  color: var(--green);
  background: rgba(26, 138, 62, 0.2);
  text-shadow: 0 0 4px rgba(51, 255, 102, 0.4);
}

/* Menu buttons */
.menu-btn {
  background: rgba(26, 138, 62, 0.08);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 3px;
}

.menu-btn:hover {
  border-color: var(--green-dim);
  color: var(--green);
  background: rgba(26, 138, 62, 0.2);
  text-shadow: 0 0 4px rgba(51, 255, 102, 0.4);
}

/* 3D scene */
.scene-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #000;
}

#three-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

/* Demo debug overlay */
.demo-debug {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 99999;
  font-family: var(--font);
  font-size: 14px;
  color: #00ff00;
  background: rgba(0, 0, 0, 0.9);
  padding: 10px 16px;
  border: 1px solid #0a3a0a;
  border-radius: 3px;
  white-space: pre;
  display: none;
  pointer-events: none;
}

.demo-debug.visible {
  display: block;
}

/* Version corner watermark */
.version-corner {
  position: fixed;
  bottom: 35px;
  right: 10px;
  font-family: var(--font);
  font-size: 10px;
  color: rgba(51, 255, 102, 0.4);
  z-index: 30;
  letter-spacing: 0.5px;
  pointer-events: none;
  user-select: none;
}

/* Stopped message */
.stopped-message {
  display: none;
  padding: 10px 20px;
  text-align: center;
  font-family: var(--font);
  font-size: 13px;
  color: var(--green);
  background: #0a0a0a;
  border-top: 1px solid var(--border);
  letter-spacing: 1px;
  animation: glow-fade 2s ease-in-out infinite;
}

.stopped-message.visible {
  display: block;
  cursor: pointer;
}

.stopped-message.visible:hover {
  color: #fff;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.9), 0 0 32px rgba(51, 255, 102, 0.6);
}

@keyframes glow-fade {
  0%, 100% {
    opacity: 0.3;
    text-shadow: 0 0 4px rgba(51, 255, 102, 0.2);
  }
  50% {
    opacity: 1;
    text-shadow: 0 0 12px rgba(51, 255, 102, 0.8), 0 0 24px rgba(51, 255, 102, 0.4);
  }
}

/* Footer */
.terminal-footer {
  padding: 8px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.terminal-footer a {
  color: var(--green-dim);
  text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
  .top-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .menu {
    width: 100%;
    justify-content: flex-start;
  }
}
