body {
    margin: 0;
    min-height: 100vh;
    font-family: "Inter", "Hiragino Sans", "Yu Gothic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(180deg, #f6f9ff 0%, #ffffff 48%, #fff8f2 100%);
    color: #102a43;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

:root {
    --nav-offset: 72px;
}

h1 {
    font-size: clamp(1.9rem, 3.6vw, 2.8rem);
}

h2 {
    font-size: clamp(1.45rem, 3vw, 2.1rem);
}

h3 {
    font-size: clamp(1.2rem, 2.2vw, 1.6rem);
}

h4 {
    font-size: clamp(1.05rem, 1.8vw, 1.3rem);
}

h5 {
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
}

h6 {
    font-size: clamp(0.85rem, 1.4vw, 1rem);
}

body::before,
body::after {
    content: "";
    position: fixed;
    pointer-events: none;
    z-index: -1;
    border-radius: 50%;
}

body::before {
    width: 540px;
    height: 540px;
    top: -200px;
    left: -160px;
    background: radial-gradient(circle at 50% 50%, rgba(103, 178, 255, 0.24) 0%, rgba(103, 178, 255, 0) 68%);
    filter: blur(0);
}

body::after {
    width: 620px;
    height: 620px;
    bottom: -260px;
    right: -200px;
    background: radial-gradient(circle at 50% 50%, rgba(255, 180, 130, 0.2) 0%, rgba(255, 180, 130, 0) 70%);
}

.navbar {
    z-index: 1050;
    position: relative;
}

#landing-page {
    display: none;
    padding: 4rem 0 6rem;
}

#article-page {
    display: none;
}

.mode-landing #landing-page {
    display: block;
}

.mode-landing #article-page {
    display: none;
}

.mode-article #landing-page {
    display: none;
}

.mode-article #article-page {
    display: flex;
}

.landing {
    position: relative;
    overflow: hidden;
}

.landing::before,
.landing::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    z-index: -1;
}

.landing::before {
    width: 480px;
    height: 480px;
    top: -120px;
    right: -160px;
    background: radial-gradient(circle at 50% 50%, rgba(103, 178, 255, 0.22) 0%, rgba(103, 178, 255, 0) 70%);
}

.landing::after {
    width: 560px;
    height: 560px;
    bottom: -220px;
    left: -180px;
    background: radial-gradient(circle at 50% 50%, rgba(255, 180, 130, 0.18) 0%, rgba(255, 180, 130, 0) 70%);
}

.landing-hero {
    position: relative;
    z-index: 1;
}

.landing-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #0b2948;
    background: rgba(255, 255, 255, 0.65);
    box-shadow: 0 10px 28px -22px rgba(12, 30, 54, 0.75);
}

.landing-title {
    font-size: clamp(2rem, 2.8vw, 2.9rem);
    font-weight: 800;
    letter-spacing: 0.01em;
    margin-top: 1.6rem;
    margin-bottom: 1rem;
    color: #0b2948;
}

.landing-lead {
    font-size: 0.98rem;
    color: #29496b;
    max-width: 600px;
    margin-bottom: 1.8rem;
}

.landing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

a.landing-primary,
a.landing-primary:visited,
a.landing-primary:active {
    color: #fff;
}

.landing-primary {
    background: linear-gradient(120deg, #2196f3, #9c27b0);
    border: none;
    padding: 0.75rem 1.8rem;
    border-radius: 999px;
    box-shadow: 0 22px 40px -30px rgba(12, 30, 54, 0.85);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.landing-primary:hover,
.landing-primary:focus {
    transform: translateY(-1px);
    box-shadow: 0 26px 52px -30px rgba(12, 30, 54, 0.9);
    color: #fff;
}

.landing-ghost {
    border-radius: 999px;
    border: 1px solid rgba(11, 41, 72, 0.12);
    padding: 0.75rem 1.8rem;
    background: rgba(255, 255, 255, 0.7);
    color: #0b2948;
    backdrop-filter: blur(8px);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border 0.25s ease;
}

.landing-ghost:hover,
.landing-ghost:focus {
    transform: translateY(-1px);
    border-color: rgba(33, 150, 243, 0.35);
    box-shadow: 0 18px 30px -24px rgba(12, 30, 54, 0.35);
}

.landing-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: #0b2948;
}

.landing-meta-item {
    padding: 0.85rem 1.2rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(11, 41, 72, 0.08);
    min-width: 140px;
    box-shadow: 0 20px 36px -32px rgba(12, 30, 54, 0.8);
}

.landing-meta-item .label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(11, 41, 72, 0.65);
    margin-bottom: 0.35rem;
}

.landing-meta-item .value {
    font-weight: 700;
    font-size: 1rem;
}

.landing-visual {
    border-radius: 24px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(227, 242, 253, 0.7));
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 30px 60px -40px rgba(12, 30, 54, 0.85);
    overflow: hidden;
    padding: 1.8rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.visual-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1.2rem;
}

.visual-header .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(33, 150, 243, 0.75);
    box-shadow: 0 0 12px rgba(33, 150, 243, 0.35);
}

.visual-header .dot:nth-child(2) {
    background: rgba(156, 39, 176, 0.75);
    box-shadow: 0 0 12px rgba(156, 39, 176, 0.28);
}

.visual-header .dot:nth-child(3) {
    background: rgba(255, 171, 0, 0.75);
    box-shadow: 0 0 12px rgba(255, 171, 0, 0.32);
}

.visual-header .caption {
    margin-left: auto;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(11, 41, 72, 0.6);
}

.visual-body {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.visual-card {
    border-radius: 18px;
    padding: 1.25rem 1.4rem;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(11, 41, 72, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.visual-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(11, 41, 72, 0.6);
    margin-bottom: 0.6rem;
}

.visual-list {
    margin: 0;
    padding-left: 1.2rem;
    color: #102a43;
}

.visual-copy {
    margin: 0;
    color: #2e4c6d;
    line-height: 1.5;
}

.landing-features {
    position: relative;
    z-index: 1;
}

.feature-card {
    height: 100%;
    border-radius: 22px;
    padding: 2rem 1.6rem;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(227, 242, 253, 0.75));
    border: 1px solid rgba(11, 41, 72, 0.06);
    box-shadow: 0 28px 52px -38px rgba(12, 30, 54, 0.8);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.feature-card:hover,
.feature-card:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 32px 60px -36px rgba(12, 30, 54, 0.88);
}

.feature-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.85), rgba(156, 39, 176, 0.85));
    color: #fff;
    font-weight: 700;
    margin-bottom: 1.2rem;
}

.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    color: #0b2948;
}

.feature-card p {
    margin: 0;
    color: #2e4c6d;
}

.landing-flow {
    position: relative;
    z-index: 1;
}

.flow-card {
    border-radius: 26px;
    padding: 3rem 2.5rem;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(244, 250, 255, 0.9));
    border: 1px solid rgba(11, 41, 72, 0.08);
    box-shadow: 0 35px 60px -40px rgba(12, 30, 54, 0.82);
}

.flow-card h3 {
    font-weight: 700;
    color: #0b2948;
    margin-bottom: 2rem;
}

.flow-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.8rem;
}

.flow-step {
    padding: 1.5rem 1.4rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(11, 41, 72, 0.06);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.flow-step .number {
    display: inline-block;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    color: rgba(11, 41, 72, 0.65);
}

.flow-step h4 {
    margin-bottom: 0.65rem;
    font-weight: 700;
    color: #0b2948;
}

.flow-step p {
    margin: 0;
    color: #2e4c6d;
}

.landing-bottom {
    position: relative;
    z-index: 1;
}

.bottom-card {
    border-radius: 28px;
    padding: 3rem 2.8rem;
    background: linear-gradient(150deg, rgba(33, 150, 243, 0.16), rgba(156, 39, 176, 0.12));
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
    align-items: center;
    text-align: center;
    box-shadow: 0 32px 64px -42px rgba(12, 30, 54, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.bottom-copy {
    margin: 0;
    max-width: 640px;
    font-size: 0.98rem;
    color: #0b2948;
}

.fancy-nav {
    position: sticky;
    top: 0;
    z-index: 1200;
    background: linear-gradient(120deg, rgba(227, 242, 253, 0.85) 0%, rgba(252, 235, 248, 0.92) 50%, rgba(255, 249, 219, 0.9) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 18px 30px -25px rgba(13, 30, 53, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

@supports not ((backdrop-filter: blur(12px))) {
    .fancy-nav {
        background: linear-gradient(120deg, #e3f2fd 0%, #fcebf8 50%, #fff9db 100%);
    }
}

.fancy-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #0b2948;
    text-shadow: 0 4px 18px rgba(11, 41, 72, 0.22);
    transition: transform 0.3s ease, text-shadow 0.3s ease;
    font-size: clamp(1rem, 2.1vw, 1.25rem);
    line-height: 1;
    white-space: nowrap;
}

.fancy-brand .brand-short {
    display: none;
}

.fancy-brand:hover,
.fancy-brand:focus {
    color: #0b2948;
    transform: translateY(-1px);
    text-shadow: 0 10px 30px rgba(11, 41, 72, 0.35);
}

.fancy-nav .navbar-toggler {
    border: none;
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 14px 28px -24px rgba(12, 30, 54, 0.85);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.fancy-nav .navbar-toggler:hover,
.fancy-nav .navbar-toggler:focus {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.75);
    box-shadow: 0 18px 36px -24px rgba(12, 30, 54, 0.9);
}

.fancy-nav .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba(11,41,72,0.85)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

.navbar .container-fluid {
    flex-wrap: nowrap;
}

@media (max-width: 575.98px) {
    .fancy-brand {
        font-size: 0.98rem;
    }
}

@media (max-width: 420px) {
    .fancy-brand {
        font-size: 0.95rem;
        letter-spacing: 0.02em;
    }

    .navbar-brand.mx-3 {
        margin-left: 0.5rem !important;
        margin-right: 0.5rem !important;
    }

    .fancy-brand .brand-long {
        display: none;
    }

    .fancy-brand .brand-short {
        display: inline;
    }
}

.fancy-link {
    position: relative;
    margin: 0 1rem;
    padding: 0.6rem 0;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #15395f !important;
    transition: color 0.3s ease, transform 0.3s ease;
}

.fancy-link::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0.25rem;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.8), rgba(156, 39, 176, 0.9));
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.3s ease;
}

.fancy-link:hover,
.fancy-link:focus {
    color: #0b2948 !important;
    transform: translateY(-1px);
}

.fancy-link:hover::after,
.fancy-link:focus::after {
    transform: scaleX(1);
}

.fancy-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 0.25rem rgba(33, 150, 243, 0.35);
    border-radius: 999px;
}

.navbar-nav .nav-link {
    font-size: 0.8rem;
}

.toc-card {
    border: 1px solid rgba(13, 41, 72, 0.08);
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.95) 0%, rgba(229, 242, 253, 0.92) 45%, rgba(255, 244, 252, 0.94) 100%);
    box-shadow: 0 28px 42px -38px rgba(12, 30, 54, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.toc-card-body {
    overflow-y: auto;
    max-height: calc(100vh - 160px);
    scrollbar-width: thin;
    /* Firefox */
    scrollbar-color: rgba(100, 100, 100, 0.3) transparent;
    /* Firefox */
}

@supports not ((backdrop-filter: blur(14px))) {
    .toc-card {
        background: linear-gradient(155deg, #ffffff 0%, #e5f2fd 45%, #fff4fc 100%);
    }
}

.toc-card-header {
    border-bottom: 1px solid rgba(13, 41, 72, 0.08);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(232, 243, 255, 0.75));
    color: #0b2948;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.toc-card-header h5 {
    font-size: 0.85rem;
}

.toc-card-body {
    background: transparent;
    padding: 1.2rem 1.25rem;
    overflow-y: auto;
    max-height: calc(100vh - 100px);
    /* 上下の余白やヘッダー分を考慮 */
}

.content-shell {
    position: relative;
    z-index: 1;
}

.content-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 32px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.75), rgba(227, 242, 253, 0.25));
    filter: blur(45px);
    z-index: 0;
}

.content-card {
    position: relative;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.95) 0%, rgba(244, 250, 255, 0.95) 70%, rgba(255, 249, 237, 0.9) 100%);
    border-radius: 26px;
    border: 1px solid rgba(13, 41, 72, 0.06);
    box-shadow: 0 28px 60px -45px rgba(12, 30, 54, 0.75);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 2.5rem 3rem;
}

.content-card::after {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    pointer-events: none;
}

.content-card h1,
.content-card h2,
.content-card h3,
.content-card h4,
.content-card h5,
.content-card h6 {
    color: #0b2948;
    letter-spacing: 0.01em;
}

#article-toc {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#article-toc a {
    position: relative;
    display: block;
    padding: 0.55rem 0.75rem 0.55rem 2rem;
    color: #14324f;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: inset 0 0 0 1px rgba(13, 41, 72, 0.05);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 100%;
}

#article-toc a::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%) scale(0.75);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

#article-toc a.toc-h1::before {
    background: linear-gradient(120deg, rgba(255, 171, 0, 0.85), rgba(233, 30, 99, 0.85));
    box-shadow: 0 0 8px rgba(255, 111, 0, 0.28);
}

#article-toc a.toc-h2::before {
    background: linear-gradient(120deg, rgba(33, 150, 243, 0.9), rgba(156, 39, 176, 0.85));
    box-shadow: 0 0 8px rgba(33, 150, 243, 0.35);
}

#article-toc a:hover,
#article-toc a:focus {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 0 0 1px rgba(33, 150, 243, 0.25), 0 12px 24px -22px rgba(13, 41, 72, 0.75);
}

#article-toc a:hover::before,
#article-toc a:focus::before {
    transform: translateY(-50%) scale(1);
}

#article-toc a.toc-h1:hover::before,
#article-toc a.toc-h1:focus::before {
    box-shadow: 0 0 10px rgba(156, 39, 176, 0.45);
}

#article-toc a.toc-h2:hover::before,
#article-toc a.toc-h2:focus::before {
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.42);
}

#article-toc a:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(33, 150, 243, 0.45), 0 0 0 0.25rem rgba(33, 150, 243, 0.25);
}

#article-toc a.toc-h1 {
    font-weight: 700;
}

#article-toc a.toc-h2 {
    font-weight: 500;
    font-size: 0.8rem;
    opacity: 0.9;
    padding-left: 2.75rem;
}

#article-toc a.toc-h2::before {
    left: 2rem;
}

#content {
    color: #102a43;
    font-size: 0.98rem;
    letter-spacing: 0.01em;
}

#content .loading {
    color: #0b2948;
    font-weight: 600;
}

#content p {
    margin: 1em 0;
}

#content a {
    color: #1f5bd6;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(31, 91, 214, 0.35);
    transition: color 0.25s ease, border-color 0.25s ease;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

#content a:hover,
#content a:focus {
    color: #17449a;
    border-bottom-color: rgba(23, 68, 154, 0.75);
}

#content ul,
#content ol {
    padding-left: 1.35rem;
    margin: 1.1rem 0;
    background: rgba(255, 255, 255, 0.5);
    border-left: 3px solid rgba(33, 150, 243, 0.2);
    border-radius: 12px;
    padding-right: 0.85rem;
}

#content li+li {
    margin-top: 0.55rem;
}

#content blockquote {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    border-radius: 20px;
    background: linear-gradient(120deg, rgba(227, 242, 253, 0.9), rgba(255, 249, 237, 0.85));
    border-left: 5px solid rgba(156, 39, 176, 0.35);
    color: #0b2948;
    box-shadow: 0 22px 38px -35px rgba(12, 30, 54, 0.82);
}

#content img {
    max-width: 100%;
    margin: 0.5rem 0 1.5rem 0;
    border-radius: 18px;
    box-shadow: 0 18px 38px -30px rgba(12, 30, 54, 0.65);
}

#content table {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    table-layout: auto;
}

.table-scroll {
    margin: 1.6rem 0;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 24px 42px -36px rgba(12, 30, 54, 0.8);
    position: relative;
}

.table-scroll-inner {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: inherit;
    padding: 0.5rem 0.75rem;
}

.table-scroll-inner table {
    width: max-content;
    min-width: 100%;
    margin: 0;
}

.table-scroll-inner::-webkit-scrollbar {
    height: 8px;
}

.table-scroll-inner::-webkit-scrollbar-thumb {
    background: rgba(33, 150, 243, 0.35);
    border-radius: 999px;
}

#content thead {
    background: linear-gradient(120deg, rgba(227, 242, 253, 0.9), rgba(255, 249, 237, 0.9));
}

#content th,
#content td {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid rgba(16, 42, 67, 0.08);
    text-align: left;
}

#content tr:last-child td {
    border-bottom: none;
}

.layout {
    display: flex;
    gap: 1.5rem;
    padding: 2.5rem 1rem 4rem;
}

@media (min-width: 992px) {
    .layout {
        align-items: flex-start;
        width: min(100%, 1120px);
        max-width: 1120px;
        margin: 0 auto;
        box-sizing: border-box;
        padding-left: 0;
        padding-right: 0;
    }

    .layout-spacer {
        display: none;
    }

    .layout-toc {
        flex: 2 1 0;
        min-width: 240px;
    }

    .layout-main {
        flex: 5 1 0;
        min-width: 0;
    }
}

/* サイドパネル */
#toc-panel {
    /* left: 0; */
    /* top: 0; */
    width: 200px;
    height: 100%;
    background-color: #ffffff;
    /* overflow-y: auto; */
    /* position: sticky; */
    border: 1px solid #ddd;
    padding: 10px;
    margin: 10px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    /* transition: transform 0.3s ease; */
    /* transform: translateX(-100%); */
    /* 最初は隠す */
    z-index: 1000;
}

/* ▼スマホ/タブレット（Bootstrap相当でlg未満） */
@media (max-width: 991.98px) {
    body::before {
        width: 360px;
        height: 360px;
        top: -140px;
        left: -140px;
    }

    body::after {
        width: 420px;
        height: 420px;
        bottom: -220px;
        right: -220px;
    }

    .layout {
        flex-direction: column;
        /* 横→縦に */
        padding: 1.5rem 1rem 2.5rem;
    }

    #landing-page {
        padding: 3rem 0 4.5rem;
    }

    .landing-hero .col-lg-7,
    .landing-hero .col-lg-5 {
        text-align: center;
    }

    .landing-actions {
        justify-content: center;
    }

    .landing-meta {
        justify-content: center;
    }

    .landing-meta-item {
        min-width: 120px;
    }

    .visual-body {
        align-items: stretch;
    }

    .flow-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .navbar-nav .fancy-link {
        padding: 0.75rem 0.25rem;
    }

    .navbar-nav .fancy-link::after {
        left: 0.25rem;
        right: auto;
        width: calc(100% - 0.5rem);
        transform-origin: left;
    }

    .layout-spacer {
        display: none;
        /* 余白カラムは非表示 */
    }

    .layout-toc {
        order: 1;
        width: 100%;
        position: static;
        z-index: auto;
        margin-top: 0.5rem;
        margin-bottom: 1.25rem;
    }

    .layout-main {
        order: 2;
    }

    .layout-toc.sticky-top {
        position: static !important;
        top: auto !important;
    }

    .layout-toc .container {
        padding-left: 0;
        padding-right: 0;
    }

    .layout-toc .card {
        margin: 0 0 1.25rem;
        box-shadow: 0 16px 30px -26px rgba(12, 30, 54, 0.85);
    }

    .toc-card-body {
        max-height: none;
        overflow-y: visible;
    }

    .content-card {
        padding: 1.8rem 1.6rem;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .layout {
        flex-direction: row;
        align-items: flex-start;
        width: min(100%, 960px);
        margin: 0 auto;
        padding: 2rem 1.5rem 3.5rem;
        gap: 1.75rem;
    }

    .layout-toc {
        order: 0;
        flex: 0 0 clamp(220px, 28vw, 260px);
        width: auto;
        margin: 0;
        position: sticky;
        top: calc(var(--nav-offset, 72px));
        align-self: flex-start;
    }

    .layout-main {
        order: 0;
        flex: 1 1 0;
        min-width: 0;
    }

    .layout-toc.sticky-top {
        position: sticky !important;
        top: calc(var(--nav-offset, 72px));
    }

    .layout-toc .container {
        padding-left: 0;
        padding-right: 0;
    }

    .layout-toc .card {
        margin: 0;
    }

    .toc-card-body {
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }
}

/* 通常の見出し余白 */
#content h1,
#content h2,
#content h3,
#content h4,
#content h5,
#content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

#content h1 {
    margin-top: 2rem;
    font-size: clamp(1.8rem, 3.2vw, 2.5rem);
}

#content h2 {
    margin-top: 1rem;
    position: relative;
    padding-bottom: 0.35rem;
    font-size: clamp(1.35rem, 2.6vw, 1.9rem);
}

#content h3 {
    font-size: clamp(1.15rem, 2vw, 1.5rem);
}

#content h4 {
    font-size: clamp(1.05rem, 1.8vw, 1.3rem);
}

#content h5,
#content h6 {
    font-size: clamp(0.95rem, 1.6vw, 1.15rem);
}

/* 最初の要素が見出しだった場合、上の余白をなくす */
#content> :first-child {
    margin-top: 0 !important;
}

#content h2::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 64px;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.75), rgba(156, 39, 176, 0.75));
    box-shadow: 0 6px 14px -10px rgba(12, 30, 54, 0.9);
}

#content h3 {
    margin-top: 2.5rem;
}

#content hr {
    margin: 2rem 0;
    border: none;
    height: 2px;
    background: linear-gradient(90deg, rgba(33, 150, 243, 0), rgba(33, 150, 243, 0.45), rgba(156, 39, 176, 0));
}

/* Code Block */
pre {
    background: linear-gradient(160deg, #303446, #1f2533);
    padding: 1em 1.2em;
    overflow-x: auto;
    border-radius: 14px;
    box-shadow: 0 18px 36px -28px rgba(12, 30, 54, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

code {
    background: rgba(227, 242, 253, 0.8);
    padding: 0.1em 0.4em;
    border-radius: 6px;
}

#content pre code {
    background: transparent;
    padding: 0;
}

.youtube-wrapper {
    width: 100vw;
    padding: 24px;
    box-sizing: border-box;
    background-color: #111;
}

.youtube-embed {
    width: 100%;
    height: 56.25vw;
    /* 16:9比率 */
    max-height: 100vh;
    border: none;
    display: block;
}

.ratio iframe {
    border-radius: 8px;
}

/* Standalone page layout */
body.page {
    background: linear-gradient(180deg, #f6f9ff 0%, #ffffff 48%, #fff8f2 100%);
}

.page-main {
    position: relative;
    padding-top: 5rem;
    padding-bottom: 4rem;
}

.page-hero .page-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.75);
    color: #0b2948;
    box-shadow: 0 10px 28px -22px rgba(12, 30, 54, 0.75);
}

.page-title {
    font-size: clamp(1.85rem, 2.5vw, 2.4rem);
    font-weight: 800;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: #0b2948;
}

.page-lead {
    font-size: 0.98rem;
    color: #29496b;
    margin-bottom: 2rem;
}

.template-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.action-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.6rem;
    border-radius: 999px;
    background: linear-gradient(120deg, rgba(33, 150, 243, 0.8), rgba(156, 39, 176, 0.85));
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 18px 34px -28px rgba(12, 30, 54, 0.72);
}

.action-button::before {
    content: "";
    position: absolute;
    inset: -120%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.6), transparent 55%);
    transform: translate3d(-30%, -30%, 0) scale(0.65);
    transition: transform 0.4s ease;
    pointer-events: none;
}

.action-button-download {
    background: linear-gradient(120deg, rgba(255, 138, 76, 0.95), rgba(255, 94, 58, 0.9));
    box-shadow: 0 20px 40px -30px rgba(255, 120, 60, 0.55);
}

.action-button.action-button-download:hover,
.action-button.action-button-download:focus {
    box-shadow: 0 28px 52px -28px rgba(255, 120, 60, 0.68);
}

.action-button:hover,
.action-button:focus {
    transform: translateY(-2px);
    color: #fff;
    box-shadow: 0 30px 48px -26px rgba(12, 30, 54, 0.9);
}

.action-button:hover::before,
.action-button:focus::before {
    transform: translate3d(10%, 10%, 0) scale(1.05);
}

.template-preview {
    position: relative;
    border-radius: 24px;
    background: linear-gradient(150deg, rgba(33, 150, 243, 0.12), rgba(156, 39, 176, 0.12));
    padding: 1.5rem;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 30px 60px -48px rgba(12, 30, 54, 0.85);
}

.preview-surface {
    position: relative;
    width: 100%;
    max-width: 640px;
    aspect-ratio: 16 / 9;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: rgba(11, 41, 72, 0.55);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.preview-surface img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    border-radius: 20px;
    display: block;
}

.preview-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 0.85rem;
    text-align: center;
    padding: 4px 0;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.page-section {
    position: relative;
    z-index: 1;
}

.feature-card,
.info-card {
    height: 100%;
    padding: 2.2rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(11, 41, 72, 0.08);
    box-shadow: 0 24px 52px -44px rgba(12, 30, 54, 0.9);
    backdrop-filter: blur(6px);
}

.feature-card h2,
.info-card h2,
.info-card h3 {
    color: #0b2948;
    font-weight: 700;
}

.feature-card h2 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

.feature-card p {
    color: #335b7b;
    margin: 0;
}

.about-hero {
    position: relative;
}

.about-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(33, 150, 243, 0.15), transparent 60%),
        radial-gradient(circle at 80% 50%, rgba(156, 39, 176, 0.12), transparent 65%);
    z-index: -1;
}

.about-highlight {
    padding: 1.8rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(11, 41, 72, 0.08);
    color: #335b7b;
    box-shadow: 0 18px 40px -34px rgba(12, 30, 54, 0.9);
}

.section-title {
    font-size: 1.25rem;
    margin-bottom: 0.35rem;
}

.section-sub {
    color: rgba(11, 41, 72, 0.55);
    margin-bottom: 1.2rem;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.profile-meta {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.meta-label {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(11, 41, 72, 0.65);
    margin-bottom: 0.35rem;
}

.meta-value {
    font-weight: 600;
    color: #0b2948;
}

.about-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin: 1.5rem 0 2rem;
}

.about-grid h3 {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

.about-grid p {
    color: #335b7b;
    margin: 0;
}

@media (max-width: 992px) {
    .page-main {
        padding-top: 4rem;
    }

    .template-preview {
        min-height: 240px;
    }
}

@media (max-width: 576px) {
    .action-button {
        width: 100%;
    }
}
