/* ================================================================
   Responsive — All @media breakpoints (must load last)
   ================================================================ */

@media (min-height: 700px) {
  body { justify-content: center; }
}

/* Extra small (< 300px) */
@media (max-width: 300px) {
  .timer { gap: 3px; }
  .unit { padding: 6px 2px; }
  .amount { font-size: 12px; } .label { font-size: 5px; }
  .language-selector { top: 6px; right: 6px; }
  .lang-btn { font-size: 7px; padding: 3px 4px; }
  .lang-divider { font-size: 6px; } .lang-eye { display: none; }
}

/* Small phones (< 360px) */
@media (max-width: 359px) {
  body { padding: 10px; } .stage { padding: 8px; }
  .card { padding: 12px; gap: 16px; }
  header h1 { font-size: 16px; margin-bottom: 6px; }
  #subtitle, #subtitle-2 { font-size: 10px; margin-bottom: 10px; }
  .timer { gap: 4px; }
  .unit { padding: 8px 3px; border-radius: 8px; }
  .amount { font-size: 14px; } .label { font-size: 6px; margin-top: 2px; letter-spacing: 0; }
  .left h2 { font-size: 12px; margin-bottom: 8px; }
  .photo-wrap { max-width: 200px; } .caption { font-size: 9px; }
  .meta { margin-top: 12px; font-size: 9px; }
  .language-selector { top: 8px; right: 8px; }
  .lang-btn { font-size: 8px; padding: 4px 6px; }
  .lang-eye { width: 10px; height: 10px; margin-right: 4px; }
  .speech-bubble { padding: 8px 12px; min-width: 80px; border-radius: 14px; top: -10px; }
  .speech-bubble::after { bottom: -12px; border-width: 10px; border-top-width: 14px; }
  .speech-bubble .quote-text { font-size: 11px; white-space: normal; max-width: 120px; }
  .milestone-text { font-size: 8px; }
  .timeline-cover-wrap { width: 36px; height: 36px; }
  .timeline-content-inner { gap: 8px; }
}

/* Standard phones (360-480px) */
@media (min-width: 360px) and (max-width: 480px) {
  body { padding: 12px; } .stage { padding: 12px; }
  .card { padding: 14px; gap: 18px; }
  header h1 { font-size: clamp(16px, 4.5vw, 20px); }
  #subtitle, #subtitle-2 { font-size: 11px; } .left h2 { font-size: 13px; }
  .timer { gap: 6px; }
  .unit { padding: 10px 5px; border-radius: 8px; }
  .amount { font-size: 16px; } .label { font-size: 7px; margin-top: 3px; }
  .photo-wrap { max-width: 240px; } .caption { font-size: 10px; }
  .meta { font-size: 10px; }
  .language-selector { top: 10px; right: 10px; }
  .lang-btn { font-size: 9px; padding: 5px 8px; }
  .lang-eye { width: 12px; height: 12px; margin-right: 6px; }
  .speech-bubble { padding: 10px 16px; min-width: 100px; }
  .speech-bubble .quote-text { font-size: 13px; }
}

/* Small tablets / large phones (481-768px) */
@media (min-width: 481px) and (max-width: 768px) {
  body { padding: 20px; } .stage { padding: 20px; }
  .card { padding: 20px; gap: 24px; }
  .timer { gap: 10px; }
  .unit { padding: 12px 8px; }
  .amount { font-size: 22px; } .label { font-size: 9px; }
  .photo-wrap { max-width: 300px; }
}

/* Comparison grid columns */
@media (min-width: 520px) {
  .comparisons-grid { grid-template-columns: 1fr 1fr; }
  .prediction-scenarios { grid-template-columns: 1fr 1fr 1fr; }
  .calc-tooltip { min-width: 200px; max-width: calc(100vw - 80px); }
}

@media (max-width: 519px) {
  .calc-tooltip { min-width: 200px; max-width: calc(100vw - 80px); }
}

@media (max-width: 480px) {
  .gap-bar-label { min-width: 70px; font-size: 8px; }
}

/* Mobile timeline (stacked) */
@media (max-width: 600px) {
  .timeline::before { left: 16px; }
  .timeline::after { left: 16px; }
  .timeline-item:nth-child(odd),
  .timeline-item:nth-child(even) { flex-direction: row; padding-left: 40px; padding-right: 0; justify-content: flex-start; }
  .timeline-dot { left: 16px; }
  .timeline-item.latest .timeline-dot { left: 16px; }
  .timeline-item:nth-child(odd) .timeline-content::before,
  .timeline-item:nth-child(even) .timeline-content::before { left: -13px; right: auto; }
  .timeline-gap-indicator { left: 16px; }
  .timeline-content { padding: 12px 14px; }
  .timeline-cover-wrap { width: 44px; height: 44px; }
  .timeline-content-inner { gap: 10px; }
}

/* Desktop (769px+) */
@media (min-width: 769px) {
  body { padding: 24px; } .stage { padding: 24px; }
  .card { flex-direction: row; padding: 24px; gap: 28px; align-items: center; }
  .left { flex: 1 1 60%; padding: 20px 0; }
  .right { flex: 0 0 auto; max-width: 320px; }
  .timer { gap: 12px; }
  .unit { padding: 14px 12px; }
  .amount { font-size: 26px; } .label { font-size: 10px; }
  .photo-wrap { max-width: 320px; }
  .comparisons-grid { grid-template-columns: 1fr 1fr 1fr; }
  .timeline-cover-wrap { width: 56px; height: 56px; }
  .timeline-content-inner { gap: 14px; }
}

/* Tablet portrait */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  .card { flex-direction: column; align-items: center; }
  .left { width: 100%; } .right { width: 100%; max-width: 400px; }
  .timer { gap: 12px; }
}

/* Large desktop (1025px+) */
@media (min-width: 1025px) {
  body { padding: 28px; } .stage { padding: 28px; }
  .card { padding: 28px; gap: 32px; }
  .left { flex: 1 1 520px; } .right { max-width: 360px; }
  .unit { padding: 16px 14px; }
  .amount { font-size: 28px; } .label { font-size: 11px; }
  .photo-wrap { max-width: 360px; }
  .timeline-cover-wrap { width: 60px; height: 60px; }
  .timeline-content-inner { gap: 16px; }
}

/* Extra large (1440px+) */
@media (min-width: 1440px) {
  .stage { max-width: 1400px; padding: 32px; }
  .card { padding: 36px; gap: 40px; }
  .unit { padding: 20px 16px; }
  .amount { font-size: 34px; } .label { font-size: 12px; }
  .photo-wrap { max-width: 400px; }
  header h1 { font-size: 32px; }
  #subtitle, #subtitle-2 { font-size: 15px; }
}

/* Ultra wide (1920px+) */
@media (min-width: 1920px) {
  .stage { max-width: 1600px; }
  .unit { padding: 24px 20px; }
  .amount { font-size: 40px; } .label { font-size: 14px; }
  .photo-wrap { max-width: 450px; }
}

/* Landscape (short viewport) */
@media (max-height: 500px) and (orientation: landscape) {
  body { padding: 10px; align-items: flex-start; justify-content: flex-start; }
  .stage { padding: 10px; }
  .card { flex-direction: row; padding: 12px; gap: 16px; align-items: center; }
  .left { flex: 1; padding: 8px 0; }
  .left h2 { font-size: 11px; margin-bottom: 8px; }
  .right { flex: 0 0 auto; }
  .photo-wrap { max-width: 120px; } .caption { font-size: 8px; }
  header h1 { font-size: 14px; margin-bottom: 4px; }
  #subtitle { display: none; }
  #subtitle-2 { margin-bottom: 6px; font-size: 10px; }
  .meta { margin-top: 6px; font-size: 9px; }
  .timer { gap: 5px; }
  .unit { padding: 5px 3px; border-radius: 6px; }
  .amount { font-size: 13px; } .label { font-size: 5px; margin-top: 2px; letter-spacing: 0; }
  .language-selector { top: 6px; }
  .lang-btn { font-size: 8px; padding: 4px 6px; }
  .speech-bubble { padding: 6px 10px; min-width: 70px; border-radius: 12px; top: -8px; }
  .speech-bubble .quote-text { font-size: 10px; }
  .milestone-banner { margin-top: 6px; } .milestone-text { font-size: 7px; }
  .share-section { margin-top: 4px; } .share-btn { padding: 3px 0; font-size: 7px; }
  .comparisons-section { margin-top: 4px; } .comparisons-toggle { padding: 3px 0; font-size: 7px; }
  .comparisons-grid { padding: 8px 0 4px; gap: 4px; }
  .comparison-card { padding: 6px 8px; } .comparison-value { font-size: 11px; } .comparison-desc { font-size: 6px; }
  .timeline-section { margin-top: 6px; } .timeline { padding: 14px 4px 8px; }
  .timeline-cover-wrap { width: 32px; height: 32px; } .timeline-content-inner { gap: 6px; }
  .prediction-section, .gapchart-section { margin-top: 4px; }
}

/* Very short landscape */
@media (max-height: 400px) and (orientation: landscape) {
  body { padding: 8px; }
  .milestone-banner, .timeline-section, .prediction-section,
  .gapchart-section { display: none; }
}

/* Safe area support */
@supports (padding: max(0px)) {
  body {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .language-selector {
    top: max(20px, calc(env(safe-area-inset-top) + 8px));
    right: max(20px, calc(env(safe-area-inset-right) + 8px));
  }
  .sound-toggle {
    bottom: max(20px, calc(env(safe-area-inset-bottom) + 8px));
    right: max(20px, calc(env(safe-area-inset-right) + 8px));
  }
}

/* Accessibility preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  img#maynard, .sacred-geometry svg, .fibonacci-overlay { animation: none; }
}

@media (prefers-contrast: high) {
  .unit { border: 2px solid rgba(255,255,255,0.2); }
  .amount { color: #fff; }
}

@media (hover: none) {
  .photo-wrap:active .speech-bubble { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(-100%) scale(1); }
  .comparison-value { cursor: pointer; -webkit-tap-highlight-color: transparent; }
}

@media (prefers-color-scheme: dark) { :root { --bg: #050307; } }
