:root {
    --app-brand-ink: #212c32;
    --app-brand-lime: #b8ff00;
    --app-surface: #ffffff;
    --app-canvas: #f4f7f8;
    --app-border: #e4e9ec;
    --app-muted: #748087;
    --app-shadow: 0 12px 30px rgba(33, 44, 50, 0.12);
}

app-component,
default-layout {
    display: block;
    min-height: 100vh;
}

.app-boot-shell {
    min-height: 100vh;
    background: var(--app-surface);
}

.app-layout-pending {
    opacity: 0;
    pointer-events: none;
}

.app-layout-ready {
    animation: app-page-fade-in 220ms ease-out both;
}

.app-loading-overlay {
    position: fixed;
    z-index: 12000;
    inset: 0;
    display: flex;
    box-sizing: border-box;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
    background: var(--app-surface);
    color: #526575;
    font-size: 13px;
    opacity: 1;
    transition: opacity 180ms ease-out;
    will-change: opacity;
}

.app-loading-overlay p {
    margin: 14px 0 0;
}

.app-loading-overlay p:empty {
    display: none;
}

.app-loading-spinner {
    width: 40px;
    height: 40px;
    box-sizing: border-box;
    border: 4px solid #d9e2ec;
    border-top-color: #212c32;
    border-radius: 50%;
    animation: app-loading-spin 800ms linear infinite;
}

.app-loading-overlay-complete {
    opacity: 0;
    pointer-events: none;
}

.app-loading-failed .app-loading-spinner {
    display: none;
}

.app-boot-brand-mark {
    display: flex;
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(184, 255, 0, 0.5);
    border-radius: 16px;
    margin-bottom: 10px;
    background: var(--app-brand-ink);
    box-shadow: 0 10px 24px rgba(33, 44, 50, 0.16);
    color: var(--app-brand-lime);
    font-size: 24px;
    font-weight: 900;
}

.app-load-retry {
    min-width: 112px;
    min-height: 42px;
    border: 0;
    border-radius: 12px;
    margin-top: 10px;
    background: var(--app-brand-ink);
    color: var(--app-brand-lime);
    font-size: 14px;
    font-weight: 800;
}

.app-load-retry[hidden] {
    display: none;
}

default-layout:empty,
default-layout main-content:empty {
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    background: var(--app-canvas);
    color: var(--app-muted);
}

default-layout:empty {
    min-height: 100vh;
}

default-layout main-content:empty {
    min-height: calc(100vh - 100px);
}

default-layout:empty::before,
default-layout main-content:empty::before {
    display: block;
    width: 40px;
    height: 40px;
    box-sizing: border-box;
    border: 4px solid #d9e2ec;
    border-top-color: #212c32;
    border-radius: 50%;
    margin-bottom: 10px;
    content: '';
    animation: app-loading-spin 800ms linear infinite;
}

default-layout:empty::after,
default-layout main-content:empty::after {
    content: '화면을 불러오고 있어요.';
    font-size: 13px;
}

@keyframes app-loading-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes app-page-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.app-content-load-failure {
    display: flex;
    min-height: calc(100vh - 100px);
    align-items: center;
    flex-direction: column;
    justify-content: center;
    background: var(--app-canvas);
    color: var(--app-muted);
    text-align: center;
}

.header,
.business-header,
.admin-header {
    box-sizing: border-box;
}

:where(a, button, [role='button'], [data-interactive], .list-row, .hof-item) {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

:where(a, button, [role='button'], [data-interactive]) {
    transition: transform 90ms ease, background-color 140ms ease,
        border-color 140ms ease, box-shadow 140ms ease;
}

:where(a, button, [role='button'], [data-interactive]).app-pressed {
    transform: scale(0.98);
}

.list-row.app-pressed,
.hof-item.app-pressed {
    background-color: #eaf2f3 !important;
    transform: none;
}

:where(button, [role='button'])[disabled],
:where(button, [role='button'])[aria-disabled='true'] {
    cursor: not-allowed;
    opacity: 0.52;
}

.app-button-pending {
    position: relative;
    cursor: progress;
}

.app-button-pending::before {
    width: 14px;
    height: 14px;
    box-sizing: border-box;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    margin-right: 8px;
    content: '';
    animation: app-button-spin 700ms linear infinite;
}

:where(a, button, [role='button'], [data-interactive]):focus-visible {
    outline: 3px solid rgba(40, 116, 240, 0.36);
    outline-offset: 2px;
}

.main-navigation-shell {
    height: 40px;
    background: var(--app-surface);
}

.main-navigation {
    display: flex;
    height: 40px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.main-navigation-item {
    min-width: 0;
    flex: 1 1 0;
}

.main-navigation-link,
.main-navigation-link:visited {
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: #68747b;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
}

.main-navigation-link::after {
    position: absolute;
    right: 20%;
    bottom: -1px;
    left: 20%;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: var(--app-brand-ink);
    content: '';
    opacity: 0;
    transform: scaleX(0.4);
    transition: opacity 160ms ease, transform 160ms ease;
}

.main-navigation-link.main-menu-selected,
.main-navigation-link.main-menu-selected:visited {
    color: var(--app-brand-ink);
    font-weight: 800;
}

.main-navigation-link.main-menu-selected::after {
    opacity: 1;
    transform: scaleX(1);
}

body.app-overlay-open {
    overflow: hidden;
}

body.app-overlay-open main-content {
    overflow: hidden;
}

.app-toast-region {
    position: fixed;
    z-index: 10000;
    right: 16px;
    bottom: 20px;
    left: 16px;
    display: flex;
    pointer-events: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.app-toast {
    display: flex;
    width: fit-content;
    max-width: min(520px, 100%);
    min-height: 46px;
    box-sizing: border-box;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    background: rgba(33, 44, 50, 0.96);
    box-shadow: 0 14px 38px rgba(15, 23, 42, 0.28);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(12px);
    transition: transform 180ms ease, opacity 180ms ease;
}

.app-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.app-toast--success {
    border-color: rgba(184, 255, 0, 0.4);
}

.app-toast--error {
    background: rgba(153, 27, 27, 0.97);
}

.app-toast-action {
    min-height: 36px;
    padding: 0 8px;
    border: 0;
    background: transparent;
    color: var(--app-brand-lime);
    font-weight: 800;
}

.user-home-main {
    right: 0;
    left: 0;
    box-sizing: border-box;
    width: calc(100% - 20px);
    max-width: 980px;
    margin: 0 auto;
}

.user-home-main > top-notice {
    --user-home-card-reserved-height: 132px;
}

.user-home-main > my-reservation {
    --user-home-card-reserved-height: 190px;
}

.user-home-main > my-badge {
    --user-home-card-reserved-height: 140px;
}

.user-home-main > hall-of-fame-scroll {
    --user-home-card-reserved-height: 166px;
}

.user-home-main > my-attendance {
    --user-home-card-reserved-height: 286px;
}

.user-home-main > my-courses {
    --user-home-card-reserved-height: 170px;
}

.user-home-main > top-notice,
.user-home-main > my-reservation,
.user-home-main > my-badge,
.user-home-main > hall-of-fame-scroll,
.user-home-main > my-attendance,
.user-home-main > my-courses {
    display: block;
    min-height: var(--user-home-card-reserved-height);
    box-sizing: border-box;
    padding: 17px;
    border: 1px solid var(--app-border);
    border-radius: 18px;
    margin-bottom: 14px;
    background: #ffffff;
    box-shadow: 0 5px 18px rgba(33, 44, 50, 0.055);
}

.user-home-main > my-experience {
    display: block;
    min-height: 124px;
}

.user-home-main > my-experience[hidden] {
    display: none;
    min-height: 0;
}

.user-home-main > my-experience .xp-card {
    border-radius: 18px;
    margin-bottom: 14px;
    box-shadow: 0 5px 18px rgba(33, 44, 50, 0.055);
}

.user-home-main .my-container,
.user-home-main .my-reservation-header {
    margin-top: 0;
}

.user-home-main .subtitle1 {
    color: var(--app-brand-ink);
}

.user-home-main .reservation-cta-button {
    min-height: 44px;
}

.user-home-main .list-row {
    cursor: pointer;
}

@keyframes app-button-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 760px) {
    body {
        overscroll-behavior-y: contain;
    }

    main-navigation {
        position: relative;
        z-index: 200;
        height: 48px;
    }

    .main-navigation-shell {
        height: 48px;
        box-sizing: border-box;
        overflow: hidden;
        border-bottom: 1px solid rgba(33, 44, 50, 0.1);
        background: rgba(255, 255, 255, 0.97);
        box-shadow: 0 6px 18px rgba(33, 44, 50, 0.06);
        backdrop-filter: blur(18px);
    }

    .main-navigation {
        display: flex;
        height: 48px;
        align-items: stretch;
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        border: 0;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .main-navigation::-webkit-scrollbar {
        display: none;
    }

    .main-navigation > .main-navigation-item {
        display: block;
        min-width: 68px;
        height: 48px;
        flex: 0 0 auto;
        line-height: normal;
        scroll-snap-align: center;
    }

    .main-navigation .main-navigation-link {
        min-width: 68px;
        padding: 0 8px;
        color: #748087;
        font-size: 13px;
        white-space: nowrap;
    }

    .main-navigation .main-navigation-link::after {
        right: 8px;
        bottom: 0;
        left: 8px;
        height: 3px;
        border-radius: 999px 999px 0 0;
        background: var(--app-brand-ink);
    }

    .main-navigation .main-navigation-link.main-menu-selected {
        color: var(--app-brand-ink);
    }

    default-layout main-content {
        top: 108px;
        bottom: 0;
        box-sizing: border-box;
        padding: 12px 10px calc(24px + env(safe-area-inset-bottom));
        background: var(--app-surface);
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }

    .app-boot-content {
        top: 108px;
        padding-bottom: env(safe-area-inset-bottom);
    }

    default-layout main-content:empty,
    .app-content-load-failure {
        min-height: calc(100vh - 108px - env(safe-area-inset-bottom));
    }

    .app-toast-region {
        bottom: calc(18px + env(safe-area-inset-bottom));
    }

    default-layout main-content.user-home-main {
        right: 0;
        left: 0;
        width: 100%;
        max-width: none;
        margin: 0;
        background: var(--app-canvas);
    }

    .user-home-main > top-notice,
    .user-home-main > my-reservation,
    .user-home-main > my-badge,
    .user-home-main > hall-of-fame-scroll,
    .user-home-main > my-attendance,
    .user-home-main > my-courses {
        padding: 15px 13px;
        border-radius: 17px;
    }

    .user-home-main .list table {
        font-size: 13px;
    }

    default-layout button,
    default-layout [role='button'] {
        min-height: 44px;
    }

    body.login-background-page default-layout main-content,
    body.owner-signup-background-page default-layout main-content,
    body.gym-add-background-page default-layout main-content {
        top: 60px;
        bottom: 0;
    }
}

@media (display-mode: standalone) and (max-width: 760px) {
    .header {
        height: calc(60px + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
    }

    default-layout main-content {
        top: calc(108px + env(safe-area-inset-top));
    }

    .app-boot-header {
        height: calc(60px + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
    }

    .app-boot-content {
        top: calc(108px + env(safe-area-inset-top));
    }

    body.login-background-page default-layout main-content,
    body.owner-signup-background-page default-layout main-content,
    body.gym-add-background-page default-layout main-content {
        top: calc(60px + env(safe-area-inset-top));
    }
}

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