/* ----- Team Focus mobile refinements ----- */
@media (max-width: 760px) {
  /* Team summary: stack header elements */
  .team-summary__header { flex-wrap: wrap; gap: 0.5rem; }
  .team-summary { padding-top: 0.5rem; }
  .team-back { margin-bottom: 0; }
  .team-logo--large { width: 56px; height: 56px; }
  /* The rating with its rank beside it, the xG form line under both: two
     rows rather than a column of three. */
  .team-summary__rating-block {
    flex-basis: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.85rem;
    align-items: center;
    justify-items: start;
  }
  .team-summary__rating-pos { line-height: 1.25; }
  .team-summary__trend { font-size: 2rem; }
  /* Key and verdict wrap as wholes, never mid-phrase. */
  .team-summary__form { grid-column: 1 / -1; margin-top: 0.1rem; flex-wrap: wrap; }
  .team-summary__form > * { white-space: nowrap; }
  /* Spaced capitals broke "Mest sannsynlig" into three lines in a tile;
     sentence case fits two and reads quicker. */
  .team-stats__label { font-size: 0.6875rem; letter-spacing: 0; text-transform: none; text-wrap: balance; }

  /* Team stats grid: 2 columns on mobile */
  .team-stats { grid-template-columns: 1fr 1fr; }
  .team-stats--xg { grid-template-columns: 1fr 1fr; }

  /* Team grid row: smaller cells */
  .team-grid-row__cell { height: 1.5rem; font-size: 0.5625rem; }
  .team-grid-row__pos { font-size: 0.5rem; }

  /* Season shape chart container */
  .team-shape-container { min-height: 280px; }
  .team-section .chart { max-width: 100%; }

  /* Season by season: tighter rows */
  .season-row-compact { padding: 0.5rem 0.6rem; gap: 0.75rem; }
  .season-row-head { padding-inline: 0.6rem; gap: 0.75rem; }
  .season-row-compact__season { width: 6.5rem; gap: 0.35rem; }
  .season-row-compact__year { font-size: 0.875rem; }
  .season-row-compact__main { gap: 0.5rem; }
  .season-row-compact__pos { font-size: 0.9375rem; min-width: 2rem; }
  .season-row-compact__rating { min-width: 6rem; gap: 0.35rem; }
  .season-row-compact__rating-start { font-size: 0.75rem; min-width: 2.5rem; }
  .season-row-compact__change { min-width: 5rem; }
  .season-row-compact__change-val { font-size: 0.8125rem; min-width: 2rem; }
  .season-row-compact__rating-end { font-size: 0.75rem; min-width: 2.5rem; }


  /* Rating chart tick sizes */

}

@media (max-width: 480px) {
  /* #team-content and each .team-section both padded 1.25rem: 40px a side of
     a 360px screen before any content. One layer of gutter is enough. */
  #team-content { padding: 0.5rem 0.25rem; }
  .team-section { padding: 1rem 0.75rem; }
  .team-summary { padding-inline: 0.75rem; }
  .team-tabs { max-width: none; margin-inline: 0.75rem; }
  .team-grid-row__cell { font-size: 0.5rem; letter-spacing: -0.04em; }
  /* Start is end minus change: the phone keeps the two that carry news. */
  .season-row-compact__rating-start { display: none; }
  .team-summary__rating { font-size: 2rem; }
  .team-stats__value { font-size: 1.25rem; }
  .team-stats__tile { padding: 0.5rem 0.35rem; }

  /* Season by season: even tighter */
  .season-row-compact { padding: 0.45rem 0.5rem; gap: 0.5rem; }
  .season-row-head { padding-inline: 0.5rem; gap: 0.5rem; }
  .season-row-compact__season { width: 6rem; }
  .season-row-compact__year { font-size: 0.8125rem; }
  .season-row-compact__main { gap: 0.35rem; }
  .season-row-compact__pos { font-size: 0.875rem; min-width: 1.75rem; }
  .season-row-compact__rating { min-width: 0; }
  .season-row-compact__rating-start { min-width: 2.25rem; }
  .season-row-compact__change { min-width: 4.5rem; }
  .season-row-compact__change-val { min-width: 1.75rem; }
  .season-row-compact__rating-end { min-width: 2.25rem; }

  /* Fixtures/results pagination buttons */
  .team-section .played-nav__btn { padding: 0.35rem 0.75rem; font-size: 0.75rem; }
}

/* ----- Next Up / Fixtures mobile refinements ----- */
@media (max-width: 760px) {
  /* Tighter gaps: the odds bar keeps its row layout at every width */
  .fixture__odds-col { gap: 0.25rem; }
  .fixture__lines { gap: 0.25rem; }
  .fixture__line { padding-inline: 0.45rem; }

  /* Week pagination: larger touch targets */
  .fixtures .played-nav__btn { min-height: 44px; min-width: 44px; padding: 0.4rem 0.75rem; }
  .fixtures .played-nav__label { min-width: 0; font-size: 0.875rem; }
}

@media (max-width: 480px) {
  .fixtures .played-nav { padding: 0.6rem 0.75rem; }
  .fixtures .played-nav__btn { min-width: 40px; padding: 0.35rem 0.5rem; font-size: 0.75rem; }
  .fixtures .played-nav__label { font-size: 0.8125rem; }
}

/* ----- Played Results mobile refinements ----- */
@media (max-width: 760px) {
  .played-results .played-nav { padding: 0.6rem 1rem; }
  .played-results .played-nav__btn { min-height: 44px; min-width: 44px; }
  .played-results .played-nav__label { min-width: 0; }

  /* xG under score readability */
  .played-card__xg { font-size: 0.6875rem; margin-top: 0.25rem; }
}

@media (max-width: 480px) {
  .played-results .played-nav { padding: 0.5rem 0.75rem; }
  .played-results .played-nav__btn { padding: 0.35rem 0.5rem; font-size: 0.75rem; }
}

/* ----- Compare Clubs mobile refinements ----- */
@media (max-width: 760px) {

  /* Scoreline chips wrap */
  .compare__scorelines-chips { gap: 0.4rem; }

  /* H2H record */
  .compare__h2h-record { font-size: 1.1rem; }
  .compare__h2h-label { font-size: 0.6875rem; }
  .compare__h2h-stat { font-size: 1.1rem; }
}

@media (max-width: 480px) {
  .compare__team { padding: 0.6rem 0.7rem; }
  .compare__team .team-logo { width: 36px; height: 36px; }
  .compare__team-name { font-size: 0.875rem; }
  .compare__team-rating { font-size: 1.1rem; }
  .compare__scoreline { font-size: 0.75rem; padding: 0.2rem 0.5rem; min-width: 3.5rem; }
  .compare__scoreline-prob { font-size: 0.6875rem; }
  .compare__h2h-record { font-size: 1rem; }
  .compare__h2h-stat { font-size: 1rem; }
}

/* ----- Model Card mobile refinements ----- */
@media (max-width: 760px) {
  .model-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .model-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0.85rem 1rem; gap: 0.55rem; }
  .model-kpi { padding: 0.7rem 0.8rem; }
  .model-kpi__value { font-size: 1.25rem; }
  .model-flow { padding: 1rem; }
  .model-flow__cta { width: 100%; justify-content: center; min-height: 44px; }
  .model-spec { padding: 0.9rem 1rem 1rem; }
  .accuracy__jump a { min-height: 44px; display: inline-flex; align-items: center; }
  @media (max-width: 340px) { .model-kpis { grid-template-columns: 1fr; } }
}

/* ----- Grid Animation Controls mobile ----- */
@media (max-width: 760px) {
  .grid-anim-btn { height: 44px; padding: 0 0.75rem; }
  .grid-anim-bar { padding: 0.5rem 1rem; gap: 0.5rem; }
  .grid-anim-bar__when { min-width: 0; font-size: 0.75rem; }
  .grid-anim-speed button { min-height: 44px; min-width: 3rem; padding: 0.2rem 0.4rem; font-size: 0.6875rem; }
  .grid-anim-speed { padding: 2px; }
}

@media (max-width: 480px) {
  .grid-anim-bar { flex-wrap: wrap; justify-content: center; }
  .grid-anim-bar__when { order: -1; width: 100%; text-align: center; margin-bottom: 0.25rem; }
  .grid-anim-speed { order: 0; }
}

/* ----- Finish Grid mobile: ensure tooltip works on tap ----- */
@media (pointer: coarse) {
  .cell { cursor: pointer; }
  .team-grid-row__cell { cursor: pointer; }
}

/* Ensure all interactive elements have 44px minimum touch target */
@media (pointer: coarse) {
  .compare__option { min-height: 44px; padding: 0.6rem 0.75rem; }
  .popover-menu__btn { min-height: 44px; padding: 0.6rem 0.75rem; }
  .settings-btn { min-height: 44px; min-width: 44px; }
  .hero-title-part { min-height: 40px; }
  .popover-menu--picker .popover-menu__btn { min-height: 44px; padding-block: 0.6rem; }
}

/* The club menu is as wide as its half-width card: on a phone a 32px crest
   and 1rem name pushed long names past it and scrolled it sideways. */
@media (max-width: 760px) {
  .compare__menu { overflow-x: hidden; padding: 0.3rem; }
  .compare__option { gap: 0.45rem; padding: 0.5rem 0.4rem; }
  .compare__option .team-logo { width: 22px; height: 22px; }
  .compare__option-name { font-size: 0.8125rem; }
}

/* Focus visible styles for mobile keyboard navigation */
@media (max-width: 760px) {
  :where(a, button, [tabindex]):focus-visible {
    outline: 2px solid var(--accent-ink);
    outline-offset: 2px;
    border-radius: 2px;
  }
}

/* Smooth scrolling for anchor links */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- one secondary button ---------------------------------- */

/* Every secondary action shares one look, whichever view it is in: a pill
   with a hairline border on the panel colour, and the same hover. They had
   drifted apart -- 4px, 8px and 14px corners, sunk or raised fills, light or
   strong borders -- so the same kind of control looked different per view.
   Last in the file so it settles the corners and colours; each rule above
   keeps its own size. */
.grid-anim-btn,
.played-nav__btn,
.timeline__now,
.timeline__step,
.compare__swap-center {
  white-space: nowrap;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.grid-anim-btn:not([aria-pressed="true"]):not(:disabled):hover,
.played-nav__btn:hover,
.timeline__now:hover,
.timeline__step:hover:not(:disabled),
.compare__swap-center:hover {
  background: var(--panel-sunk);
  border-color: var(--rule-strong);
  box-shadow: var(--glow-hover);
}

/* Touch size on a phone, like the rewind step buttons. */
@media (pointer: coarse), (max-width: 760px) {
  .grid-anim-btn { height: 44px; }
  .grid-anim-speed button { min-height: 44px; min-width: 3rem; }
  .grid-anim-bar { padding-inline: 1rem; gap: 0.6rem; }
  .grid-anim-bar__when { min-width: 0; }
}


/* xG beneath a played score: secondary, so smaller and muted. */
.played-card__xg {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--body);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--ink-muted);
}
