/**
 * SwissFans — mobile fit (390–767px)
 * Last-loaded overrides so header, cookie, settings and profile actions
 * stay on-screen and tappable. UI only.
 */

@media (max-width: 767px) {
  html,
  body {
    max-width: 100%;
  }

  /* Guest header: long "Kostenlos Registrieren" must wrap, not clip */
  .header .i_header_in {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center;
    gap: 0.4rem 0.5rem;
    min-width: 0;
    max-width: 100%;
  }

  .header .i_logo_,
  .header .sf-brand-link,
  .header .sf-brand {
    min-width: 0 !important;
    max-width: min(46vw, 9.5rem);
    flex-shrink: 1 !important;
  }

  .header .sf-brand__img,
  .header .i_logo img {
    max-width: 100%;
    height: auto;
    max-height: 32px;
  }

  .header .i_search {
    display: none !important;
  }

  .header .i_one .i_language {
    display: none !important;
  }

  .header .i_header_right,
  .header .i_one {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.4rem;
    min-width: 0 !important;
    flex: 1 1 auto;
    flex-shrink: 1 !important;
    max-width: 100%;
  }

  .header .i_header_right {
    flex: 1 1 100% !important;
    width: 100%;
  }

  .header .i_one {
    width: 100%;
  }

  .header .i_one > a {
    max-width: 100%;
  }

  .header .i_login,
  .header .i_singup {
    margin-right: 0 !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    line-height: 1.2;
    white-space: nowrap;
    box-sizing: border-box;
    max-width: 100%;
  }

  /* Cookie: compact strip above bottom nav, do not bury forms */
  body.sf-ui-consistency-v2 .gdprcookie,
  body .gdprcookie {
    max-height: min(20vh, 8.75rem) !important;
    padding: 0.4rem 0.6rem !important;
    bottom: calc(4.85rem + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 1200 !important;
  }

  body.sf-ui-consistency-v2 .gdprcookie > p {
    -webkit-line-clamp: 1 !important;
    max-height: 1.35em !important;
    font-size: 0.72rem !important;
    margin: 0 0 0.25rem !important;
  }

  body.sf-ui-consistency-v2 .gdprcookie-buttons {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 0.35rem;
    margin-top: 0.35rem;
  }

  body.sf-ui-consistency-v2 .gdprcookie-buttons button {
    flex: 1 1 46%;
    min-height: 40px !important;
    padding: 0.4rem 0.65rem !important;
    font-size: 0.8rem !important;
  }

  body.sf-cookie-open.sf-settings-v2 .settings_wrapper,
  body.sf-cookie-open .settings_wrapper {
    padding-bottom: calc(var(--sf-cookie-h, 9rem) + 5.75rem + env(safe-area-inset-bottom, 0px));
  }

  /* Settings avatar + cover buttons: full-width stack */
  body.sf-settings-v2 .sf-profile-settings-avatar-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  body.sf-settings-v2 .sf-profile-settings-avatar-meta,
  body.sf-settings-v2 .sf-av-actions {
    width: 100%;
  }

  body.sf-settings-v2 .sf-av-actions {
    flex-direction: column;
    align-items: stretch;
  }

  body.sf-settings-v2 .sf-av-btn {
    width: 100%;
    justify-content: center;
  }

  /* Profile subscribe / tip: stack so German labels stay readable */
  body.sf-creator-profile-v2 .sf-cp-actions-primary.i_p_items_box {
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
  }

  body.sf-creator-profile-v2 .sf-cp-actions-primary .i_btn_become_fun,
  body.sf-creator-profile-v2 .sf-cp-actions-primary .i_btn_unsubscribe,
  body.sf-creator-profile-v2 .sf-cp-actions-primary .i_btn_send_to_point.sendPoint {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    font-size: 0.88rem;
    padding: 0.85rem 0.9rem;
    white-space: normal;
  }

  /* Auth checkboxes: keep label readable next to box */
  .sf-auth label,
  .sf-auth .fill_age,
  .sf-auth .i_checkbox {
    overflow-wrap: anywhere;
    word-break: normal;
    line-height: 1.4;
  }

  /* Age gate */
  .sf-age-gate {
    padding: 1rem !important;
    align-items: center;
  }

  .sf-age-gate__panel {
    width: 100%;
    max-width: 22rem;
  }

  .sf-age-gate__title {
    font-size: 1.2rem !important;
    line-height: 1.25;
  }

  .sf-age-gate__text {
    font-size: 0.92rem;
    line-height: 1.45;
  }

  .sf-age-gate__actions {
    flex-direction: column;
    width: 100%;
  }

  .sf-age-gate__actions .sf-btn,
  .sf-age-gate__actions a {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Tables / wide legacy blocks */
  .table_wrapper,
  .table-wrapper,
  table {
    max-width: 100%;
  }

  .table_wrapper,
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 430px) {
  .header .i_login,
  .header .i_singup {
    padding: 8px 10px !important;
    font-size: 12px !important;
  }

  .header .sf-brand,
  .header .sf-brand-link,
  .header .i_logo_ {
    max-width: min(52vw, 9rem);
  }
}

@media (max-width: 360px) {
  .sf-top-bar__wallet {
    display: none !important;
  }
}
