:root {
  --page: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #edf2f7;
  --ink: #142033;
  --muted: #68758a;
  --line: #dce3ec;
  --blue: #0f5fd0;
  --blue-dark: #0a3f91;
  --green: #10845f;
  --red: #bf3030;
  --gold: #d9a222;
  --shadow: 0 16px 38px rgba(28, 40, 62, 0.09);
}

/* Final adaptive fixes: forecast modal, achievements, sticky navigation, schedule */
html,
body,
.app,
.content {
  max-width: 100%;
  overflow-x: hidden !important;
}

@media (max-width: 900px) {
  .app-header {
    height: calc(52px + env(safe-area-inset-top)) !important;
    min-height: calc(52px + env(safe-area-inset-top)) !important;
    margin: -14px -14px 14px !important;
    padding: env(safe-area-inset-top) 14px 0 !important;
  }

  .mobile-brand img,
  .brand img {
    width: 30px !important;
    height: 30px !important;
  }

  .mobile-brand strong {
    font-size: 17px !important;
    line-height: 22px !important;
  }

  .profile-link {
    min-height: 34px !important;
    padding: 0 10px !important;
    font-size: 13px !important;
  }

  .content {
    padding: 14px 14px calc(104px + env(safe-area-inset-bottom)) !important;
  }

  .nav {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 5000 !important;
    height: calc(70px + env(safe-area-inset-bottom)) !important;
    max-height: calc(70px + env(safe-area-inset-bottom)) !important;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)) !important;
    transform: translateZ(0) !important;
    will-change: transform;
  }

  .nav-count-5 .nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    overflow-x: hidden !important;
  }
}

.award-strip {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-auto-flow: row !important;
  grid-auto-columns: unset !important;
  gap: 12px !important;
  overflow: visible !important;
  padding: 0 !important;
}

.achievement-card {
  position: relative !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 146px !important;
  height: 146px !important;
  display: grid !important;
  grid-template-rows: 42px 34px 1fr !important;
  gap: 6px !important;
  padding: 14px !important;
  overflow: hidden !important;
  border-radius: 18px !important;
}

.achievement-medal {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #cbd5e1;
  box-shadow: inset 0 -3px 0 rgba(15, 23, 42, .12);
}

.achievement-medal::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .75);
}

.achievement-card img {
  position: absolute;
  left: 14px;
  top: 14px;
  width: 38px !important;
  height: 38px !important;
  object-fit: contain;
  z-index: 1;
}

.achievement-card.locked img {
  filter: grayscale(1) !important;
  opacity: .45 !important;
}

.achievement-card.earned img {
  filter: none !important;
  opacity: 1 !important;
}

.achievement-champion.earned .achievement-medal { background: #d9a222; }
.achievement-silver.earned .achievement-medal { background: #a8b3c2; }
.achievement-bronze.earned .achievement-medal { background: #c87942; }
.achievement-bestRound.earned .achievement-medal { background: #159a63; }
.achievement-bestRound .achievement-medal {
  border-radius: 12px 12px 50% 50%;
}

.achievement-bestRound .achievement-medal::before {
  width: 18px;
  height: 14px;
  border: 3px solid rgba(255, 255, 255, .78);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 12px 0 -6px rgba(255, 255, 255, .78);
}

.achievement-card b {
  min-width: 0;
  max-height: none !important;
  overflow: hidden !important;
  color: var(--ink) !important;
  font-size: 13px !important;
  line-height: 17px !important;
}

.achievement-card span {
  min-width: 0;
  display: -webkit-box !important;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden !important;
  padding-right: 32px !important;
  color: var(--muted) !important;
  font-size: 11px !important;
  line-height: 14px !important;
}

.achievement-card strong {
  right: 12px !important;
  bottom: 12px !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  font-size: 12px !important;
}

@media (max-width: 700px) {
  .award-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 430px) {
  .award-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .achievement-card {
    height: 136px !important;
    min-height: 136px !important;
    padding: 12px !important;
    grid-template-rows: 38px 32px 1fr !important;
  }

  .achievement-medal,
  .achievement-card img {
    width: 34px !important;
    height: 34px !important;
  }

  .achievement-card img {
    left: 12px;
    top: 12px;
  }
}

.modal-backdrop {
  overflow-x: hidden !important;
}

.modal {
  overflow-x: hidden !important;
}

.modal-header {
  min-height: 42px !important;
  margin-bottom: 12px !important;
}

.modal-actions {
  gap: 8px !important;
}

.modal-close,
.modal-save {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  border-radius: 14px !important;
}

.modal-close {
  font-size: 26px !important;
}

.modal-save .ui-icon {
  width: 21px !important;
  height: 21px !important;
}

.predict-form {
  gap: 12px !important;
}

.predict-match-summary {
  padding: 12px !important;
  border-radius: 16px !important;
}

.predict-teams {
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr) !important;
  gap: 10px !important;
}

.predict-teams img {
  width: 30px !important;
  height: 30px !important;
}

.predict-teams strong {
  font-size: 15px !important;
  line-height: 19px !important;
}

.predict-score-row {
  grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr) !important;
  gap: 10px !important;
  align-items: end !important;
}

.predict-score-row .score-field input {
  width: 100% !important;
  height: 64px !important;
  min-height: 64px !important;
  text-align: center !important;
  font-size: 26px !important;
  font-weight: 850 !important;
  border-radius: 16px !important;
}

.predict-score-row .field label,
.predict-form .prediction-grid .field label {
  min-height: 28px;
  display: flex;
  align-items: end;
  font-size: 12px !important;
  line-height: 14px !important;
}

.predict-score-row .score-separator {
  height: 64px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 24px;
}

.predict-form .prediction-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
  padding: 12px !important;
  border-radius: 16px !important;
  background: var(--panel-soft) !important;
}

.predict-form .prediction-grid .field {
  min-width: 0 !important;
  padding: 0 !important;
}

.predict-form .prediction-grid input,
.predict-form .prediction-grid select {
  width: 100% !important;
  min-height: 48px !important;
  border-radius: 14px !important;
  font-size: 15px !important;
}

.predict-form .field-note {
  display: none !important;
}

@media (max-width: 430px) {
  .modal {
    max-height: calc(100svh - 18px - env(safe-area-inset-top)) !important;
    padding: 14px !important;
  }

  .modal-header h3 {
    font-size: 18px !important;
    line-height: 23px !important;
  }

  .predict-match-summary {
    padding: 10px !important;
  }

  .predict-score-row .score-field input {
    height: 58px !important;
    min-height: 58px !important;
    font-size: 24px !important;
  }

  .predict-score-row .score-separator {
    height: 58px;
  }

  .predict-form .prediction-grid {
    gap: 8px !important;
    padding: 10px !important;
  }
}
/* Desktop web layout guard. This block must stay at the end of the file. */
@media (min-width: 901px) {
  .app {
    display: grid !important;
    grid-template-columns: 286px minmax(0, 1fr) !important;
    min-height: 100vh !important;
    background: #eef3f8 !important;
  }

  .app-header {
    display: none !important;
  }

  .sidebar {
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    bottom: auto !important;
    grid-column: 1 !important;
    width: auto !important;
    height: 100vh !important;
    min-height: 100vh !important;
    padding: 26px 20px !important;
    overflow-y: auto !important;
    background: #101827 !important;
  }

  .content {
    grid-column: 2 !important;
    width: 100% !important;
    max-width: 1360px !important;
    margin: 0 auto !important;
    padding: 36px 48px 56px !important;
    background: transparent !important;
    overflow-x: hidden !important;
  }

  .brand img,
  .brand span:first-child {
    width: 44px !important;
    height: 44px !important;
    border-radius: 14px !important;
  }

  .brand strong {
    font-size: 23px !important;
    line-height: 28px !important;
  }

  .nav {
    position: static !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
    background: transparent !important;
  }

  .nav button {
    width: 100% !important;
    height: 50px !important;
    min-height: 50px !important;
    justify-content: flex-start !important;
    gap: 13px !important;
    padding: 0 14px !important;
    border-radius: 15px !important;
    color: #cbd5e1 !important;
    text-align: left !important;
  }

  .nav button:hover,
  .nav button.active {
    color: #fff !important;
    background: rgba(59, 130, 246, 0.18) !important;
  }

  .nav .ui-icon,
  .nav svg,
  .nav button img {
    width: 22px !important;
    height: 22px !important;
    flex: 0 0 22px !important;
  }

  .nav button span {
    display: inline !important;
    font-size: 15px !important;
    line-height: 20px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .screen-stack {
    gap: 30px !important;
  }

  .screen-title,
  .topbar h2 {
    font-size: clamp(34px, 3.2vw, 48px) !important;
    line-height: 1.05 !important;
  }

  .rank-summary,
  .profile-stats,
  .stats-grid,
  .award-strip {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
    gap: 16px !important;
  }

  .match-feed,
  .schedule-list,
  .cards-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)) !important;
    gap: 16px !important;
  }

  .schedule-toolbar {
    display: grid !important;
    grid-template-columns: minmax(300px, 380px) minmax(260px, 1fr) !important;
    align-items: end !important;
    gap: 16px !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .schedule-toolbar .schedule-title-row {
    grid-column: 1 / -1 !important;
  }

  .schedule-toolbar .actions.one-line {
    width: auto !important;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 10px !important;
  }

  .schedule-toolbar .actions.one-line .btn {
    width: auto !important;
  }

  .grid.two,
  .grid.three,
  .settings-grid,
  .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  }

  .modal {
    max-width: 760px !important;
  }

  .modal-predict {
    max-width: 580px !important;
  }

  .results-section .compact-result .tag.done,
  .results-section .compact-result .tag.live,
  .results-section .compact-result .tag {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 86px !important;
    min-height: 26px !important;
    padding: 4px 10px !important;
    border-radius: 999px !important;
    font-size: 13px !important;
    font-weight: 850 !important;
    white-space: nowrap !important;
  }

  .results-section .compact-result .tag.done {
    color: #0a8f55 !important;
    background: #e2f8ee !important;
  }
}

/* Final desktop guard. Keep this last so old desktop rules cannot override it. */
@media (min-width: 901px) {
  .app {
    display: grid !important;
    grid-template-columns: 286px minmax(0, 1fr) !important;
    min-height: 100vh !important;
    background: #eef3f8 !important;
  }

  .app-header {
    display: none !important;
  }

  .sidebar {
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    bottom: auto !important;
    grid-column: 1 !important;
    width: auto !important;
    height: 100vh !important;
    min-height: 100vh !important;
    padding: 26px 20px !important;
    overflow-y: auto !important;
    background: #101827 !important;
  }

  .content {
    grid-column: 2 !important;
    width: 100% !important;
    max-width: 1360px !important;
    margin: 0 auto !important;
    padding: 36px 48px 56px !important;
    background: transparent !important;
    overflow-x: hidden !important;
  }

  .brand img,
  .brand span:first-child {
    width: 44px !important;
    height: 44px !important;
    border-radius: 14px !important;
  }

  .brand strong {
    font-size: 23px !important;
    line-height: 28px !important;
  }

  .nav {
    position: static !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
    background: transparent !important;
  }

  .nav button {
    width: 100% !important;
    height: 50px !important;
    min-height: 50px !important;
    justify-content: flex-start !important;
    gap: 13px !important;
    padding: 0 14px !important;
    border-radius: 15px !important;
    color: #cbd5e1 !important;
    text-align: left !important;
  }

  .nav button:hover,
  .nav button.active {
    color: #fff !important;
    background: rgba(59, 130, 246, 0.18) !important;
  }

  .nav .ui-icon,
  .nav svg,
  .nav button img {
    width: 22px !important;
    height: 22px !important;
    flex: 0 0 22px !important;
  }

  .nav button span {
    display: inline !important;
    font-size: 15px !important;
    line-height: 20px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .screen-stack {
    gap: 30px !important;
  }

  .screen-title,
  .topbar h2 {
    font-size: clamp(34px, 3.2vw, 48px) !important;
    line-height: 1.05 !important;
  }

  .rank-summary,
  .profile-stats,
  .stats-grid,
  .award-strip {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
    gap: 16px !important;
  }

  .match-feed,
  .schedule-list,
  .cards-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)) !important;
    gap: 16px !important;
  }

  .schedule-toolbar {
    display: grid !important;
    grid-template-columns: minmax(300px, 380px) minmax(260px, 1fr) !important;
    align-items: end !important;
    gap: 16px !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .schedule-toolbar .schedule-title-row {
    grid-column: 1 / -1 !important;
  }

  .schedule-toolbar .actions.one-line {
    width: auto !important;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 10px !important;
  }

  .schedule-toolbar .actions.one-line .btn {
    width: auto !important;
  }

  .grid.two,
  .grid.three,
  .settings-grid,
  .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  }

  .modal {
    max-width: 760px !important;
  }

  .modal-predict {
    max-width: 580px !important;
  }
}

/* Final guard for player and match prediction detail tables. */
.modal-user-predictions,
.modal-admin-predictions {
  max-width: min(940px, calc(100vw - 24px)) !important;
}

.leader-row {
  cursor: pointer;
}

.user-predictions-wrap,
.match-predictions-wrap {
  max-width: 100% !important;
}

.user-predictions-table,
.match-predictions-table {
  width: 100% !important;
}

.match-card-actions {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 8px !important;
}

.match-card-actions .btn {
  min-height: 40px !important;
  width: auto !important;
  padding: 0 12px !important;
}

@media (max-width: 700px) {
  .user-predictions-table,
  .user-predictions-table thead,
  .user-predictions-table tbody,
  .user-predictions-table tr,
  .user-predictions-table td,
  .match-predictions-table,
  .match-predictions-table thead,
  .match-predictions-table tbody,
  .match-predictions-table tr,
  .match-predictions-table td {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .user-predictions-table thead,
  .match-predictions-table thead {
    display: none !important;
  }

  .user-predictions-table tr,
  .match-predictions-table tr {
    margin-bottom: 10px !important;
    padding: 10px !important;
    border-radius: 16px !important;
    background: #f8fbff !important;
    border: 1px solid rgba(148, 163, 184, .18) !important;
  }

  .user-predictions-table td,
  .match-predictions-table td {
    display: grid !important;
    grid-template-columns: 92px minmax(0, 1fr) !important;
    gap: 10px !important;
    padding: 5px 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    text-align: left !important;
    white-space: normal !important;
  }

  .user-predictions-table td::before,
  .match-predictions-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 12px;
    font-weight: 850;
  }
}

/* Prediction details in leaderboard and admin match view */
.modal-user-predictions,
.modal-admin-predictions {
  max-width: min(940px, calc(100vw - 24px)) !important;
}

.user-predictions-card {
  display: grid;
  gap: 14px;
}

.user-predictions-head {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f3f7fc;
}

.user-predictions-head b {
  font-size: 18px;
  line-height: 1.2;
}

.user-predictions-head span {
  color: #64748b;
  font-size: 13px;
  font-weight: 750;
}

.user-predictions-table,
.match-predictions-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.user-predictions-table th,
.match-predictions-table th {
  padding: 0 10px 4px;
  color: #64748b;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

.user-predictions-table td,
.match-predictions-table td {
  padding: 10px;
  background: #f8fbff;
  color: #0f172a;
  font-size: 13px;
  vertical-align: middle;
  border-top: 1px solid rgba(148, 163, 184, .18);
  border-bottom: 1px solid rgba(148, 163, 184, .18);
}

.user-predictions-table td:first-child,
.match-predictions-table td:first-child {
  border-left: 1px solid rgba(148, 163, 184, .18);
  border-radius: 14px 0 0 14px;
}

.user-predictions-table td:last-child,
.match-predictions-table td:last-child {
  border-right: 1px solid rgba(148, 163, 184, .18);
  border-radius: 0 14px 14px 0;
}

.user-predictions-table td b,
.match-predictions-table td b {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.user-predictions-table td span,
.match-predictions-table td span {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.2;
}

.match-predictions-table th:not(:first-child),
.match-predictions-table td:not(:first-child) {
  text-align: center;
}

.match-predictions-table th:first-child,
.match-predictions-table td:first-child {
  min-width: 128px;
  max-width: 180px;
}

.match-card-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.match-card-actions .btn {
  min-height: 40px;
  padding: 0 12px;
}

@media (max-width: 700px) {
  .user-predictions-wrap,
  .match-predictions-wrap {
    overflow-x: hidden !important;
  }

  .user-predictions-table,
  .user-predictions-table thead,
  .user-predictions-table tbody,
  .user-predictions-table tr,
  .user-predictions-table td,
  .match-predictions-table,
  .match-predictions-table thead,
  .match-predictions-table tbody,
  .match-predictions-table tr,
  .match-predictions-table td {
    display: block;
    width: 100%;
  }

  .user-predictions-table thead,
  .match-predictions-table thead {
    display: none;
  }

  .user-predictions-table,
  .match-predictions-table {
    border-spacing: 0;
  }

  .user-predictions-table tr,
  .match-predictions-table tr {
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 16px;
    background: #f8fbff;
    border: 1px solid rgba(148, 163, 184, .18);
  }

  .user-predictions-table td,
  .match-predictions-table td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    padding: 5px 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent;
    text-align: left !important;
  }

  .user-predictions-table td::before,
  .match-predictions-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 12px;
    font-weight: 850;
  }

  .match-card-bottom {
    align-items: center;
    gap: 8px;
  }

  .match-card-actions {
    flex: 0 0 auto;
  }
}

/* User avatars */
.profile-link.has-avatar {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  max-width: 38px !important;
  padding: 0 !important;
  border-radius: 999px !important;
  overflow: hidden !important;
  background: rgba(255,255,255,.12) !important;
}

.profile-link.has-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-editor {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin: 0 0 18px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(241, 245, 249, .82);
}

.profile-avatar-preview {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #e5eaf2;
  color: #64748b;
  font-size: 26px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08);
}

.profile-avatar-preview.filled {
  background: #111827;
}

.profile-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-editor-body {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.avatar-editor-body b {
  font-size: 16px;
  line-height: 1.2;
}

.avatar-editor-body span {
  color: #64748b;
  font-size: 13px;
  line-height: 1.25;
}

.avatar-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.avatar-upload-label {
  position: relative;
  cursor: pointer;
}

.avatar-upload-label input {
  position: absolute;
  inset: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.modal-avatar-crop {
  width: min(420px, calc(100vw - 24px)) !important;
}

.avatar-cropper {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.avatar-crop-stage {
  width: min(280px, calc(100vw - 72px));
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  background: #0f172a;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 0 0 999px rgba(15, 23, 42, .04), inset 0 0 0 2px rgba(255, 255, 255, .96);
}

.avatar-crop-stage:active {
  cursor: grabbing;
}

.avatar-crop-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, .8);
}

.avatar-crop-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
  will-change: transform, object-position;
  user-select: none;
  -webkit-user-drag: none;
}

.avatar-crop-help {
  max-width: 300px;
  margin: 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}

.avatar-zoom-control {
  width: 100%;
  display: grid;
  gap: 8px;
  color: #64748b;
  font-size: 13px;
  font-weight: 850;
}

.avatar-zoom-control input {
  width: 100%;
  height: 34px;
  padding: 0;
  accent-color: #2563eb;
}

.avatar-crop-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 480px) {
  .profile-link.has-avatar {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    max-width: 34px !important;
  }

  .avatar-editor {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .profile-avatar-preview {
    width: 54px;
    height: 54px;
    font-size: 21px;
  }
}

/* Desktop web layout: isolated from the mobile rules above. */
@media (min-width: 901px) {
  html,
  body {
    min-height: 100%;
    background: #eef3f8;
  }

  .app {
    display: grid !important;
    grid-template-columns: 286px minmax(0, 1fr) !important;
    min-height: 100vh;
    background: #eef3f8;
  }

  .app-header {
    display: none !important;
  }

  .sidebar {
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    bottom: auto !important;
    grid-column: 1;
    width: auto !important;
    height: 100vh !important;
    min-height: 100vh !important;
    padding: 26px 20px !important;
    overflow-y: auto !important;
    background: #101827 !important;
    box-shadow: 12px 0 34px rgba(15, 23, 42, 0.12);
  }

  .content {
    grid-column: 2 !important;
    width: 100% !important;
    max-width: 1360px !important;
    margin: 0 auto !important;
    padding: 36px 48px 56px !important;
    background: transparent !important;
    overflow-x: hidden !important;
  }

  .brand {
    margin-bottom: 10px;
    gap: 14px !important;
  }

  .brand img,
  .brand span:first-child {
    width: 44px !important;
    height: 44px !important;
    border-radius: 14px !important;
  }

  .brand strong {
    font-size: 23px !important;
    line-height: 28px !important;
  }

  .nav {
    position: static !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
    background: transparent !important;
  }

  .nav button {
    width: 100% !important;
    min-height: 50px !important;
    height: 50px !important;
    justify-content: flex-start !important;
    gap: 13px !important;
    padding: 0 14px !important;
    border-radius: 15px !important;
    color: #cbd5e1 !important;
    text-align: left !important;
  }

  .nav button:hover,
  .nav button.active {
    color: #ffffff !important;
    background: rgba(59, 130, 246, 0.18) !important;
  }

  .nav .ui-icon,
  .nav svg,
  .nav button img {
    width: 22px !important;
    height: 22px !important;
    flex: 0 0 22px !important;
  }

  .nav button span {
    display: inline !important;
    min-width: 0;
    font-size: 15px !important;
    line-height: 20px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .account {
    margin-top: auto !important;
    padding-top: 20px;
    color: #e5e7eb;
  }

  .screen-stack {
    gap: 30px !important;
  }

  .screen-title,
  .topbar h2 {
    font-size: clamp(34px, 3.2vw, 48px) !important;
    line-height: 1.05 !important;
    letter-spacing: 0 !important;
  }

  .section-title,
  .screen-stack h2,
  .screen-stack h3 {
    letter-spacing: 0 !important;
  }

  .home-screen {
    align-items: start;
  }

  .home-screen .next-hero,
  .next-hero {
    min-height: 210px !important;
    padding: 26px !important;
  }

  .rank-summary,
  .profile-stats,
  .stats-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
    gap: 16px !important;
  }

  .award-strip {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
    gap: 16px !important;
  }

  .achievement-card {
    min-height: 150px !important;
    height: 150px !important;
  }

  .match-feed,
  .schedule-list,
  .cards-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)) !important;
    gap: 16px !important;
  }

  .match-card,
  .compact-match-card {
    min-height: 132px !important;
    height: auto !important;
  }

  .leaderboard,
  .leaderboard-list {
    display: grid;
    gap: 12px;
  }

  .table-wrap {
    max-width: 100%;
    overflow-x: auto;
  }

  .schedule-toolbar {
    display: grid !important;
    grid-template-columns: minmax(300px, 380px) minmax(260px, 1fr) !important;
    align-items: end !important;
    gap: 16px !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .schedule-toolbar .schedule-title-row {
    grid-column: 1 / -1;
  }

  .schedule-toolbar .actions.one-line {
    width: auto !important;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 10px !important;
  }

  .schedule-toolbar .actions.one-line .btn {
    width: auto !important;
    min-width: 0 !important;
  }

  .schedule-toolbar .compact-segmented,
  .schedule-toolbar .switch-row {
    width: max-content !important;
    max-width: 100%;
  }

  .grid.two,
  .grid.three,
  .settings-grid,
  .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  }

  .profile-screen {
    max-width: 1120px;
  }

  .modal {
    max-width: 760px !important;
  }

  .modal-predict {
    max-width: 580px !important;
  }
}

@media (min-width: 1280px) {
  .content {
    padding-left: 64px !important;
    padding-right: 64px !important;
  }
}

/* 20260714 v13: final compact match list and prediction bottom sheet */
.schedule-toolbar {
  display: grid !important;
  gap: 10px !important;
  padding: 14px !important;
  border-radius: 18px !important;
}

.schedule-title-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
}

.schedule-title-row b,
.match-card-top span,
.match-card-bottom span,
.quick-predict-row span,
.winner-poll {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.schedule-toolbar .actions.one-line {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 10px !important;
}

.schedule-toolbar .sync-icon-btn {
  width: 48px !important;
  min-width: 48px !important;
  padding-inline: 0 !important;
}

.schedule-toolbar .sync-icon-btn span {
  display: none !important;
}

.switch-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  font-weight: 800 !important;
}

.switch-row input {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 48px !important;
  height: 28px !important;
  border-radius: 999px !important;
  background: #dbe5f0 !important;
  position: relative !important;
  border: 0 !important;
  transition: background .18s ease !important;
}

.switch-row input::after {
  content: "" !important;
  position: absolute !important;
  top: 3px !important;
  left: 3px !important;
  width: 22px !important;
  height: 22px !important;
  border-radius: 999px !important;
  background: #fff !important;
  box-shadow: 0 2px 8px rgba(15,23,42,.22) !important;
  transition: transform .18s ease !important;
}

.switch-row input:checked {
  background: var(--blue, #2563eb) !important;
}

.switch-row input:checked::after {
  transform: translateX(20px) !important;
}

.match-card {
  border: 1px solid rgba(148, 163, 184, .22) !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .06) !important;
}

.match-card-top {
  grid-template-columns: minmax(0, 1fr) auto auto !important;
}

.match-card-bottom,
.quick-predict-row {
  grid-template-columns: minmax(0, 1fr) auto !important;
}

body.modal-open {
  overflow: hidden !important;
}

.modal-backdrop {
  background: rgba(15, 23, 42, .58) !important;
}

.modal-predict {
  max-width: 560px !important;
  overflow-y: auto !important;
}

.modal-predict .predict-penalty-row.is-hidden {
  display: none !important;
}

.modal-predict .modal-actions {
  display: flex !important;
  gap: 8px !important;
}

@media (max-width: 900px) {
  .modal-predict {
    align-self: flex-end !important;
    border-radius: 22px 22px 0 0 !important;
    margin-bottom: calc(64px + env(safe-area-inset-bottom)) !important;
    max-height: min(78svh, calc(100svh - 118px - env(safe-area-inset-bottom))) !important;
  }
}

/* Absolute last mobile override. Do not place rules after this block unless they
   are intentionally stronger mobile hotfixes. */
@media (max-width: 900px) {
  html,
  body,
  .app,
  .content {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .content {
    padding: 10px 12px calc(92px + env(safe-area-inset-bottom)) !important;
  }

  .app-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 9000 !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    margin: 0 -12px 8px !important;
    padding: 0 12px !important;
    display: flex !important;
    align-items: center !important;
    background: #101827 !important;
  }

  .mobile-brand img,
  .brand img {
    width: 28px !important;
    height: 28px !important;
  }

  .mobile-brand strong,
  .brand strong {
    font-size: 18px !important;
    line-height: 20px !important;
  }

  .profile-link {
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    padding: 0 10px !important;
    font-size: 13px !important;
    line-height: 30px !important;
  }

  .nav {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 10000 !important;
    height: calc(64px + env(safe-area-inset-bottom)) !important;
    max-height: calc(64px + env(safe-area-inset-bottom)) !important;
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom)) !important;
    background: #101827 !important;
    transform: translate3d(0, 0, 0) !important;
    -webkit-transform: translate3d(0, 0, 0) !important;
  }

  .nav-count-5 .nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 4px !important;
    overflow: hidden !important;
  }

  .nav button {
    height: 54px !important;
    min-height: 54px !important;
    padding: 4px 2px !important;
    border-radius: 18px !important;
  }

  .nav button span {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 11px !important;
    line-height: 13px !important;
  }
}

@media (max-width: 430px) {
  .modal-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9500 !important;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 8px 10px calc(72px + env(safe-area-inset-bottom)) !important;
    overflow: hidden !important;
  }

  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100svh - 94px - env(safe-area-inset-bottom)) !important;
    padding: 12px !important;
    border-radius: 20px 20px 0 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .modal-header {
    min-height: 36px !important;
    margin-bottom: 8px !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 38px 38px !important;
    gap: 8px !important;
    align-items: center !important;
  }

  .modal-header h3 {
    min-width: 0 !important;
    font-size: 19px !important;
    line-height: 22px !important;
    margin: 0 !important;
  }

  .modal-save,
  .modal-close {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    border-radius: 14px !important;
  }

  .modal-close {
    font-size: 24px !important;
  }

  .predict-form {
    gap: 8px !important;
  }

  .predict-match-summary {
    padding: 8px !important;
    border-radius: 14px !important;
  }

  .predict-meta {
    gap: 6px !important;
    font-size: 11px !important;
    line-height: 14px !important;
  }

  .predict-teams {
    grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) !important;
    gap: 6px !important;
  }

  .predict-teams img {
    width: 24px !important;
    height: 24px !important;
  }

  .predict-teams strong {
    min-width: 0 !important;
    font-size: 14px !important;
    line-height: 17px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .predict-score-row {
    grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  .predict-score-row .field label,
  .predict-form .prediction-grid .field label {
    min-height: 16px !important;
    height: 16px !important;
    display: block !important;
    font-size: 10px !important;
    line-height: 12px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .predict-score-row .score-field input {
    height: 46px !important;
    min-height: 46px !important;
    max-height: 46px !important;
    padding: 0 6px !important;
    border-radius: 14px !important;
    font-size: 22px !important;
    line-height: 24px !important;
  }

  .predict-score-row .score-separator {
    height: 46px !important;
    font-size: 20px !important;
  }

  .predict-form .prediction-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 8px !important;
    border-radius: 14px !important;
  }

  .predict-form .prediction-grid input,
  .predict-form .prediction-grid select {
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    padding: 0 8px !important;
    border-radius: 12px !important;
    font-size: 13px !important;
    line-height: 16px !important;
  }

  .predict-form .field-note {
    display: none !important;
  }
}

/* Mobile hotfix v2: this block intentionally stays last. It overrides older
   experimental mobile rules that made the header and prediction modal too tall. */
@media (max-width: 900px) {
  html,
  body,
  .app {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
  }

  .app {
    min-height: 100svh;
    padding: 0 !important;
  }

  .content {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px calc(90px + env(safe-area-inset-bottom)) !important;
    overflow-x: hidden !important;
  }

  .app-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 6000 !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    margin: 0 -12px 8px !important;
    padding: 0 12px !important;
    display: flex !important;
    align-items: center !important;
    background: #101827 !important;
    box-shadow: 0 1px 0 rgba(255,255,255,.06) !important;
  }

  .mobile-brand,
  .brand {
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .mobile-brand img,
  .brand img {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
  }

  .mobile-brand strong,
  .brand strong {
    font-size: 18px !important;
    line-height: 20px !important;
    white-space: nowrap !important;
  }

  .profile-link {
    min-height: 30px !important;
    height: 30px !important;
    max-height: 30px !important;
    padding: 0 10px !important;
    border-radius: 999px !important;
    font-size: 13px !important;
    line-height: 30px !important;
    white-space: nowrap !important;
  }

  .nav {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 10000 !important;
    height: calc(64px + env(safe-area-inset-bottom)) !important;
    min-height: calc(64px + env(safe-area-inset-bottom)) !important;
    max-height: calc(64px + env(safe-area-inset-bottom)) !important;
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom)) !important;
    background: #101827 !important;
    transform: translate3d(0,0,0) !important;
    -webkit-transform: translate3d(0,0,0) !important;
    will-change: transform;
  }

  .nav-count-5 .nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 4px !important;
    overflow: hidden !important;
  }

  .nav button {
    min-width: 0 !important;
    height: 54px !important;
    min-height: 54px !important;
    padding: 4px 2px !important;
    border-radius: 18px !important;
    gap: 2px !important;
  }

  .nav button span {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 11px !important;
    line-height: 13px !important;
  }

  .nav .ui-icon,
  .nav svg {
    width: 21px !important;
    height: 21px !important;
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: 30px !important;
    line-height: 34px !important;
    margin: 0 0 12px !important;
  }

  .modal-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9000 !important;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 8px 10px calc(72px + env(safe-area-inset-bottom)) !important;
    overflow: hidden !important;
  }

  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100svh - 94px - env(safe-area-inset-bottom)) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 12px !important;
    border-radius: 20px 20px 0 0 !important;
  }

  .modal-header {
    min-height: 36px !important;
    margin-bottom: 8px !important;
    display: grid !important;
    grid-template-columns: 1fr 38px 38px !important;
    gap: 8px !important;
    align-items: center !important;
  }

  .modal-header h3 {
    font-size: 19px !important;
    line-height: 22px !important;
    margin: 0 !important;
  }

  .modal-save,
  .modal-close {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    border-radius: 14px !important;
  }

  .modal-close {
    font-size: 24px !important;
  }

  .predict-form {
    gap: 8px !important;
  }

  .predict-match-summary {
    padding: 8px !important;
    border-radius: 14px !important;
  }

  .predict-meta {
    gap: 6px !important;
    font-size: 11px !important;
    line-height: 14px !important;
  }

  .predict-teams {
    grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) !important;
    gap: 6px !important;
  }

  .predict-teams img {
    width: 24px !important;
    height: 24px !important;
  }

  .predict-teams strong {
    min-width: 0 !important;
    font-size: 14px !important;
    line-height: 17px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .predict-score-row {
    grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  .predict-score-row .field label,
  .predict-form .prediction-grid .field label {
    min-height: 16px !important;
    height: 16px !important;
    font-size: 10px !important;
    line-height: 12px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .predict-score-row .score-field input {
    width: 100% !important;
    height: 46px !important;
    min-height: 46px !important;
    max-height: 46px !important;
    font-size: 22px !important;
    line-height: 24px !important;
    border-radius: 14px !important;
    padding: 0 6px !important;
  }

  .predict-score-row .score-separator {
    height: 46px !important;
    font-size: 20px !important;
  }

  .predict-form .prediction-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 8px !important;
    border-radius: 14px !important;
  }

  .predict-form .prediction-grid .field {
    min-width: 0 !important;
    gap: 3px !important;
  }

  .predict-form .prediction-grid input,
  .predict-form .prediction-grid select {
    width: 100% !important;
    min-width: 0 !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    border-radius: 12px !important;
    padding: 0 8px !important;
    font-size: 13px !important;
    line-height: 16px !important;
  }

  .predict-form .field-note {
    display: none !important;
  }

  .achievement-card {
    height: 128px !important;
    min-height: 128px !important;
    max-height: 128px !important;
    padding: 10px !important;
    border-radius: 18px !important;
  }

  .achievement-card h3,
  .achievement-card b {
    font-size: 14px !important;
    line-height: 17px !important;
  }

  .achievement-card p {
    font-size: 11px !important;
    line-height: 14px !important;
  }
}

/* Hard mobile fixes requested on 2026-07-13. Keep this block last. */
@media (max-width: 900px) {
  .app-header {
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    margin: -14px -14px 10px !important;
    padding: 0 12px !important;
    top: 0 !important;
  }

  .mobile-brand {
    gap: 8px !important;
  }

  .mobile-brand img,
  .brand img {
    width: 26px !important;
    height: 26px !important;
    border-radius: 8px !important;
  }

  .mobile-brand strong {
    font-size: 18px !important;
    line-height: 22px !important;
  }

  .profile-link {
    min-height: 30px !important;
    height: 30px !important;
    padding: 0 12px !important;
    border-radius: 999px !important;
    font-size: 14px !important;
    line-height: 30px !important;
  }

  .content {
    padding-top: 14px !important;
    padding-bottom: calc(92px + env(safe-area-inset-bottom)) !important;
  }

  .nav {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 8000 !important;
    height: calc(66px + env(safe-area-inset-bottom)) !important;
    max-height: calc(66px + env(safe-area-inset-bottom)) !important;
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom)) !important;
    transform: none !important;
    translate: none !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .nav button {
    height: 56px !important;
    min-height: 56px !important;
    padding: 4px 3px !important;
    border-radius: 16px !important;
  }

  .nav button .ui-icon {
    width: 22px !important;
    height: 22px !important;
  }

  .nav button span {
    font-size: 11px !important;
    line-height: 13px !important;
  }
}

@media (max-width: 430px) {
  .screen-title {
    font-size: 28px !important;
    line-height: 32px !important;
  }

  .modal-backdrop {
    align-items: end !important;
    padding: 8px 10px calc(82px + env(safe-area-inset-bottom)) !important;
    z-index: 7000 !important;
  }

  .modal {
    width: 100% !important;
    max-height: calc(100svh - 104px - env(safe-area-inset-bottom)) !important;
    padding: 12px !important;
    border-radius: 20px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .modal-header {
    min-height: 36px !important;
    margin-bottom: 8px !important;
  }

  .modal-header h3 {
    font-size: 20px !important;
    line-height: 24px !important;
  }

  .modal-close,
  .modal-save {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 12px !important;
  }

  .predict-form {
    gap: 8px !important;
  }

  .predict-match-summary {
    padding: 8px !important;
    border-radius: 14px !important;
  }

  .predict-meta {
    font-size: 10px !important;
    line-height: 12px !important;
  }

  .predict-teams {
    grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr) !important;
    gap: 6px !important;
    margin-top: 6px !important;
  }

  .predict-teams img {
    width: 24px !important;
    height: 24px !important;
  }

  .predict-teams strong {
    font-size: 13px !important;
    line-height: 16px !important;
  }

  .predict-score-row {
    grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  .predict-score-row .field label,
  .predict-form .prediction-grid .field label {
    min-height: 16px !important;
    margin-bottom: 3px !important;
    font-size: 10px !important;
    line-height: 12px !important;
    white-space: nowrap !important;
  }

  .predict-score-row .score-field input {
    height: 42px !important;
    min-height: 42px !important;
    font-size: 20px !important;
    border-radius: 12px !important;
  }

  .predict-score-row .score-separator {
    height: 42px !important;
    font-size: 20px !important;
  }

  .predict-form .prediction-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
    padding: 8px !important;
    border-radius: 14px !important;
  }

  .predict-form .prediction-grid input,
  .predict-form .prediction-grid select {
    min-height: 38px !important;
    height: 38px !important;
    padding: 0 8px !important;
    border-radius: 11px !important;
    font-size: 13px !important;
  }
}

.schedule-screen,
.schedule-list,
.match-feed,
.match-card,
.table-screen,
.home-screen,
.profile-screen {
  max-width: 100%;
  overflow-x: hidden;
}

.bracket-board {
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-padding-left: 0;
}

.bracket-round {
  min-width: 260px !important;
}

.bracket-card {
  min-height: 92px !important;
}

.schedule-toolbar {
  max-width: 100%;
}

.schedule-toolbar .actions.one-line {
  width: 100%;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.schedule-toolbar .actions.one-line .btn {
  width: 100%;
  min-width: 0;
}

/* Native mobile redesign layer */
:root {
  --accent: #1f6feb;
  --accent-soft: #e7f0ff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #eef3f8;
  --panel: #ffffff;
  --panel-soft: #f6f8fb;
  --success: #159a63;
  --warning: #d7a315;
  --danger: #dc2626;
  --shadow: 0 14px 36px rgba(15, 23, 42, .08);
}

body {
  background: var(--bg) !important;
  color: var(--ink);
  overflow-x: hidden;
}

.app {
  min-height: 100svh;
  background: var(--bg);
}

.content {
  background: transparent !important;
  padding: 20px 24px 96px !important;
  max-width: 1120px;
}

.screen-stack {
  display: grid;
  gap: 24px;
}

.screen-title {
  margin: 0;
  font-size: 28px;
  line-height: 34px;
  font-weight: 800;
  letter-spacing: 0;
}

.section-heading,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.section-heading h3,
.section-title h3 {
  margin: 0;
  font-size: 22px;
  line-height: 28px;
  font-weight: 800;
}

.surface-flat {
  padding: 0;
}

.section-shell,
.card,
.toolbar,
.rules-panel {
  border: 0 !important;
  box-shadow: none !important;
}

.card,
.section-shell {
  border-radius: 20px !important;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 60px;
  display: none;
  align-items: center;
  justify-content: space-between;
  margin: -20px -24px 20px;
  padding: 0 16px;
  background: rgba(15, 23, 42, .94);
  backdrop-filter: blur(18px);
  color: #fff;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mobile-brand img,
.brand img {
  width: 32px !important;
  height: 32px !important;
  border-radius: 10px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.icon-text,
.compact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.danger-link {
  border: 0;
  background: transparent;
  color: #fecaca;
  font-weight: 700;
}

.ui-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.btn {
  min-height: 48px;
  border-radius: 14px !important;
  border: 0 !important;
  box-shadow: none !important;
  font-weight: 800;
}

.btn.secondary {
  background: #e9eef5 !important;
  color: var(--ink) !important;
}

.btn.ghost,
.text-btn {
  background: transparent !important;
  color: var(--accent) !important;
}

.btn.danger,
.danger {
  background: var(--danger) !important;
  color: #fff !important;
}

.compact-btn {
  min-height: 38px !important;
  padding: 0 14px !important;
  border-radius: 12px !important;
  font-size: 14px !important;
}

.next-hero {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(135deg, #0f172a, #154aa8);
  box-shadow: var(--shadow);
}

.hero-meta,
.hero-footer,
.match-card-top,
.match-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.hero-meta span,
.hero-footer span {
  color: rgba(255,255,255,.78);
  font-size: 13px;
}

.hero-matchline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.hero-team {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hero-team.away {
  justify-content: flex-end;
  text-align: right;
}

.hero-team img,
.team-row img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.hero-team strong,
.team-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-score {
  font-size: 20px;
  font-weight: 900;
}

.rank-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.rank-summary div,
.metric,
.kpi-card {
  padding: 14px 16px !important;
  border: 0 !important;
  border-radius: 18px !important;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.rank-summary span,
.metric span,
.kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.rank-summary strong,
.metric b,
.kpi-card b {
  display: block;
  margin-top: 4px;
  font-size: 22px !important;
  line-height: 1.1;
  color: var(--ink);
}

.news-banner {
  min-height: 78px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 18px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
}

.news-banner em {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-style: normal;
  font-size: 14px;
}

.news-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
}

.modal-news-full {
  max-width: 560px;
}

.news-full-text {
  white-space: normal;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  word-break: break-word;
}

.match-feed {
  display: grid;
  gap: 12px;
}

.match-card {
  position: relative;
  display: grid;
  gap: 10px;
  min-height: 132px;
  padding: 14px 16px;
  border: 0;
  border-radius: 18px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.match-card-top {
  font-size: 12px;
  color: var(--muted);
}

.match-card-top span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-card-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.team-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
}

.team-row.away {
  justify-content: flex-end;
  text-align: right;
}

.card-score {
  text-align: center;
  font-size: 16px;
  font-weight: 900;
}

.match-card-bottom {
  min-height: 38px;
  color: var(--muted);
  font-size: 13px;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf2f7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.finished,
.status-pill.done,
.tag.done {
  background: #dff7ec;
  color: #087246;
}

.status-pill.live,
.tag.live {
  background: #fff4da;
  color: #8a5a00;
}

.winner-poll {
  justify-self: end;
  max-width: 100%;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.rules-panel.compact-rules {
  padding: 0 !important;
  background: transparent !important;
}

.rules-toggle {
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border: 0;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-weight: 800;
}

.compact-rules.open .rules-toggle .ui-icon {
  transform: rotate(90deg);
}

.rules-grid {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px !important;
  margin-top: 10px;
}

.rule-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}

.rule-chip b {
  color: var(--ink);
  font-size: 14px;
}

.toolbar.compact-toolbar,
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 !important;
  background: transparent !important;
}

.toolbar select,
.table-toolbar select,
.field input,
.field select,
.field textarea {
  min-height: 44px !important;
  border: 0 !important;
  border-radius: 14px !important;
  background: #f2f5f9 !important;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .18);
}

.leaderboard {
  display: grid;
  gap: 10px;
}

.leader-row {
  min-height: 76px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 18px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
}

.leader-row.is-me {
  box-shadow: inset 0 0 0 2px var(--accent), var(--shadow);
}

.leader-main {
  min-width: 0;
}

.leader-main b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-main em {
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-style: normal;
}

.leader-main span,
.legend {
  color: var(--muted);
  font-size: 12px;
}

.leader-score {
  text-align: right;
}

.leader-score b {
  font-size: 22px !important;
}

.rank-badge {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: #e8eef6;
  font-weight: 900;
}

.podium.gold .rank-badge { background: #e8b11c; color: #fff; }
.podium.silver .rank-badge { background: #94a3b8; color: #fff; }
.podium.bronze .rank-badge { background: #c87942; color: #fff; }
.podium.gold { background: #fff8d9; }
.podium.silver { background: #f1f5f9; }
.podium.bronze { background: #fff0e6; }

.bracket-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 300px);
  gap: 16px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  overscroll-behavior-x: contain;
}

.bracket-round {
  display: grid;
  align-content: start;
  gap: 12px;
}

.bracket-round h2 {
  margin: 0;
  font-size: 18px;
  line-height: 24px;
}

.bracket-cards {
  display: grid;
  gap: 10px;
}

.bracket-card {
  position: relative;
  display: grid;
  gap: 6px;
  min-height: 94px;
  padding: 12px;
  border: 0;
  border-radius: 16px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
}

.bracket-card::after {
  content: "";
  position: absolute;
  right: -16px;
  top: 50%;
  width: 16px;
  height: 1px;
  background: #cbd5e1;
}

.bracket-round:last-child .bracket-card::after {
  display: none;
}

.bracket-date {
  color: var(--muted);
  font-size: 11px;
}

.bracket-team {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  font-size: 13px;
}

.bracket-team em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
}

.bracket-team.winner {
  color: var(--success);
  font-weight: 900;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.award-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 150px;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.achievement-card {
  position: relative;
  min-height: 138px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.achievement-card img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.achievement-card b {
  color: var(--ink);
  font-size: 14px;
}

.achievement-card span {
  color: var(--muted);
  font-size: 12px;
}

.achievement-card strong {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

.achievement-card.locked {
  opacity: .78;
}

.empty-state {
  min-height: 112px !important;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px;
  border: 0 !important;
  border-radius: 18px;
  background: rgba(255,255,255,.68);
  color: var(--muted);
}

.empty-state .ui-icon,
.empty-state img {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.empty-state b {
  color: var(--ink);
}

.score-row {
  display: flex !important;
  align-items: end;
  justify-content: center;
  gap: 8px;
}

.score-field input {
  width: 64px !important;
  min-height: 48px !important;
  text-align: center;
  font-size: 20px !important;
  font-weight: 900;
}

.prediction-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 901px) {
  .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0;
    width: 272px !important;
    background: #0f172a !important;
    color: #fff;
  }

  .content {
    margin-left: 272px !important;
  }

  .nav button {
    color: #cbd5e1 !important;
  }

  .nav button.active {
    background: rgba(255,255,255,.12) !important;
    color: #fff !important;
  }
}

@media (max-width: 900px) {
  .app-header {
    display: flex;
  }

  .content {
    padding: 16px 16px calc(104px + env(safe-area-inset-bottom)) !important;
  }

  .sidebar {
    position: static !important;
    width: auto !important;
    padding: 0 !important;
    background: transparent !important;
  }

  .sidebar > .brand,
  .sidebar > .account {
    display: none !important;
  }

  .nav {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    height: calc(72px + env(safe-area-inset-bottom));
    display: grid !important;
    grid-auto-flow: column;
    grid-auto-columns: minmax(72px, 1fr);
    align-items: stretch;
    gap: 0 !important;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)) !important;
    overflow-x: auto;
    background: rgba(15, 23, 42, .96) !important;
    border-top: 1px solid rgba(255,255,255,.08);
    backdrop-filter: blur(18px);
  }

  .nav-count-5 .nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-columns: unset;
  }

  .nav button {
    min-width: 0 !important;
    min-height: 60px !important;
    display: grid !important;
    place-items: center;
    align-content: center;
    gap: 4px !important;
    border: 0 !important;
    border-radius: 16px !important;
    background: transparent !important;
    color: #94a3b8 !important;
    font-size: 11px !important;
  }

  .nav button.active {
    background: rgba(255,255,255,.12) !important;
    color: #60a5fa !important;
  }

  .nav .ui-icon {
    width: 20px;
    height: 20px;
  }

  .screen-stack {
    gap: 22px;
  }

  .screen-title {
    font-size: 26px;
    line-height: 32px;
  }

  .section-heading h3,
  .section-title h3 {
    font-size: 20px;
    line-height: 26px;
  }

  .rank-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-matchline,
  .match-card-main {
    grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  }

  .match-card {
    min-height: 122px;
    padding: 12px 14px;
  }

  .match-card-bottom {
    align-items: start;
  }

  .winner-poll {
    justify-self: stretch;
    text-align: right;
  }

  .leader-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    min-height: 72px;
    gap: 8px;
    padding: 10px 12px;
  }

  .leader-main span {
    font-size: 11px;
  }

  .leader-score b {
    font-size: 20px !important;
  }
}

@media (max-width: 430px) {
  .content {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .next-hero {
    padding: 16px;
  }

  .hero-team strong,
  .team-row span {
    font-size: 13px;
  }

  .match-card-top {
    grid-template-columns: 1fr auto;
    flex-wrap: wrap;
  }

  .match-card-top span:nth-child(2) {
    font-size: 11px;
  }

  .prediction-grid {
    grid-template-columns: 1fr;
  }

  .table-toolbar select {
    width: 100%;
  }
}

/* Profile layout and shared achievements */
.profile-screen {
  gap: 22px !important;
}

.profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(135deg, #0f172a, #1f6feb);
  box-shadow: var(--shadow);
}

.profile-hero h1 {
  margin: 0;
  font-size: 26px;
  line-height: 32px;
}

.profile-hero p,
.profile-hero span {
  display: block;
  margin: 3px 0 0;
  color: rgba(255,255,255,.76);
  font-size: 13px;
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.profile-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.profile-leagues {
  display: grid;
  gap: 10px;
}

.profile-league-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.profile-league-row b,
.profile-league-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-league-row span {
  color: var(--muted);
  font-size: 13px;
}

.profile-league-actions {
  margin-top: 12px;
}

.profile-edit-card {
  padding: 18px !important;
}

.achievement-champion.earned {
  background: #fff8d9 !important;
}

.achievement-silver.earned {
  background: #f1f5f9 !important;
}

.achievement-bronze.earned {
  background: #fff0e6 !important;
}

.achievement-bestRound.earned {
  background: #e7fff4 !important;
}

.achievement-champion.earned strong {
  background: #d9a222 !important;
}

.achievement-silver.earned strong {
  background: #94a3b8 !important;
}

.achievement-bronze.earned strong {
  background: #c87942 !important;
}

.achievement-bestRound.earned strong {
  background: #159a63 !important;
}

@media (max-width: 620px) {
  .profile-hero {
    align-items: flex-start;
    padding: 16px;
  }

  .profile-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-actions .btn {
    min-height: 36px !important;
  }

  .profile-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .profile-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .profile-hero h1 {
    font-size: 24px;
    line-height: 30px;
  }
}

@media (max-width: 900px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }

  .app {
    width: 100%;
    max-width: 100%;
    padding-bottom: calc(118px + env(safe-area-inset-bottom)) !important;
    overflow-x: hidden;
  }

  .content,
  .grid,
  .card,
  .match,
  section,
  .table-wrap,
  .match-meta,
  .news-strip,
  .home-actions {
    min-width: 0;
    max-width: 100%;
  }

  .nav {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999 !important;
    display: grid !important;
    grid-auto-flow: column !important;
    grid-auto-columns: 68px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom)) !important;
    background: #101827 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -10px 24px rgba(16, 24, 39, 0.22);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    transform: translateZ(0);
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav button {
    width: 68px !important;
    min-width: 68px !important;
    min-height: 54px !important;
    padding: 5px 4px !important;
    overflow: hidden;
    font-size: 10px !important;
    line-height: 1.12 !important;
  }

  .nav button span {
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
  }

  .table-wrap {
    width: 100%;
    overflow: hidden !important;
  }

  table {
    width: 100%;
    min-width: 0 !important;
    table-layout: fixed;
  }

  th,
  td {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
    overflow-wrap: normal;
  }

  .standings-table {
    font-size: 9px !important;
  }

  .standings-table th,
  .standings-table td {
    padding: 5px 2px !important;
    white-space: nowrap;
  }

  .standings-table th:nth-child(1),
  .standings-table td:nth-child(1) {
    width: 22px !important;
  }

  .standings-table th:nth-child(2),
  .standings-table td:nth-child(2) {
    width: 88px !important;
    text-align: left;
  }

  .standings-table th:nth-child(3),
  .standings-table td:nth-child(3),
  .standings-table th:nth-child(4),
  .standings-table td:nth-child(4),
  .standings-table th:nth-child(5),
  .standings-table td:nth-child(5),
  .standings-table th:nth-child(6),
  .standings-table td:nth-child(6),
  .standings-table th:nth-child(7),
  .standings-table td:nth-child(7),
  .standings-table th:nth-child(8),
  .standings-table td:nth-child(8) {
    width: calc((100% - 110px) / 6) !important;
    text-align: center;
  }

  .predictions-table {
    font-size: 10px !important;
  }

  .predictions-table th,
  .predictions-table td {
    padding: 5px 3px !important;
    vertical-align: top;
  }

  .predictions-table td:nth-child(3) {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: break-word;
  }

  .match-meta .muted,
  .render-percent,
  .muted {
    max-width: 100%;
    overflow-wrap: break-word;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
}

html,
body {
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
}

.login-visual {
  min-height: 100vh;
  padding: 46px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #fff;
  background:
    linear-gradient(rgba(6, 17, 38, 0.64), rgba(6, 17, 38, 0.52)),
    url("assets/football-bg.jpg") center/cover,
    url("https://images.unsplash.com/photo-1431324155629-1a6deb1dec8d?auto=format&fit=crop&w=1400&q=80") center/cover;
}

.hero-logo {
  width: 86px;
  height: 86px;
  object-fit: contain;
  margin-bottom: 22px;
}

.login-visual h1 {
  max-width: 640px;
  margin: 0 0 14px;
  font-size: clamp(40px, 6vw, 76px);
  line-height: 0.95;
}

.login-visual p {
  max-width: 520px;
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 18px;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-card {
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.auth-subtitle {
  margin: 0 0 18px;
  color: var(--muted);
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.segmented button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.segmented button.active {
  color: var(--ink);
  background: var(--panel);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.hint,
.muted {
  color: var(--muted);
}

.hint {
  margin: -4px 0 14px;
  font-size: 13px;
}

.notice {
  padding: 10px 12px;
  margin: 0 0 16px;
  border: 1px solid #efd68d;
  border-radius: 8px;
  background: #fff8dc;
  color: #684b00;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 278px minmax(0, 1fr);
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 278px;
  height: 100vh;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: #fff;
  background: #101827;
}

.content {
  grid-column: 2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 850;
}

.brand span:first-child,
.brand img {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  color: #101827;
  object-fit: contain;
}

.sidebar select {
  width: 100%;
  min-height: 40px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar option {
  color: var(--ink);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  text-align: left;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav button img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.nav button.active,
.nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.account {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.content {
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.topbar h2 {
  margin: 0 0 4px;
  font-size: clamp(21px, 3vw, 30px);
  line-height: 1.1;
}

.topbar p {
  margin: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 750;
  color: #fff;
  background: var(--blue);
}

.btn:hover {
  background: var(--blue-dark);
}

.btn.secondary {
  color: var(--ink);
  background: var(--panel-soft);
}

.btn.danger {
  background: var(--red);
}

.telegram-btn {
  background: #2aabee;
}

.telegram-btn:hover {
  background: #1d98dc;
}

.telegram-status {
  margin-top: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 14px;
  color: #536176;
  background: #f1f5f9;
}

.telegram-status span {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #2aabee;
  box-shadow: 0 0 0 4px rgba(42, 171, 238, 0.14);
}

.telegram-status p {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.3;
}

.telegram-status strong {
  display: block;
  color: #142033;
  font-size: 13px;
  line-height: 1.25;
}

.telegram-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.telegram-open-link {
  color: #1264d8;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.full-btn {
  width: 100%;
  margin-top: 10px;
}

.grid {
  display: grid;
  gap: 10px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card,
.match {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 2px 10px rgba(28, 40, 62, 0.04);
}

.card {
  padding: 11px;
}

.home-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.news-strip {
  min-height: 38px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #d7e4fb;
  border-radius: 8px;
  background: #eef5ff;
}

.news-strip b {
  flex: 0 0 auto;
}

.news-strip span {
  min-width: 0;
  color: var(--muted);
}

.home-actions p {
  margin: 3px 0 0;
}

.metric {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric.first {
  border-color: #e7bd3d;
  background: #fff7d7;
}

.metric.second {
  border-color: #b9c1cc;
  background: #f3f6fa;
}

.metric.third {
  border-color: #c99468;
  background: #fff0e4;
}

.metric b {
  display: block;
  margin-top: 3px;
  font-size: 18px;
}

.metric-small {
  font-size: 18px !important;
  line-height: 1.25;
}

.toolbar,
.system-line {
  min-height: 42px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.toolbar {
  justify-content: flex-start;
}

.toolbar label,
.system-line span {
  color: var(--muted);
  font-weight: 750;
}

.toolbar select {
  width: auto;
  min-width: 220px;
  min-height: 30px;
}

.settings-grid {
  display: grid;
  gap: 8px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title h3 {
  margin: 0;
  font-size: 16px;
}

.match {
  padding: 9px 10px;
  display: grid;
  gap: 8px;
}

.match-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.team {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-weight: 750;
  font-size: 13px;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.team.away {
  justify-content: flex-end;
  text-align: right;
}

.team span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logo {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  object-fit: contain;
  background: var(--panel-soft);
}

.score {
  text-align: center;
  font-size: 13px;
  font-weight: 850;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: var(--panel-soft);
}

.tag.live {
  color: #fff;
  background: var(--red);
}

.tag.done {
  color: #fff;
  background: var(--green);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.rules-panel {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 2px 10px rgba(28, 40, 62, 0.04);
}

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

.rule-cell {
  min-height: 56px;
  padding: 8px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
}

.rule-cell span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
}

.rule-cell b {
  font-size: 19px;
  line-height: 1;
}

.archived-section {
  opacity: 0.72;
}

.archived-match {
  background: #f4f6f9;
  color: #6b778a;
  filter: grayscale(0.35);
}

.archived-match .btn {
  opacity: 0.75;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  background: #f9fbfd;
}

tr:last-child td {
  border-bottom: 0;
}

.rank-1 td {
  background: #fff5c5;
}

.rank-2 td {
  background: #eef2f7;
}

.rank-3 td {
  background: #fff0e4;
}

.empty {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 14, 24, 0.55);
}

.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 16px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.prediction-grid {
  display: grid;
  grid-template-columns: 120px 120px minmax(180px, 1fr) 140px;
  gap: 10px;
  align-items: start;
}

.score-row {
  display: flex;
  align-items: end;
  gap: 8px;
  margin: 12px 0 10px;
}

.result-line {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.score-field {
  width: 92px;
  margin-bottom: 0;
}

.score-field label {
  display: block;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-field input {
  width: 58px;
  min-height: 34px;
  padding: 4px 6px;
  text-align: center;
  font-weight: 800;
}

.score-separator {
  height: 34px;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.stat-list {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.stat-list div {
  min-height: 32px;
  padding: 6px 9px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.stat-list div:last-child {
  border-bottom: 0;
}

.stat-list span {
  color: var(--muted);
  font-weight: 700;
}

.stat-list b {
  font-size: 13px;
}

.compact-empty {
  padding: 12px;
}

.compact-form {
  gap: 8px 12px;
}

.full {
  grid-column: 1 / -1;
}

.check-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
}

.check-row input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.award-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.award {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.team-card {
  min-height: 70px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 2px 10px rgba(28, 40, 62, 0.04);
}

.team-card img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.team-card span {
  font-weight: 800;
  text-align: left;
}

.award b {
  display: block;
}

.member-list {
  display: grid;
  gap: 8px;
}

.member-row {
  min-height: 48px;
  padding: 8px 10px;
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.award-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.award-tile {
  min-height: 48px;
  padding: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.award-tile span {
  min-width: 0;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.award-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.award-icons img,
.award-tile .empty-award-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.muted-award {
  opacity: 0.46;
}

.member-row span {
  font-weight: 800;
}

.member-row small {
  color: var(--muted);
}

@media (max-width: 980px) {
  .login-page,
  .app,
  .grid.two,
  .grid.three,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 360px;
  }

  .sidebar {
    position: static;
    width: auto;
    height: auto;
  }

  .rules-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    background: #eef3f8;
  }

  .login-page {
    display: block;
    min-height: 100vh;
  }

  .login-visual {
    min-height: 260px;
    padding: 24px 20px;
  }

  .hero-logo {
    width: 62px;
    height: 62px;
    margin-bottom: 16px;
  }

  .login-visual h1 {
    font-size: 42px;
  }

  .login-visual p {
    font-size: 15px;
  }

  .login-panel {
    display: block;
    padding: 16px;
  }

  .auth-card {
    width: 100%;
    padding: 18px;
  }

  .segmented {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .app {
    display: block;
    padding-bottom: 86px;
  }

  .sidebar {
    position: static;
    width: auto;
    height: auto;
    padding: 14px;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .brand {
    font-size: 18px;
  }

  .sidebar > div:nth-child(2) {
    display: grid;
    gap: 6px;
  }

  .nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(76px, 1fr);
    gap: 0;
    overflow-x: auto;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: #101827;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .nav button {
    min-height: 58px;
    padding: 6px 6px;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    font-size: 10.5px;
    line-height: 1.15;
    text-align: center;
  }

  .nav button span {
    min-height: 24px;
    display: grid;
    place-items: start center;
  }

  .nav button img {
    width: 20px;
    height: 20px;
  }

  .account {
    margin-top: 0;
    grid-template-columns: 1fr auto auto;
    align-items: center;
  }

  .account .btn {
    min-height: 36px;
    padding: 0 10px;
    font-size: 13px;
  }

  .content {
    padding: 12px;
  }

  .topbar {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
  }

  .topbar h2 {
    font-size: 22px;
  }

  .home-actions {
    display: grid;
    gap: 10px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .btn {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    font-size: 14px;
  }

  .grid {
    gap: 9px;
  }

  .card,
  .match,
  .metric,
  .team-card {
    border-radius: 8px;
  }

  .metric {
    padding: 9px;
  }

  .metric b {
    font-size: 16px;
  }

  .toolbar {
    display: grid;
    gap: 6px;
  }

  .toolbar select {
    width: 100%;
    min-width: 0;
  }

  .prediction-grid {
    grid-template-columns: 1fr 1fr;
  }

  .score-row {
    justify-content: flex-start;
  }

  .score-field {
    width: 86px;
  }

  .award-strip {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .award-tile {
    min-height: 52px;
  }

  .match {
    padding: 10px;
  }

  .match-meta {
    display: grid;
    gap: 8px;
  }

  .match-meta .tag {
    width: fit-content;
  }

  .teams {
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
  }

  .team.away {
    justify-content: flex-end;
    text-align: right;
  }

  .team span {
    white-space: nowrap;
  }

  .score {
    text-align: center;
    min-height: auto;
    display: block;
    padding-left: 0;
  }

  .rules-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .rule-cell {
    min-height: 48px;
    padding: 7px;
  }

  .table-wrap {
    overflow-x: hidden;
    border: 1px solid var(--line);
    background: var(--panel);
  }

  table {
    min-width: 0;
    table-layout: fixed;
    font-size: 12px;
  }

  th,
  td {
    padding: 6px 5px;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
  }

  .predictions-table th:nth-child(1),
  .predictions-table td:nth-child(1) {
    width: 28px;
  }

  .predictions-table th:nth-child(2),
  .predictions-table td:nth-child(2) {
    width: 74px;
  }

  .predictions-table th:nth-child(3),
  .predictions-table td:nth-child(3) {
    width: auto;
  }

  .standings-table {
    font-size: 9.5px;
  }

  .standings-table th,
  .standings-table td {
    padding: 5px 3px;
  }

  .standings-table th:nth-child(1),
  .standings-table td:nth-child(1) {
    width: 24px;
  }

  .standings-table th:nth-child(2),
  .standings-table td:nth-child(2) {
    width: 70px;
  }

  .standings-table th:nth-child(3),
  .standings-table td:nth-child(3) {
    width: 30px;
  }

  th,
  td {
    padding: 7px 8px;
  }

  td:last-child {
    border-bottom: 0;
  }

  .rank-1,
  .rank-1 td {
    background: #fff5c5;
  }

  .rank-2,
  .rank-2 td {
    background: #eef2f7;
  }

  .rank-3,
  .rank-3 td {
    background: #fff0e4;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 8px 8px 0 0;
    padding: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .full {
    grid-column: auto;
  }

  .section-title {
    align-items: flex-start;
  }

  .section-title h3 {
    font-size: 17px;
  }
}

@media (max-width: 480px) and (orientation: portrait) {
  body {
    font-size: 12px;
  }

  .login-page {
    min-height: 100svh;
    background: var(--page);
  }

  .login-visual {
    min-height: auto;
    padding: 14px 14px 12px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    background: #101827;
  }

  .hero-logo {
    width: 42px;
    height: 42px;
    margin: 0;
  }

  .login-visual h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1;
  }

  .login-visual p {
    display: none;
  }

  .login-panel {
    padding: 10px;
  }

  .auth-card {
    padding: 12px;
    border-radius: 8px;
    box-shadow: none;
  }

  .auth-card h2 {
    font-size: 18px;
  }

  .auth-subtitle {
    margin-bottom: 12px;
    font-size: 12px;
    line-height: 1.35;
  }

  .segmented {
    margin-bottom: 14px;
  }

  .segmented button {
    min-height: 32px;
    padding: 0 8px;
  }

  .field {
    gap: 4px;
    margin-bottom: 9px;
  }

  .field label {
    font-size: 12px;
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 34px;
    padding: 6px 9px;
    border-radius: 7px;
    font-size: 13px;
  }

  .notice {
    padding: 8px 9px;
    margin-bottom: 10px;
    font-size: 12px;
  }

  .btn {
    min-height: 34px;
    font-size: 13px;
  }

  .full-btn {
    margin-top: 8px;
  }

  .telegram-status {
    padding: 8px;
  }

  .app {
    padding-bottom: 74px;
  }

  .sidebar {
    padding: 12px;
    gap: 10px;
  }

  .brand {
    font-size: 18px;
  }

  .brand span:first-child,
  .brand img {
    width: 34px;
    height: 34px;
  }

  .sidebar select {
    min-height: 36px;
  }

  .account {
    gap: 8px;
  }

  .account .btn {
    min-height: 32px;
    font-size: 12px;
  }

  .content {
    padding: 10px;
  }

  .topbar {
    gap: 8px;
    margin-bottom: 10px;
  }

  .topbar h2 {
    font-size: 20px;
  }

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

  .card,
  .match,
  .home-actions,
  .metric {
    padding: 8px;
  }

  .nav {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 68px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav button {
    width: 68px;
    min-height: 54px;
    padding: 5px 4px;
    font-size: 10px;
    overflow: hidden;
  }

  .nav button img {
    width: 18px;
    height: 18px;
  }

  .nav button span {
    min-height: 22px;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .rules-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rule-cell {
    min-height: 42px;
  }

  .score-field {
    width: 64px;
  }

  .score-field input {
    min-height: 34px;
  }

  .result-line {
    display: grid;
    grid-template-columns: 64px 12px 64px minmax(0, 1fr);
    align-items: end;
  }

  .result-line .score-separator {
    padding-bottom: 9px;
  }

  .table-wrap {
    overflow-x: hidden;
    border: 1px solid var(--line);
    background: var(--panel);
  }

  .table-wrap table {
    min-width: 0;
    table-layout: fixed;
  }
}

@media (max-width: 900px) {
  body {
    padding-bottom: calc(112px + env(safe-area-inset-bottom)) !important;
  }

  .app {
    padding-bottom: calc(118px + env(safe-area-inset-bottom)) !important;
    overflow-x: hidden !important;
  }

  .nav {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999 !important;
    grid-auto-columns: 68px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    background: #101827 !important;
    box-shadow: 0 -10px 24px rgba(16, 24, 39, 0.22);
    transform: translateZ(0);
  }

  .table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .standings-table {
    width: 100% !important;
    table-layout: fixed !important;
    font-size: 9px !important;
  }

  .standings-table th,
  .standings-table td {
    padding: 5px 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .standings-table th:nth-child(1),
  .standings-table td:nth-child(1) {
    width: 22px !important;
  }

  .standings-table th:nth-child(2),
  .standings-table td:nth-child(2) {
    width: 88px !important;
    text-align: left !important;
  }

  .standings-table th:nth-child(n+3),
  .standings-table td:nth-child(n+3) {
    width: calc((100% - 110px) / 6) !important;
    text-align: center !important;
  }

  .predictions-table td:nth-child(3) {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: break-word !important;
  }
}

@media (max-width: 900px) {
  .sidebar {
    min-height: 84px !important;
    padding: 10px 12px !important;
    display: grid !important;
    grid-template-columns: 1fr auto auto !important;
    grid-template-areas:
      "brand profile logout"
      "account profile logout" !important;
    align-items: center !important;
    gap: 4px 8px !important;
  }

  .brand {
    grid-area: brand !important;
    font-size: 18px !important;
    line-height: 1 !important;
  }

  .brand span:first-child,
  .brand img {
    width: 34px !important;
    height: 34px !important;
  }

  .account {
    grid-area: account !important;
    margin: 0 !important;
    display: contents !important;
  }

  .account div {
    grid-area: account !important;
    min-width: 0 !important;
    line-height: 1.1 !important;
  }

  .account .btn {
    min-height: 34px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
  }

  .account .btn.secondary {
    grid-area: profile !important;
  }

  .account .btn.danger {
    grid-area: logout !important;
  }

  .content {
    padding-top: 12px !important;
  }

  .topbar {
    margin-bottom: 10px !important;
  }

  .topbar p {
    display: none !important;
  }
}

/* Modern UI refresh: visual layer only */
:root {
  --page: #f4f6fb;
  --panel: #ffffff;
  --panel-soft: #f2f5f9;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e6eaf0;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #059669;
  --red: #dc2626;
  --gold: #d6a11f;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.06);
  --radius: 16px;
  --radius-sm: 12px;
}

body {
  font-size: 14px;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 12% -10%, rgba(37, 99, 235, 0.08), transparent 30%),
    var(--page);
}

.content {
  padding: 24px;
}

.grid {
  gap: 24px;
}

.grid.two,
.grid.three {
  gap: 24px;
}

.topbar {
  margin-bottom: 24px;
}

.topbar h2 {
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 850;
  letter-spacing: 0;
}

.sidebar {
  background: #101827;
  box-shadow: 10px 0 30px rgba(15, 23, 42, 0.08);
}

.brand {
  gap: 12px;
}

.brand img,
.brand span:first-child {
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(255, 255, 255, 0.12);
}

.nav {
  gap: 8px;
}

.nav button {
  min-height: 46px;
  border-radius: 14px;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav button:hover,
.nav button.active {
  background: rgba(255, 255, 255, 0.12);
}

.nav button.active {
  color: #fff;
}

.account {
  gap: 12px;
}

.card,
.match,
.rules-panel,
.toolbar,
.system-line,
.home-actions,
.news-strip,
.metric,
.auth-card,
.modal,
.empty,
.table-wrap,
.award-tile,
.team-card,
.member-row {
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.card,
.rules-panel,
.match,
.metric {
  padding: 18px;
}

.section-title {
  margin-bottom: 14px;
}

.section-title h3,
.card h3,
.rules-panel h3 {
  font-size: 19px;
  font-weight: 850;
}

.muted,
.field-note,
.hint {
  color: var(--muted);
}

.field {
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  font-size: 12px;
  letter-spacing: 0;
  color: #667085;
}

.field input,
.field select,
.field textarea,
.toolbar select,
.sidebar select {
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid #d8dee8;
  border-radius: 14px;
  outline: none;
  background: #f9fbff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.toolbar select:focus,
.sidebar select:focus {
  border-color: rgba(37, 99, 235, 0.65);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.btn {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 800;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.22);
}

.btn.secondary {
  color: #1f2937;
  background: #eef2f7;
  box-shadow: none;
}

.btn.ghost,
.toolbar .btn.secondary {
  color: var(--blue);
  background: transparent;
  box-shadow: none;
}

.btn.danger {
  background: var(--red);
  box-shadow: 0 8px 18px rgba(220, 38, 38, 0.16);
}

.btn[data-action]::before,
.btn[data-view]::before {
  content: "";
  width: 16px;
  height: 16px;
  display: inline-block;
  margin-right: 7px;
  vertical-align: -3px;
  background: currentColor;
  -webkit-mask: var(--button-icon) center / contain no-repeat;
  mask: var(--button-icon) center / contain no-repeat;
}

.btn[data-action="logout"] { --button-icon: url("assets/icon-action-logout.svg"); }
.btn[data-action="newLeague"] { --button-icon: url("assets/icon-action-add.svg"); }
.btn[data-action="members"] { --button-icon: url("assets/icon-action-members.svg"); }
.btn[data-action="sync"] { --button-icon: url("assets/icon-action-sync.svg"); }
.btn[data-action="newMatch"] { --button-icon: url("assets/icon-action-add.svg"); }
.btn[data-action="editMatch"] { --button-icon: url("assets/icon-action-edit.svg"); }
.btn[data-action="adminPredictions"] { --button-icon: url("assets/icon-action-list.svg"); }
.btn[data-action="deleteMatch"] { --button-icon: url("assets/icon-action-hide.svg"); }
.btn[data-action="createInvite"] { --button-icon: url("assets/icon-action-invite.svg"); }
.btn[data-action="archiveSeason"] { --button-icon: url("assets/icon-action-archive.svg"); }
.btn[data-action="close"] { --button-icon: url("assets/icon-action-close.svg"); }
.btn[data-action="restoreMatches"] { --button-icon: url("assets/icon-action-restore.svg"); }
.btn[data-action="recalculateAwards"] { --button-icon: url("assets/icon-action-award.svg"); }
.btn[data-view="profile"] { --button-icon: url("assets/icon-profile.svg"); }
.btn[data-view="automation"] { --button-icon: url("assets/icon-settings.png"); }

.table-wrap {
  overflow: auto;
  background: #fff;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px 14px;
  background: rgba(249, 250, 252, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

td {
  min-height: 48px;
  padding: 13px 14px;
  border-bottom: 1px solid #edf1f6;
}

tr:last-child td {
  border-bottom: 0;
}

.rank-1 td {
  background: #fff8d8;
}

.rank-2 td {
  background: #f2f5f9;
}

.rank-3 td {
  background: #fff2e8;
}

.award-strip {
  gap: 16px;
}

.award-tile {
  min-height: 76px;
  padding: 16px;
}

.award-tile span {
  font-size: 13px;
}

.metric b,
.kpi-card b {
  font-size: 24px;
  font-weight: 900;
}

.kpi-grid,
.stat-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card,
.stat-list > div {
  min-height: 86px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.kpi-card span,
.stat-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.rules-grid {
  gap: 12px;
}

.rule-cell {
  border: 0;
  border-radius: 14px;
  background: #f7f9fc;
}

.match {
  gap: 14px;
}

.match-meta {
  font-size: 12px;
}

.logo {
  border: 0;
  box-shadow: inset 0 0 0 1px #e6eaf0;
}

.tag {
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef2f7;
}

.modal-backdrop {
  backdrop-filter: blur(8px);
}

.modal {
  padding: 24px;
}

.notice {
  border: 0;
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
}

@media (max-width: 900px) {
  .content {
    padding: 18px 14px calc(128px + env(safe-area-inset-bottom)) !important;
  }

  .grid,
  .grid.two,
  .grid.three {
    gap: 20px;
  }

  .card,
  .rules-panel,
  .match,
  .metric {
    padding: 16px !important;
  }

  .sidebar {
    min-height: 72px !important;
  }

  .account div {
    font-size: 13px;
  }

  .account .btn {
    min-height: 36px !important;
  }

  .nav {
    border-radius: 18px 18px 0 0;
  }

  .topbar h2 {
    font-size: 28px !important;
  }

  .award-strip,
  .kpi-grid,
  .stat-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .rules-grid {
    gap: 10px;
  }

  th {
    padding: 9px 8px !important;
  }

  td {
    padding: 11px 8px !important;
  }
}

@media (max-width: 480px) and (orientation: portrait) {
  .content {
    padding: 14px 12px calc(122px + env(safe-area-inset-bottom)) !important;
  }

  .topbar h2 {
    font-size: 26px !important;
  }

  .card,
  .rules-panel,
  .match {
    border-radius: 16px;
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 42px;
  }

  .btn {
    min-height: 40px;
  }
}

/* Compact mobile header */
@media (max-width: 900px) {
  .sidebar {
    position: sticky !important;
    top: 0 !important;
    z-index: 120 !important;
    min-height: 56px !important;
    padding: max(6px, env(safe-area-inset-top)) 12px 6px !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    grid-template-areas: "brand account logout" !important;
    align-items: center !important;
    gap: 8px !important;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.94)) !important;
  }

  .brand {
    grid-area: brand !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 17px !important;
    line-height: 1 !important;
  }

  .brand img,
  .brand span:first-child {
    width: 30px !important;
    height: 30px !important;
    flex: 0 0 30px !important;
  }

  .brand strong {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .account {
    grid-area: account !important;
    display: contents !important;
    margin: 0 !important;
  }

  .account div {
    grid-area: account !important;
    justify-self: end !important;
    min-width: 0 !important;
    max-width: 34vw !important;
    color: #fff !important;
    font-size: 13px !important;
    line-height: 1 !important;
    overflow: hidden !important;
    text-align: right !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .account .btn.danger {
    grid-area: logout !important;
    min-height: 32px !important;
    padding: 0 12px !important;
    border-radius: 12px !important;
    font-size: 12px !important;
  }

  .account .btn.secondary {
    display: none !important;
  }

  .content {
    padding-top: 12px !important;
  }
}

@media (max-width: 480px) and (orientation: portrait) {
  .sidebar {
    min-height: 52px !important;
    padding: max(5px, env(safe-area-inset-top)) 10px 5px !important;
  }

  .brand {
    font-size: 16px !important;
  }

  .brand img,
  .brand span:first-child {
    width: 28px !important;
    height: 28px !important;
    flex-basis: 28px !important;
  }

  .account div {
    max-width: 30vw !important;
    font-size: 12px !important;
  }

  .account .btn.danger {
    min-height: 30px !important;
    padding: 0 10px !important;
  }
}

/* Premium sports app redesign layer */
:root {
  --app-bg: #eef3f8;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --surface-muted: #f6f8fb;
  --text: #111827;
  --text-soft: #667085;
  --hairline: rgba(17, 24, 39, 0.08);
  --accent: #1f6feb;
  --accent-2: #00a884;
  --accent-soft: rgba(31, 111, 235, 0.1);
  --success: #079455;
  --warning: #dc9b16;
  --danger: #d92d20;
  --info: #1570ef;
  --gold-soft: #fff2bf;
  --silver-soft: #eef2f6;
  --bronze-soft: #fae7d6;
  --premium-shadow: 0 18px 45px rgba(16, 24, 40, 0.10);
  --soft-shadow: 0 8px 24px rgba(16, 24, 40, 0.07);
  --hair-shadow: 0 1px 0 rgba(17, 24, 39, 0.05);
}

body {
  background:
    radial-gradient(circle at 15% -8%, rgba(31, 111, 235, 0.14), transparent 28%),
    linear-gradient(180deg, #f7faff 0%, var(--app-bg) 42%, #edf3f7 100%) !important;
  color: var(--text) !important;
  font-size: 14px !important;
}

.content {
  max-width: 1180px;
  width: 100%;
  padding: 22px 24px 120px !important;
}

.screen-stack,
.grid {
  display: grid;
  gap: 18px !important;
}

.topbar {
  margin: 0 0 16px !important;
}

.topbar h2 {
  margin: 0 !important;
  font-size: clamp(24px, 3vw, 34px) !important;
  line-height: 1.05 !important;
  letter-spacing: 0 !important;
}

.section-shell,
.card,
.rules-panel,
.toolbar,
.match,
.metric {
  border: 0 !important;
  border-radius: 22px !important;
  background: var(--surface) !important;
  box-shadow: var(--soft-shadow), var(--hair-shadow) !important;
}

.section-shell,
.card,
.rules-panel,
.toolbar {
  padding: 18px !important;
}

.section-title {
  gap: 12px !important;
  margin: 0 0 14px !important;
  align-items: center !important;
}

.section-title h3 {
  margin: 0 !important;
  font-size: 18px !important;
  line-height: 1.15 !important;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.home-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  min-height: 184px;
  padding: 22px;
  border-radius: 28px;
  color: #fff;
  background:
    radial-gradient(circle at 82% 12%, rgba(0, 168, 132, 0.55), transparent 28%),
    linear-gradient(135deg, rgba(9, 16, 31, 0.96), rgba(17, 44, 86, 0.94)),
    url("assets/football-bg.jpg") center/cover;
  box-shadow: var(--premium-shadow);
}

.home-hero::after {
  content: "";
  position: absolute;
  inset: auto -40px -90px auto;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
}

.home-hero h3 {
  position: relative;
  z-index: 1;
  margin: 0 0 8px;
  max-width: 720px;
  font-size: clamp(24px, 4.5vw, 42px);
  line-height: 1.02;
  letter-spacing: 0;
}

.home-hero p {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 620px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 14px;
}

.hero-action {
  position: relative;
  z-index: 1;
  background: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18) !important;
}

.premium-strip,
.news-strip {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 14px 16px !important;
  border-radius: 18px !important;
  background: linear-gradient(135deg, rgba(31, 111, 235, 0.10), rgba(0, 168, 132, 0.08)) !important;
  box-shadow: none !important;
}

.match-feed {
  display: grid;
  gap: 12px;
}

.match {
  padding: 14px !important;
}

.match-meta {
  align-items: center !important;
  gap: 10px !important;
  margin-bottom: 12px;
  font-size: 11px !important;
}

.match-meta .muted {
  color: var(--text-soft) !important;
  font-size: 11px !important;
}

.tag {
  min-height: 24px;
  padding: 5px 9px !important;
  border-radius: 999px !important;
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  white-space: nowrap;
}

.tag.live {
  background: rgba(220, 155, 22, 0.14) !important;
  color: var(--warning) !important;
}

.tag.done {
  background: rgba(7, 148, 85, 0.12) !important;
  color: var(--success) !important;
}

.teams {
  align-items: center !important;
  gap: 10px !important;
}

.team {
  min-width: 0 !important;
  gap: 10px !important;
  color: var(--text) !important;
  font-size: 15px !important;
  font-weight: 800 !important;
}

.team span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logo {
  width: 30px !important;
  height: 30px !important;
  padding: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.10);
}

.score {
  min-width: 56px;
  padding: 8px 10px;
  border-radius: 14px;
  background: #111827;
  color: #fff;
  font-size: 16px !important;
  font-weight: 900 !important;
  text-align: center;
}

.award-strip {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 10px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.award-tile {
  min-height: 86px;
  padding: 14px !important;
  border-radius: 20px !important;
  background: var(--surface-muted) !important;
  box-shadow: none !important;
}

.award-tile span {
  color: var(--text-soft);
  font-size: 12px !important;
  font-weight: 800;
}

.award-icons img {
  width: 28px !important;
  height: 28px !important;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 22px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(31, 111, 235, 0.06), rgba(0, 168, 132, 0.04)),
    var(--surface-muted);
}

.empty-state img {
  width: 34px;
  height: 34px;
  opacity: 0.72;
}

.empty-state b {
  font-size: 16px;
}

.empty-state span {
  max-width: 520px;
  color: var(--text-soft);
  line-height: 1.45;
}

.leaderboard {
  display: grid;
  gap: 10px;
}

.leader-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 12px;
  border-radius: 20px;
  background: var(--surface-strong);
  box-shadow: var(--hair-shadow);
}

.leader-row.podium.gold {
  background: linear-gradient(135deg, var(--gold-soft), #fffdf3);
}

.leader-row.podium.silver {
  background: linear-gradient(135deg, var(--silver-soft), #ffffff);
}

.leader-row.podium.bronze {
  background: linear-gradient(135deg, var(--bronze-soft), #ffffff);
}

.rank-badge {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: #111827;
  color: #fff;
  font-weight: 900;
}

.gold .rank-badge {
  background: #d6a11f;
}

.silver .rank-badge {
  background: #8b96a5;
}

.bronze .rank-badge {
  background: #c2743f;
}

.leader-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.leader-main b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.leader-main span,
.leader-score span {
  color: var(--text-soft);
  font-size: 11px;
}

.leader-score {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 52px;
}

.leader-score b {
  font-size: 22px;
  line-height: 1;
}

.rules-grid,
.kpi-grid,
.stat-list {
  gap: 10px !important;
}

.rule-cell,
.kpi-card,
.metric {
  border: 0 !important;
  border-radius: 18px !important;
  background: var(--surface-muted) !important;
  box-shadow: none !important;
}

.kpi-card b,
.metric b,
.rule-cell b {
  font-size: 26px !important;
  line-height: 1 !important;
}

.btn {
  border-radius: 16px !important;
  background: var(--accent) !important;
  color: #fff !important;
  box-shadow: 0 10px 22px rgba(31, 111, 235, 0.22) !important;
}

.btn.secondary {
  background: #e9eef5 !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

.btn.ghost,
.text-btn {
  background: transparent !important;
  color: var(--accent) !important;
  box-shadow: none !important;
}

.btn.danger {
  background: var(--danger) !important;
  color: #fff !important;
  box-shadow: 0 10px 22px rgba(217, 45, 32, 0.18) !important;
}

.text-btn {
  min-height: 32px;
  padding: 0 4px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  border: 0 !important;
  border-radius: 16px !important;
  background: #f3f6fa !important;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.06) !important;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none !important;
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px rgba(31, 111, 235, 0.12) !important;
}

.sync-log {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
  background: var(--surface-muted);
}

.sync-log > b {
  font-size: 13px;
}

.sync-row {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
}

.sync-row span {
  font-weight: 850;
}

.sync-row small {
  color: var(--text-soft);
  line-height: 1.35;
}

.sync-row.bad {
  background: rgba(217, 45, 32, 0.08);
}

.sync-row.ok {
  background: rgba(7, 148, 85, 0.08);
}

@media (max-width: 900px) {
  .content {
    padding: 14px 12px calc(120px + env(safe-area-inset-bottom)) !important;
  }

  .topbar h2 {
    font-size: 24px !important;
  }

  .home-hero {
    min-height: 156px;
    grid-template-columns: 1fr;
    padding: 18px;
    border-radius: 24px;
  }

  .home-hero h3 {
    font-size: 25px;
  }

  .hero-action {
    width: fit-content;
  }

  .section-shell,
  .card,
  .rules-panel,
  .toolbar {
    padding: 14px !important;
    border-radius: 20px !important;
  }

  .award-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .leader-row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 9px;
    min-height: 62px;
    padding: 10px;
  }

  .rank-badge {
    width: 34px;
    height: 34px;
    border-radius: 12px;
  }

  .leader-main span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .leader-score b {
    font-size: 20px;
  }

  .team {
    font-size: 13px !important;
  }

  .score {
    min-width: 46px;
    padding: 7px 8px;
    font-size: 14px !important;
  }
}

@media (max-width: 480px) and (orientation: portrait) {
  .content {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .home-hero h3 {
    font-size: 23px;
  }

  .home-hero p,
  .empty-state span {
    font-size: 12px;
  }

  .match {
    padding: 12px !important;
  }

  .leader-main span {
    max-width: 185px;
  }
}

/* Compact tournament screens */
.compact-toolbar {
  padding: 8px 10px !important;
}

.actions.one-line {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.result-actions {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.actions.one-line .btn,
.result-actions .btn {
  min-width: 0;
  width: 100%;
}

.match-feed {
  gap: 7px !important;
}

.section-shell .match,
.compact-result,
.match {
  padding: 7px 9px !important;
  gap: 5px !important;
  border-radius: 12px !important;
}

.match-meta {
  margin-bottom: 4px !important;
  font-size: 10px !important;
}

.match-meta .muted {
  font-size: 10px !important;
  line-height: 1.25 !important;
}

.tag {
  min-height: 18px !important;
  padding: 2px 6px !important;
  font-size: 10px !important;
}

.teams {
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr) !important;
  gap: 6px !important;
}

.team {
  gap: 6px !important;
  font-size: 12px !important;
}

.logo {
  width: 20px !important;
  height: 20px !important;
  padding: 1px !important;
}

.score {
  min-width: 38px !important;
  padding: 4px 6px !important;
  border-radius: 10px !important;
  font-size: 12px !important;
}

.match-extra {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.result-edit-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.result-edit-grid .score-field {
  width: auto !important;
}

.result-edit-grid .score-field input,
.score-field input {
  width: 48px !important;
  min-height: 30px !important;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 6px !important;
}

.kpi-card {
  min-height: 42px !important;
  padding: 6px 8px !important;
  border-radius: 10px !important;
}

.kpi-card span {
  font-size: 10px !important;
}

.kpi-card b {
  font-size: 16px !important;
}

.api-help {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  background: var(--panel-soft);
}

.api-help b {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.api-help p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.award-count {
  position: absolute;
  right: 10px;
  bottom: 8px;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: 11px;
}

.award-tile {
  position: relative;
}

.muted-award .award-count {
  background: #cbd5e1;
}

.results-section .section-title h3 {
  font-size: 15px;
}

.schedule-toolbar {
  gap: 8px !important;
}

.compact-check {
  min-height: 28px !important;
  margin: 0 !important;
  font-size: 12px !important;
}

@media (max-width: 620px) {
  .result-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-actions .btn:last-child {
    grid-column: 1 / -1;
  }

  .result-edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Final native override: keep this block last */
.content { background: transparent !important; }
.topbar { display: none !important; }
.surface-flat { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; }
.match-card { border: 0 !important; }
.rules-panel.compact-rules { margin: 0 !important; }
.rules-panel.compact-rules .rules-grid { padding: 0 !important; }
.rule-cell { display: none !important; }
.toolbar.table-toolbar,
.table-toolbar { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; }
.nav button img { display: none !important; }
.winner-poll:empty { display: none !important; }
.match-card .winner-poll { margin-top: -2px; }
.bracket-board { max-width: 100%; }
.achievement-card { color: var(--ink) !important; }
.screen-stack > .card { box-shadow: var(--shadow) !important; }
.btn[data-action]::before,
.btn[data-view]::before { display: none !important; content: none !important; }

@media (max-width: 900px) {
  .app { display: block !important; }
  .app-header { display: flex !important; }
  .content { margin-left: 0 !important; max-width: none !important; width: 100% !important; }
  .sidebar { display: block !important; }
  .sidebar .nav { width: 100% !important; }
  .nav-count-5 .nav { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
  .nav button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav button[data-view="schedule"] span { max-width: 52px; }
}

/* Header and bottom navigation acceptance fixes */
.profile-link {
  min-height: 36px;
  max-width: 132px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .app-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 80 !important;
    height: calc(58px + env(safe-area-inset-top)) !important;
    min-height: calc(58px + env(safe-area-inset-top)) !important;
    margin: -16px -16px 16px !important;
    padding: env(safe-area-inset-top) 16px 0 !important;
    box-sizing: border-box !important;
  }

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

  .mobile-brand strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 18px;
  }

  .mobile-brand img {
    width: 32px !important;
    height: 32px !important;
  }

  .header-actions {
    min-width: 0;
    flex: 0 0 auto;
  }

  .avatar-btn {
    display: none !important;
  }

  .content {
    padding-top: 16px !important;
    padding-bottom: calc(96px + env(safe-area-inset-bottom)) !important;
    min-height: 100svh;
  }

  .nav {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 1000 !important;
    height: calc(72px + env(safe-area-inset-bottom)) !important;
    max-height: calc(72px + env(safe-area-inset-bottom)) !important;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)) !important;
    box-sizing: border-box !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    background: rgba(15, 23, 42, .98) !important;
    box-shadow: 0 -10px 30px rgba(15, 23, 42, .18) !important;
  }

  .nav-count-5 .nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    grid-auto-columns: unset !important;
    overflow-x: hidden !important;
  }

  .is-admin .nav {
    display: grid !important;
    grid-auto-flow: column !important;
    grid-auto-columns: minmax(72px, 1fr) !important;
    overflow-x: auto !important;
    overscroll-behavior-x: contain;
  }

  .nav button {
    height: 60px !important;
    min-height: 60px !important;
    padding: 5px 4px !important;
  }

  .nav button.active {
    background: rgba(96, 165, 250, .18) !important;
    color: #60a5fa !important;
  }
}

@media (max-width: 430px) {
  .app-header {
    height: calc(56px + env(safe-area-inset-top)) !important;
    min-height: calc(56px + env(safe-area-inset-top)) !important;
    margin: -14px -14px 14px !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .profile-link {
    max-width: 112px;
    font-size: 13px;
  }

  .content {
    padding-bottom: calc(98px + env(safe-area-inset-bottom)) !important;
  }
}

/* Home, forecast modal, schedule and achievement compactness */
.home-screen {
  gap: 20px !important;
}

.rank-summary div strong {
  min-height: 24px;
}

.award-strip {
  grid-auto-columns: minmax(148px, 1fr) !important;
  align-items: stretch;
}

.achievement-card {
  min-height: 148px !important;
  height: 148px !important;
  padding: 14px !important;
  grid-template-rows: 34px auto 1fr !important;
  overflow: hidden;
}

.achievement-card img {
  width: 34px !important;
  height: 34px !important;
  filter: grayscale(1);
  opacity: .62;
}

.achievement-card.earned img {
  filter: none;
  opacity: 1;
}

.achievement-card b {
  display: block;
  max-height: 36px;
  overflow: hidden;
  color: var(--ink) !important;
  font-size: 13px !important;
  line-height: 18px;
}

.achievement-card span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-right: 34px;
  color: var(--muted) !important;
  font-size: 11px !important;
  line-height: 15px;
}

.achievement-card strong {
  right: 10px !important;
  bottom: 10px !important;
  width: 28px !important;
  height: 28px !important;
  font-size: 12px !important;
}

.achievement-card.earned:nth-child(1) strong { background: #d9a222 !important; }
.achievement-card.earned:nth-child(2) strong { background: #94a3b8 !important; }
.achievement-card.earned:nth-child(3) strong { background: #c87942 !important; }
.achievement-card.earned:nth-child(4) strong { background: #159a63 !important; }
.achievement-card.locked strong { background: #cbd5e1 !important; color: #475569 !important; }

.match-card {
  min-height: 112px !important;
  height: auto;
  gap: 8px !important;
  padding: 12px 14px !important;
}

.match-card-top {
  min-height: 24px;
  gap: 8px !important;
}

.match-card-main {
  min-height: 34px;
}

.match-card-bottom {
  min-height: 32px !important;
}

.schedule-list {
  display: grid;
  gap: 24px;
}

.schedule-toolbar {
  flex-wrap: wrap;
  align-items: center !important;
}

.compact-segmented {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  padding: 4px;
  border-radius: 14px;
  background: #e9eef5;
}

.compact-segmented button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
}

.compact-segmented button.active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}

.bracket-board {
  grid-auto-columns: minmax(248px, 280px) !important;
}

.modal {
  position: relative;
  max-width: 620px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  line-height: 26px;
}

.modal-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.modal-close,
.modal-save {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

.modal-close {
  background: #dc2626;
}

.modal-save {
  background: #159a63;
}

.modal-save .ui-icon {
  width: 19px;
  height: 19px;
}

.predict-form {
  display: grid;
  gap: 10px;
}

.predict-match-summary {
  padding: 10px;
  border-radius: 14px;
  background: var(--panel-soft);
}

.predict-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 14px;
}

.predict-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.predict-meta b {
  color: var(--ink);
  white-space: nowrap;
}

.predict-teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.predict-teams div {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.predict-teams div:last-child {
  justify-content: flex-end;
  text-align: right;
}

.predict-teams img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: 0 0 auto;
}

.predict-teams strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.predict-teams span {
  color: var(--muted);
  text-align: center;
  font-weight: 900;
}

.predict-form .score-row {
  padding: 0;
}

.predict-form .prediction-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.predict-form .field {
  margin: 0 !important;
}

.predict-form .field label {
  margin-bottom: 4px;
  font-size: 11px;
  line-height: 14px;
}

.predict-form .field-note {
  margin-top: 4px;
  font-size: 11px;
  line-height: 14px;
}

.predict-form > .btn[type="submit"] {
  display: none !important;
}

.predict-score-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
  align-items: end;
  gap: 8px;
}

.predict-score-row .score-separator {
  align-self: center;
  text-align: center;
  font-weight: 900;
}

@media (max-width: 900px) {
  .modal-backdrop {
    align-items: end !important;
    padding: 12px !important;
  }

  .modal {
    width: 100% !important;
    max-height: calc(100svh - 28px - env(safe-area-inset-top)) !important;
    overflow: auto;
    border-radius: 22px 22px 0 0 !important;
    padding: 16px !important;
  }
}

@media (max-width: 430px) {
  .award-strip {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-flow: row !important;
    grid-auto-columns: unset !important;
    overflow: visible !important;
    gap: 10px !important;
  }

  .achievement-card {
    width: 100% !important;
    min-width: 0 !important;
    height: 142px !important;
    min-height: 142px !important;
  }

  .rank-summary {
    gap: 8px !important;
  }

  .rank-summary div {
    min-height: 76px;
    padding: 12px !important;
  }

  .rank-summary strong {
    font-size: 18px !important;
  }

  .match-card {
    min-height: 104px !important;
    padding: 10px 12px !important;
  }

  .match-card-top {
    font-size: 11px !important;
  }

  .match-card-bottom {
    font-size: 12px !important;
  }

  .compact-segmented {
    width: 100%;
  }

  .compact-segmented button {
    flex: 1;
    padding: 0 8px;
    font-size: 12px;
  }

  .predict-form .prediction-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .predict-form .score-field input {
    width: 100% !important;
    min-height: 42px !important;
    font-size: 18px !important;
  }
}

/* Final override must stay at the end of the file. */
html,
body,
.app,
.content {
  max-width: 100%;
  overflow-x: hidden !important;
}

@media (max-width: 900px) {
  .app-header {
    height: calc(52px + env(safe-area-inset-top)) !important;
    min-height: calc(52px + env(safe-area-inset-top)) !important;
    margin: -14px -14px 14px !important;
    padding: env(safe-area-inset-top) 14px 0 !important;
  }

  .mobile-brand img,
  .brand img {
    width: 30px !important;
    height: 30px !important;
  }

  .mobile-brand strong {
    font-size: 17px !important;
    line-height: 22px !important;
  }

  .profile-link {
    min-height: 34px !important;
    padding: 0 10px !important;
    font-size: 13px !important;
  }

  .content {
    padding: 14px 14px calc(104px + env(safe-area-inset-bottom)) !important;
  }

  .nav {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 5000 !important;
    height: calc(70px + env(safe-area-inset-bottom)) !important;
    max-height: calc(70px + env(safe-area-inset-bottom)) !important;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)) !important;
    transform: translateZ(0) !important;
    will-change: transform;
  }

  .nav-count-5 .nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    overflow-x: hidden !important;
  }
}

.award-strip {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-auto-flow: row !important;
  grid-auto-columns: unset !important;
  gap: 12px !important;
  overflow: visible !important;
  padding: 0 !important;
}

.achievement-card {
  position: relative !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 146px !important;
  height: 146px !important;
  display: grid !important;
  grid-template-rows: 42px 34px 1fr !important;
  gap: 6px !important;
  padding: 14px !important;
  overflow: hidden !important;
  border-radius: 18px !important;
}

.achievement-medal {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #cbd5e1;
  box-shadow: inset 0 -3px 0 rgba(15, 23, 42, .12);
}

.achievement-medal::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .75);
}

.achievement-card img {
  position: absolute;
  left: 14px;
  top: 14px;
  width: 38px !important;
  height: 38px !important;
  object-fit: contain;
  z-index: 1;
}

.achievement-card.locked img {
  filter: grayscale(1) !important;
  opacity: .45 !important;
}

.achievement-card.earned img {
  filter: none !important;
  opacity: 1 !important;
}

.achievement-champion.earned .achievement-medal { background: #d9a222; }
.achievement-silver.earned .achievement-medal { background: #a8b3c2; }
.achievement-bronze.earned .achievement-medal { background: #c87942; }
.achievement-bestRound.earned .achievement-medal { background: #159a63; }
.achievement-bestRound .achievement-medal {
  border-radius: 12px 12px 50% 50%;
}

.achievement-bestRound .achievement-medal::before {
  width: 18px;
  height: 14px;
  border: 3px solid rgba(255, 255, 255, .78);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 12px 0 -6px rgba(255, 255, 255, .78);
}

.achievement-card b {
  min-width: 0;
  max-height: none !important;
  overflow: hidden !important;
  color: var(--ink) !important;
  font-size: 13px !important;
  line-height: 17px !important;
}

.achievement-card span {
  min-width: 0;
  display: -webkit-box !important;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden !important;
  padding-right: 32px !important;
  color: var(--muted) !important;
  font-size: 11px !important;
  line-height: 14px !important;
}

.achievement-card strong {
  right: 12px !important;
  bottom: 12px !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  font-size: 12px !important;
}

.modal-backdrop,
.modal,
.schedule-screen,
.schedule-list,
.match-feed,
.match-card,
.table-screen,
.home-screen,
.profile-screen {
  max-width: 100%;
  overflow-x: hidden !important;
}

.modal-header {
  min-height: 42px !important;
  margin-bottom: 12px !important;
}

.modal-close,
.modal-save {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  border-radius: 14px !important;
}

.modal-close {
  font-size: 26px !important;
}

.modal-save .ui-icon {
  width: 21px !important;
  height: 21px !important;
}

.predict-form {
  gap: 12px !important;
}

.predict-match-summary {
  padding: 12px !important;
  border-radius: 16px !important;
}

.predict-teams {
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr) !important;
  gap: 10px !important;
}

.predict-teams img {
  width: 30px !important;
  height: 30px !important;
}

.predict-teams strong {
  font-size: 15px !important;
  line-height: 19px !important;
}

.predict-score-row {
  grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr) !important;
  gap: 10px !important;
  align-items: end !important;
}

.predict-score-row .score-field input {
  width: 100% !important;
  height: 64px !important;
  min-height: 64px !important;
  text-align: center !important;
  font-size: 26px !important;
  font-weight: 850 !important;
  border-radius: 16px !important;
}

.predict-score-row .field label,
.predict-form .prediction-grid .field label {
  min-height: 28px;
  display: flex;
  align-items: end;
  font-size: 12px !important;
  line-height: 14px !important;
}

.predict-score-row .score-separator {
  height: 64px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 24px;
}

.predict-form .prediction-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
  padding: 12px !important;
  border-radius: 16px !important;
  background: var(--panel-soft) !important;
}

.predict-form .prediction-grid .field {
  min-width: 0 !important;
  padding: 0 !important;
}

.predict-form .prediction-grid input,
.predict-form .prediction-grid select {
  width: 100% !important;
  min-height: 48px !important;
  border-radius: 14px !important;
  font-size: 15px !important;
}

.predict-form .field-note {
  display: none !important;
}

.bracket-board {
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-padding-left: 0;
}

.bracket-round {
  min-width: 260px !important;
}

.bracket-card {
  min-height: 92px !important;
}

.schedule-toolbar .actions.one-line {
  width: 100%;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.schedule-toolbar .actions.one-line .btn {
  width: 100%;
  min-width: 0;
}

@media (max-width: 700px) {
  .award-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 430px) {
  .award-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .achievement-card {
    height: 136px !important;
    min-height: 136px !important;
    padding: 12px !important;
    grid-template-rows: 38px 32px 1fr !important;
  }

  .achievement-medal,
  .achievement-card img {
    width: 34px !important;
    height: 34px !important;
  }

  .achievement-card img {
    left: 12px;
    top: 12px;
  }

  .modal {
    max-height: calc(100svh - 18px - env(safe-area-inset-top)) !important;
    padding: 14px !important;
  }

  .modal-header h3 {
    font-size: 18px !important;
    line-height: 23px !important;
  }

  .predict-match-summary {
    padding: 10px !important;
  }

  .predict-score-row .score-field input {
    height: 58px !important;
    min-height: 58px !important;
    font-size: 24px !important;
  }

  .predict-score-row .score-separator {
    height: 58px;
  }

  .predict-form .prediction-grid {
    gap: 8px !important;
    padding: 10px !important;
  }
}
.players-search-panel,
.players-table-card {
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .07);
}

.players-search-panel {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.players-search-panel label {
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
}

.players-search-panel input {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  background: #f2f6fb;
  padding: 0 14px;
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
  outline: none;
}

.players-search-panel input:focus {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .18);
  background: #fff;
}

.players-table-card {
  padding: 12px;
}

.players-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.players-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  min-width: 760px;
}

.players-table .player-number-col {
  width: 44px;
}

.players-table th {
  padding: 0 12px 6px;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
  white-space: nowrap;
}

.players-table td {
  background: #f8fafc;
  padding: 12px;
  color: #0f172a;
  font-size: 14px;
  vertical-align: middle;
}

.players-table tr td:first-child {
  border-radius: 14px 0 0 14px;
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding-left: 6px;
  padding-right: 6px;
  text-align: center;
}

.players-table th:first-child {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding-left: 6px;
  padding-right: 6px;
  text-align: center;
}

.players-table tr td:last-child {
  border-radius: 0 14px 14px 0;
}

.player-cell-open {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.player-cell-open:hover,
.player-cell-open:focus-visible {
  color: #1d4ed8;
  outline: none;
}

.player-login-open {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.player-state {
  display: inline-flex;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 900;
}

.player-blocked td {
  opacity: .68;
}

.player-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.icon-action {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: #e8eef6;
  color: #334155;
  cursor: pointer;
}

.icon-action .ui-icon {
  width: 18px;
  height: 18px;
}

.icon-action:hover,
.icon-action:focus-visible {
  background: #dbeafe;
  color: #1d4ed8;
  outline: none;
}

.icon-action.danger {
  background: #fee2e2;
  color: #dc2626;
}

.icon-action.lock {
  background: #fff7ed;
  color: #c2410c;
}

.icon-action.reset {
  background: #ecfeff;
  color: #0e7490;
}

.icon-action:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.players-empty {
  text-align: center;
  color: #64748b;
  font-weight: 800;
}

.modal-player-details {
  max-width: 460px;
}

.player-detail-card {
  display: grid;
  gap: 10px;
}

.player-detail-row {
  display: grid;
  grid-template-columns: minmax(112px, 42%) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border-radius: 14px;
  background: #f7faff;
}

.player-detail-row span {
  color: #64748b;
  font-size: 13px;
  font-weight: 850;
}

.player-detail-row b {
  min-width: 0;
  color: #0f172a;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.player-detail-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 4px;
}

.player-detail-actions .btn {
  min-height: 44px;
  padding: 0 10px;
  border-radius: 14px;
  font-size: 13px;
}

.player-detail-actions .btn .ui-icon {
  width: 17px;
  height: 17px;
}

@media (max-width: 700px) {
  .players-search-panel,
  .players-table-card {
    border-radius: 16px;
  }

  .players-table-card {
    padding: 8px;
  }

  .players-table {
    min-width: 690px;
  }

  .players-table th,
  .players-table td {
    padding-left: 9px;
    padding-right: 9px;
    font-size: 13px;
  }

  .icon-action {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .player-detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .player-detail-actions {
    grid-template-columns: 1fr;
  }
}

/* Desktop EOF guard. Do not move above mobile fixes. */
@media (min-width: 901px) {
  .app {
    display: grid !important;
    grid-template-columns: 286px minmax(0, 1fr) !important;
    min-height: 100vh !important;
    background: #eef3f8 !important;
  }

  .app-header {
    display: none !important;
  }

  .sidebar {
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    bottom: auto !important;
    grid-column: 1 !important;
    width: auto !important;
    height: 100vh !important;
    min-height: 100vh !important;
    padding: 26px 20px !important;
    overflow-y: auto !important;
    background: #101827 !important;
  }

  .content {
    grid-column: 2 !important;
    width: 100% !important;
    max-width: 1360px !important;
    margin: 0 auto !important;
    padding: 36px 48px 56px !important;
    background: transparent !important;
    overflow-x: hidden !important;
  }

  .brand {
    gap: 14px !important;
  }

  .brand img,
  .brand span:first-child {
    width: 44px !important;
    height: 44px !important;
    border-radius: 14px !important;
  }

  .brand strong {
    font-size: 23px !important;
    line-height: 28px !important;
  }

  .nav {
    position: static !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 !important;
    overflow: visible !important;
    background: transparent !important;
  }

  .nav button {
    width: 100% !important;
    height: 50px !important;
    min-height: 50px !important;
    justify-content: flex-start !important;
    gap: 13px !important;
    padding: 0 14px !important;
    border-radius: 15px !important;
    color: #cbd5e1 !important;
    text-align: left !important;
  }

  .nav button:hover,
  .nav button.active {
    color: #fff !important;
    background: rgba(59, 130, 246, 0.18) !important;
  }

  .nav .ui-icon,
  .nav svg,
  .nav button img {
    width: 22px !important;
    height: 22px !important;
    flex: 0 0 22px !important;
  }

  .nav button span {
    display: inline !important;
    font-size: 15px !important;
    line-height: 20px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .account {
    margin-top: auto !important;
    padding-top: 20px !important;
  }

  .screen-stack {
    gap: 30px !important;
  }

  .screen-title,
  .topbar h2 {
    font-size: clamp(34px, 3.2vw, 48px) !important;
    line-height: 1.05 !important;
  }

  .rank-summary,
  .profile-stats,
  .stats-grid,
  .award-strip {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
    gap: 16px !important;
  }

  .match-feed,
  .schedule-list,
  .cards-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)) !important;
    gap: 16px !important;
  }

  .match-card,
  .compact-match-card {
    min-height: 132px !important;
    height: auto !important;
  }

  .schedule-toolbar {
    display: grid !important;
    grid-template-columns: minmax(300px, 380px) minmax(260px, 1fr) !important;
    align-items: end !important;
    gap: 16px !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .schedule-toolbar .schedule-title-row {
    grid-column: 1 / -1 !important;
  }

  .schedule-toolbar .actions.one-line {
    width: auto !important;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 10px !important;
  }

  .schedule-toolbar .actions.one-line .btn {
    width: auto !important;
    min-width: 0 !important;
  }

  .grid.two,
  .grid.three,
  .settings-grid,
  .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  }

  .table-wrap {
    max-width: 100% !important;
    overflow-x: auto !important;
  }

  .modal {
    max-width: 760px !important;
  }

  .modal-predict {
    max-width: 580px !important;
  }
}

/* EOF guard: player and match prediction details. */
.modal-user-predictions,
.modal-admin-predictions { max-width: min(940px, calc(100vw - 24px)) !important; }
.leader-row { cursor: pointer; }
.user-predictions-wrap,
.match-predictions-wrap { max-width: 100% !important; }
.user-predictions-table,
.match-predictions-table { width: 100% !important; }
.match-card-actions { display: flex !important; justify-content: flex-end !important; align-items: center !important; gap: 8px !important; }
.match-card-actions .btn { min-height: 40px !important; width: auto !important; padding: 0 12px !important; }
@media (max-width: 700px) {
  .user-predictions-table, .user-predictions-table thead, .user-predictions-table tbody, .user-predictions-table tr, .user-predictions-table td,
  .match-predictions-table, .match-predictions-table thead, .match-predictions-table tbody, .match-predictions-table tr, .match-predictions-table td { display: block !important; width: 100% !important; min-width: 0 !important; }
  .user-predictions-table thead, .match-predictions-table thead { display: none !important; }
  .user-predictions-table tr, .match-predictions-table tr { margin-bottom: 10px !important; padding: 10px !important; border-radius: 16px !important; background: #f8fbff !important; border: 1px solid rgba(148, 163, 184, .18) !important; }
  .user-predictions-table td, .match-predictions-table td { display: grid !important; grid-template-columns: 92px minmax(0, 1fr) !important; gap: 10px !important; padding: 5px 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; text-align: left !important; white-space: normal !important; }
  .user-predictions-table td::before, .match-predictions-table td::before { content: attr(data-label); color: #64748b; font-size: 12px; font-weight: 850; }
}

/* Avatar positioning and table avatars */
.profile-link.has-avatar img,
.profile-avatar-preview img,
.mini-avatar {
  object-fit: cover !important;
}

.avatar-position-controls {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(241, 245, 249, .78);
}

.avatar-range-field {
  gap: 7px !important;
}

.avatar-range-field label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 850;
  color: #64748b;
}

.avatar-range-field output {
  color: #111827;
  font-weight: 900;
}

.avatar-range-field input[type="range"] {
  width: 100%;
  height: 32px;
  padding: 0;
  accent-color: #2563eb;
}

.mini-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  background: #dbe5f0;
  color: #475569;
  font-size: 13px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08);
}

img.mini-avatar {
  display: block;
}

.leader-row {
  grid-template-columns: 38px 34px minmax(0, 1fr) auto !important;
}

.leader-avatar {
  align-self: center;
}

.player-login-open .mini-avatar {
  margin-right: 8px;
}

@media (max-width: 430px) {
  .leader-row {
    grid-template-columns: 32px 30px minmax(0, 1fr) auto !important;
    gap: 8px !important;
  }

  .leader-row .rank-badge {
    width: 32px !important;
    height: 32px !important;
    border-radius: 12px !important;
  }

  .leader-row .mini-avatar {
    width: 30px;
    height: 30px;
    min-width: 30px;
  }
}


/* Player prediction card mobile fix */
.modal-user-predictions {
  max-height: min(88dvh, 760px) !important;
  overflow: auto !important;
  padding-top: 0 !important;
}

.modal-user-predictions .modal-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 5 !important;
  padding: 14px 0 10px !important;
  margin: 0 0 8px !important;
  background: #fff !important;
}

.modal-user-predictions .modal-header h3 {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.prediction-match-cell {
  position: relative !important;
  padding-top: 22px !important;
}

.prediction-match-meta {
  position: absolute !important;
  top: 3px !important;
  right: 0 !important;
  max-width: 68% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  color: #64748b !important;
  font-size: 11px !important;
  font-weight: 800 !important;
}

@media (max-width: 700px) {
  .modal-user-predictions {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    margin-top: max(8px, env(safe-area-inset-top)) !important;
    margin-bottom: calc(var(--nav-height, 76px) + env(safe-area-inset-bottom) + 10px) !important;
  }

  .modal-user-predictions .modal-header {
    border-bottom: 1px solid rgba(148, 163, 184, .16) !important;
  }

  .prediction-match-cell {
    padding-top: 20px !important;
  }

  .prediction-match-meta {
    left: 102px !important;
    right: 0 !important;
    max-width: none !important;
    text-align: right !important;
  }
}


/* Fix player prediction rows: no text overlapping */
.prediction-match-cell {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: start !important;
  column-gap: 10px !important;
  padding-top: 0 !important;
}

.prediction-match-cell b {
  min-width: 0 !important;
  overflow-wrap: anywhere !important;
  line-height: 1.25 !important;
}

.prediction-match-meta {
  position: static !important;
  max-width: 150px !important;
  text-align: right !important;
  white-space: normal !important;
  line-height: 1.2 !important;
  font-size: 11px !important;
}

@media (max-width: 700px) {
  .user-predictions-table td.prediction-match-cell {
    display: grid !important;
    grid-template-columns: 92px minmax(0, 1fr) !important;
    gap: 6px 10px !important;
  }

  .user-predictions-table td.prediction-match-cell::before {
    grid-row: 1 / 3 !important;
  }

  .prediction-match-cell b,
  .prediction-match-meta {
    grid-column: 2 !important;
  }

  .prediction-match-meta {
    max-width: none !important;
    text-align: left !important;
    order: -1 !important;
  }
}

/* Keep player prediction details fully inside the phone viewport. */
@media (max-width: 700px) {
  .modal-backdrop-modal-user-predictions {
    align-items: start !important;
    justify-items: center !important;
    place-items: start center !important;
    padding: calc(env(safe-area-inset-top) + 10px) 10px calc(var(--nav-height, 76px) + env(safe-area-inset-bottom) + 12px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
  }

  .modal-backdrop-modal-user-predictions .modal-user-predictions {
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - var(--nav-height, 76px) - 24px) !important;
    margin: 0 !important;
    padding: 14px !important;
    border-radius: 22px !important;
    overflow: auto !important;
  }

  .modal-backdrop-modal-user-predictions .modal-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 20 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    min-height: 42px !important;
    padding: 0 0 10px !important;
    margin: 0 0 10px !important;
    background: #fff !important;
    border-bottom: 1px solid rgba(148, 163, 184, .16) !important;
  }

  .modal-backdrop-modal-user-predictions .modal-header h3 {
    min-width: 0 !important;
    max-width: calc(100% - 52px) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    line-height: 1.15 !important;
  }

  .modal-backdrop-modal-user-predictions .modal-actions {
    flex: 0 0 auto !important;
  }

  .modal-backdrop-modal-user-predictions .modal-close {
    position: static !important;
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    display: inline-grid !important;
    place-items: center !important;
  }
}

/* Compact achievements: only Home keeps this block. */
.home-screen .award-strip {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 8px !important;
  overflow: visible !important;
}

.home-screen .achievement-card {
  min-width: 0 !important;
  height: 84px !important;
  min-height: 84px !important;
  padding: 10px 8px !important;
  border-radius: 16px !important;
  display: grid !important;
  grid-template-rows: 30px 1fr !important;
  align-items: center !important;
  justify-items: center !important;
  gap: 5px !important;
}

.home-screen .achievement-card span {
  display: none !important;
}

.home-screen .achievement-medal,
.home-screen .achievement-card img {
  width: 28px !important;
  height: 28px !important;
}

.home-screen .achievement-card img {
  left: 50% !important;
  top: 10px !important;
  transform: translateX(-50%) !important;
}

.home-screen .achievement-card b {
  max-width: 100% !important;
  padding: 0 !important;
  font-size: 11px !important;
  line-height: 1.1 !important;
  text-align: center !important;
  white-space: normal !important;
  overflow: hidden !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
}

.home-screen .achievement-card strong {
  right: 6px !important;
  bottom: 6px !important;
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  font-size: 11px !important;
}

@media (max-width: 380px) {
  .home-screen .award-strip {
    gap: 6px !important;
  }

  .home-screen .achievement-card {
    height: 78px !important;
    min-height: 78px !important;
    padding: 8px 6px !important;
  }

  .home-screen .achievement-card b {
    font-size: 10px !important;
  }
}
