/* ============================================================
   TREINO DE RACIOCÍNIO 3D — Design System & Base Styles
   ============================================================ */

/* Google Fonts já carregadas via HTML */

/* ── Variáveis CSS ── */
:root {
  /* Cores */
  --bg-void:        #050814;
  --bg-surface:     #0a0e1f;
  --bg-elevated:    #0f1428;
  --bg-card:        rgba(10, 20, 60, 0.45);

  --blue-primary:   #4f8fff;
  --blue-electric:  #00d4ff;
  --blue-glow:      #0070ff;
  --blue-deep:      #1a3a7a;
  --blue-mid:       #2563eb;

  --accent-orange:  #ff6b35;
  --accent-green:   #00d4a0;
  --accent-purple:  #d400ff;

  --glass-bg:       rgba(10, 20, 60, 0.45);
  --glass-border:   rgba(79, 143, 255, 0.25);
  --glass-blur:     16px;

  --text-primary:   #e8f0ff;
  --text-secondary: rgba(200, 220, 255, 0.75);
  --text-muted:     rgba(200, 220, 255, 0.45);

  /* Tipografia */
  --font-display: 'Orbitron', sans-serif;
  --font-body:    'Space Grotesk', sans-serif;

  /* Espaçamento */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;
  --space-2xl: 64px;
  --space-3xl: 96px;

  /* Border radius */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-full: 9999px;

  /* Sombras */
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:    0 8px 32px rgba(0,0,0,0.5);
  --shadow-lg:    0 16px 64px rgba(0,0,0,0.6);
  --shadow-glow:  0 0 40px rgba(79,143,255,0.3);
  --shadow-glow-sm: 0 0 20px rgba(79,143,255,0.2);

  /* Transições */
  --transition-fast:   150ms ease-out;
  --transition-base:   300ms ease-out;
  --transition-slow:   600ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-index */
  --z-base:    1;
  --z-card:    10;
  --z-nav:     100;
  --z-overlay: 200;
  --z-game:    300;
  --z-toast:   400;
  --z-cursor:  500;
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-void);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
  cursor: none;
}

/* ── Cursor personalizado ── */
.cursor {
  position: fixed;
  width: 12px;
  height: 12px;
  background: var(--blue-electric);
  border-radius: 50%;
  pointer-events: none;
  z-index: var(--z-cursor);
  transform: translate(-50%, -50%);
  transition: width 200ms, height 200ms, background 200ms;
  mix-blend-mode: screen;
}

.cursor-trail {
  position: fixed;
  width: 32px;
  height: 32px;
  border: 1.5px solid rgba(0, 212, 255, 0.4);
  border-radius: 50%;
  pointer-events: none;
  z-index: var(--z-cursor);
  transform: translate(-50%, -50%);
  transition: all 80ms ease-out;
}

body:has(button:hover) .cursor,
body:has(a:hover) .cursor {
  width: 20px;
  height: 20px;
  background: var(--blue-primary);
}

/* ── Views SPA ── */
#app {
  position: relative;
  min-height: 100vh;
}

.view {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0;
  min-height: 100vh;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

.view.active {
  display: block;
  position: relative;
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.view.leaving {
  display: block;
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

/* ── Navbar ── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: var(--z-nav);
  padding: var(--space-md) var(--space-xl);
  transition: background var(--transition-base), backdrop-filter var(--transition-base);
}

.navbar.scrolled {
  background: rgba(5, 8, 20, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}

.navbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.brand-logo {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.4);
  border: 1px solid rgba(0, 212, 255, 0.5);
}

.brand-accent {
  color: var(--blue-electric);
  margin-left: 2px;
}

/* ── Botões globais ── */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 16px 36px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bg-void);
  background: linear-gradient(135deg, var(--blue-electric), var(--blue-primary));
  border: none;
  border-radius: 0;
  cursor: none;
  overflow: hidden;
  transition: transform var(--transition-spring), box-shadow var(--transition-base), filter var(--transition-base);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
  filter: drop-shadow(0 0 15px rgba(0, 212, 255, 0.4));
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.03);
  filter: drop-shadow(0 0 25px rgba(0, 212, 255, 0.6));
}

.btn-primary:active {
  transform: translateY(0) scale(1);
}

.btn-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, rgba(255,255,255,0.2));
  border-radius: inherit;
  pointer-events: none;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: none;
  transition: all var(--transition-base);
  backdrop-filter: blur(var(--glass-blur));
}

.btn-icon:hover {
  color: var(--blue-electric);
  border-color: var(--blue-electric);
  box-shadow: var(--shadow-glow-sm);
}

/* ── Lucide Icons ── */
[data-lucide] {
  width: 1em;
  height: 1em;
  stroke-width: 1.75;
  flex-shrink: 0;
}

/* ── Glassmorphism Panel ── */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}

/* ── Toast Notifications ── */
#toast-container {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: var(--text-primary);
  transform: translateX(120%);
  transition: transform var(--transition-spring);
  pointer-events: all;
  box-shadow: var(--shadow-md);
  max-width: 320px;
}

.toast.show {
  transform: translateX(0);
}

.toast.success { border-color: var(--accent-green); }
.toast.error   { border-color: var(--accent-orange); }
.toast.info    { border-color: var(--blue-electric); }

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-void);
}
::-webkit-scrollbar-thumb {
  background: var(--blue-deep);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--blue-primary);
}

/* ── Selection ── */
::selection {
  background: rgba(79, 143, 255, 0.3);
  color: var(--text-primary);
}

/* ── Loading Spinner ── */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(79,143,255,0.2);
  border-top-color: var(--blue-electric);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Countdown ── */
.countdown-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5,8,20,0.85);
  backdrop-filter: blur(8px);
  z-index: var(--z-overlay);
}

.countdown-number {
  font-family: var(--font-display);
  font-size: clamp(8rem, 30vw, 12rem);
  font-weight: 900;
  color: var(--blue-electric);
  text-shadow: 0 0 80px rgba(0,212,255,0.8);
  animation: countPulse 1s ease-out;
}

.countdown-number.text-mode {
  font-size: clamp(4rem, 15vw, 8rem);
}

@keyframes countPulse {
  0%   { transform: scale(1.5); opacity: 0; }
  20%  { transform: scale(1.1); opacity: 1; }
  80%  { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0; }
}

/* ── Partículas de efeito ── */
.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  animation: particleFly 0.8s ease-out forwards;
}

@keyframes particleFly {
  0%   { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* ── Responsividade global ── */
@media (max-width: 768px) {
  .navbar {
    padding: var(--space-md);
  }
  body {
    cursor: auto;
  }
  .cursor, .cursor-trail {
    display: none;
  }
  /* Touch targets mínimos de 44px */
  button, a, [tabindex] {
    cursor: auto;
  }
  .btn-primary {
    min-height: 52px;
    padding: 14px 28px;
    font-size: 0.85rem;
  }
  .btn-icon {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ── Acessibilidade ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Game View ── */
#view-game {
  background: var(--bg-void);
  min-height: 100vh;
}

#game-container {
  width: 100%;
  min-height: 100vh;
}
