/* Mobile-only layout overrides. Desktop styles remain unchanged. */
html { scroll-padding-top: 88px; }
body { overflow-x: hidden; }
img, svg { max-width: 100%; }

@media (max-width: 900px) {
  header {
    padding: 14px 20px !important;
    gap: 14px !important;
  }

  header > a { min-width: 0; min-height: 44px; gap: 10px !important; }
  header > a img:first-child { width: 36px !important; height: 36px !important; }
  header > a img:last-child { height: 21px !important; max-width: 116px; object-fit: contain; }
  header nav { gap: 10px !important; }
  header nav a:not(:last-child) { display: none; }
  header nav a:last-child { min-height: 44px; display: inline-flex; align-items: center; padding: 9px 14px !important; font-size: 14px; white-space: nowrap; }

  .home #top {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 42px !important;
    padding: 54px 20px 48px !important;
    text-align: center;
  }

  .home #top > div:first-child { align-items: center !important; }
  .home #top h1 { font-size: clamp(48px, 15vw, 72px) !important; }
  .home #top > div:first-child > p { max-width: 38ch !important; }
  .home #top > div:first-child > div { justify-content: center; }
  .home #top > div:first-child a { width: 100%; justify-content: center; }
  .home #top > div:last-child { min-height: 500px !important; }
  .home #top > div:last-child > div:nth-child(-n+3) { max-width: 88vw; max-height: 88vw; }
  .home #top > div:last-child > div:last-child {
    width: min(292px, 78vw) !important;
    height: auto !important;
    aspect-ratio: 352 / 628;
    border-radius: 36px !important;
    padding: 9px !important;
  }

  .home section { scroll-margin-top: 72px; }
  .home #party,
  .home #history { padding-left: 20px !important; padding-right: 20px !important; }
  .home .home-party-layout,
  .home .home-history-layout { grid-template-columns: minmax(0, 1fr) !important; }
  .home .home-party-layout { gap: 38px !important; padding: 28px 22px !important; }
  .home .home-party-layout > div { min-width: 0; }
  .home .home-party-layout > div:last-child > div { width: min(292px, 78vw) !important; height: auto !important; aspect-ratio: 300 / 536; }
  .home .home-party-layout > div:last-child > p { width: min(292px, 78vw) !important; }
  .home .home-history-layout { gap: 36px !important; }
  .home .home-history-layout > div { min-width: 0; }
  .home .history-leaderboard-row {
    grid-template-columns: 32px minmax(0, 1fr) 62px 54px !important;
    gap: 10px !important;
    width: 100%;
  }
  .home .history-leaderboard-row > span { min-width: 0; }
  .home .history-leaderboard-row > span:nth-child(3),
  .home .history-leaderboard-row > span:nth-child(4) { white-space: nowrap; }
  .home .history-leaderboard-row > span:nth-child(2) span { display: block; margin-top: 2px; }
  .home .home-history-layout figure,
  .home .home-history-layout figure > div { width: 100% !important; box-sizing: border-box; }
  .home #history > div[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  .home #history > div[style*="grid-template-columns"] > div,
  .home #modes > div[style*="grid-template-columns"] > div { width: 100%; box-sizing: border-box; }
  .home #how,
  .home #modes,
  .home #faq,
  .home section[style*="padding:0 56px 80px"] { padding-left: 20px !important; padding-right: 20px !important; }
  .home #how { padding-top: 64px !important; padding-bottom: 64px !important; }
  .home #how > div:last-child { grid-template-columns: minmax(0, 1fr) !important; gap: 12px !important; margin-top: 30px !important; }
  .home #modes { padding-bottom: 32px !important; }
  .home #modes > div[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  .home section[style="padding:72px 0"] { padding: 56px 0 !important; }
  .home section[style="padding:72px 0"] > div { padding: 0 20px !important; }
  .home section[style="padding:72px 0"] div[style*="grid-template-columns:repeat(3"] { grid-template-columns: minmax(0, 1fr) !important; gap: 22px !important; }
  .home #faq { padding-bottom: 64px !important; }
  .home #faq > div:last-child { grid-template-columns: minmax(0, 1fr) !important; gap: 0 !important; }
  .home section[style*="padding:0 56px 80px"] { padding-bottom: 56px !important; }
  .home section[style*="padding:0 56px 80px"] > div[style*="grid-template-columns:auto 1fr"] {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 22px !important;
    padding: 28px 22px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden;
  }
  .home .maker-section { padding: 0 20px 56px !important; }
  .home .maker-card {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 22px !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 28px 22px !important;
    overflow: hidden;
  }
  .home .maker-card > *,
  .home .maker-card p,
  .home .maker-card a { min-width: 0; overflow-wrap: anywhere; }
  .home section[style*="padding:0 56px 80px"] > div[style*="grid-template-columns:auto 1fr"] > div,
  .home section[style*="padding:0 56px 80px"] > div[style*="grid-template-columns:auto 1fr"] p,
  .home section[style*="padding:0 56px 80px"] > div[style*="grid-template-columns:auto 1fr"] a {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .home section[style*="padding:0 56px 80px"] > div[style*="text-align:center"] { padding: 44px 20px !important; }

  .home section[style="padding:72px 0"] figure { cursor: zoom-in; }
  .home section[style="padding:72px 0"] figure img { pointer-events: none; }

  footer { padding: 34px 20px !important; }
  footer > div { align-items: flex-start !important; }
  footer nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 10px 4px; }

  .legal-page div[style*="max-width:720px"] { padding: 44px 20px 64px !important; }
}

@media (max-width: 600px) {
  .legal-table-wrap { overflow: visible !important; border: 0 !important; }
  .legal-table,
  .legal-table tbody { display: block; width: 100%; }
  .legal-table tr:first-child { display: none; }
  .legal-table tr:not(:first-child) {
    display: block;
    margin-bottom: 12px;
    padding: 8px 12px;
    border: 1px solid rgba(201,161,95,0.25);
    border-radius: 10px;
    background: #12291F;
  }
  .legal-table td {
    display: grid;
    grid-template-columns: minmax(86px, 0.75fr) minmax(0, 1.4fr);
    gap: 12px;
    padding: 8px 0 !important;
    border: 0 !important;
    overflow-wrap: anywhere;
  }
  .legal-table td::before {
    color: #C9A15F;
    font-family: 'Big Shoulders Display', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
  }
  .legal-table--data td:nth-child(1)::before { content: 'Data type'; }
  .legal-table--data td:nth-child(2)::before { content: 'Used for'; }
  .legal-table--data td:nth-child(3)::before { content: 'Stored'; }
  .legal-table--analytics td:nth-child(1)::before { content: 'Event'; }
  .legal-table--analytics td:nth-child(2)::before { content: 'Purpose'; }
}

.gallery-image-link {
  display: block;
  border-radius: 10px;
  border: 1px solid rgba(201,161,95,0.25);
  background: #12291F;
  overflow: hidden;
  cursor: zoom-in;
}

@media (max-width: 520px) {
  .home #top > div:last-child { min-height: 440px !important; }
  .home section:nth-of-type(2) > div {
    flex-basis: 50% !important;
    padding: 22px 18px !important;
  }
  .home section:nth-of-type(2) > div:nth-child(even) { border-right: 0 !important; }
  .home #modes > div:first-child { align-items: flex-start !important; }
  footer > div { flex-direction: column; }
  footer > div,
  footer > div > div { align-items: center !important; text-align: center; width: 100%; }
  footer nav { justify-content: center; width: 100%; }
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(4, 14, 10, 0.94);
  backdrop-filter: blur(8px);
}
.gallery-lightbox.is-open { display: flex; }
.gallery-lightbox__content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: min(94vw, 760px);
  max-height: 94vh;
}
.gallery-lightbox__image {
  display: block;
  max-width: 100%;
  max-height: calc(94vh - 52px);
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(201,161,95,0.45);
  object-fit: contain;
}
.gallery-lightbox__caption {
  color: #E3C083;
  font-family: 'Big Shoulders Display', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.gallery-lightbox__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(227,192,131,0.6);
  border-radius: 50%;
  background: rgba(11,31,23,0.9);
  color: #F2EAD3;
  font: 28px/1 sans-serif;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { scroll-behavior: auto !important; }
}


/* Dartful Party page (party.html) */
@media (max-width: 900px) {
  .party section:first-of-type {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 40px !important;
    padding: 48px 20px 44px !important;
    text-align: center;
  }
  .party section:first-of-type > div:first-child { align-items: center !important; }
  .party section:first-of-type h1 { font-size: clamp(42px, 13vw, 66px) !important; }
  .party section:first-of-type > div:first-child a { width: 100%; justify-content: center; text-align: center; }
  .party section:first-of-type > div:last-child > div {
    width: min(292px, 78vw) !important;
    height: auto !important;
    aspect-ratio: 300 / 536;
    border-radius: 36px !important;
  }
  .party section { padding-left: 20px !important; padding-right: 20px !important; }
  .party section > div { min-width: 0 !important; }
  .party .party-scoring-layout {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 28px !important;
  }
  .party .party-scoring-layout > div { min-width: 0; width: 100%; }
  .party div[style*="grid-template-columns:1fr 0.9fr"],
  .party div[style*="grid-template-columns:repeat(auto-fit"] { grid-template-columns: minmax(0, 1fr) !important; }
  .party div[style*="grid-template-columns:repeat(auto-fit,minmax(330px,1fr))"] { gap: 0 !important; }
}
