/* ============================================================
   Draxon WebGL Template — Stylesheet
   ============================================================ */

:root {
  --color-navy: #1a1a2e;
  --color-navy-light: #2a2a4a;
  --color-bg: #f5f5f5;
  --color-card: #1E2454;
  --color-primary: #4a6cf7;
  --color-primary-hover: #3b5de0;
  --color-text: #e8ecf4;
  --color-text-light: #b8c4d8;
  --color-text-muted: #7a8aa4;
  --color-error: #ff6b6b;
  --color-border: #e0e0e0;
  --max-content-width: 1200px;
  --font-stack: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.25);
  --radius: 16px;
  --radius-sm: 12px;
}

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

body {
  background: var(--color-bg);
  font-family: var(--font-stack);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Password Gate ---- */

#password-gate {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--color-navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: #e0e0e0;
}

#password-gate .gate-logo {
  height: 48px;
  width: auto;
  margin-bottom: 32px;
  opacity: 0.9;
}

#password-gate h1 {
  font-size: 24px;
  font-weight: 300;
  margin-bottom: 24px;
  letter-spacing: 2px;
}

#password-gate input {
  width: 280px;
  padding: 12px 16px;
  font-size: 16px;
  font-family: var(--font-stack);
  border: 1px solid #444;
  border-radius: var(--radius-sm);
  background: var(--color-navy-light);
  color: #e0e0e0;
  outline: none;
  text-align: center;
  transition: border-color 0.2s;
}

#password-gate input:focus {
  border-color: var(--color-primary);
}

#password-gate .error {
  color: var(--color-error);
  font-size: 14px;
  margin-top: 12px;
  height: 20px;
}

/* ---- Top Bar ---- */

.page-top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-navy);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.top-bar-inner {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
}

.top-bar-inner .logo {
  height: 36px;
  width: auto;
}

/* ---- Language Dropdown ---- */

.lang-dropdown {
  position: relative;
  margin-left: auto;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-stack);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  -webkit-user-select: none;
  user-select: none;
}

.lang-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.lang-dropdown--open .lang-toggle {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.lang-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.lang-label {
  letter-spacing: 0.5px;
}

.lang-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.lang-dropdown--open .lang-chevron {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--color-navy-light);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  list-style: none;
  padding: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
  z-index: 200;
}

.lang-dropdown--open .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  padding: 8px 14px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.lang-option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.lang-option--active {
  color: var(--color-primary);
  font-weight: 600;
}

.lang-option--active:hover {
  color: var(--color-primary);
  background: rgba(74, 108, 247, 0.1);
}

/* ---- Landing Page ---- */

#landing-page {
  min-height: 100vh;
}

.landing-content {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 32px 24px 40px;
}

/* ---- Back Navigation ---- */

.back-nav {
  margin-bottom: 16px;
}

.back-link {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--color-primary-hover);
}

/* ---- Page Transitions ---- */

.page-transition {
  animation-duration: 0.3s;
  animation-timing-function: ease;
  animation-fill-mode: both;
  pointer-events: none;
}

/* Slide left (exit when navigating forward) */
.slide-out-left { animation-name: slideOutLeft; }
/* Slide in from right (enter when navigating forward) */
.slide-in-right { animation-name: slideInRight; }
/* Slide right (exit when navigating back) */
.slide-out-right { animation-name: slideOutRight; }
/* Slide in from left (enter when navigating back) */
.slide-in-left { animation-name: slideInLeft; }
/* Fade */
.fade-in { animation-name: fadeIn; }
.fade-out { animation-name: fadeOut; }

@keyframes slideOutLeft {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-40px); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ---- Page Titles ---- */

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-navy);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 16px;
  color: #666;
  margin-bottom: 28px;
}

/* ---- Lesson Grid ---- */

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.lesson-card {
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.lesson-card--active {
  background: var(--color-card);
  box-shadow: var(--shadow-card);
  cursor: pointer;
}

.lesson-card--active:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.lesson-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.lesson-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

.lesson-card-body {
  padding: 20px 24px;
}

.lesson-card--active .lesson-card-body h2 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}

.lesson-card--active .lesson-card-body p {
  font-size: 14px;
  color: var(--color-text-light);
  line-height: 1.5;
}

.lesson-card--placeholder {
  border: 2px dashed rgba(30, 36, 84, 0.25);
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lesson-card--placeholder .lesson-card-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.coming-soon {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 0.5px;
}

/* ---- Content Card ---- */

.content-card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: min(720px, calc(100vh - 200px));
  max-height: min(720px, calc(100vh - 200px));
}

/* ---- Card Layout (image left, content right) ---- */

.card-layout {
  display: flex;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.hero-image {
  width: 38%;
  min-width: 38%;
  max-width: 38%;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

.card-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 32px 32px 0;
  min-height: 0;
}

.card-body h1 {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  line-height: 1.3;
  flex-shrink: 0;
}

.card-body-scroll {
  flex: 1;
  overflow-y: auto;
  padding-right: 12px;
  min-height: 0;
}

/* Scrollbar styling */
.card-body-scroll::-webkit-scrollbar {
  width: 6px;
}

.card-body-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.card-body-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.card-body-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.card-body .welcome-text {
  font-size: 15px;
  color: var(--color-text-light);
  margin-bottom: 20px;
}

.card-body h2 {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 10px;
}

.card-body .takeaways {
  list-style: disc;
  padding-left: 20px;
  margin-bottom: 20px;
}

.card-body .takeaways li {
  font-size: 14px;
  color: var(--color-text-light);
  margin-bottom: 6px;
  line-height: 1.5;
}

.card-body .body-text {
  font-size: 14px;
  color: var(--color-text-light);
  margin-bottom: 10px;
}

.card-body .body-text:last-of-type {
  margin-bottom: 0;
}

/* ---- Card Actions ---- */

.card-actions {
  flex-shrink: 0;
  padding: 24px 32px 32px;
  display: flex;
  justify-content: flex-end;
}

.btn {
  display: inline-block;
  padding: 14px 48px;
  font-size: 17px;
  font-weight: 600;
  font-family: var(--font-stack);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  text-decoration: none;
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-text-light);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-text);
}

/* ---- Version Footer ---- */

.version-footer {
  text-align: center;
  padding: 40px 0 16px;
  font-size: 12px;
  color: #999;
  letter-spacing: 0.5px;
}

/* ---- Unity Overlay ---- */

#unity-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: #111;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ---- Unity Container (16:9 aspect-fit) ---- */

#unity-container {
  width: 100%;
  max-width: min(1024px, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  max-height: min(576px, 100vh);
  position: relative;
}

#unity-canvas {
  width: 100% !important;
  height: 100% !important;
  background: #000;
  display: block;
}

/* ---- In-page fullscreen ---- */

.unity-overlay--fullscreen {
  justify-content: flex-start !important;
}

.unity-overlay--fullscreen #unity-container {
  width: 100%;
  max-width: calc(100vh * 16 / 9);
  max-height: 100vh;
}

/* ---- Loading Bar ---- */

#unity-loading-bar {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: none;
  text-align: center;
}

#unity-loading-bar .loading-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 12px;
  letter-spacing: 1px;
}

#unity-progress-bar-empty {
  width: 240px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

#unity-progress-bar-full {
  width: 0%;
  height: 100%;
  background: var(--color-primary);
  border-radius: 2px;
  transition: width 0.15s ease;
}

/* ---- Warning Banner ---- */

#unity-warning {
  position: absolute;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  z-index: 1002;
  display: none;
}

#unity-warning div {
  background: #fff;
  color: #333;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ---- Responsive ---- */

@media (max-width: 700px) {
  .lesson-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .landing-content {
    padding: 20px 12px 20px;
  }

  .card-layout {
    flex-direction: column;
  }

  .hero-image {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 220px;
  }

  .card-body {
    padding: 24px 20px 0;
  }

  .card-body-scroll {
    max-height: 300px;
  }

  .card-actions {
    padding: 20px 20px 24px;
  }

  .card-body h1 {
    font-size: 22px;
  }

  .card-body h2 {
    font-size: 16px;
  }

  .top-bar-inner {
    padding: 0 16px;
  }

  .btn {
    padding: 12px 32px;
    font-size: 16px;
  }
}

/* ===== Version badges ===== */
.version-badge {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    font-size: 12px;
    font-family: "Courier New", monospace;
    color: rgba(30, 34, 60, 0.55);
    pointer-events: none;
    z-index: 100;
    letter-spacing: 0.06em;
    text-transform: lowercase;
}

.lesson-version {
    margin: 24px auto 8px;
    text-align: center;
    font-size: 12px;
    font-family: "Courier New", monospace;
    color: rgba(30, 34, 60, 0.55);
    letter-spacing: 0.06em;
    text-transform: lowercase;
}
