* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(244, 194, 224, 0.58), transparent 34rem),
        radial-gradient(circle at top right, rgba(172, 221, 255, 0.62), transparent 32rem),
        linear-gradient(180deg, #fff7fc 0%, #eef8ff 100%);
    color: #273043;
    margin: 0;
    min-height: 100vh;
}

.article-page {
    padding-bottom: 86px;
}

.container {
    width: min(800px, calc(100% - 32px));
    max-width: 800px;
    margin: 40px auto;
    background: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border: 1px solid rgba(150, 190, 230, 0.38);
    border-radius: 16px;
    box-shadow: 0 18px 44px rgba(88, 125, 167, 0.16);
    backdrop-filter: blur(8px);
}

.article-container {
    width: min(1120px, calc(100% - 32px));
    max-width: 1120px;
}

h1 {
    margin-top: 0;
    color: #203757;
    font-size: clamp(1.85rem, 5vw, 2.45rem);
    line-height: 1.12;
}

h2 {
    font-size: clamp(1.35rem, 4vw, 1.75rem);
    line-height: 1.22;
}

h3 {
    font-size: clamp(1.12rem, 3.2vw, 1.35rem);
    line-height: 1.28;
}

.announcement {
    margin: 22px 0;
    padding: 16px 18px;
    background: linear-gradient(135deg, rgba(255, 222, 238, 0.92), rgba(222, 242, 255, 0.92));
    border: 1px solid rgba(236, 142, 194, 0.45);
    border-radius: 12px;
    box-shadow: 0 10px 26px rgba(114, 159, 207, 0.12);
}

.announcement > :first-child {
    margin-top: 0;
}

.announcement > :last-child {
    margin-bottom: 0;
}

.search-box {
    margin: 24px 0;
}

.search-box label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.search-box input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid #b9d9f5;
    border-radius: 8px;
    color: #273043;
    font: inherit;
}

.search-box input:focus {
    border-color: #ef8fc8;
    outline: 3px solid rgba(239, 143, 200, 0.22);
}

.no-results {
    color: #6b5f74;
}

.category {
    margin-top: 28px;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(151, 201, 242, 0.58);
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(105, 145, 190, 0.1);
}

.category summary {
    cursor: pointer;
    font-size: 1.35rem;
    font-weight: 700;
    color: #203757;
}

.category summary::marker {
    color: #ef8fc8;
}

.category summary span {
    margin-left: 6px;
}

.category summary + .category-description {
    margin-top: 8px;
}

.category h2,
.toc h2 {
    margin-bottom: 8px;
}

.category-description {
    margin: 0 0 12px;
    color: #5f6472;
    line-height: 1.5;
}

a {
    color: #1f73b7;
    text-decoration: none;
}

a:hover {
    color: #d84f9d;
    text-decoration: underline;
}

ul {
    padding-left: 20px;
}

li {
    margin: 8px 0;
}

.article-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.article-main {
    min-width: 0;
}

.toc-panel {
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 16px 18px;
    background: rgba(239, 248, 255, 0.86);
    border: 1px solid rgba(151, 201, 242, 0.58);
    border-radius: 12px;
}

.toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.toc-header h2 {
    margin-top: 0;
    margin-bottom: 0;
    font-size: 1.1rem;
}

.toc-toggle {
    flex: 0 0 auto;
    padding: 6px 10px;
    background: #ffffff;
    border: 1px solid rgba(236, 142, 194, 0.5);
    border-radius: 8px;
    color: #203757;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
}

.toc-toggle:hover {
    background: #fff1f8;
}

.toc-panel.is-collapsed {
    max-height: none;
    overflow: visible;
}

.toc-panel.is-collapsed .toc {
    display: none;
}

.toc {
    font-size: 0.95rem;
}

.toc ul {
    margin-bottom: 0;
}

.toc ul ul {
    padding-left: 16px;
}

.toc li {
    position: relative;
}

.toc-branch-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    margin-left: 6px;
    padding: 0;
    background: #ffffff;
    border: 1px solid rgba(151, 201, 242, 0.68);
    border-radius: 6px;
    color: #203757;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    line-height: 1;
    vertical-align: middle;
}

.toc-branch-toggle:hover {
    background: #fff1f8;
    border-color: rgba(236, 142, 194, 0.65);
}

.toc li.is-branch-collapsed > a {
    font-weight: 600;
}

.article-body {
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.article-body p,
.article-body li {
    overflow-wrap: break-word;
}

.article-body table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    -webkit-overflow-scrolling: touch;
}

.article-body th,
.article-body td {
    min-width: 160px;
    padding: 9px 10px;
    border: 1px solid rgba(151, 201, 242, 0.5);
    vertical-align: top;
}

.article-body th {
    background: rgba(239, 248, 255, 0.92);
    color: #203757;
    text-align: left;
}

.article-body figure {
    max-width: 560px;
    margin: 24px auto;
    text-align: center;
}

.article-body img {
    display: block;
    max-width: min(100%, 560px);
    height: auto;
    margin: 24px auto;
    border: 1px solid rgba(151, 201, 242, 0.5);
    border-radius: 12px;
}

.article-body figure img {
    max-width: 100%;
    margin: 0 auto;
}

.article-body figcaption {
    margin-top: 8px;
    color: #5f6472;
    font-size: 0.95rem;
    line-height: 1.45;
}

pre {
    max-width: 100%;
    overflow-x: auto;
    padding: 16px;
    background: #17263f;
    color: #eaf5ff;
    border: 1px solid rgba(239, 143, 200, 0.28);
    border-radius: 10px;
}

code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.95em;
}

:not(pre) > code {
    padding: 2px 5px;
    background: #f5e9f4;
    border-radius: 4px;
}

.back {
    display: inline-block;
    margin-top: 20px;
}

.article-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.78);
    border-top: 1px solid rgba(150, 190, 230, 0.42);
    box-shadow: 0 -10px 28px rgba(88, 125, 167, 0.16);
    backdrop-filter: blur(10px);
}

.article-bottom-nav-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 10px;
    width: min(1120px, 100%);
    margin: 0 auto;
}

.article-nav-item {
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 42px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid rgba(151, 201, 242, 0.62);
    border-radius: 8px;
    color: #203757;
    font-weight: 700;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.article-nav-item:hover {
    background: #fff1f8;
    color: #d84f9d;
    text-decoration: none;
}

.article-nav-item.is-home {
    justify-content: center;
}

.article-nav-item.is-next {
    justify-content: flex-end;
}

.article-nav-item.is-disabled {
    color: #8b94a6;
    background: rgba(255, 255, 255, 0.58);
    cursor: default;
}

.not-found {
    text-align: center;
}

.not-found-code {
    display: inline-block;
    margin: 0 0 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #ffd6eb, #c8ebff);
    border: 1px solid rgba(236, 142, 194, 0.45);
    border-radius: 999px;
    color: #203757;
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
}

.not-found-text {
    max-width: 560px;
    margin: 0 auto 24px;
    color: #5f6472;
    line-height: 1.6;
}

.primary-link {
    display: inline-block;
    padding: 12px 18px;
    background: linear-gradient(135deg, #ef8fc8, #6fb9ee);
    border-radius: 10px;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 10px 22px rgba(111, 185, 238, 0.25);
}

.primary-link:hover {
    color: #ffffff;
    text-decoration: none;
    filter: brightness(1.04);
}

.not-found-suggestions {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid rgba(151, 201, 242, 0.58);
    text-align: left;
}

.not-found-suggestions h2 {
    margin-top: 0;
    color: #203757;
    font-size: 1.1rem;
}

@media (max-width: 900px) {
    .article-layout {
        display: block;
    }

    .toc-panel {
        position: static;
        max-height: none;
        margin-bottom: 24px;
        padding: 14px;
    }
}

@media (max-width: 720px) {
    body {
        background:
            linear-gradient(180deg, #fff9fd 0%, #f1f9ff 100%);
    }

    .container,
    .article-container {
        width: 100%;
        margin: 0;
        padding: 18px 14px 22px;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .article-body {
        font-size: 1rem;
        line-height: 1.68;
    }

    .article-body h1,
    .article-body h2,
    .article-body h3 {
        overflow-wrap: break-word;
    }

    .article-body figure {
        max-width: 100%;
        margin: 18px auto;
    }

    .article-body img {
        max-width: 100%;
        margin: 18px auto;
        border-radius: 8px;
    }

    .article-body figcaption {
        font-size: 0.9rem;
    }

    .category {
        margin-top: 16px;
        padding: 14px;
        border-radius: 8px;
    }

    .category summary {
        font-size: 1.12rem;
    }

    .toc-panel {
        margin: -2px 0 18px;
        border-radius: 8px;
    }

    .toc {
        font-size: 0.92rem;
    }

    .toc ul {
        padding-left: 16px;
    }

    .toc ul ul {
        padding-left: 14px;
    }

    pre {
        padding: 12px;
        border-radius: 8px;
        font-size: 0.88rem;
    }

    code {
        font-size: 0.9em;
    }
}

@media (max-width: 600px) {
    .article-page {
        padding-bottom: 92px;
    }

    .article-bottom-nav {
        padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    }

    .article-bottom-nav-inner {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
    }

    .article-nav-item {
        justify-content: center;
        min-height: 42px;
        padding: 6px;
        font-size: 0.78rem;
        text-align: center;
        white-space: normal;
        word-break: normal;
        overflow-wrap: anywhere;
    }

    .article-nav-item.is-next {
        justify-content: center;
    }

    .toc-header {
        align-items: stretch;
    }

    .toc-toggle {
        min-width: 92px;
    }
}

@media (max-width: 380px) {
    .container,
    .article-container {
        padding-right: 11px;
        padding-left: 11px;
    }

    .article-nav-item {
        font-size: 0.72rem;
    }
}

.not-found {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.robot {
    font-size: 90px;
    margin-bottom: 20px;
    animation: robotFloat 3s ease-in-out infinite;
    user-select: none;
}

.not-found-code {
    font-size: 60px;
    font-weight: bold;
    margin: 0;
    color: #3b82f6;
}

.not-found-text {
    max-width: 600px;
    opacity: .8;
    margin: 20px 0 35px;
    line-height: 1.6;
}

.search-light {
    position: absolute;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle,
        rgba(59,130,246,.15) 0%,
        rgba(59,130,246,0) 70%);
    animation: search 6s ease-in-out infinite;
    pointer-events: none;
}

.not-found-suggestions {
    margin-top: 50px;
}

.not-found-suggestions ul {
    list-style: none;
    padding: 0;
}

.not-found-suggestions li {
    margin: 10px 0;
}

.not-found-suggestions a {
    text-decoration: none;
    color: #3b82f6;
    transition: .2s;
}

.not-found-suggestions a:hover {
    opacity: .7;
}

@keyframes robotFloat {
    0%,100% {
        transform: translateY(0) rotate(-2deg);
    }

    50% {
        transform: translateY(-8px) rotate(2deg);
    }
}

@keyframes search {
    0% {
        transform: translate(-180px,-120px);
    }

    25% {
        transform: translate(160px,-60px);
    }

    50% {
        transform: translate(250px,120px);
    }

    75% {
        transform: translate(-120px,140px);
    }

    100% {
        transform: translate(-180px,-120px);
    }
}
