/* Mobile-first refinements & overflow guards */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

.container {
  width: min(100% - 24px, var(--container));
}

/* ----- Header: prevent squeeze on narrow phones ----- */
@media (max-width: 899px) {
  .site-header__inner {
    gap: 8px;
  }

  .logo span {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.95rem;
  }

  .logo img {
    width: auto;
    height: 18px;
    max-width: min(120px, 42vw);
  }

  .header-actions {
    gap: 6px;
    flex-shrink: 0;
  }

  .header-actions .btn--ghost {
    display: none;
  }

  .header-actions .btn--sm {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
}

@media (max-width: 380px) {
  .logo span {
    display: none;
  }

  .header-actions .btn--sm {
    padding: 8px 10px;
    font-size: 0.75rem;
  }
}

/* Mobile nav: scrollable + safe area */
.nav-mobile {
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom, 0));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-mobile.is-open {
  display: flex;
}

.nav-mobile[hidden] {
  display: none !important;
}

.nav-mobile.is-open[hidden] {
  display: flex !important;
}

/* Hero — container width; natural height keeps sharpness */
@media (max-width: 639.98px) {
  .hero {
    width: min(100% - 24px, var(--container));
    margin-top: 8px;
    height: auto;
  }

  .hero__img {
    object-position: center center;
  }
}

@media (min-width: 640px) {
  .hero {
    height: auto;
  }
}

@media (min-width: 1200px) {
  .hero {
    height: auto;
  }
}

/* ----- Sections & type ----- */
@media (max-width: 639px) {
  :root {
    --space-section: 32px;
    --space-block: 16px;
  }

  .section {
    padding: var(--space-section) 0;
  }

  .intro {
    padding: 24px 0 4px;
  }

  h1 {
    font-size: 1.35rem;
    overflow-wrap: anywhere;
  }

  h2 {
    font-size: 1.2rem;
    overflow-wrap: anywhere;
  }

  h3 {
    font-size: 1.05rem;
  }

  .intro__lead {
    font-size: 0.95rem;
  }

  .section-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .section-head h2 {
    flex: 1 1 auto;
    min-width: 0;
  }

  .link-all {
    flex-shrink: 0;
    font-size: 0.85rem;
  }

  .promo-banner,
  .join-banner,
  .bonus-timer,
  .max-win {
    padding: 18px 16px;
  }

  .join-banner {
    text-align: left;
  }

  .join-banner .btn,
  .promo-banner .btn {
    width: 100%;
  }

  .countdown__value {
    font-size: 1.15rem;
  }

  .countdown__unit {
    font-size: 0.62rem;
  }

  .bonus-timer__percent {
    font-size: 1.5rem;
    overflow-wrap: anywhere;
  }

  .steps li {
    padding: 14px 14px 14px 50px;
    font-size: 0.92rem;
  }

  .vip-perks li {
    padding: 12px;
  }
}

/* Games: slightly tighter on very small screens */
@media (max-width: 380px) {
  .games-grid {
    gap: 8px;
  }

  .game-card__body {
    padding: 8px;
  }

  .game-card__title {
    font-size: 0.72rem;
    margin-bottom: 6px;
  }

  .game-card .btn {
    padding: 6px 8px;
    font-size: 0.72rem;
  }
}

/* Winning now: single column on tiny screens */
@media (max-width: 420px) {
  .winning-now {
    grid-template-columns: 1fr;
  }
}

.winning-card__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.winning-card > div:last-child {
  min-width: 0;
  flex: 1;
}

/* Winners ticker: pause on reduced motion */
@media (prefers-reduced-motion: reduce) {
  .winners__track {
    animation: none;
    flex-wrap: wrap;
    width: 100%;
  }
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

@media (max-width: 639px) {
  .btn-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .btn-row .btn {
    width: 100%;
  }
}

/* Sports odds: prevent overflow */
.sport-card__match {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.odd {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.8rem;
  padding: 8px 2px;
}

/* Footer */
@media (max-width: 639px) {
  .site-footer {
    padding: 36px 0 calc(88px + env(safe-area-inset-bottom, 0));
  }

  .footer-grid {
    gap: 22px;
  }

  .footer-col .logo span {
    font-size: 1rem;
  }
}

/* Mobile bottom bar */
.mobile-bar {
  padding-bottom: env(safe-area-inset-bottom, 0);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mobile-bar a {
  min-width: 0;
  padding: 10px 2px calc(10px + env(safe-area-inset-bottom, 0) / 2);
  font-size: 0.65rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 360px) {
  .mobile-bar a {
    font-size: 0.6rem;
  }
}

/* Floating bonus: less intrusive on mobile */
@media (max-width: 899px) {
  .float-bonus {
    left: 12px;
    right: 12px;
    bottom: calc(64px + env(safe-area-inset-bottom, 0));
    width: auto;
    max-width: none;
    padding: 12px 40px 12px 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 4px 12px;
  }

  .float-bonus__label {
    margin: 0;
    grid-column: 1;
  }

  .float-bonus__value {
    margin: 0;
    font-size: 0.95rem;
    grid-column: 1;
    overflow-wrap: anywhere;
  }

  .float-bonus .btn {
    grid-column: 2;
    grid-row: 1 / span 2;
    width: auto;
    white-space: nowrap;
    padding: 8px 12px;
  }

  .float-bonus__close {
    top: 4px;
    right: 8px;
    z-index: 1;
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 420px) {
  .float-bonus {
    grid-template-columns: 1fr;
    padding: 14px 36px 14px 14px;
  }

  .float-bonus .btn {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
    margin-top: 4px;
  }
}

/* Touch targets */
@media (hover: none) {
  .btn,
  .menu-toggle,
  .toc__toggle,
  .hero__dot,
  .mobile-bar a {
    min-height: 44px;
  }

  .hero__dot {
    min-width: 44px;
    min-height: 44px;
    display: grid;
    place-items: center;
    background: transparent;
  }

  .hero__dot::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
  }

  .hero__dot.is-active::after {
    width: 22px;
    border-radius: 999px;
    background: var(--color-accent);
  }
}

/* Long placeholder / URL protection */
p,
li,
.btn,
.max-win__value,
.promo-banner__title {
  overflow-wrap: anywhere;
}
