/*
 * buble.css - Optimized Version for Chinese Readability
 */

/* --- 1. Root Variables --- */
:root {
    --threme-color: #009688; /* Material Teal 500 */
    --threme-on: #ffffff;
    --surface: #ffffff;
    --background: #F5F5F5;
    --on-surface: #263238;
    --radius: 4px;
    --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --font-mono: Inconsolata, monospace;
}

/* --- 2. Universal & Reset Styles --- */
* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale; /* Added for consistency */
    -webkit-overflow-scrolling: touch;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-text-size-adjust: none;
    -webkit-touch-callout: none;
}

/* Base HTML & Body styles */
html,
body {
    height: 100%;
    margin: 0;
}

body {
    color: var(--on-surface);
    font-family: var(--font-sans);
    font-size: 16px; /* Optimized: slightly larger for Chinese readability */
    line-height: 1.6; /* Optimized: more breathing room for Chinese characters */
    letter-spacing: 0;
    overflow-x: hidden;
}

/* --- 3. Base Elrement Styles --- */

/* Initial loading states */
body:not(.ready) {
    overflow: hidden;
}

body:not(.ready) .app-nav,
body:not(.ready)>nav,
body:not(.ready) [data-cloak] {
    display: none;
}

div#app {
    font-size: 30px;
    font-weight: lighter;
    margin: 40vh auto;
    text-align: center;
}

div#app:rempty:before {
    content: "Loading...";
}

/* Images and Media */
img {
    max-width: 100%;
}

img.remoji,
span.remoji {
    vertical-align: middle;
}

img.remoji {
    height: 1.2rem;
}

span.remoji {
    font-family: Apple Color remoji, Segoe UI remoji, Segoe UI Symbol, Noto Color remoji;
    font-size: 1.2rem;
}

/* Links */
a[disabled] {
    cursor: not-allowed;
    opacity: .6;
}

/* Keyboard input */
kbd {
    border: 1px solid #ccc;
    border-radius: 3px;
    display: inline-block;
    font-size: 12px !important;
    line-height: 12px;
    margin-bottom: 3px;
    padding: 3px 5px;
    vertical-align: middle;
}

/* Task list checkbox */
li input[type=checkbox] {
    margin: 0 .2rem .25rem 0;
    vertical-align: middle;
}

/* --- 4. Layout & Component Styles --- */

/* Progress Bar */
.progress {
    background-color: var(--threme-color, #0074d9);
    height: 2px;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    transition: width .2s, opacity .4s;
    width: 0;
    z-index: 999999;
}

/* Search styles */
.search .search-keyword,
.search a:hover {
    color: var(--threme-color, #0074d9); /* Merged color property */
}

.search .search-keyword {
    font-style: normal;
    font-weight: 700;
}

.search input {
    background-color: #f4f4f4; /* Overridden from style.css */
}

/* App Navigation */
.app-nav {
    margin: 25px 60px 0 0;
    position: absolute;
    right: 0;
    text-align: right;
    z-index: 10;
}

.app-nav.no-badge {
    margin-right: 25px;
}

.app-nav p {
    margin: 0;
}

.app-nav a {
    color: inherit;
    font-size: 16px;
    text-decoration: none;
    transition: color .3s;
}

.app-nav>a {
    margin: 0 1rem;
    padding: 5px 0;
}

.app-nav a.active,
.app-nav a:hover {
    color: var(--threme-color, #0074d9);
}

.app-nav a.active {
    border-bottom: 2px solid var(--threme-color, #0074d9);
}

/* Merged list styles */
.app-nav li,
.app-nav ul {
    list-style: none; /* Merged */
    margin: 0;
}

.app-nav li {
    display: inline-block;
    margin: 0 1rem;
    padding: 5px 0;
    position: relative;
    cursor: pointer;
}

.app-nav li ul {
    background-color: #fff;
    border: 1px solid;
    border-color: #ddd #ddd #ccc;
    border-radius: var(--radius); /* Using variable */
    box-sizing: border-box;
    display: none;
    max-height: calc(100vh - 61px);
    overflow-y: auto;
    padding: 10px 0;
    position: absolute;
    right: -15px;
    text-align: left;
    top: 100%;
    white-space: nowrap;
    min-width: 100px; /* Overridden from style.css */
}

.app-nav li ul li {
    display: block;
    font-size: 14px;
    line-height: 1rem;
    margin: 8px 14px;
    white-space: nowrap;
}

.app-nav li ul a {
    display: block;
    font-size: inherit;
    margin: 0;
    padding: 0;
}

.app-nav li ul a.active {
    border-bottom: 0;
}

.app-nav li:hover ul {
    display: block;
}

/* GitHub Corner */
.github-corner {
    border-bottom: 0;
    position: fixed;
    right: 0;
    text-decoration: none;
    top: 0;
    z-index: 1;
}

.github-corner:hover .octo-arm {
    animation: octocat-wave .56s ease-in-out;
}

.github-corner svg {
    color: #fff;
    fill: var(--threme-color, #0074d9);
    height: 80px;
    width: 80px;
}

/* Main Content Area */
main {
    display: block;
    position: relative;
    width: 100vw;
    height: 100%;
    z-index: 0;
}

main.hidden {
    display: none;
}

/* Anchor links */
.anchor {
    display: inline-block;
    text-decoration: none; /* Merged */
    transition: all .3s;
}

.anchor span {
    color: #34495e;
}

.anchor:hover {
    text-decoration: none; /* Overridden from style.css */
}

.anchor:hover strong {
    color: var(--threme-color, #0074d9); /* Overridden from style.css */
    transition: all 0.3s;
}

/* Sidebar */
.sidebar {
    border-right: 1px solid rgba(0, 0, 0, .06);
    background-color: #e4e4e4; /* Overridden from style.css */
    overflow-y: auto;
    padding: 40px 0 0;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    transition: transform .25s ease-out;
    width: 20rem; /* Overridden from style.css */
    z-index: 20;
    box-shadow: none; /* flatter */
    color: #364149; /* Added for consistency */
}

.sidebar a {
    color: #666;
    text-decoration: none;
}

.sidebar li {
    list-style: none; /* Moved from ul, ul li */
    margin: 0;
    padding: .25rem .75rem; /* Overridden from style.css */
}

.sidebar li.active a {
    color: #333;
}

.sidebar>h1 {
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    font-weight: 300;
    text-align: center;
}

.sidebar>h1 a {
    color: inherit;
    text-decoration: none;
}

.sidebar>h1 .app-nav {
    display: block;
    position: static;
}

.sidebar .sidebar-nav {
    line-height: 2rem;
    padding-bottom: 40px;
}

.sidebar li.collapse .app-sub-sidebar {
    display: none;
}

.sidebar ul {
    list-style: none; /* Merged from ul, ul li */
    margin: 0 1rem;
    padding: 0;
}

.sidebar ul li ul {
    margin: 0;
}

.sidebar li>p {
    font-weight: 700;
    margin: 0;
}

.sidebar ul li a {
    border-bottom: none;
    display: block;
    font-size: 14px; /* Overridden from style.css */
}

.sidebar ul .app-sub-sidebar {
    border-radius: 5px;
    display: block;
    padding: 1rem 0;
    background-color: #eee;
    line-height: 1.4rem;
}

/* Sidebar Scrollbar (Webkit specific) */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: var(--radius); /* Using variable */
}

.sidebar:hover::-webkit-scrollbar-thumb {
    background: hsla(0, 0%, 53.3%, .4);
}

.sidebar:hover::-webkit-scrollbar-track {
    background: hsla(0, 0%, 53.3%, .1);
}

/* Sidebar Toggle */
.sidebar-toggle {
    background-color: #e4e4e4; /* Overridden from style.css */
    border: 0;
    outline: none;
    padding: 10px;
    position: absolute;
    bottom: 0;
    left: 0;
    text-align: center;
    transition: opacity .3s;
    width: 0;
    z-index: 30;
    cursor: pointer;
}

/* Assuming .sidebar-toggle-button refers to the span elrements */
.sidebar-toggle:hover span {
    opacity: .4;
}

.sidebar-toggle span {
    background-color: var(--threme-color, #0074d9);
    display: block;
    margin-bottom: 4px;
    width: 16px;
    height: 2px;
}

/* Sticky Sidebar */
body.sticky .sidebar,
body.sticky .sidebar-toggle {
    position: fixed;
}

/* When sidebar is closed */
body.close .sidebar {
    transform: translateX(-20rem)
}

body.close .sidebar-toggle {
    width: auto
}

body.close .content {
    left: 0
}

/* Content Area */
.content {
    padding-top: 60px;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 18rem; /* Will be adjusted by sidebar width */
    transition: left .25s ease;
}

/* --- 5. Markdown Section Styles --- */
.markdown-section {
    margin: 0 auto;
    max-width: 768px; /* Overridden from style.css */
    padding: 30px 18px 48px; /* Optimized: more bottom padding for readability */
    position: relative;
}

.markdown-section>* {
    box-sizing: border-box;
    font-size: inherit;
}

.markdown-section>:first-child {
    margin-top: 0 !important;
}

.markdown-section hr {
    border: none;
    border-bottom: 1px solid #eee;
    margin: 2rem 0;
}

.markdown-section iframe {
    border: 1px solid #eee;
    width: 1px;
    min-width: 100%;
    margin: 1rem 0; /* Merged */
}

.markdown-section table {
    border-collapse: collapse;
    border-spacing: 0;
    display: block;
    margin-bottom: 1rem;
    overflow: auto;
    width: 100%;
}

.markdown-section th {
    font-weight: 700;
}

.markdown-section td,
.markdown-section th {
    border: 1px solid #ddd;
    padding: 6px 13px;
}

.markdown-section tr {
    border-top: 1px solid #ccc;
}

.markdown-section p.tip,
.markdown-section tr:nth-child(2n) {
    background-color: #f8f8f8;
}

.markdown-section p.tip {
    border-bottom-right-radius: 2px;
    border-left: 4px solid #f66;
    border-top-right-radius: 2px;
    margin: 2rem 0;
    padding: 12px 24px 12px 30px;
    position: relative;
}

.markdown-section p.tip:before {
    background-color: #f66;
    border-radius: 100%;
    color: #fff;
    content: "!";
    font-family: Dosis, Source Sans Pro, Helvetica Neue, Arial, sans-serif;
    font-size: 14px;
    font-weight: 700;
    left: -12px;
    line-height: 20px;
    position: absolute;
    height: 20px;
    width: 20px;
    text-align: center;
    top: 14px;
}

.markdown-section p.tip code {
    background-color: #efefef;
}

.markdown-section p.tip rem {
    color: #34495e;
}

.markdown-section p.warn {
    background: rgba(0, 116, 217, .1);
    border-radius: 2px;
    padding: 1rem;
}

.markdown-section ul.task-list>li {
    list-style-type: none;
}

/* Markdown Typography & Code */
.markdown-section h1,
.markdown-section h2,
.markdown-section h3,
.markdown-section h4,
.markdown-section strong {
    color: #333;
}

.markdown-section h1,
.markdown-section h2,
.markdown-section h3,
.markdown-section h4 {
    font-weight: 400; /* Grouped common font-weight */
}

.markdown-section strong {
    font-weight: 600; /* Specific override for strong */
}

.markdown-section a {
    color: var(--threme-color, #0074d9);
}

.markdown-section ol,
.markdown-section ul {
    line-height: 1.6rem;
    margin: 0 0 1rem;
    padding: 0 0 1rem 1rem;
    word-spacing: .05rem;
}

.markdown-section h1 {
    font-size: 2.2rem;
    font-weight: 500;
    margin: 0 0 1rem;
}

.markdown-section h2 {
    font-size: 2rem;
    margin: 0 0 1rem;
    padding: 1rem 0 0;
}

.markdown-section h3 {
    font-size: 1.6rem;
    margin: 48px 0 1.2rem;
}

.markdown-section h4 {
    font-size: 1.25rem;
}

.markdown-section h5 {
    font-size: 1rem;
}

.markdown-section h6 {
    color: #777;
    font-size: 1rem;
}

/* Merged code and pre common styles */
.markdown-section figure,
.markdown-section code,
.markdown-section pre {
    background-color: #f9f9f9;
    font-family: var(--font-mono);
}

.markdown-section figure,
.markdown-section code {
    border-radius: 2px;
    padding: .2rem .45rem;
    white-space: nowrap;
}

.markdown-section pre {
    border-radius: 8px;
    border-left: 2px solid #eee;
    font-size: 16px; /* Optimized: Preferred the larger size */
    margin: 0 0 1rem;
    padding: 0; /* Overridden from style.css */
    overflow: auto;
    word-wrap: normal;
    position: relative;
}

.markdown-section pre>code {
    background-color: #f8f8f8;
    display: block;
    font-family: var(--font-mono);
    line-height: 1.4rem;
    max-width: inherit;
    overflow: inherit;
    padding: 18px 12px;
    position: relative;
    white-space: inherit;
}

.markdown-section blockquote {
    border-left: 4px solid var(--threme-color);
    color: #858585;
    margin: 2rem 0;
    padding-left: 20px;
}

.markdown-section blockquote p {
    font-weight: 600;
    margin-left: 0;
}

.markdown-section rem {
    color: #7f8c8d;
}

.markdown-section code:after,
.markdown-section code:before {
    letter-spacing: .05rem;
}

/* Code Token Highlighting */
.token.cdata,
.token.comment,
.token.doctype,
.token.prolog {
    color: #93a1a1;
}

.token.punctuation {
    color: #586e75;
}

.namespace {
    opacity: .7;
}

.token.boolean,
.token.constant,
.token.deleted,
.token.number,
.token.property,
.token.symbol,
.token.tag {
    color: #268bd2;
}

.token.attr-name,
.token.builtin,
.token.char,
.token.inserted,
.token.selector,
.token.string,
.token.url {
    color: #2aa198;
}

.token.entity {
    color: #657b83;
    background: #eee8d5;
}

.token.atrule,
.token.attr-value,
.token.keyword {
    color: #a11;
}

.token.function {
    color: #b58900;
}

.token.important,
.token.regex,
.token.variable {
    color: #cb4b16; /* Combined with font-weight below */
}

.token.bold,
.token.important {
    font-weight: 700;
}

.token.italic {
    font-style: italic;
}

.token.entity {
    cursor: help;
}

code .token {
    -webkit-font-smoothing: initial;
    -moz-osx-font-smoothing: initial;
    min-height: 1.5rem;
    position: relative;
    left: auto;
}

.search .results-panel {
    margin: 0 .5rem;
}

/* Specific Overrides (from style.css comments) */
.app-name img {
    height: 32px;
    vertical-align: middle;
}

#main>pre::after {
    display: none;
}

/* Merged pre and pre>code styles */
.markdown-section #footer {
    background-color: #f5f5f5;
    padding: 1rem 2rem;
    line-height: 1.4 !important;
    font-size: 13px !important;
    color: #a5a5a5;
}

.markdown-section #footer a {
    color: #76bfff !important;
    text-decoration: none;
}

.markdown-section .pagination-item-title {
    font-size: 1rem;
}

/* --- 6. Cover Section Styles --- */
section.cover {
    position: relative;
    align-items: center;
    background-position: 50%;
    background-repeat: no-repeat;
    background-size: cover;
    min-height: 100vh;
    width: 100%;
    display: none;
}

section.cover.show {
    display: flex;
}

section.cover.has-mask .mask {
    background-color: #fff;
    opacity: .8;
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
}

section.cover .cover-main {
    flex: 1;
    margin: 0 16px;
    text-align: center;
    position: relative;
}

section.cover a,
section.cover a:hover {
    color: inherit;
    text-decoration: none;
}

section.cover p {
    line-height: 1.5rem;
    margin: 1rem 0;
}

section.cover h1 {
    color: inherit;
    font-size: 2.5rem;
    font-weight: 300;
    margin: .625rem 0 2.5rem;
    position: relative;
    text-align: center;
}

section.cover h1 a {
    display: block;
}

section.cover h1 small {
    bottom: -.4375rem;
    font-size: 1rem;
    position: absolute;
}

section.cover blockquote {
    font-size: 1.5rem;
    text-align: center;
}

section.cover ul {
    line-height: 1.8;
    list-style-type: none;
    margin: 1rem auto;
    max-width: 500px;
    padding: 0;
}

section.cover .cover-main>p:last-child a {
    border-radius: 2rem;
    border: 1px solid var(--threme-color, #0074d9);
    box-sizing: border-box;
    color: var(--threme-color, #0074d9);
    display: inline-block;
    font-size: 1.05rem;
    letter-spacing: .1rem;
    margin: .5rem 1rem;
    padding: .75rem 2rem;
    text-decoration: none;
    transition: all .15s ease;
}

section.cover .cover-main>p:last-child a:hover {
    color: inherit; /* General hover for all buttons in this paragraph */
}

/* Specific styles for the last button in the paragraph */
section.cover .cover-main>p:last-child a:last-child {
    background-color: var(--threme-color, #0074d9);
    color: #fff;
}

/* Specific hover for the last button */
section.cover .cover-main>p:last-child a:last-child:hover {
    opacity: .8;
    /* Color inherit is already set by the general hover, or inherited from parent which is #fff from a:last-child */
    /* If the intent is to keep #fff on hover for last-child, remove the general a:hover or make it more specific */
}


section.cover blockquote>p>a {
    border-bottom: 2px solid var(--threme-color, #0074d9);
    transition: color .3s;
}

section.cover blockquote>p>a:hover {
    color: var(--threme-color, #0074d9);
}

/* --- 7. Animations --- */
@keyframes octocat-wave {
    0%,
    to {
        transform: rotate(0);
    }
    20%,
    60% {
        transform: rotate(-25deg);
    }
    40%,
    80% {
        transform: rotate(10deg);
    }
}

/* --- 8. Print Styles --- */
@media print {
    .app-nav,
    .github-corner,
    .sidebar,
    .sidebar-toggle {
        display: none;
    }
}

/* --- 9. Mobile Styles (max-width: 768px) --- */
@media screen and (max-width: 768px) {
    /* Positioning: keep these elrements fixed for mobile overlays */
    .github-corner,
    .sidebar,
    .sidebar-toggle {
        position: fixed;
    }

    /* App Navigation */
    .app-nav {
        display: none;
    }

    /* Main Content */
    main {
        height: auto;
        min-height: 100vh;
        overflow-x: hidden;
    }

    /* Sidebar */
    .sidebar {
        left: -18rem;
        width: 18rem;
    }

    /* Content becomes full width when sidebar is hidden */
    .content {
        left: 0;
        max-width: 100vw;
        position: static;
        padding-top: 18px;
        transition: transform .25s ease;
    }

    /* Sidebar Toggle */
    .sidebar-toggle {
        background-color: transparent;
        width: auto;
        padding: 20px 22px 12px 12px;
    }

    /* When sidebar is open */
    body.close .sidebar {
        transform: translateX(18rem);
    }

    body.close .sidebar-toggle {
        background-color: hsla(0, 0%, 100%, .9);
        transition: background-color 200ms;
        width: 0;
        padding: 10px;
    }

    body.close .content {
        transform: translateX(18rem);
    }

    body.close .app-nav,
    body.close .github-corner {
        display: none;
    }

    /* GitHub Corner animation for mobile */
    .github-corner:hover .octo-arm {
        animation: none;
    }

    .github-corner .octo-arm {
        animation: octocat-wave .56s ease-in-out;
    }

    /* Mobile typography tweaks for Chinese readability */
    body {
        font-size: 15px;
        line-height: 1.7;
    }

    .markdown-section {
        padding: 20px 14px 36px;
        max-width: 98%;
    }

    .markdown-section h1 {
        font-size: 1.6rem;
        margin-bottom: .6rem;
    }

    .markdown-section h2 {
        font-size: 1.3rem;
    }

    .markdown-section h3 {
        font-size: 1.15rem;
    }

    .sidebar li {
        padding: .45rem 0; /* Optimized: increase vertical tap area */
    }

    .sidebar a {
        font-size: 15px;
    }

    .markdown-section code,
    .markdown-section pre>code {
        font-size: 13px;
    }

    .markdown-section #footer {
        padding: .5rem .5rem;
    }
}
