/* アプリケーション共通枠、ヘッダー、本文、フッターの配置を定義する。 */
#app {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
}

.skip-link {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2000;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    color: #fff;
    background: var(--color-ink);
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: translateY(0);
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(217, 222, 231, 0.9);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
}

.app-header__inner {
    width: min(calc(100% - 2rem), var(--content-width));
    min-height: 68px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-sm);
}

.brand img {
    display: block;
    width: auto;
    height: 38px;
}

.app-nav {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-nav [aria-current="page"] {
    color: var(--color-primary-strong);
    background: var(--color-primary-soft);
    box-shadow: inset 0 -3px 0 var(--color-primary);
}

.app-main {
    width: min(calc(100% - 2rem), var(--content-width));
    margin: 0 auto;
    padding: clamp(1.5rem, 4vw, 3.5rem) 0 4rem;
}

.app-main:focus {
    outline: 0;
}

.app-footer {
    padding: 2rem 1rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-muted);
    background: #fff;
    text-align: center;
}

.app-footer p {
    margin: 1rem 0 0;
    font-size: 0.86rem;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.25rem 1.25rem;
}

.footer-nav a,
.footer-nav button {
    padding: 0.35rem 0;
    border: 0;
    color: var(--color-muted);
    background: transparent;
    cursor: pointer;
    text-decoration: none;
}

.footer-nav a:hover,
.footer-nav button:hover {
    color: var(--color-primary-strong);
    text-decoration: underline;
}

.boot-mask {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--color-muted);
    background: #fff;
}

.boot-mask__logo {
    width: min(240px, 65vw);
}

.boot-mask__spinner,
.spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--color-primary-soft);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@media (max-width: 640px) {
    .app-header__inner,
    .app-main {
        width: min(calc(100% - 1.25rem), var(--content-width));
    }

    .app-header__inner {
        min-height: auto;
        align-items: stretch;
        flex-direction: column;
        gap: 0.35rem;
        padding: 0.55rem 0 0.45rem;
    }

    .brand {
        align-self: center;
    }

    .brand img {
        height: 30px;
    }

    .app-nav {
        width: 100%;
        justify-content: space-between;
        gap: 0.2rem;
    }

    .app-nav .button {
        min-width: 0;
        flex: 1 1 0;
        min-height: 40px;
        padding: 0.45rem 0.65rem;
    }
}

@media (max-width: 430px) {
    .app-header__inner {
        gap: 0.35rem;
    }

    .brand img {
        height: 28px;
    }

    .app-nav {
        gap: 0.1rem;
    }

    .app-nav .button {
        padding-inline: 0.3rem;
        font-size: 0.82rem;
    }

    .app-nav .button > [aria-hidden="true"] {
        display: none;
    }
}
