:root {
    /* Red Culture Theme */
    --app-bg: #fdfbf7;
    --sidebar-bg: rgba(255, 248, 240, 0.8);
    --glass-border: rgba(214, 59, 29, 0.2);
    --text-primary: #8b0000;
    --text-secondary: #a05a5a;
    --accent-red: #d63b1d;
    --accent-gold: #ffb400;
    --accent-hover: #b32b12;
    --danger-red: #ff3b30;

    /* Concept Colors */
    --color-homomorphism: #ff6b6b;
    --color-monomorphism: #ffb400;
    --color-epimorphism: #10b981;
    --color-isomorphism: #4ecdc4;
    --color-kernel: #8b5cf6;

    --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", "Outfit", 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: url('https://images.unsplash.com/photo-1533038590840-1cde6e668a91?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.85);
    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: 1rem;
}

.window-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.dot.red {
    background: linear-gradient(135deg, #ff5f57, #ff3b30);
}

.dot.yellow {
    background: linear-gradient(135deg, #ffbd2e, #ffaa00);
}

.dot.green {
    background: linear-gradient(135deg, #28ca42, #27c93f);
}

h1 {
    font-family: var(--font-title);
    font-size: 1.75rem;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.subtitle {
    font-size: 0.8rem;
    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.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Concept Navigation */
.concept-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.concept-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(139, 0, 0, 0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-family);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.concept-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--accent-red);
    transform: translateX(3px);
}

.concept-btn.active {
    background: var(--accent-red);
    color: #fff;
    border-color: var(--accent-red);
    box-shadow: var(--shadow-md);
}

.concept-btn .icon {
    font-size: 1.3rem;
}

/* Demo Panel */
.demo-panel {
    background: rgba(255, 255, 255, 0.5);
    padding: 10px;
    border-radius: 12px;
}

.apple-select {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(139, 0, 0, 0.2);
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
}

.apple-select:focus {
    outline: none;
    border-color: var(--accent-red);
}

/* Property Panel */
.property-panel {
    background: rgba(255, 255, 255, 0.5);
    padding: 12px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.property-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.3s;
}

.property-item.active {
    background: rgba(16, 185, 129, 0.1);
}

.property-item.inactive {
    opacity: 0.4;
}

.prop-icon {
    font-weight: bold;
    font-size: 1rem;
    min-width: 20px;
}

.property-item.active .prop-icon {
    color: var(--accent-red);
}

/* Kernel Panel */
.kernel-panel {
    background: rgba(139, 92, 246, 0.1);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.kernel-panel p {
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.kernel-panel strong {
    color: var(--color-kernel);
}

#kernelValue {
    color: var(--accent-red);
    font-weight: 600;
}

.kernel-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Info Box */
.info-box {
    background: linear-gradient(135deg, rgba(214, 59, 29, 0.05), rgba(255, 180, 0, 0.05));
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(214, 59, 29, 0.2);
}

.info-box h3 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--accent-red);
}

.info-box p {
    font-size: 0.8rem;
    line-height: 1.5;
    margin-bottom: 0.4rem;
}

/* Actions Footer */
.actions-footer {
    display: flex;
    gap: 0.75rem;
}

.apple-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn {
    background: var(--accent-red);
    color: #fff;
}

.action-btn:hover {
    background: var(--accent-hover);
}

.danger-btn {
    background: rgba(255, 59, 48, 0.1);
    color: var(--danger-red);
    border: 1px solid var(--danger-red);
}

.danger-btn:hover {
    background: var(--danger-red);
    color: #fff;
}

/* Visualizer */
.visualizer-stage {
    flex-grow: 1;
    padding: 2rem;
    display: flex;
    background: rgba(255, 255, 255, 0.1);
}

.glass-pane {
    width: 100%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.graph-title {
    text-align: center;
    margin-bottom: 1rem;
}

.graph-title h2 {
    font-family: var(--font-title);
    font-size: 1.8rem;
    color: var(--accent-red);
}

.graph-title p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Quote Banner */
.quote-banner {
    background: linear-gradient(90deg, rgba(214, 59, 29, 0.1), transparent);
    border-left: 3px solid var(--accent-red);
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.quote-text {
    font-family: var(--font-title);
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.quote-author {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
}

/* Mapping Container */
.mapping-container {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1rem;
    position: relative;
}

.group-box {
    flex: 1;
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid rgba(139, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
}

.group-box h3 {
    font-size: 1.1rem;
    color: var(--accent-red);
    margin-bottom: 0.75rem;
    text-align: center;
    font-family: var(--font-title);
}

.elements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: 8px;
}

.element-item {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(139, 0, 0, 0.15);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
    cursor: pointer;
}

.element-item:hover {
    background: rgba(255, 180, 0, 0.2);
    border-color: var(--accent-gold);
    transform: scale(1.05);
}

.element-item.highlighted {
    background: var(--accent-gold);
    color: #000;
    border-color: var(--accent-gold);
    box-shadow: var(--shadow-sm);
}

.arrow-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mapping-arrow {
    font-size: 3rem;
    color: var(--accent-red);
    position: relative;
}

.mapping-arrow::before {
    content: '→';
}

.arrow-label {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    font-family: var(--font-title);
    color: var(--accent-red);
}

#mappingSvg {
    margin-bottom: 1rem;
}

.mapping-line {
    stroke: var(--accent-red);
    stroke-width: 2;
    opacity: 0.3;
    transition: all 0.3s;
}

.mapping-line.active {
    opacity: 1;
    stroke-width: 3;
}

/* Ideology Box */
.ideology-content-box {
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.05), rgba(255, 180, 0, 0.05));
    border: 1px solid rgba(214, 59, 29, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-top: auto;
}

.ideology-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.red-star {
    color: var(--accent-red);
    font-size: 1.2rem;
}

.ideology-header h3 {
    color: var(--accent-red);
    font-family: var(--font-title);
    font-size: 1.2rem;
}

.ideology-text p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 10px;
}

.social-analogy {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(139, 0, 0, 0.1);
}

.social-analogy label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.social-analogy p {
    font-size: 0.85rem;
    line-height: 1.6;
}

/* Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--accent-red);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}