@media (max-width: 520px) {
    .network-search {
        flex-wrap: wrap;
        padding: 0 20px;
    }

    .network-search .search-field--list {
        flex-basis: 100%;
        margin-inline: 0;
    }
}

.settings-profile {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin: 20px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: var(--color-surface);
}

.settings-profile > div {
    display: grid;
    line-height: 1.4;
    min-width: 0;
}

.settings-profile > div b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-profile > div span {
    color: var(--color-text-muted);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-profile__logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid rgba(140, 60, 60, .22);
    border-radius: 999px;
    background: rgba(140, 60, 60, .05);
    color: var(--color-tertiary);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform .18s ease, background-color .18s ease, border-color .18s ease, color .18s ease;
}

.settings-profile__logout:hover {
    background: rgba(140, 60, 60, .12);
    border-color: rgba(140, 60, 60, .38);
    color: #702f2f;
    transform: translateY(-1px);
}

.settings-profile__logout .rs-icon {
    width: 16px;
    height: 16px;
}

.settings-group {
    padding: 0 20px 16px;
}

.settings-group .section-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding-bottom: 6px;
}

.settings-group .section-heading h2 {
    margin: 0;
}

.settings-group .section-heading p {
    margin-top: 5px;
    margin-bottom: 0;
    color: var(--color-text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.setting-row__icon {
    display: grid;
    place-items: center;
    width: 35px;
    height: 35px;
    border-radius: 10px;
    background: var(--color-surface-muted);
    color: var(--color-primary-dark);
    font-size: 14px;
    font-weight: 700;
}

.setting-row__icon .rs-icon {
    width: 17px;
    height: 17px;
}

.setting-row__icon--verified,
.match-verified-toggle .setting-row__icon {
    border-radius: 10px;
    background: var(--color-surface-muted);
    color: var(--color-primary-dark);
    box-shadow: none;
}

.setting-row__icon--verified .rs-icon,
.match-verified-toggle .setting-row__icon .rs-icon {
    color: inherit;
    stroke: currentColor;
}

.setting-row--control {
    grid-template-columns: auto 1fr auto;
}

.setting-row > em {
    max-width: 180px;
    text-align: right;
}

.setting-row select {
    max-width: 120px;
    min-height: 38px;
    padding: 0 26px 0 10px;
    border: 1px solid var(--color-border);
    border-radius: 9px;
    background-color: var(--color-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23756a63' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px 14px;
    font-size: 12px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.switch {
    position: relative;
    width: 43px;
    height: 25px;
    margin: 0;
    appearance: none;
    border-radius: 999px;
    background: #d8cfc6;
    transition: background-color .18s ease;
}

.switch::before {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(58, 48, 42, .18);
    content: "";
    transition: transform .18s ease;
}

.switch:checked {
    background: var(--color-primary);
}

.switch:checked::before {
    transform: translateX(18px);
}

.danger-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 40px);
    min-height: 46px;
    margin: 12px 20px;
    border: 1px solid rgba(140, 60, 60, .24);
    border-radius: 999px;
    background: rgba(140, 60, 60, .06);
    color: var(--color-tertiary);
    font-weight: 650;
    cursor: pointer;
    transition: transform .18s ease, background-color .18s ease, color .18s ease;
}

.danger-button:hover {
    background: rgba(140, 60, 60, .14);
    color: #702f2f;
    transform: translateY(-1px);
}

.settings-save-action {
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
}

.app-toast {
    position: fixed;
    z-index: 100000;
    right: 50%;
    bottom: 28px;
    max-width: min(calc(100% - 32px), 380px);
    padding: 11px 16px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 999px;
    background: rgba(52, 45, 41, .92);
    color: #fff;
    box-shadow: 0 12px 34px rgba(35, 29, 25, .22);
    font-size: 12px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translate(50%, 14px);
    transition: opacity .2s ease, transform .2s ease;
}

.app-toast.is-visible {
    opacity: 1;
    transform: translate(50%, 0);
}

@media (max-width: 1099px) {
    .welcome-nav {
        gap: 16px;
    }

    .welcome-hero__grid {
        grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr);
        gap: 38px;
    }

    .welcome-visual {
        min-height: 520px;
    }

    .welcome-float-card--run {
        left: 16px;
    }

    .welcome-float-card--event {
        right: -16px;
    }

    .app-shell {
        grid-template-columns: 190px minmax(0, var(--content-width));
        justify-content: center;
        gap: 22px;
    }

    .context-rail {
        display: none;
    }
}

@media (max-width: 767px) {
    body {
        font-size: 14px;
    }

    .welcome-container {
        width: min(calc(100% - 32px), 640px);
    }

    .welcome-header {
        position: absolute;
    }

    .welcome-header__inner {
        min-height: 68px;
    }

    .welcome-nav,
    .welcome-header__actions .button {
        display: none;
    }

    .welcome-header__actions {
        gap: 0;
    }

    .welcome-login-link {
        display: inline-flex;
        align-items: center;
        min-height: 42px;
        padding: 0 15px;
        border: 1px solid var(--color-border);
        border-radius: 999px;
        background: rgba(255, 253, 249, .7);
        color: var(--color-primary-dark);
    }

    .welcome-hero {
        min-height: auto;
        padding: 112px 0 70px;
        background:
            radial-gradient(circle at 20% 10%, rgba(237, 206, 174, .38), transparent 29%),
            var(--color-background);
    }

    .welcome-hero__grid {
        display: flex;
        flex-direction: column;
        gap: 48px;
    }

    .welcome-hero__copy {
        width: 100%;
    }

    .welcome-hero__copy h1 {
        font-size: clamp(46px, 15vw, 68px);
    }

    .welcome-hero__copy > p {
        margin-top: 20px;
        font-size: 15px;
    }

    .welcome-hero__actions {
        display: grid;
        grid-template-columns: 1fr;
        margin-top: 28px;
    }

    .welcome-trust {
        margin-top: 30px;
    }

    .welcome-visual {
        width: 100%;
        min-height: 520px;
        border-radius: 46% 46% 20px 20px;
    }

    .welcome-float-card--run {
        top: 92px;
        left: 12px;
        min-width: 145px;
    }

    .welcome-float-card--event {
        right: 12px;
        bottom: 48px;
        min-width: 255px;
    }

    .welcome-visual__caption {
        left: 18px;
        font-size: 32px;
    }

    .welcome-feature-section,
    .welcome-journey-section {
        padding: 76px 0;
    }

    .welcome-section-heading {
        display: block;
    }

    .welcome-section-heading h2,
    .welcome-journey__copy h2,
    .welcome-cta h2 {
        font-size: 36px;
    }

    .welcome-section-heading > p {
        margin-top: 18px;
    }

    .welcome-feature-grid {
        grid-template-columns: 1fr;
        margin-top: 34px;
    }

    .welcome-feature-card {
        min-height: 290px;
    }

    .welcome-feature-card__icon {
        margin-bottom: 36px;
    }

    .welcome-journey {
        display: flex;
        flex-direction: column;
        gap: 46px;
    }

    .welcome-journey__visual {
        order: 2;
        width: 100%;
        min-height: 500px;
    }

    .welcome-journey__copy {
        order: 1;
    }

    .welcome-cta-section {
        padding-bottom: 60px;
    }

    .welcome-cta {
        display: grid;
        min-height: 390px;
        padding: 32px 24px;
    }

    .welcome-cta > div:last-child {
        display: grid;
        flex-basis: auto;
    }

    .welcome-footer .welcome-container {
        grid-template-columns: 1fr auto;
    }

    .welcome-footer p {
        display: none;
    }

    .auth-shell {
        display: block;
    }

    .auth-brand {
        display: none;
    }

    .auth-panel {
        justify-content: flex-start;
        min-height: 100dvh;
        padding: 24px 20px 48px;
    }

    .auth-panel::before {
        width: 70px;
        height: 70px;
        margin: 12px auto 24px;
        border-radius: 50%;
        background: url('../media/runscape-mark.svg') center / contain no-repeat;
        content: "";
    }

    .auth-panel > .preview-pill {
        position: absolute;
        top: 16px;
        right: 16px;
    }

    .auth-card__heading {
        margin-bottom: 24px;
        text-align: center;
    }

    .auth-card__heading h1 {
        font-size: 28px;
    }

    .onboarding-shell {
        width: min(100% - 28px, 640px);
    }

    .onboarding-header {
        min-height: 70px;
    }

    .onboarding-card {
        display: block;
        margin-top: 16px;
        padding: 22px 18px;
        border-radius: 20px;
    }

    .onboarding-copy {
        margin-bottom: 28px;
    }

    .onboarding-copy h1 {
        font-size: 31px;
    }

    .choice-grid--three {
        grid-template-columns: 1fr;
    }

    .app-body {
        background: var(--color-surface);
    }

    .app-shell {
        display: block;
        width: 100%;
        height: calc(100vh - var(--mobile-bottom-nav-height) - env(safe-area-inset-bottom, 0px));
        height: calc(100dvh - var(--mobile-bottom-nav-height) - env(safe-area-inset-bottom, 0px));
        min-height: 0;
    }

    .side-nav,
    .context-rail {
        display: none;
    }

    .main-column {
        height: 100%;
        border: 0;
        background: var(--color-surface);
    }

    #runscape-app-navigation.appnav {
        height: 100%;
        min-height: 0;
    }

    .top-bar {
        min-height: 58px;
        padding: 7px 14px;
    }

    .top-bar h1 {
        font-size: 17px;
    }

    .top-bar .icon-button {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }

    .page-content {
        min-height: calc(100dvh - 58px - var(--mobile-bottom-nav-height) - env(safe-area-inset-bottom, 0px));
        padding-bottom: 0;
    }

    .appnav-page {
        scroll-padding-bottom: 0;
    }

    .bottom-nav {
        position: fixed;
        z-index: 50;
        right: 0;
        bottom: 0;
        left: 0;
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        min-height: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom, 0px));
        padding-top: 6px;
        padding-right: 12px;
        padding-right: max(12px, env(safe-area-inset-right, 0px));
        padding-bottom: 10px;
        padding-bottom: max(10px, calc(6px + env(safe-area-inset-bottom, 0px)));
        padding-left: 12px;
        padding-left: max(12px, env(safe-area-inset-left, 0px));
        border-top: 1px solid var(--color-border);
        background: rgba(255, 253, 249, .95);
        backdrop-filter: blur(18px);
        box-sizing: border-box;
    }

    .bottom-nav a {
        position: relative;
        display: grid;
        place-items: center;
        align-content: center;
        gap: 2px;
        min-width: 0;
        min-height: 50px;
        color: var(--color-text-muted);
        font-size: 10px;
        font-weight: 600;
        text-decoration: none;
        user-select: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav .rs-icon {
        width: 21px;
        height: 21px;
    }

    .bottom-nav a.is-active {
        color: var(--color-primary);
    }

    .bottom-nav .notification-badge {
        position: absolute;
        top: 2px;
        left: calc(50% + 4px);
        min-width: 17px;
        height: 17px;
        margin: 0;
        padding: 0 4px;
        font-size: 9px;
    }

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

    .post-card,
    .composer-page {
        padding-inline: 16px;
    }

    .feed-intro,
    .discovery-controls,
    .discovery-section,
    .comments-section,
    .content-section,
    .detail-summary,
    .tour-price-bar,
    .profile-main,
    .form-section,
    .settings-group {
        padding-inline: 16px;
    }

    .placeholder-photo__caption {
        font-size: 34px;
    }

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

    .event-card {
        display: grid;
        grid-template-columns: 42% 1fr;
    }

    .event-card__visual {
        min-height: 190px;
        aspect-ratio: auto;
    }

    .event-card__body h3 {
        min-height: 0;
    }

    .tour-card {
        grid-template-columns: 40% 1fr;
    }

    .tour-card__visual,
    .tour-card {
        min-height: 200px;
    }

    .tour-card__body {
        padding: 14px;
    }

    .tour-card__body h3 {
        font-size: 15px;
    }

    .detail-hero {
        min-height: 360px;
    }

    .detail-hero__overlay {
        right: 18px;
        bottom: 24px;
        left: 18px;
    }

    .detail-hero__overlay h2 {
        font-size: 40px;
    }

    .detail-hero__date {
        top: 18px;
        right: 18px;
        width: 68px;
        height: 76px;
    }

    .detail-hero__date b {
        font-size: 32px;
    }

    .detail-summary,
    .tour-price-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .save-button,
    .tour-price-bar > .button {
        width: 100%;
    }

    .profile-cover {
        height: 158px;
    }

    .profile-avatar-wrap {
        height: 52px;
    }

    .profile-stats {
        gap: 16px;
    }

    .settings-profile {
        margin-inline: 16px;
    }

    .search-field--list {
        margin-inline: 16px;
    }

    .people-list {
        padding-inline: 16px;
    }

    .detail-cta,
    .sticky-form-action,
    .comment-composer {
        bottom: 0;
    }

    .profile-edit-form > .sticky-form-action {
        margin-inline: 0;
        padding-inline: 16px;
    }

    .app-toast {
        bottom: calc(var(--mobile-bottom-nav-height) + 14px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 479px) {
    .welcome-hero__copy h1 {
        font-size: 49px;
    }

    .welcome-visual {
        min-height: 470px;
    }

    .welcome-visual__sun {
        top: 64px;
        right: 38px;
        width: 88px;
        height: 88px;
    }

    .welcome-float-card--run {
        top: 78px;
        left: 10px;
    }

    .welcome-float-card--event {
        right: 10px;
        bottom: 34px;
        min-width: 245px;
    }

    .welcome-feature-card {
        padding: 24px;
    }

    .welcome-journey__visual {
        min-height: 430px;
    }

    .welcome-footer .welcome-container {
        display: grid;
        grid-template-columns: 1fr;
    }

    .welcome-footer > div > small {
        margin-top: 4px;
    }

    .brand img {
        width: 34px;
        height: 34px;
    }

    .onboarding-header .preview-pill {
        max-width: 96px;
        overflow: hidden;
        white-space: nowrap;
    }

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

    .event-inline {
        grid-template-columns: 104px 1fr;
    }

    .event-card,
    .tour-card {
        display: flex;
        flex-direction: column;
    }

    .event-card__visual,
    .tour-card__visual {
        min-height: 190px;
    }

    .distance-cards,
    .inclusion-grid {
        grid-template-columns: 1fr;
    }

    .detail-facts {
        display: grid;
        gap: 13px;
    }

    .route-preview {
        grid-template-columns: 82px 1fr;
    }

    .organizer-row {
        grid-template-columns: 1fr auto;
    }

    .organizer-row .text-button {
        grid-column: 2;
        justify-self: start;
    }

    .detail-cta {
        gap: 8px;
    }

    .detail-cta .button {
        padding-inline: 13px;
        font-size: 12px;
    }

    .departure-card {
        grid-template-columns: 91px 1fr auto;
        gap: 8px;
        padding-inline: 10px;
    }

    .bookmark-filter {
        padding: 10px 16px;
        gap: 8px;
    }

    .bookmark-filter .filter-chip {
        min-height: 32px;
        height: 32px;
        padding: 0 14px;
        font-size: 12px;
    }

    .saved-card {
        grid-template-columns: 96px 1fr auto;
        gap: 12px;
        padding: 14px 16px;
    }

    .saved-card__visual {
        height: 76px;
        min-height: 76px;
    }

    .profile-header-aside {
        right: 16px;
    }

    .profile-stats {
        gap: 14px;
    }

    .profile-actions {
        right: 16px;
    }

    .profile-stats--own {
        right: 16px;
        gap: 14px;
    }

    .top-bar__profile-edit {
        gap: 5px;
        padding-inline: 10px;
        font-size: 12px;
    }

    .top-bar__profile-edit .rs-icon {
        width: 16px;
        height: 16px;
    }

    .profile-post {
        grid-template-columns: minmax(0, 100px) minmax(0, 1fr);
        gap: 12px;
        padding-inline: 16px;
    }

    .saved-card {
        grid-template-columns: 94px 1fr auto;
        gap: 10px;
        padding-inline: 16px;
    }

    .saved-card__visual {
        min-height: 82px;
    }

    .person-row .button {
        min-width: 68px;
        padding-inline: 10px;
    }

    .settings-profile {
        grid-template-columns: auto minmax(0, 1fr) auto;
        padding: 12px 14px;
        gap: 10px;
    }

    .sticky-form-action {
        padding: 12px 16px;
    }

    .sticky-form-action > span {
        display: none;
    }

    .sticky-form-action .button {
        width: 100%;
    }

    .profile-cropper {
        width: calc(100% - 20px);
        max-height: calc(100dvh - 20px);
        border-radius: 18px;
    }

    .profile-cropper__panel {
        max-height: calc(100dvh - 20px);
        padding: 16px;
    }

    .profile-cropper__actions .button {
        flex: 1;
        padding-inline: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

