/**
 * Mobile adaptation — all pages
 */

body.no-scroll {
  overflow: hidden;
  touch-action: none;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.65);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.nav-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-nav-toggle.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-nav-toggle.is-open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.mobile-nav-toggle.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Shared week navigator (schedule / standings) */
.week-navigator {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: var(--backdrop-blur);
  margin-bottom: 28px;
}

.week-nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.week-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.week-title-block strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #fff;
  display: block;
}

.week-title-block span {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.week-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.week-day-btn {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  padding: 12px 6px;
  cursor: pointer;
  text-align: center;
  transition: var(--transition-fast);
  color: var(--text-secondary);
  min-height: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.week-day-btn:hover {
  border-color: rgba(0, 240, 255, 0.35);
  background: rgba(0, 240, 255, 0.06);
  color: #fff;
}

.week-day-btn.is-today {
  border-color: rgba(0, 240, 255, 0.45);
}

.week-day-btn.is-active {
  background: linear-gradient(160deg, rgba(0, 240, 255, 0.18), rgba(59, 130, 246, 0.12));
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: var(--glow-cyan);
}

.week-day-btn .wd-name {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.week-day-btn.is-active .wd-name {
  color: var(--accent-cyan);
}

.week-day-btn .wd-num {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}

.week-day-btn .wd-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
}

.week-day-btn.has-matches .wd-dot {
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.7);
}

.week-picker-panel {
  display: none;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

.week-picker-panel.is-open {
  display: block;
}

.week-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.week-pick-btn {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.week-pick-btn:hover {
  border-color: rgba(0, 240, 255, 0.35);
  color: #fff;
}

.week-pick-btn.is-active {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.1);
  color: #fff;
}

.week-pick-btn strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 2px;
}

.week-pick-btn span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.day-section {
  margin-bottom: 36px;
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.day-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.day-section-header h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: #fff;
  margin: 0;
}

.day-section-header span {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ========== Tablet ========== */
@media (max-width: 1120px) {
  body {
    overflow-x: hidden;
  }
}

@media (max-width: 1024px) {
  .container {
    padding-left: 20px;
    padding-right: 20px;
  }

  .hero-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .matches-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

/* ========== Mobile ========== */
@media (max-width: 768px) {
  :root {
    --header-height: 64px;
  }

  body > main {
    padding-top: calc(var(--header-height) + 20px) !important;
  }

  .container {
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
  }

  .site-header .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .site-header {
    height: var(--header-height);
  }

  .header-inner {
    height: var(--header-height);
    gap: 10px;
  }

  .logo-brand {
    min-width: 0;
  }

  .logo-title .main-txt {
    font-size: 0.95rem;
  }

  .nav-actions .btn-primary,
  .nav-actions .header-instagram {
    display: none;
  }

  /* Hero */
  .hero-section {
    padding: calc(var(--header-height) + 20px) 0 48px;
  }

  .hero-banner-card {
    padding: 28px 18px;
    border-radius: var(--radius-md);
  }

  .hero-badge-tag {
    font-size: 0.7rem;
    padding: 5px 10px;
    margin-bottom: 16px;
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
    text-align: left;
  }

  .hero-title {
    font-size: clamp(1.65rem, 7.5vw, 2.2rem);
    margin-bottom: 14px;
  }

  .hero-subtitle {
    font-size: 0.95rem;
    margin-bottom: 22px;
  }

  .hero-cta-group {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .hero-cta-group .btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }

  .hero-stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 28px;
    padding-top: 24px;
  }

  .hero-stat-value {
    font-size: 1.45rem;
  }

  .hero-stat-label {
    font-size: 0.72rem;
  }

  /* Sections */
  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 22px;
  }

  .section-title {
    font-size: clamp(1.45rem, 6vw, 1.85rem);
  }

  .section-header .btn,
  .section-header .btn-sm {
    width: 100%;
    justify-content: center;
  }

  .tab-filter-bar {
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-md);
    padding: 6px;
    gap: 6px;
  }

  .tab-btn {
    padding: 10px 14px;
    font-size: 0.82rem;
    flex-shrink: 0;
  }

  /* Match cards */
  .matches-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .match-card {
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .match-card:hover {
    transform: none;
  }

  .team-logo-wrap {
    width: 48px;
    height: 48px;
  }

  .team-name-title {
    font-size: 0.82rem;
    max-width: 100%;
  }

  .score-digits {
    font-size: 1.55rem;
  }

  .match-card-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  .home-matches-wrap {
    gap: 20px;
  }

  .home-results-strip {
    padding: 14px 14px 12px;
  }

  .home-results-head {
    flex-wrap: wrap;
    margin-bottom: 10px;
  }

  .home-result-chip {
    padding: 7px 10px;
    font-size: 0.78rem;
  }

  .home-result-teams {
    max-width: 72px;
  }

  /* Features / complex */
  .features-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .feature-card {
    padding: 20px 16px;
  }

  .cafe-preview-box {
    padding: 22px 16px;
    gap: 20px;
  }

  .cafe-dishes-grid {
    grid-template-columns: 1fr;
  }

  .booking-form-box {
    padding: 24px 16px !important;
    margin-bottom: 48px !important;
  }

  .booking-form-box h2 {
    font-size: 1.45rem !important;
  }

  .booking-form-box p {
    font-size: 0.95rem !important;
    margin-bottom: 20px !important;
  }

  .booking-cta-btn,
  .booking-form-box .btn {
    width: 100%;
    max-width: 100%;
    justify-content: center;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
    padding: 14px 16px;
    box-sizing: border-box;
  }

  /* Week navigator */
  .week-navigator {
    padding: 14px;
    gap: 14px;
    margin-bottom: 20px;
  }

  .week-nav-top {
    flex-direction: column;
    align-items: stretch;
  }

  .week-nav-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .week-nav-actions .tab-btn,
  .week-nav-actions .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
    min-height: 42px;
    font-size: 0.82rem;
    padding: 8px 10px;
  }

  .week-nav-actions .btn {
    grid-column: 1 / -1;
  }

  .week-title-block strong {
    font-size: 1rem;
  }

  .week-days {
    gap: 4px;
  }

  .week-day-btn {
    min-height: 64px;
    padding: 8px 2px;
    border-radius: 10px;
  }

  .week-day-btn .wd-name {
    font-size: 0.58rem;
  }

  .week-day-btn .wd-num {
    font-size: 1rem;
  }

  .week-picker-grid {
    grid-template-columns: 1fr;
    max-height: 240px;
  }

  .day-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .day-section-header h2 {
    font-size: 1.05rem;
  }

  .tournament-group-header {
    padding: 12px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .tournament-group-title {
    font-size: 1rem;
  }

  /* Tables — scroll inside, keep page side padding */
  .standings-table-wrap {
    margin-left: 0;
    margin-right: 0;
    border-radius: var(--radius-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .standings-table-wrap > div {
    padding: 14px 16px !important;
  }

  .modern-table {
    min-width: 560px;
  }

  .modern-table th,
  .modern-table td {
    padding: 10px 8px;
    font-size: 0.8rem;
  }

  /* Glass / rules cards */
  .glass-card,
  .glass-panel {
    padding: 20px 16px !important;
    border-radius: var(--radius-md);
  }

  .glass-card ol,
  .glass-card ul {
    padding-left: 1.1rem;
  }

  .glass-card li {
    font-size: 0.9rem;
  }

  /* Footer */
  .site-footer {
    margin-top: 56px;
    padding: 48px 0 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    margin-bottom: 32px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  /* Modal */
  .modal-backdrop {
    padding: 12px;
    align-items: flex-end;
  }

  .modal-dialog {
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-width: 100%;
  }

  .protocol-scoreboard {
    padding: 18px 12px;
    gap: 8px;
  }

  .protocol-team-logo {
    width: 52px;
    height: 52px;
  }

  .protocol-team-name {
    font-size: 0.88rem;
  }

  .protocol-score-digits {
    font-size: 2rem;
    gap: 8px;
  }

  .protocol-meta-grid {
    grid-template-columns: 1fr;
  }

  .protocol-details-body {
    padding: 16px;
  }

  /* Match page hero — keep horizontal scoreboard */
  .match-hero-board {
    padding: 18px 14px !important;
    margin-bottom: 20px !important;
  }

  .match-teams-stage {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr !important;
    align-items: center !important;
    gap: 8px !important;
    flex-direction: row !important;
  }

  .stage-team {
    width: auto !important;
    min-width: 0 !important;
  }

  .stage-team-logo {
    width: 56px !important;
    height: 56px !important;
    padding: 6px !important;
    margin-bottom: 8px !important;
  }

  .stage-team-title {
    font-size: 0.85rem !important;
  }

  .stage-center {
    width: auto !important;
    margin: 0 !important;
    gap: 6px !important;
  }

  .stage-score {
    font-size: 1.85rem !important;
    gap: 6px !important;
  }

  .periods-strip {
    gap: 4px;
  }

  .period-pill {
    font-size: 0.68rem;
    padding: 2px 6px;
  }

  /* Buttons general */
  .btn {
    min-height: 44px;
  }

  .btn-sm {
    min-height: 38px;
  }
}

/* ========== Small phones ========== */
@media (max-width: 400px) {
  .hero-stats-row {
    grid-template-columns: 1fr;
  }

  .week-nav-actions {
    grid-template-columns: 1fr;
  }

  .week-day-btn .wd-name {
    display: none;
  }

  .week-day-btn {
    min-height: 48px;
  }

  .logo-title .main-txt {
    font-size: 0.85rem;
  }
}
