:root {
    color-scheme: light;
    --page-bg: #f3f6f2;
    --surface: #ffffff;
    --ink: #26352f;
    --muted: #748179;
    --line: #e1e8e1;
    --accent: #287568;
    --accent-soft: #e6f2ed;
    --warm-accent: #bc7047;
}

body.bg-gray-50 {
    background-color: var(--page-bg);
    color: var(--ink);
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

header.bg-white {
    background-color: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 2px 10px rgba(31, 54, 43, 0.045);
}

header h1 { color: var(--ink); }
header .bg-indigo-600 { background-color: var(--accent); }

#sidebar {
    background-color: var(--surface);
    border-color: var(--line);
}

#sidebar h3 { color: var(--muted); }

.category-btn {
    border-radius: 8px;
    transition: background-color 160ms ease, color 160ms ease;
}

.category-btn:hover {
    background-color: #f1f5f1;
    color: var(--ink);
}

.navigation-mode-btn {
    color: var(--muted);
}

.navigation-mode-btn.active {
    background-color: var(--surface);
    color: var(--accent);
    box-shadow: 0 1px 3px rgba(31, 54, 43, 0.12);
}

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

#sidebar .category-btn.active {
    background-color: var(--accent-soft);
    color: var(--accent);
    border-right: 3px solid var(--accent);
}

main section.bg-gray-50 {
    background-color: var(--page-bg);
}

#current-topic-title {
    color: var(--ink);
    line-height: 1.25;
}

#current-topic-desc {
    color: var(--muted);
}

main section > div > .bg-white.rounded-xl {
    border-color: var(--line);
    border-radius: 8px;
    box-shadow: 0 3px 12px rgba(31, 54, 43, 0.045);
}

#method-view {
    color: #43524a;
    line-height: 1.85;
}

#questions-list article {
    background-color: var(--surface);
    border-color: var(--line);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(31, 54, 43, 0.055);
    transition: box-shadow 160ms ease, border-color 160ms ease;
}

#questions-list article:hover {
    border-color: #cbd9ce;
    box-shadow: 0 7px 22px rgba(31, 54, 43, 0.075);
}

#questions-list article > div:first-child p {
    color: var(--ink);
    line-height: 1.75;
}

#questions-list article > div:first-child p > span:first-child {
    color: var(--accent);
    font-weight: 700;
}

#questions-list figure figcaption {
    color: var(--muted);
}

#questions-list figure > div,
#questions-list figure > img {
    border-color: var(--line);
}

#questions-list .solution-box {
    padding: 12px 14px;
    border: 1px solid #d8e5dc;
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    background-color: #edf5f0;
}

#questions-list .solution-answer {
    margin: 0 0 9px;
    padding-bottom: 9px;
    border-bottom: 1px solid #d8e5dc;
    color: #294b40;
}

#questions-list .solution-answer .solution-label {
    color: var(--accent);
    font-weight: 600;
}

#questions-list .solution-explanation {
    margin: 0;
    color: #5a625d;
    line-height: 1.75;
}

#questions-list .solution-explanation .solution-label {
    color: var(--accent);
    font-weight: 600;
}

#questions-list figure .bg-gray-50 {
    background-color: #f4f7f4;
}

.voxel-viewer {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f4f7f4;
}

.voxel-gallery {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f4f7f4;
}

.voxel-gallery--single {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
}

.voxel-gallery-item { min-width: 0; }
.voxel-gallery-item--large { grid-row: span 3; }
.voxel-gallery-item figcaption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voxel-gallery-item--large .voxel-canvas { height: 360px; }
.voxel-gallery-item--small .voxel-canvas { height: 110px; }
.voxel-gallery--single .voxel-canvas { height: 250px; }

.voxel-canvas {
    width: 100%;
    height: 250px;
    touch-action: none;
    cursor: grab;
}

.voxel-canvas:active { cursor: grabbing; }
.voxel-canvas canvas { display: block; }

.voxel-reset {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--muted);
    font-size: 12px;
}

.voxel-reset:hover {
    border-color: var(--accent);
    color: var(--accent);
}

@media (max-width: 640px) {
    .voxel-gallery {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-rows: auto auto;
    }

    .voxel-gallery-item--large {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .voxel-gallery-item--large .voxel-canvas { height: 230px; }
    .voxel-gallery-item--small .voxel-canvas { height: 105px; }
}

* { -webkit-tap-highlight-color: transparent; }

/* A4打印专属优化 */
@media print {
    @page {
        size: A4;
        margin: 2cm 1.5cm;
    }
    body {
        background-color: white !important;
        font-size: 12pt;
        line-height: 1.6;
    }
    .shadow-sm, .shadow-lg {
        box-shadow: none !important;
    }
    .bg-white.rounded-xl {
        page-break-inside: avoid;
    }
    h2, h3 {
        page-break-after: avoid;
    }
}
