:root {
    /* 思政主题配色 */
    --app-bg: #fdfbf7;
    --sidebar-bg: rgba(255, 248, 240, 0.9);
    --glass-border: rgba(214, 59, 29, 0.2);
    --text-primary: #8b0000;
    --text-secondary: #a05a5a;
    --accent-red: #d63b1d;
    --accent-gold: #ffb400;
    --accent-blue: #4a90e2;
    --accent-green: #27c93f;
    --accent-hover: #b32b12;

    /* 鸽巢配色 */
    --hole-bg: rgba(255, 255, 255, 0.8);
    --hole-border: #d63b1d;
    --hole-hover: rgba(214, 59, 29, 0.1);

    /* 鸽子配色 */
    --pigeon-colors: #ff6b6b, #4ecdc4, #45b7d1, #f9ca24, #6c5ce7, #fd79a8, #00b894, #e17055;

    --shadow-sm: 0 2px 8px rgba(139, 0, 0, 0.08);
    --shadow-md: 0 8px 24px rgba(139, 0, 0, 0.12);
    --shadow-lg: 0 20px 40px rgba(139, 0, 0, 0.15);

    --font-family: "Noto Serif SC", "ZCOOL XiaoWei", serif;
    --font-title: "Ma Shan Zheng", cursive;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--app-bg);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image:
        linear-gradient(135deg, rgba(214, 59, 29, 0.05) 0%, rgba(74, 144, 226, 0.05) 100%),
        url('https://images.unsplash.com/photo-1552664730-d307ca884978?q=80&w=2574&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
}

.app-container {
    width: 90vw;
    height: 85vh;
    max-width: 1400px;
    background: rgba(255, 252, 245, 0.90);
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    display: flex;
    overflow: hidden;
}

/* ========== 侧边栏 ========== */
.sidebar {
    width: 340px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.2rem;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.window-controls {
    display: flex;
    gap: 8px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red {
    background: #ff5f56;
    border: 1px solid #e0443e;
}

.dot.yellow {
    background: #ffbd2e;
    border: 1px solid #dea123;
}

.dot.green {
    background: #27c93f;
    border: 1px solid #1aab29;
}

h1 {
    font-family: var(--font-title);
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: 0.05em;
}

.subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: -5px;
}

.highlight {
    color: var(--accent-red);
}

.controls-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-grow: 1;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========== 选择器 ========== */
.apple-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--accent-red);
    background: #fff;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.apple-select:hover {
    border-color: var(--accent-hover);
    box-shadow: var(--shadow-md);
}

.apple-select:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(214, 59, 29, 0.1);
}

/* ========== 滑块 ========== */
.slider-container {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.slider-label {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
}

.slider-label span {
    color: var(--accent-red);
    font-weight: 700;
    margin-left: 8px;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--accent-red);
    cursor: pointer;
    margin-top: -7px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 2px solid #fff;
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(214, 59, 29, 0.2);
    border-radius: 2px;
}

/* ========== 信息面板 ========== */
.info-panel {
    background: rgba(255, 255, 255, 0.6);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(214, 59, 29, 0.1);
}

.info-panel h3 {
    font-size: 1rem;
    color: var(--accent-red);
    margin-bottom: 6px;
    font-weight: 700;
}

.info-panel p {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 6px;
}

.info-panel p:last-child {
    margin-bottom: 0;
}

.political-text {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.8rem !important;
}

/* ========== 结果面板 ========== */
.result-panel {
    background: rgba(255, 255, 255, 0.6);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(214, 59, 29, 0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
}

.result-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.result-value {
    font-size: 1.3rem;
    color: var(--accent-red);
    font-weight: 700;
}

.result-unit {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 4px;
}

.highlight-result {
    background: rgba(214, 59, 29, 0.1);
    border: 1px solid var(--accent-red);
}

.highlight-result .result-value {
    font-size: 1.5rem;
}

/* ========== 策略按钮 ========== */
.strategy-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.strategy-btn {
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(214, 59, 29, 0.3);
    background: #fff;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.strategy-btn:hover {
    background: rgba(214, 59, 29, 0.05);
    border-color: var(--accent-red);
}

.strategy-btn.active {
    background: var(--accent-red);
    color: #fff;
    border-color: var(--accent-red);
}

/* ========== 按钮 ========== */
.apple-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: var(--font-family);
    width: 100%;
}

.action-btn {
    background: linear-gradient(135deg, var(--accent-red) 0%, var(--accent-hover) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.action-btn:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.secondary-btn {
    background: #fff;
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.secondary-btn:hover {
    background: rgba(214, 59, 29, 0.05);
}

.actions-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ========== 可视化主区域 ========== */
.visualizer-stage {
    flex-grow: 1;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
}

.glass-pane {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 2rem;
    position: relative;
    overflow: auto;
}

.visualization-area {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ========== 鸽巢容器 ========== */
.pigeonholes-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1rem;
}

.pigeonhole {
    width: 140px;
    min-height: 180px;
    background: var(--hole-bg);
    border: 3px solid var(--hole-border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.pigeonhole:hover {
    background: var(--hole-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.hole-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(214, 59, 29, 0.2);
}

.hole-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-red);
}

.hole-count {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--accent-red);
    color: #fff;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
}

.hole-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

/* ========== 待分配区域 ========== */
.pigeons-waiting {
    background: rgba(255, 255, 255, 0.7);
    border: 2px dashed var(--accent-gold);
    border-radius: 12px;
    padding: 1rem;
    min-height: 120px;
}

.waiting-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-gold);
    margin-bottom: 12px;
    text-align: center;
}

.pigeons-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

/* ========== 鸽子元素 ========== */
.pigeon {
    padding: 8px 14px;
    border-radius: 20px;
    background: #ff6b6b;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pigeon:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-md);
}

.pigeon-icon {
    font-size: 1rem;
}

.pigeon.flying {
    animation: fly 0.6s ease;
}

@keyframes fly {
    0% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-20px) scale(1.1);
    }

    100% {
        transform: translateY(0) scale(1);
    }
}

/* ========== 统计覆盖层 ========== */
.stats-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
    justify-content: center;
    pointer-events: none;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 16px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(214, 59, 29, 0.2);
    min-width: 100px;
}

.stat-icon {
    font-size: 1.5rem;
}

.stat-text {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.stat-number {
    font-size: 1.3rem;
    color: var(--accent-red);
    font-weight: 700;
}

.highlight-card {
    background: linear-gradient(135deg, rgba(214, 59, 29, 0.1) 0%, rgba(255, 180, 0, 0.1) 100%);
    border-color: var(--accent-red);
}

.highlight-card .stat-number {
    font-size: 1.5rem;
}

/* ========== 动画 ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.pigeonhole {
    animation: fadeIn 0.4s ease;
}

.pigeon {
    animation: fadeIn 0.3s ease;
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
        width: 95vw;
        height: 95vh;
    }

    .sidebar {
        width: 100%;
        max-height: 50vh;
    }

    .glass-pane {
        padding: 1rem;
    }

    .pigeonhole {
        width: 120px;
        min-height: 150px;
    }

    .stats-overlay {
        flex-wrap: wrap;
    }
}