/* Responsive overrides for the unified public layout */
@media (max-width: 900px) {
  :root {
    --mobile-pad: clamp(16px, 4vw, 24px);
  }

  body {
    font-size: 16px;
    line-height: 1.4;
    background: radial-gradient(1200px 800px at 20% -10%, #ffffff 0%, #f7fbff 40%, #e9f5ff 60%, #dff1ff 100%),
                linear-gradient(180deg, #f8fbff 0%, #eaf4ff 100%);
    overflow-x: hidden;
  }

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  .lights { display: none !important; }

  .modal-content {
    width: min(100vw - 24px, 1280px);
    max-height: calc(100vh - 24px);
  }

  header {
    padding: 2.5rem 1rem 3rem;
  }

  .container {
    padding: var(--mobile-pad);
    padding-bottom: clamp(48px, 6vw, 96px);
  }

  .grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;
  }

  .col-12,
  .col-8,
  .col-6,
  .col-4,
  .col-3,
  .col-md-12,
  .col-sm-12 { grid-column: 1 / -1; }

  #map {
    height: 68vh;
    min-height: 360px;
    max-height: 640px;
    border-radius: 16px;
    border: 4px solid #fff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    overflow: hidden;
  }

  .leaflet-pane svg,
  .leaflet-pane canvas {
    max-width: none !important;
  }

  .tree-icon { background: transparent !important; border: none !important; }
  .tree-icon .tree-emoji { font-size: 32px; line-height: 1; }

  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea,
  button {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }

  button,
  .btn {
    padding: 0.8rem 1rem;
    border-radius: 10px;
  }

  #registerCard .otp-flow input,
  #registerCard .otp-flow button,
  #registerCard select {
    width: 100%;
  }

  #registerCard .otp-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  #otpResend {
    text-align: center;
  }

  #otpVerifiedBadge {
    text-align: center;
  }

  #registerCard [data-captcha-for] {
    max-width: 100%;
    overflow: hidden;
  }

  .card {
    border-radius: 16px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  }

  form .row {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: 1fr;
  }

  .form-consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    justify-content: flex-start;
    text-align: left;
  }

  .form-consent input[type="checkbox"] {
    margin-top: 4px;
    flex: 0 0 auto;
  }

  .form-consent label {
    flex: 1 1 auto;
    margin: 0;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
    text-align: left;
    float: none !important;
  }

  #entriesTable {
    display: none;
  }

  #leaderboard {
    display: block;
  }

  #leaderboardList {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  #leaderboardList > * {
    visibility: visible;
  }

  #entriesCards {
    display: grid;
    gap: 12px;
  }

  #entriesWrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }

  #entriesWrap.scroll-hint::after {
    content: 'Swipe →';
    position: absolute;
    right: 8px;
    top: 8px;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    padding: 3px 6px;
    border-radius: 6px;
  }

  .entry-card {
    display: grid;
    grid-template-columns: 84px 1fr auto;
    gap: 10px;
    align-items: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px;
  }

  .entry-card .thumb {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: 8px;
  }

  .entry-card .addr { font-weight: 600; }
  .entry-card .votes { font-variant-numeric: tabular-nums; }

  .sponsors .tier {
    overflow: hidden;
  }

  .sponsors .s-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 72vw;
    gap: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 2px 10px;
    scroll-snap-type: x mandatory;
  }

  .sponsors .s-grid > .s-wrap { scroll-snap-align: center; }
  .sponsors .logo-box img,
  .sponsors .logo-box svg {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  .s-card {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--tier-accent, #e5e7eb);
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    padding: 0.75rem;
    width: 100%;
    height: 42vw;
    overflow: hidden;
  }

  .s-card img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
  }

  #tier-northpole .s-grid { grid-auto-columns: 82vw; }
  #tier-northpole .s-card { height: 46vw; }

  #tier-winter .s-grid { grid-auto-columns: 68vw; }
  #tier-winter .s-card { height: 40vw; }

  /* Consent row: mobile-safe layout */
  .consent-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
  }

  .consent-row input[type="checkbox"] {
    margin-top: 4px;
    flex: 0 0 auto;
  }

  .consent-row label {
    flex: 1 1 auto;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
    text-align: left;
  }

  footer {
    padding: 24px 16px;
  }
}

/* ensure consent checkbox never stretches */
input[type="checkbox"] {
  width: auto !important;
  height: auto;
}

/* HL copy hints – mobile adjustments */
body.mobile .hl-banner {
  font-size: 0.95rem;
  grid-template-columns: 1.2em 1fr; /* keeps emoji narrow on phones */
  padding: 10px 12px;
  margin-bottom: 14px;
}
body.mobile .hl-inline-note,
body.mobile .hl-helper {
  font-size: 0.95rem;
}

/* Inline helper sizing on mobile */
body.mobile .hl-helper-inline {
  font-size: 0.95em;
}
