
/* V4.7 — Samsung Galaxy S23 optimization
   Typical portrait CSS viewport is around 360px wide.
   This file sits AFTER the iPhone 16 Pro Max rules and sharpens the layout for compact Android phones. */

@media (min-width: 340px) and (max-width: 390px) {
  html {
    scroll-padding-top: 104px;
  }

  body {
    overflow-x: hidden;
  }

  .competition-panel {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .competition-nav {
    top: 0 !important;
    gap: 6px !important;
    padding: 8px 10px !important;
    margin-left: -10px !important;
    margin-right: -10px !important;
  }

  .competition-nav button {
    min-height: 42px !important;
    padding: 0 12px !important;
    font-size: 9px !important;
    border-radius: 11px !important;
  }

  .losers-badge,
  .home-logo-link {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    min-height: 52px !important;
    border-radius: 13px !important;
  }

  .brand-title {
    font-size: clamp(21px, 7.2vw, 27px) !important;
    line-height: 1 !important;
    letter-spacing: -.04em !important;
  }

  .competition-hero {
    padding: 16px 12px !important;
    border-radius: 16px !important;
  }

  .competition-hero h1 {
    font-size: clamp(28px, 10vw, 37px) !important;
  }

  .competition-hero p {
    font-size: 12px !important;
    line-height: 1.42 !important;
  }

  .comp-card,
  .history-global-card {
    border-radius: 16px !important;
  }

  /* Next match: compact phone layout */

  #nextMatchSaveBtn {
    width: 100% !important;
    min-height: 46px !important;
  }

  /* Match rows */

  .ll-tag {
    min-width: 30px !important;
    font-size: 7px !important;
    padding: 4px 5px !important;
  }

  /* Rivalry block */
  .ll-duel-score > div > b {
    font-size: 36px !important;
  }

  .ll-duel-score em {
    width: 48px !important;
    height: 48px !important;
  }

  .ll-record-row {
    grid-template-columns: 24px minmax(0,1fr) 48px minmax(0,1fr) !important;
    gap: 7px !important;
  }

  .ll-record-row strong {
    font-size: 14px !important;
  }

  /* History */
  .history-global-head {
    padding: 14px 12px !important;
  }

  .history-global-head h2 {
    font-size: 24px !important;
  }

  .history-status {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .history-global-list {
    padding: 0 12px !important;
  }

  /* Team history */
  .th-player-grid,
  .th-stat-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .th-player-grid b {
    font-size: 24px !important;
  }

  .th-stat-grid b {
    font-size: 19px !important;
  }

  .th-match-row {
    grid-template-columns: 28px minmax(0,1fr) 48px !important;
  }

  /* Match card / modals */
  .matchcard-sheet,
  .team-history-sheet {
    padding: 18px 12px 16px !important;
    border-radius: 20px 20px 0 0 !important;
  }

  .matchcard-sheet h2,
  .team-history-sheet h2 {
    font-size: 26px !important;
  }

  .mc-scoreline {
    grid-template-columns: 1fr 54px 1fr !important;
    gap: 6px !important;
    padding: 11px 8px !important;
  }

  .mc-scoreline b {
    font-size: 12px !important;
  }

  .mc-scoreline strong {
    font-size: 20px !important;
  }

  .mc-event-row input,
  .mc-event-row select {
    font-size: 16px !important;
    min-height: 44px !important;
  }

  /* Tables stay scrollable but with tighter cells */
  table {
    font-size: 10px !important;
  }

  th, td {
    padding-left: 6px !important;
    padding-right: 6px !important;
  }

  .foot,
  footer {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}

/* Samsung S23 landscape */
@media (min-width: 640px) and (max-width: 915px) and (max-height: 430px) and (orientation: landscape) {

  .matchcard-sheet,
  .team-history-sheet {
    max-height: 100dvh !important;
    border-radius: 0 !important;
  }
}
