* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 滚动条样式 - 透明背景，不影响宽度 */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(93, 190, 170, 0.3) transparent;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

*::-webkit-scrollbar-thumb {
    background: rgba(93, 190, 170, 0.3);
    border-radius: 4px;
    transition: background 0.2s;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(93, 190, 170, 0.5);
}

/* Dark mode 滚动条 */
[data-theme="dark"] * {
    scrollbar-color: rgba(93, 190, 170, 0.4) transparent;
}

[data-theme="dark"] *::-webkit-scrollbar-thumb {
    background: rgba(93, 190, 170, 0.4);
}

[data-theme="dark"] *::-webkit-scrollbar-thumb:hover {
    background: rgba(93, 190, 170, 0.6);
}

:root {
    --primary-color: #2d3436;
    --teal: #5dbeaa;
    --orange: #ffb347;
    --text-color: #2d3436;
    --text-light: #636e72;
    --bg-gray: #f5f6fa;
    --card-bg: #ffffff;
    --border-color: #dfe6e9;
}

/* Dark Mode */
[data-theme="dark"] {
    --primary-color: #e8eaed;
    --text-color: #e8eaed;
    --text-light: #9aa0a6;
    --bg-gray: #202124;
    --card-bg: #292a2d;
    --border-color: #3c4043;
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(
        90deg,
        #292a2d 0%,
        #3c4043 50%,
        #292a2d 100%
    );
    background-size: 200% 100%;
}

[data-theme="dark"] .loading-spinner {
    border-color: #3c4043;
    border-top-color: var(--teal);
}

[data-theme="dark"] code {
    background: #3c4043;
}

[data-theme="dark"] .image-error {
    background: #3c4043;
}

/* Filter and Sort Bar */
.filter-sort-bar {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.filter-sort-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-sort-section label {
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
}

.filter-sort-section select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-gray);
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-sort-section select:hover,
.filter-sort-section select:focus {
    border-color: var(--teal);
    outline: none;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap; /* 允許換行 */
    gap: 0.5rem;
    flex: 1;
}

.filter-chip {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-gray);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0; /* 防止標籤被壓縮 */
}

.filter-chip:hover {
    border-color: var(--teal);
    background: var(--card-bg);
}

.filter-chip.active {
    background: var(--teal);
    color: white;
    border-color: var(--teal);
}

.filter-chip-count {
    display: inline-block;
    margin-left: 0.3rem;
    padding: 0.1rem 0.4rem;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    font-size: 0.8rem;
}

.filter-chip.active .filter-chip-count {
    background: rgba(255, 255, 255, 0.2);
}

/* Secondary Filters (Collapsible) */
.filter-chips-secondary {
    display: contents; /* 让子元素直接参与父容器的 flex 布局，标签会接续在第一行后面 */
}

/* Toggle Button */
.filter-chip-toggle {
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    font-weight: 600;
}

.filter-chip-toggle:hover {
    border-color: var(--teal);
    border-style: solid;
}

.filter-chip-toggle .toggle-icon {
    display: inline-block;
    margin-left: 0.3rem;
    font-size: 0.8rem;
    transition: transform 0.3s;
}

/* Search Highlight */
.search-highlight {
    background-color: #ffeb3b;
    color: #000;
    padding: 0.1rem 0.2rem;
    border-radius: 2px;
    font-weight: 600;
}

[data-theme="dark"] .search-highlight {
    background-color: #ffa000;
    color: #fff;
}

/* Card Actions */
.item-card {
    position: relative;
}

.card-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.item-card:hover .card-actions {
    opacity: 1;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
}

.btn-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.btn-icon:active {
    transform: scale(0.95);
}

.btn-icon.favorited {
    background: var(--orange);
    color: white;
}

.btn-icon::before {
    content: attr(data-icon);
}

/* Favorites Badge */
.favorites-indicator {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: var(--orange);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: none;
}

.item-card.favorited .favorites-indicator {
    display: block;
}

/* Share Popover */
.share-popover {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 100;
    min-width: 250px;
    display: none;
}

.share-popover.show {
    display: block;
}

.share-popover input {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.share-popover button {
    width: 100%;
    padding: 0.5rem;
    background: var(--teal);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.share-popover button:hover {
    background: #4da996;
}

/* Breadcrumb Navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0;
    font-size: 0.9rem;
    color: var(--text-light);
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--teal);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: #4da996;
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-light);
}

.breadcrumb-current {
    color: var(--text-color);
    font-weight: 600;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transition: bottom 0.3s ease;
    white-space: nowrap;
}

.toast.show {
    bottom: 2rem;
}

[data-theme="dark"] .toast {
    background: var(--card-bg);
    border: 2px solid var(--teal);
    color: var(--text-color);
}

/* Global Search Modal */
.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: flex-start;
    justify-content: center;
    padding-top: 5vh;
}

.search-modal.show {
    display: flex;
}

.search-modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.search-modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-modal-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.1rem;
    background: var(--bg-gray);
    color: var(--text-color);
}

.search-modal-input:focus {
    outline: none;
    border-color: var(--teal);
}

.search-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-gray);
    color: var(--text-color);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.search-modal-close:hover {
    background: var(--teal);
    color: white;
}

.search-modal-results {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.search-filter-bar {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.search-result-group-title {
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--teal);
    background: var(--bg-gray);
    border-radius: 6px;
    border-left: 3px solid var(--teal);
}

.search-result-group-title:first-child {
    margin-top: 0;
}

.search-result-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--bg-gray);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-title {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.search-result-breadcrumb {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.search-result-snippet {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
}

.search-no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.search-shortcut {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--bg-gray);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: monospace;
}

/* Tooltip */
.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    margin-bottom: 0.5rem;
    z-index: 1000;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--primary-color);
}

[data-theme="dark"] .tooltip {
    background: var(--card-bg);
    border: 2px solid var(--teal);
    color: var(--text-color);
}

[data-theme="dark"] .tooltip::after {
    border-top-color: var(--teal);
}

.tooltip-container:hover .tooltip,
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Simple data-tooltip attribute */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    margin-bottom: 0.5rem;
    z-index: 1000;
}

[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% - 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--primary-color);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

[data-theme="dark"] [data-tooltip]::after {
    background: var(--card-bg);
    border: 2px solid var(--teal);
    color: var(--text-color);
}

[data-theme="dark"] [data-tooltip]::before {
    border-top-color: var(--teal);
}

/* Mobile Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 2px solid var(--border-color);
    padding: 0.5rem 0;
    z-index: 999;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
}

.bottom-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.75rem;
    transition: all 0.2s;
    border-radius: 8px;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    background: var(--bg-gray);
    color: var(--teal);
}

.bottom-nav-icon {
    font-size: 1.5rem;
}

/* Recipe Tree / Dependency Graph */
.recipe-tree {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    margin: 2rem 0;
    overflow-x: auto;
}

.recipe-tree-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

.tree-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    min-width: fit-content;
    overflow-x: auto;
    padding: 1rem 0;
}

.tree-level {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
    position: relative;
}

.tree-node {
    background: var(--bg-gray);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    min-width: 150px;
    min-height: 140px;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
}

.tree-node:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    border-color: var(--teal);
}

.tree-node-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

.tree-node-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.tree-node-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.tree-node-count {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.tree-arrow {
    font-size: 1.5rem;
    color: var(--teal);
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
}

.tree-arrow::before {
    content: '→';
}

.tree-separator {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--teal);
    padding: 0 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

.tree-connector {
    position: absolute;
    top: -1.5rem;
    left: 50%;
    width: 2px;
    height: 1.5rem;
    background: var(--teal);
    transform: translateX(-50%);
}

.tree-node-output {
    background: linear-gradient(135deg, var(--teal) 0%, #4da996 100%);
    color: white;
    border-color: var(--teal);
}

.tree-node-output .tree-node-name,
.tree-node-output .tree-node-count {
    color: white;
}

.tree-node-multi {
    min-width: 300px;
    min-height: 150px;
    padding: 1rem 1.5rem;
}

/* Related Items Section */
.related-items {
    background: var(--bg-gray);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.related-items-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.related-items-title::before {
    content: '';
}

.related-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.related-item-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.related-item-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--teal);
}

.related-item-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.related-item-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.related-item-tag {
    font-size: 0.75rem;
    color: var(--text-light);
}

@media (max-width: 768px) {
    .related-items-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .bottom-nav {
        display: block;
    }
    
    .main-content {
        padding-bottom: 5rem;
    }
    
    .back-to-top,
    .dark-mode-toggle {
        display: none;
    }
    
    .tree-node {
        min-width: 120px;
        padding: 0.75rem;
    }
    
    .tree-node-icon {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 768px) {
    .filter-sort-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-sort-section {
        width: 100%;
    }
    
    .filter-sort-section select {
        flex: 1;
    }
    
    .filter-chips {
        width: 100%;
    }
}

/* Skip to Main Content */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--teal);
    color: white;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 10001;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Focus Styles */
*:focus-visible {
    outline: 3px solid var(--teal);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid var(--teal);
    outline-offset: 2px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-gray);
    min-height: 100vh;
    display: flex;
}

/* Left Sidebar */
.sidebar {
    width: 260px;
    background: var(--card-bg);
    border-right: 3px solid var(--teal);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 2rem 1.5rem 1.5rem;
    border-bottom: 2px solid var(--border-color);
    flex-shrink: 0;
}

.logo {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 28px;
    height: 28px;
    background: var(--teal);
    flex-shrink: 0;
}

/* 导航区域可滚动 */
.sidebar nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    /* 顶部和底部淡出效果 */
    mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        black 40px,
        black calc(100% - 40px),
        transparent 100%
    );
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        black 40px,
        black calc(100% - 40px),
        transparent 100%
    );
}

.nav-links {
    list-style: none;
    padding: 1rem 0;
}

.nav-links li {
    margin: 0;
}

.nav-links a {
    display: block;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.nav-links a:hover {
    background: var(--bg-gray);
    border-left-color: var(--teal);
}

.nav-links a.active {
    background: var(--bg-gray);
    border-left-color: var(--teal);
    color: var(--teal);
}

/* Sub-menu styles */
.nav-section {
    margin: 0.5rem 0;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-links .sub-menu {
    list-style: none;
    padding: 0;
}

.nav-links .sub-menu a {
    padding-left: 2.5rem;
    font-size: 0.9rem;
}

/* 可折叠菜单容器 */
.collapsible-menu {
    position: relative;
}

.collapsible-menu a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 3rem !important; /* 为箭头留出空间 */
}

/* 折叠按钮 */
.collapse-toggle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    z-index: 1;
}

.collapse-toggle:hover {
    color: var(--teal);
}

.collapse-toggle .arrow {
    font-size: 1.2rem;
    font-weight: bold;
    transition: transform 0.4s ease;
    display: inline-block;
}

/* 展开状态 - 只影响一级菜单的箭头 */
.sub-menu.expanded > .collapsible-menu > .collapse-toggle .arrow {
    transform: rotate(90deg);
}

/* 确保按钮在 hover/active 状态下也在背景内 */
.collapsible-menu:hover .collapse-toggle,
.collapsible-menu a.active ~ .collapse-toggle {
    color: var(--teal);
}

/* 子菜单列表 */
.sub-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sub-menu.expanded .sub-menu-list {
    max-height: 1000px;
}

.nav-links .sub-menu-indent a {
    padding-left: 3.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
    transition: color 0.2s;
    opacity: 0;
}

/* 展开时文字淡入 */
.sub-menu.expanded .sub-menu-indent a {
    opacity: 1;
    transition: color 0.2s, opacity 0.3s ease;
}

.nav-links .sub-menu-indent a:hover {
    color: var(--teal);
}

/* 二级分类样式 */
.sub-menu-indent.sub-category {
    position: relative;
}

.sub-menu-indent.sub-category .collapsible-menu {
    position: relative;
}

.sub-menu-indent.sub-category .category-label {
    display: block;
    padding: 0.6rem 3.5rem 0.6rem 3.5rem;
    font-size: 0.85rem;
    color: var(--text-color);
    font-weight: 500;
    cursor: default;
    opacity: 0;
}

/* 展开时分类标签淡入 */
.sub-menu.expanded .sub-menu-indent.sub-category .category-label {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.sub-menu-indent.sub-category .collapse-toggle {
    right: 0;
    padding: 0.6rem 1rem;
}

/* 二级分类展开状态 */
.sub-menu-indent.sub-category.expanded .collapse-toggle .arrow {
    transform: rotate(90deg);
}

/* 二级分类的子菜单列表 */
.sub-menu-indent.sub-category .sub-menu-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sub-menu-indent.sub-category.expanded .sub-menu-list {
    max-height: 800px;
}

/* 三级缩进 */
.nav-links .sub-menu-indent-2 a {
    padding-left: 5rem;
    font-size: 0.85rem;
    color: var(--text-light);
    transition: color 0.2s;
    opacity: 0;
}

/* 展开时三级菜单淡入 */
.sub-menu-indent.sub-category.expanded .sub-menu-indent-2 a {
    opacity: 1;
    transition: color 0.2s, opacity 0.3s ease;
}

.nav-links .sub-menu-indent-2 a:hover {
    color: var(--teal);
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    min-height: 100vh;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 2rem 2rem 1.5rem;
    background: var(--card-bg);
    border-bottom: 3px solid var(--teal);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-light);
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.external-links {
    padding: 1rem 1.5rem;
    border-top: 2px solid var(--border-color);
    flex-shrink: 0;
}

.external-links a {
    display: block;
    color: var(--teal);
    text-decoration: none;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.external-links a:hover {
    text-decoration: underline;
}

.btn {
    padding: 0.75rem 2rem;
    border: 2px solid;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--teal);
    color: white;
    border-color: var(--teal);
}

.btn-primary:hover {
    background: #4da896;
    border-color: #4da896;
}

.btn-secondary {
    background: transparent;
    color: var(--teal);
    border-color: var(--teal);
}

.btn-secondary:hover {
    background: var(--teal);
    color: white;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Section */
section {
    background: var(--card-bg);
    margin: 2rem;
    padding: 2rem 2rem;
    border-top: 3px solid var(--border-color);
}

section h2 {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-align: center;
    position: relative;
    padding-bottom: 0.5rem;
}

section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--teal);
}

section h3 {
    font-size: 1.6rem;
    color: var(--primary-color);
    margin: 1.25rem 0 0.5rem;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature-card {
    background: var(--card-bg);
    padding: 2rem;
    border: 2px solid var(--border-color);
    text-align: center;
}

.feature-card:nth-child(odd) {
    border-top: 3px solid var(--teal);
}

.feature-card:nth-child(even) {
    border-top: 3px solid var(--orange);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    color: var(--primary-color);
    margin: 1rem 0;
    font-size: 1.3rem;
}

.feature-card p {
    color: var(--text-light);
}

/* Items Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.item-card {
    background: var(--bg-gray);
    padding: 1.5rem;
    border-left: 4px solid var(--teal);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.item-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.item-icon {
    width: 48px;
    height: 48px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    image-rendering: pixelated;
}

.item-icon img {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
}

.item-card h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.item-card p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.item-tag {
    display: inline-block;
    background: var(--teal);
    color: white;
    padding: 0.2rem 0.8rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    align-self: flex-start;
    margin-top: auto;
}

/* Gallery Section */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.gallery-item {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    padding: 1rem;
    text-align: center;
    transition: border-color 0.2s;
}

.gallery-item:hover {
    border-color: var(--teal);
}

.gallery-item img {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
    margin-bottom: 0.5rem;
}

.gallery-item-name {
    font-size: 0.85rem;
    color: var(--text-color);
    font-weight: 500;
}

/* Recipe Section */
.recipe-card {
    background: var(--bg-gray);
    padding: 1.5rem;
    margin: 1rem 0;
    border-left: 4px solid var(--orange);
}

.recipe-card h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.recipe-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.recipe-input, .recipe-output {
    background: var(--card-bg);
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.recipe-input h5, .recipe-output h5 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.recipe-input ul, .recipe-output ul {
    list-style: none;
    padding-left: 1rem;
}

.recipe-input li::before {
    content: "→ ";
    color: var(--teal);
    font-weight: bold;
}

.recipe-output li::before {
    content: "› ";
    color: var(--orange);
    font-weight: bold;
}

/* Multiblock Section */
.multiblock-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-left: 4px solid var(--teal);
    padding: 2rem;
    margin: 1.5rem 0;
}

.multiblock-card h4 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.multiblock-requirements {
    background: var(--bg-gray);
    padding: 1rem;
    margin-top: 1rem;
}

.multiblock-requirements ul {
    list-style: none;
    padding-left: 1rem;
}

.multiblock-requirements li::before {
    content: "◆ ";
    color: var(--teal);
}

/* Installation Section */
.install-steps {
    counter-reset: step-counter;
    list-style: none;
}

.install-steps li {
    position: relative;
    padding: 1.5rem 1.5rem 1.5rem 4rem;
    margin: 1rem 0;
    background: var(--bg-gray);
    border-left: 3px solid var(--teal);
    counter-increment: step-counter;
}

.install-steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 1rem;
    top: 1.5rem;
    background: var(--teal);
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Footer */
footer {
    background: var(--card-bg);
    color: var(--text-color);
    text-align: center;
    padding: 2rem;
    margin: 0 2rem 2rem;
    border-top: 3px solid var(--teal);
}

/* Responsive */
@media (max-width: 968px) {
    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
    }

    section {
        margin: 1.5rem;
        padding: 2rem 1.5rem;
    }

    footer {
        margin: 0 1.5rem 1.5rem;
    }
}

@media (max-width: 768px) {
    body {
        display: block;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 3px solid var(--teal);
    }

    .main-content {
        margin-left: 0;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .recipe-details {
        grid-template-columns: 1fr;
    }

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

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

    section {
        margin: 1rem;
        padding: 2rem 1rem;
    }

    footer {
        margin: 0 1rem 1rem;
    }
}

/* Category Badge */
.category-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: var(--teal);
    color: white;
    border-radius: 3px;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Highlight boxes */
.highlight-box {
    background: var(--card-bg);
    border: 2px solid var(--teal);
    border-radius: 4px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.highlight-box h3 {
    color: var(--teal);
    margin-top: 0;
}

code {
    background: var(--bg-gray);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: var(--primary-color);
}

/* Machine Images */
.machine-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

/* Item Images */
.item-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--teal);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.back-to-top:hover {
    background: #4da996;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.back-to-top:active {
    transform: translateY(-1px);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top::before {
    content: '↑';
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    position: fixed;
    bottom: 2rem;
    right: 5rem;
    width: 50px;
    height: 50px;
    background: var(--card-bg);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 999;
}

.dark-mode-toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    border-color: var(--teal);
}

.dark-mode-toggle:active {
    transform: translateY(-1px);
}

.dark-mode-toggle::before {
    content: '◐';
}

[data-theme="dark"] .dark-mode-toggle::before {
    content: '◯';
}

/* Mobile Sidebar Toggle */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    width: 44px;
    height: 44px;
    background: var(--teal);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.mobile-nav-toggle:hover {
    background: #4da996;
}

.mobile-nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--card-bg);
    margin: 4px auto;
    transition: all 0.3s ease;
}

.mobile-nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translateY(6px);
}

.mobile-nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translateY(-6px);
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 50%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.skeleton-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.skeleton-icon {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.skeleton-text {
    flex: 1;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 0.5rem;
}

.skeleton-subtitle {
    height: 16px;
    width: 40%;
}

.skeleton-line {
    height: 14px;
    margin-bottom: 0.5rem;
}

.skeleton-line:last-child {
    width: 80%;
}

.loading-container {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spinner-rotation 0.8s linear infinite;
}

@keyframes spinner-rotation {
    to {
        transform: rotate(360deg);
    }
}

/* Error State */
.error-state {
    background: var(--card-bg);
    border: 2px solid #ff6b6b;
    border-radius: 8px;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 500px;
    text-align: center;
}

.error-state h3 {
    color: #ff6b6b;
    margin-bottom: 0.5rem;
}

.error-state p {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.error-state button {
    background: var(--teal);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.error-state button:hover {
    background: #4da996;
}

/* Image Fallback */
.image-error {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gray);
    color: var(--text-light);
    font-size: 2rem;
}

.image-error::before {
    content: '□';
}

@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: block;
    }
    
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
    
    .dark-mode-toggle {
        bottom: 5.5rem;
        right: 1rem;
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
}