:root {
    --bg: #0b1020;
    --surface: rgba(255, 255, 255, 0.08);
    --surface-strong: rgba(255, 255, 255, 0.12);
    --border: rgba(255, 255, 255, 0.14);
    --text: rgba(255, 255, 255, 0.92);
    --muted: rgba(255, 255, 255, 0.7);
    --muted-2: rgba(255, 255, 255, 0.58);
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    --accent: #7c5cff;
    --accent-2: #00d4ff;
    --radius: 18px;
    --radius-sm: 14px;
    --max: 1120px;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f5f7ff;
        --surface: rgba(10, 18, 38, 0.06);
        --surface-strong: rgba(10, 18, 38, 0.08);
        --border: rgba(10, 18, 38, 0.12);
        --text: rgba(10, 18, 38, 0.92);
        --muted: rgba(10, 18, 38, 0.7);
        --muted-2: rgba(10, 18, 38, 0.55);
        --shadow: 0 18px 50px rgba(10, 18, 38, 0.12);
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

/* Text transition animation for language switching */
[data-i18n] {
    transition: opacity 0.2s ease-in-out;
    display: inline-block;
}

[data-i18n].changing {
    opacity: 0;
}

[data-i18n].changed {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    line-height: 1.55;
    color: var(--text);
    background:
        radial-gradient(800px 500px at 10% 10%, rgba(124, 92, 255, 0.35), transparent 60%),
        radial-gradient(800px 500px at 90% 20%, rgba(0, 212, 255, 0.28), transparent 55%),
        radial-gradient(900px 700px at 40% 100%, rgba(124, 92, 255, 0.18), transparent 60%),
        var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: min(var(--max), calc(100% - 48px));
    margin: 0 auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
}

.brand {
    display: inline-flex;
    gap: 12px;
    align-items: center;
}

.brand img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.brand strong {
    letter-spacing: 0.2px;
    font-size: 16px;
}

.nav {
    display: inline-flex;
    gap: 14px;
    align-items: center;
    color: var(--muted);
    font-size: 14px;
}

.nav a {
    padding: 8px 10px;
    border-radius: 12px;
}

.nav a:hover {
    background: var(--surface);
    text-decoration: none;
}

/* Language switcher styles */
.language-selector {
    position: relative;
    margin-left: 14px;
}

.language-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.language-button:hover {
    background: var(--surface-strong);
}

.language-button:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.language-button .language-icon {
    width: 18px;
    height: 18px;
}

.language-button .dropdown-arrow {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

.language-button.active .dropdown-arrow {
    transform: rotate(180deg);
}

.language-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 150px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

.language-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.language-option:first-child {
    border-radius: 12px 12px 0 0;
}

.language-option:last-child {
    border-radius: 0 0 12px 12px;
}

.language-option:hover {
    background: var(--surface);
}

.language-option:focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.hero {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.06));
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-inner {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 28px;
    padding: 46px 44px;
    align-items: center;
}

.hero h1 {
    margin: 0 0 10px;
    font-size: clamp(30px, 4vw, 44px);
    letter-spacing: -0.6px;
}

.hero p {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 16px;
}

.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.btn {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
    background: var(--surface-strong);
}

.btn.primary {
    border-color: rgba(124, 92, 255, 0.6);
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.95), rgba(0, 212, 255, 0.65));
}

.btn.primary:hover {
    filter: brightness(1.03);
}

.hero-art {
    position: relative;
    border-radius: calc(var(--radius) - 6px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.08);
}

.hero-art img {
    width: 100%;
    height: auto;
    display: block;
    transform: scale(1.02);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.hero-art img:hover {
    transform: scale(1.05);
}

.hero-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.badge {
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.08);
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    color: var(--muted);
}

@media (prefers-color-scheme: light) {
    .badge {
        background: rgba(255, 255, 255, 0.55);
    }
}

/* User comment style */
.user-comment {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 16px 0 24px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    width: 100%;
    max-width: 500px;
}

.user-comment.zh-only,
.user-comment.en-only {
    display: none;
}

body[data-lang="zh-CN"] .user-comment.zh-only {
    display: flex;
}

body[data-lang="en-US"] .user-comment.en-only {
    display: flex;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: var(--surface-strong);
    display: block;
}

.comment-content {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.comment-text {
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 4px;
}

.comment-author {
    color: var(--muted-2);
    font-size: 12px;
}

.section {
    padding: 36px 0;
}

.notice {
    border: 1px solid rgba(255, 205, 75, 0.35);
    background: rgba(255, 205, 75, 0.12);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text);
    margin: 14px 0 0;
    font-size: 13px;
}

@media (prefers-color-scheme: light) {
    .notice {
        background: rgba(255, 205, 75, 0.18);
    }
}

.section h2 {
    margin: 0 0 14px;
    font-size: 18px;
    letter-spacing: 0.2px;
}

.section p.lead {
    margin: 0 0 20px;
    color: var(--muted);
}

.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 14px;
}

.card {
    grid-column: span 6;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 18px;
}

.card h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.card p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.panel {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 18px;
}

.panel p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.feature-blocks {
    display: grid;
    gap: 14px;
}

.feature-row {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 16px;
    align-items: center;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    overflow: hidden;
}

.feature-row.reverse {
    grid-template-columns: 0.8fr 1.2fr;
}

.feature-text h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.feature-text p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.feature-media {
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-media img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
}

.icon-tile {
    width: 140px;
    height: 140px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.08);
    display: grid;
    place-items: center;
}

.icon-tile img {
    width: 90px;
    height: 90px;
    border-radius: 20px;
}

@media (prefers-color-scheme: light) {
    .icon-tile {
        background: rgba(255, 255, 255, 0.55);
    }
}

@media (max-width: 920px) {
    .feature-row,
    .feature-row.reverse {
        grid-template-columns: 1fr;
    }
}

footer {
    padding: 26px 0 40px;
    color: var(--muted-2);
    font-size: 13px;
}

.footer-disclaimer {
    margin-top: 10px;
    color: var(--muted-2);
}

.cta-row-margin {
    margin-top: 14px;
}

.footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    padding-top: 18px;
}

.footer-links {
    display: inline-flex;
    gap: 14px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--muted);
}

@media (max-width: 920px) {
    .hero-inner {
        grid-template-columns: 1fr;
        padding: 32px 22px;
    }

    .card {
        grid-column: span 12;
    }

    .split {
        grid-template-columns: 1fr;
    }

    .nav {
        display: none;
    }
}

/* Responsive design for topbar */
@media (max-width: 768px) {
    .topbar {
        flex-wrap: wrap;
        gap: 12px;
    }

    .brand {
        flex: 1;
        min-width: 200px;
    }

    .nav {
        display: none;
    }

    .language-selector {
        margin-left: auto;
    }
}

@media (max-width: 600px) {
    .container {
        width: calc(100% - 32px);
    }

    .topbar {
        padding: 12px 0;
    }

    .brand strong {
        font-size: 14px;
    }

    .language-button {
        padding: 6px 10px;
        font-size: 13px;
    }

    .language-button .language-icon {
        width: 16px;
        height: 16px;
    }

    .language-button .current-lang {
        display: none;
    }

    .hero h1 {
        font-size: 24px;
    }

    .hero p {
        font-size: 14px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* Build guide page styles */
.build-guide {
    padding: 40px 0;
    max-width: 800px;
}

/* Page TOC Navigation */
.page-toc {
    position: fixed;
    right: calc(50% - 620px);
    top: 50%;
    transform: translateY(-50%);
    width: 180px;
    z-index: 100;
}

@media (max-width: 1400px) {
    .page-toc {
        right: 20px;
    }
}

@media (max-width: 1024px) {
    .page-toc {
        display: none;
    }
}

.toc-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toc-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: var(--muted-2);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
    position: relative;
}

.toc-item:hover {
    color: var(--text);
}

.toc-item.active {
    color: var(--accent);
}

.toc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.toc-item:hover .toc-dot {
    background: var(--muted);
}

.toc-item.active .toc-dot {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    transform: scale(1.2);
}

.toc-text {
    flex: 1;
}

/* TOC Group (for nested items) */
.toc-group {
    display: flex;
    flex-direction: column;
}

.toc-parent {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toc-arrow {
    width: 16px;
    height: 16px;
    margin-left: auto;
    position: relative;
    transition: transform 0.3s ease;
}

.toc-arrow::before,
.toc-arrow::after {
    content: '';
    position: absolute;
    background-color: currentColor;
    transition: transform 0.3s ease;
}

.toc-arrow::before {
    width: 8px;
    height: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.toc-arrow::after {
    width: 2px;
    height: 8px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.toc-group.expanded .toc-arrow {
    transform: rotate(90deg);
}

.toc-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 0;
    margin-left: 24px;
}

.toc-group.expanded .toc-submenu {
    max-height: 300px;
    opacity: 1;
}

.toc-subitem {
    font-size: 12px;
    padding: 6px 0;
}

.toc-subitem .toc-dot {
    width: 6px;
    height: 6px;
}

/* Progress indicator */
.toc-progress {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
    overflow: hidden;
}

.toc-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
    transition: top 0.3s ease;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.build-guide h1 {
    font-size: 32px;
    margin-bottom: 12px;
}

.build-guide .lead {
    font-size: 18px;
    color: var(--muted);
    margin-bottom: 40px;
}

.build-section {
    margin-bottom: 40px;
}

.build-section h2 {
    font-size: 22px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.build-section h3 {
    font-size: 18px;
    margin: 24px 0 12px;
}

.build-section h4 {
    font-size: 16px;
    margin: 16px 0 8px;
}

.build-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.build-list li {
    padding: 10px 0 10px 24px;
    position: relative;
    line-height: 1.6;
}

.build-list li::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: var(--accent);
}

.code-block {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 16px 0;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
}

.code-block code {
    background: none;
    padding: 0;
}

/* Inline code styling */
.build-list li code,
.note code,
p code {
    background: var(--surface);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    color: var(--text);
}

/* Prevent inline code in code blocks from getting background */
.code-block code {
    background: none;
    padding: 0;
}

.code-comment {
    color: var(--muted-2);
}

.note {
    color: var(--muted);
    font-size: 14px;
    margin: 8px 0;
}

/* Build steps ordered list */
.build-steps {
    list-style: none;
    padding: 0;
    margin: 12px 0;
    counter-reset: build-step-counter;
}

.build-steps li {
    padding: 10px 0 10px 36px;
    position: relative;
    counter-increment: build-step-counter;
    line-height: 1.6;
}

.build-steps li::before {
    content: counter(build-step-counter);
    position: absolute;
    left: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface-strong);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.build-steps li code {
    background: var(--surface);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

/* Build divider */
.build-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 32px 0;
}

@media (max-width: 600px) {
    .build-guide {
        padding: 24px 0;
    }

    .build-guide h1 {
        font-size: 24px;
    }

    .build-guide .lead {
        font-size: 16px;
    }

    .code-block {
        padding: 12px;
    }

    .code-block pre {
        font-size: 12px;
    }
}

/* Image preview clickability hint */
img[alt]:not(.brand img, .comment-avatar) {
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

img[alt]:not(.brand img, .comment-avatar):hover {
    filter: brightness(1.1);
}

/* GLightbox custom theme to match website */
.glightbox-clean .gslide-description {
    background: var(--bg) !important;
    color: var(--text) !important;
}

.glightbox-clean .gslide-desc {
    color: var(--text) !important;
}

.glightbox-clean .goverlay {
    background: rgba(0, 0, 0, 0.85) !important;
}
