/* ============================================
   RESPONSIVE.CSS — Tablet & mobile adaptations
   ============================================ */

/* --- Tablet (768px - 1024px) --- */
@media (max-width: 1024px) {
  :root {
    --terminal-padding: 16px;
  }

  .terminal {
    max-width: 100%;
  }

  .crt-wrapper {
    max-width: 100%;
    border-radius: 0;
  }

  /* Simplify CRT effects for performance */
  .crt-wrapper::after {
    opacity: 0.02;
  }

  .crt-aberration {
    box-shadow:
      inset 1px 0 0 rgba(255, 0, 0, 0.04),
      inset -1px 0 0 rgba(0, 0, 255, 0.04);
  }

  /* Larger touch targets for choices */
  .choice {
    padding: 10px 12px;
    min-height: 44px;
  }

  /* Header: hide less important info */
  .header-scene {
    display: none;
  }

  .window-controls {
    display: none;
  }
}

/* --- Mobile (< 768px) --- */
@media (max-width: 768px) {
  :root {
    --font-size-body: 15px;
    --font-size-header: 16px;
    --font-size-narrator: 13px;
    --font-size-system: 11px;
    --terminal-padding: 12px;
    --line-height: 1.5;
  }

  body {
    align-items: flex-start;
  }

  .terminal {
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    border: none;
  }

  .crt-wrapper {
    height: 100vh;
    height: 100dvh;
  }

  /* Minimal CRT effects on mobile (battery/performance) */
  .crt-scanlines {
    background: repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(0, 0, 0, 0.06) 3px,
      rgba(0, 0, 0, 0.06) 4px
    );
  }

  .crt-aberration {
    display: none;
  }

  .crt-wrapper::after {
    display: none;
  }

  /* Disable curvature on mobile */
  .crt-wrapper.crt-curved {
    border-radius: 0;
  }

  .crt-wrapper.crt-curved::before {
    display: none;
  }

  /* Header simplification */
  .terminal-header {
    padding: 6px var(--terminal-padding);
    flex-wrap: nowrap;
  }

  .header-session,
  .header-scene,
  .header-separator,
  .window-controls {
    display: none;
  }

  .header-right {
    gap: 6px;
  }

  /* Indicators: compact */
  .terminal-indicators {
    gap: 10px;
    padding: 3px var(--terminal-padding);
    font-size: 10px;
    overflow-x: auto;
    white-space: nowrap;
  }

  /* Choices: bigger touch targets */
  .choice {
    padding: 12px;
    margin-bottom: 1em;
    min-height: 48px;
    border: 1px solid var(--border-color);
  }

  .choice-arrow {
    display: none;
  }

  /* Footer */
  .terminal-footer {
    padding: 6px var(--terminal-padding);
  }

  /* Content area */
  .terminal-content {
    padding: var(--terminal-padding);
    -webkit-overflow-scrolling: touch;
  }
}

/* --- Small mobile (< 400px) --- */
@media (max-width: 400px) {
  :root {
    --font-size-body: 14px;
    --terminal-padding: 10px;
  }

  .header-title {
    font-size: 10px;
  }

  .header-btn {
    padding: 2px 4px;
    font-size: 10px;
  }

  .terminal-indicators {
    font-size: 9px;
    gap: 8px;
  }
}

/* --- Large desktop (> 1400px) --- */
@media (min-width: 1400px) {
  .crt-wrapper {
    /* Add slight shadow to float terminal above background */
    filter: drop-shadow(0 0 40px rgba(0, 255, 65, 0.03));
  }
}

/* --- High contrast mode --- */
@media (prefers-contrast: more) {
  :root {
    --bg-primary: #000000;
    --bg-terminal: #000000;
    --bg-header: #000000;
    --bg-footer: #000000;

    --text-primary: #ffffff;
    --text-secondary: #ffffff;
    --text-dimmed: #cccccc;
    --text-accent: #ff4444;
    --text-system: #ffffff;

    --border-color: #ffffff;
    --border-bright: #ffffff;
    --border-header: #ffffff;

    --glow-primary: transparent;
    --glow-accent: transparent;
  }

  .crt-scanlines,
  .crt-aberration,
  .crt-glitch-line,
  .burn-in-ghost {
    display: none !important;
  }

  .crt-wrapper {
    animation: none !important;
    filter: none !important;
  }

  .crt-wrapper::after,
  .crt-wrapper::before {
    display: none !important;
  }

  .terminal {
    border-width: 2px;
  }

  .game-text,
  .narrator-text {
    text-shadow: none !important;
  }

  .choice {
    border: 2px solid var(--border-color);
  }

  .choice:hover,
  .choice:focus-visible {
    background: #ffffff;
    color: #000000;
  }
}
