:root {
    --primary-red: #de2910;
    --primary-gold: #ffde00;
    --heritage-brown: #8b4513;
    --heritage-amber: #ff8c00;
    --bg-color: #fdfbf7;
    --text-dark: #2c3e50;
    --text-light: #596b7e;
    --glass-bg: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --shadow-lg: 0 12px 48px 0 rgba(31, 38, 135, 0.25);
    --font-title: 'Ma Shan Zheng', cursive;
    --font-body: 'Outfit', sans-serif;
    --font-serif: 'Noto Serif SC', serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 15% 25%, rgba(139, 69, 19, 0.04) 0%, transparent 25%),
        radial-gradient(circle at 85% 75%, rgba(255, 140, 0, 0.05) 0%, transparent 25%);
    color: var(--text-dark);
    font-family: var(--font-body);
    min-height: 100vh;
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== Header ===== */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 35px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--glass-border);
}

.header-content h1 {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.header-content .highlight {
    color: var(--primary-red);
    font-family: var(--font-title);
    font-size: 2rem;
    margin-left: 10px;
}

.subtitle {
    font-family: var(--font-body);
    color: var(--text-light);
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.stats-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--heritage-brown), #6b3410);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.stats-icon {
    font-size: 2rem;
}

.stats-number {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.stats-label {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* ===== Main Stage ===== */
.main-stage {
    display: grid;
    grid-template-columns: 300px 1fr 340px;
    gap: 20px;
}

.left-panel,
.right-panel,
.center-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border-radius: 14px;
    box-shadow: var(--shadow);
    border: 1px solid var(--glass-border);
    padding: 20px;
}

.left-panel,
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ===== Panel Sections ===== */
.panel-section {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 18px;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-gold);
}

.panel-header.main {
    border-bottom: none;
    justify-content: space-between;
    margin-bottom: 20px;
}

.panel-header.main h2 {
    font-family: var(--font-title);
    font-size: 1.8rem;
    color: var(--primary-red);
}

.panel-icon {
    font-size: 1.4rem;
}

.panel-header h3 {
    font-size: 1.05rem;
    color: var(--primary-red);
    font-weight: 700;
}

/* === = Rule Box ===== */
.rule-box {
    margin-bottom: 20px;
    background: white;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid var(--heritage-amber);
}

.rule-box:last-child {
    margin-bottom: 0;
}

.rule-title {
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--heritage-brown);
}

.rule-formula {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: #f9f9f9;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.formula-line {
    padding: 2px 0;
}

.formula-indent {
    margin-left: 20px;
    color: var(--text-light);
}

.formula-arrow {
    margin: 5px 0;
    text-align: center;
    font-size: 1.2rem;
    color: var(--primary-red);
}

.formula-result {
    background: #fff5f5;
    padding: 8px;
    border-radius: 6px;
    font-weight: 700;
    color: var(--primary-red);
    text-align: center;
}

.rule-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* ===== Predicate List ===== */
.predicate-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.predicate-item {
    background: white;
    padding: 10px;
    border-radius: 8px;
}

.predicate-item code {
    display: block;
    font-family: var(--font-mono);
    color: var(--heritage-amber);
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.predicate-item p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0;
}

/* ===== Ideology Box ===== */
.ideology-box h4 {
    color: var(--primary-red);
    margin-bottom: 12px;
    font-size: 1.05rem;
}

.ideology-box p {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-light);
    margin-bottom: 12px;
}

.ideology-box blockquote {
    margin: 12px 0 0 0;
    padding: 12px;
    background: #fff5f5;
    border-left: 4px solid var(--primary-red);
    border-radius: 8px;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 0.9rem;
    color: var(--text-dark);
}

/* ===== Filter Controls ===== */
.filter-controls {
    display: flex;
    gap: 8px;
}

.filter-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    color: var(--text-dark);
}

.filter-btn:hover {
    border-color: var(--heritage-amber);
}

.filter-btn.active {
    background: var(--heritage-amber);
    border-color: var(--heritage-amber);
    color: white;
}

/* ===== Heritage Grid ===== */
.heritage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 10px;
}

.heritage-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.heritage-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--heritage-amber);
}

.heritage-card.priority {
    border-color: var(--primary-red);
    box-shadow: 0 4px 12px rgba(222, 41, 16, 0.2);
}

.heritage-image {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.heritage-info {
    padding: 12px;
}

.heritage-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 6px;
    color: var(--text-dark);
}

.heritage-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tag {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.tag.unesco {
    background: #e6f7ff;
    color: #1890ff;
}

.tag.unique {
    background: #fff7e6;
    color: #fa8c16;
}

.tag.danger {
    background: #fff1f0;
    color: #f5222d;
}

.tag.priority {
    background: #fff5f5;
    color: var(--primary-red);
}

/* ===== Heritage Detail ===== */
.heritage-detail {
    background: white;
    padding: 15px;
    border-radius: 10px;
    min-height: 200px;
}

.detail-header {
    text-align: center;
    margin-bottom: 15px;
}

.detail-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
}

.detail-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.detail-location {
    font-size: 0.9rem;
    color: var(--text-light);
}

.detail-body {
    margin-top: 15px;
}

.detail-row {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: var(--text-dark);
}

.detail-value {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* ===== Reasoning Box ===== */
.reasoning-box,
.advice-box {
    background: white;
    padding: 15px;
    border-radius: 10px;
    min-height: 150px;
}

.reasoning-step {
    margin-bottom: 12px;
    padding: 10px;
    background: #f9f9f9;
    border-left: 3px solid var(--heritage-amber);
    border-radius: 6px;
}

.step-formula {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.step-result {
    font-size: 0.8rem;
    color: var(--text-light);
}

.step-result.success {
    color: #52c41a;
}

/* ===== Advice Box ===== */
.advice-content {
    padding: 15px;
    background: linear-gradient(135deg, #fff5f5, #ffffff);
    border: 2px solid var(--primary-red);
    border-radius: 10px;
}

.advice-title {
    font-weight: 700;
    color: var(--primary-red);
    margin-bottom: 10px;
    font-size: 1.05rem;
}

.advice-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-dark);
}

/* ===== Empty States ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state-small {
    text-align: center;
    padding: 20px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
}

.modal.show {
    display: block;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #e0e0e0;
}