:root {
    --bg0: #07060d;
    --bg1: #0b0717;
    --card-bg: rgba(16, 14, 26, 0.7);
    --text-main: rgba(255, 255, 255, 0.92);
    --text-muted: rgba(255, 255, 255, 0.6);
    --accent-color: #3b82f6;
    --accent-hover: #60a5fa;
    --border-color: rgba(255, 255, 255, 0.08);
    --star-color: #fbbf24;
    --badge-bg: rgba(59, 130, 246, 0.25);
    --badge-border: rgba(59, 130, 246, 0.35);
    --badge-text: rgba(255, 255, 255, 0.86);
    --case-card-fixed-width: 280px;
    --case-card-mobile-width: 220px;
}

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.75) rgba(255, 255, 255, 0.06);
}

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

*::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.86), rgba(14, 165, 233, 0.72));
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(96, 165, 250, 0.92), rgba(56, 189, 248, 0.82));
}

body {
    margin: 0;
    padding: 0;
    background: radial-gradient(1200px 700px at 50% -120px, rgba(59, 130, 246, 0.35), transparent 60%),
        radial-gradient(900px 500px at 10% 0%, rgba(14, 165, 233, 0.22), transparent 55%),
        linear-gradient(180deg, var(--bg1), var(--bg0));
    color: var(--text-main);
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    min-height: 100vh;
}

.nav-link:hover {
    color: #fff !important;
}

.cases-container {
    width: min(1680px, calc(100% - 48px));
    margin: 0 auto;
    padding: 40px 0 60px;
}

.cases-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px 0;
}

.cases-title {
    text-align: center;
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 1.4px;
    margin: 0 0 8px 0;
    color: var(--text-main);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.cases-subtitle {
    text-align: center;
    font-size: 16px;
    color: var(--text-muted);
    margin: 0;
}

.cases-search-bar {
    width: min(100%, 560px);
    margin-top: 24px;
    display: flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(16, 14, 26, 0.7);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.cases-search-bar:focus-within {
    border-color: rgba(59, 130, 246, 0.55);
    box-shadow: 0 12px 28px rgba(59, 130, 246, 0.18);
}

.cases-search-input {
    flex: 1;
    min-width: 0;
    height: 52px;
    padding: 0 18px;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text-main);
    font-size: 14px;
}

.cases-search-input::placeholder {
    color: rgba(255, 255, 255, 0.42);
}

.cases-search-input::-webkit-search-cancel-button {
    cursor: pointer;
}

.cases-search-btn {
    width: 54px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    cursor: pointer;
    transition: color 0.3s ease, background 0.3s ease;
}

.cases-search-btn:hover {
    background: rgba(59, 130, 246, 0.12);
    color: #ffffff;
}

.cases-search-btn:active {
    transform: scale(0.97);
}

.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(var(--case-card-fixed-width), 100%), var(--case-card-fixed-width)));
    gap: 24px;
    width: 100%;
    align-items: stretch;
    justify-content: center;
}

.cases-grid.cases-grid-searching,
.app-projects-list.cases-grid-searching {
    grid-template-columns: repeat(auto-fit, minmax(min(var(--case-card-fixed-width), 100%), var(--case-card-fixed-width)));
    justify-content: center;
}

.case-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(14px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    min-width: 0;
}

.case-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.5);
}

.case-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    /* 16:9 Aspect Ratio */
    background-color: #000;
    overflow: hidden;
}

.case-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.case-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: var(--badge-bg);
    color: var(--badge-text);
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--badge-border);
    font-size: 12px;
    font-weight: bold;
    z-index: 1;
}

.case-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.case-card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
    line-height: 1.5;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.case-card-summary {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 20px 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.case-btn {
    display: block;
    width: 100%;
    padding: 10px 0;
    text-align: center;
    background: linear-gradient(135deg, #2563eb, #06b6d4) !important;
    color: #ffffff !important;
    border: 0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, filter 0.2s;
    box-sizing: border-box;
}

.case-btn:hover {
    background: linear-gradient(135deg, #1d4ed8, #0891b2) !important;
    color: #fff;
    border: 0;
}

.tomai-page button:not(.category-tab):not(.category-tag):not(.refresh-btn):not(.cases-search-btn),
.tomai-page .btn,
.tomai-page .btn-secondary,
.tomai-page .btn-tertiary,
.tomai-page .btn-inverse,
.tomai-page .btn-cta,
.tomai-page .tomai-gateway-btn,
.tomai-page .tomai-gateway-btn2,
.tomai-page .tomai-gateway-btn3,
.tomai-page .museum-download-btn,
.tomai-page .platform-link-btn,
.tomai-page .cta-join-btn {
    background: linear-gradient(135deg, #2563eb, #06b6d4) !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

.tomai-page button:not(.category-tab):not(.category-tag):not(.refresh-btn):not(.cases-search-btn):hover,
.tomai-page .btn:hover,
.tomai-page .btn-secondary:hover,
.tomai-page .btn-tertiary:hover,
.tomai-page .btn-inverse:hover,
.tomai-page .btn-cta:hover,
.tomai-page .tomai-gateway-btn:hover,
.tomai-page .tomai-gateway-btn2:hover,
.tomai-page .tomai-gateway-btn3:hover,
.tomai-page .museum-download-btn:hover,
.tomai-page .platform-link-btn:hover,
.tomai-page .cta-join-btn:hover {
    background: linear-gradient(135deg, #1d4ed8, #0891b2) !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

.loading-state,
.error-state,
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    grid-column: 1 / -1;
}

/* 分类切换标签 */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    width: 100%;
}

.category-tab {
    padding: 8px 20px;
    background: rgba(30, 41, 59, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6) !important;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-tab:hover {
    background: rgba(30, 41, 59, 0.7) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: rgba(255, 255, 255, 0.8) !important;
}

.category-tab.active {
    background: linear-gradient(135deg, #2563eb, #06b6d4) !important;
    border: 1px solid transparent !important;
    color: #ffffff !important;
}

/* 刷新按钮 */
.refresh-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

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

.refresh-btn.refreshing {
    opacity: 0.6;
    pointer-events: none;
}

.refresh-btn.refreshing svg {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* App 项目容器 */
.app-projects-container {
    width: 100%;
    margin: 40px auto 0;
}

.section-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 24px 0;
    padding-top: 20px;
}

.app-projects-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(var(--case-card-fixed-width), 100%), var(--case-card-fixed-width)));
    gap: 24px;
    width: 100%;
    align-items: stretch;
    justify-content: center;
}

.app-project-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    backdrop-filter: blur(14px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.app-project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.5);
}

/* App 项目正方形封面 */
.app-project-cover-square {
    position: relative;
    width: 100%;
    padding-top: 100%;
    /* 1:1 正方形 */
    background-color: #000;
    overflow: hidden;
}

.app-project-cover-square img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-project-cover {
    position: relative;
    width: 100%;
    padding-top: 100%;
    /* 1:1 正方形 */
    background-color: #000;
    overflow: hidden;
}

.app-project-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-project-info {
    padding: 20px;
}

.app-project-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--text-main);
}

.app-project-description {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Toast 提示消息 */
.toast-message {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(16, 14, 26, 0.95);
    border: 1px solid rgba(59, 130, 246, 0.5);
    border-radius: 12px;
    padding: 16px 24px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.toast-message.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-message.success {
    border-color: rgba(34, 197, 94, 0.5);
}

.toast-message.error {
    border-color: rgba(239, 68, 68, 0.5);
}

.toast-message.info {
    border-color: rgba(59, 130, 246, 0.5);
}

/* 分类标签 - 与大分类标签样式保持一致 */
.category-tag {
    padding: 8px 20px;
    background: rgba(30, 41, 59, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6) !important;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.category-tag:hover {
    background: rgba(30, 41, 59, 0.7) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: rgba(255, 255, 255, 0.8) !important;
}

.category-tag.active {
    background: linear-gradient(135deg, #2563eb, #06b6d4) !important;
    border: 1px solid transparent !important;
    color: #ffffff !important;
}

.category-tags-web,
.category-tags-app {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

@media (max-width: 768px) {
    .cases-container {
        width: calc(100% - 24px);
        padding-top: 24px;
    }

    .cases-search-bar {
        width: 100%;
    }

    .cases-grid,
    .app-projects-list {
        grid-template-columns: repeat(auto-fill, minmax(min(var(--case-card-mobile-width), 100%), var(--case-card-mobile-width)));
        gap: 18px;
    }

    .cases-grid.cases-grid-searching,
    .app-projects-list.cases-grid-searching {
        grid-template-columns: repeat(auto-fit, minmax(min(var(--case-card-mobile-width), 100%), var(--case-card-mobile-width)));
    }

    .category-tabs {
        gap: 10px;
    }

    .refresh-btn,
    .category-tab {
        width: auto;
    }
}
