/* ===== Global responsive foundation ===== */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  max-width: 100%;
}

img,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
}

.container,
.hero-container,
.footer-container {
  padding-left: clamp(16px, 4vw, 24px);
  padding-right: clamp(16px, 4vw, 24px);
}

/* ===== Landing — navbar & hero ===== */
@media (max-width: 991px) {
  .hero-section {
    min-height: auto;
    padding-bottom: 0;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: left;
    padding-top: 1.25rem;
  }

  .hero-content {
    order: 1;
    width: 100%;
    max-width: none;
    margin: 0;
    text-align: left;
    margin-top: 10px;
  }

  .hero-visual.orbital-hero {
    order: 2;
    width: 100%;
    max-width: min(100%, 480px);
    min-height: clamp(320px, 88vw, 440px);
    margin: 0;
  }

  .hero-badges {
    justify-content: flex-start;
  }

  .hero-badges .badge {
    width: auto;
    max-width: 100%;
  }

  .hero-headline,
  .hero-tagline {
    text-align: left;
  }

  .hero-headline .line-1,
  .hero-headline .line-2 {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .hero-tagline,
  .hero-stats {
    margin-left: 0;
    margin-right: 0;
  }

  .hero-stats {
    justify-content: flex-start;
  }

  .hero-cta {
    align-self: flex-start;
  }

  /* Keep orbital-child layout same as desktop (percentage positions) */
  .orbital-child.orbital-child-1 img {
    max-width: clamp(110px, 36vw, 230px);
  }

  .orbital-child.orbital-child-2 img {
    max-width: clamp(88px, 28vw, 180px);
  }

  .orbital-child.orbital-child-3 img {
    max-width: clamp(120px, 40vw, 250px);
  }

  .orbital-hero .float-label {
    font-size: 10px;
    padding: 5px 10px;
  }

  .orb-sparkle {
    font-size: 14px;
  }

  .orbital-system {
    transform: scale(clamp(0.78, 0.18vw + 0.72, 0.92));
    transform-origin: center center;
  }

  .marquee-wrap {
    margin-top: 12px;
  }

  .site-header {
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    text-align: left;
  }

  .site-logo {
    flex: 0 0 auto;
  }

  .site-nav {
    flex: 0 1 auto;
    justify-content: flex-end;
    gap: 8px 12px;
    flex-wrap: wrap;
    min-width: 0;
  }

  .theme-toggle-nav {
    padding: 7px 14px;
    font-size: 12px;
    gap: 6px;
    flex-shrink: 0;
  }

  .ttn-track {
    width: 32px;
    height: 18px;
  }

  .nav-link {
    min-width: 0;
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .site-header {
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }

  .site-logo {
    flex: 0 0 auto;
    display: block;
  }

  .site-nav {
    flex: 0 1 auto;
    justify-content: flex-end;
    gap: 6px 10px;
  }

  .nav-link {
    font-size: 16px;
    padding: 6px 4px;
  }

  .theme-toggle-nav {
    padding: 6px 10px;
    font-size: 11px;
  }

  .theme-toggle-nav #ttnLabel {
    display: none;
  }

  .hero-section {
    padding-top: 12px;
  }

  .hero-visual.orbital-hero {
    min-height: clamp(300px, 92vw, 400px);
  }
}

/* ===== Landing — tablet landscape / small desktop ===== */
@media (max-width: 1199px) {
  .gamehub-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: none;
  }
}

@media (max-width: 900px) {
  .hero-container {
    padding-top: 8px;
  }

  .hero-tagline {
    font-size: 1rem;
    line-height: 1.25;
  }

  .hero-cta {
    margin-top: 8px;
  }

  .meters-section,
  .gamehub-section {
    padding-left: clamp(16px, 4vw, 24px);
    padding-right: clamp(16px, 4vw, 24px);
  }

  .meter-child,
  .gamehub-section .game-child {
    display: none;
  }

  .site-footer {
    padding-bottom: 24px;
  }
}

/* ===== Tablet portrait ===== */
@media (max-width: 768px) {
  .hero-section {
    padding-bottom: 0;
  }

  .marquee-wrap {
    padding: 14px 0;
  }

  .marquee-track span {
    font-size: 13px;
    letter-spacing: 2px;
    padding-right: 32px;
  }

  .meters-section {
    padding-top: 48px;
  }

  .gamehub-section {
    padding-top: 56px;
  }

  .gamehub-title {
    margin-bottom: 28px;
  }

  .mode-card {
    min-height: 300px;
    padding: 24px 20px 88px;
  }

  /* Auth */
  #login,
  #register {
    padding: 20px 14px;
    min-height: 100dvh;
  }

  .login-card {
    padding: 26px 20px;
    max-width: 100%;
    box-shadow: 6px 6px 0 var(--dark);
  }

  .login-top-badge {
    font-size: 11px;
    letter-spacing: 1.5px;
    line-height: 1.35;
    white-space: normal;
    text-align: center;
  }

  .finput {
    font-size: 16px;
  }

  .btn-login-action {
    font-size: 22px;
    letter-spacing: 3px;
    padding: 14px 12px;
  }

  .otp-row .finput {
    font-size: 22px;
    letter-spacing: 2px;
  }

  /* Quiz */
  .quiz-topbar {
    padding: 16px;
  }

  .quiz-progress-wrap {
    padding: 0 16px 12px;
    gap: 10px;
  }

  .qcard {
    padding: 0 16px;
  }

  .result-scroll {
    padding: 16px 14px 48px;
  }

  .result-actions {
    grid-template-columns: 1fr 1fr;
  }

  .toast-msg {
    white-space: normal;
    max-width: calc(100vw - 32px);
    text-align: center;
    line-height: 1.4;
    border-radius: 14px;
  }
}

/* ===== Mobile ===== */
@media (max-width: 576px) {
  .site-logo img {
    max-width: 50px;
  }

  .hero-headline .line-1,
  .hero-headline .line-2 {
    font-size: clamp(45px, 15vw, 66px);
    gap: 6px;
  }

  .hero-cta {
    width: auto;
    max-width: none;
    justify-content: center;
    padding: 12px 22px;
    font-size: 15px;
    align-self: flex-start;
  }

  .hero-stats {
    flex-direction: row;
    align-items: start;
    text-align: left;
    gap: 12px;
    margin-top: 20px;
  }

  .stats-text {
    align-items: flex-start;
  }

  .hero-visual.orbital-hero {
    min-height: clamp(280px, 90vw, 380px);
    margin-top: 15px;
  }

  .orbital-system {
    transform: scale(clamp(0.72, 0.16vw + 0.66, 0.85));
  }

  .orbit-ring {
    border: 1px dashed #1a0a00;
  }

  .cf2 {
    top: 3.5%;
    right: 11%;
    animation-duration: 5s;
    animation-delay: 1s;
  }
  #landing .chip-float.cf3,
  #landing .chip-float.cf1,
  #landing .chip-float.cf4,
  #landing .chip-float.cf7 {
    display: none;
  }

  #landing .chip-float img {
    width: 42px;
  }

  .gamehub-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
  }

  .mode-card h3 {
    font-size: 1.35rem;
  }

  .footer-tag {
    font-size: 20px;
  }

  .footer-copy {
    font-size: 11px;
    line-height: 1.5;
    padding: 0 8px;
  }

  .login-flavor-pills span {
    font-size: 11px;
    padding: 5px 10px;
  }

  .age-row .chklabel {
    font-size: 13px;
    line-height: 1.35;
  }

  .quiz-home-link {
    font-size: 12px;
    padding: 6px 12px;
  }

  .result-topbar-actions {
    align-items: flex-end;
    gap: 6px;
  }

  .result-card-num {
    font-size: 10px;
  }

  .rbtn {
    font-size: 14px;
    letter-spacing: 1px;
    padding: 13px 8px;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }
}

/* ===== Small mobile ===== */
@media (max-width: 400px) {
  .hero-headline .line-1,
  .hero-headline .line-2 {
    font-size: clamp(61px, 12vw, 48px);
  }

  .badge {
    font-size: 0.75rem;
    padding: 8px 12px;
  }

  #login,
  #register {
    padding: 14px 10px;
  }

  .login-card {
    padding: 22px 16px;
    border-radius: 16px;
  }

  .login-top-badge {
    font-size: 10px;
    letter-spacing: 1px;
  }

  .btn-login-action {
    font-size: 18px;
    letter-spacing: 1.5px;
  }

  .otp-row {
    gap: 6px;
  }

  .otp-row .finput {
    font-size: 20px;
    padding: 10px 4px;
    letter-spacing: 0;
  }

  .field-error {
    font-size: 11px;
  }

  .qquestion {
    font-size: clamp(1.25rem, 6vw, 1.6rem) !important;
  }

  .qopt {
    padding: 12px 14px !important;
  }
}

/* ===== Desktop large ===== */
@media (min-width: 1200px) {
  .hero-container,
  .meters-section,
  .gamehub-section {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
  }
}
