:root {
    /* Red Culture Theme - Same as existing files */
    --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 */
    --node-default: #fff8f0;
    --node-border: #d63b1d;
    --node-highlight: #ffb400;
    --node-hover: #ff8c75;

    --edge-default: rgba(139, 0, 0, 0.3);

    /* Shadows */
    --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-1557426272-fc759fdf7a8d?q=80&w=2574&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
}

.app-container {
    width: 95vw;
    height: 90vh;
    max-width: 1600px;
    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 */
.sidebar {
    width: 340px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.5rem;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.window-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 0.5rem;
}

.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: 2rem;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    line-height: 1.2;
}

.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: 1.2rem;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.controls-wrapper::-webkit-scrollbar {
    width: 6px;
}

.controls-wrapper::-webkit-scrollbar-track {
    background: rgba(139, 0, 0, 0.05);
    border-radius: 3px;
}

.controls-wrapper::-webkit-scrollbar-thumb {
    background: var(--accent-red);
    border-radius: 3px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Info Panels */
.info-panel {
    background: rgba(255, 255, 255, 0.6);
    padding: 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--text-primary);
    border: 1px solid rgba(139, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.ideology-panel {
    background: linear-gradient(135deg, rgba(214, 59, 29, 0.1), rgba(255, 180, 0, 0.1));
}

.ideology-text {
    line-height: 1.6;
    font-size: 0.8rem;
}

.ideology-text strong {
    color: var(--accent-red);
    font-weight: 700;
}

.dimensions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dimension-tag {
    padding: 6px 12px;
    background: var(--accent-red);
    color: white;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

.dimension-tag:hover {
    transform: scale(1.05);
}

#statusText {
    font-weight: 700;
    color: var(--accent-red);
    margin-bottom: 6px;
}

.stats-display {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.stats-display strong {
    color: var(--accent-red);
    font-size: 1.2em;
}

.insights-panel {
    min-height: 80px;
    background: rgba(255, 180, 0, 0.1);
}

#insightText {
    font-size: 0.8rem;
    line-height: 1.5;
}

/* Buttons */
.apple-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: var(--font-family);
    gap: 8px;
}

.action-btn {
    background: var(--accent-red);
    color: white;
    width: 100%;
    box-shadow: var(--shadow-md);
}

.action-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(139, 0, 0, 0.2);
}

.danger-btn {
    background: rgba(139, 0, 0, 0.1);
    color: var(--text-primary);
    width: 100%;
}

.danger-btn:hover {
    background: rgba(139, 0, 0, 0.2);
}

.apple-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.actions-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Main Stage */
.visualizer-stage {
    flex-grow: 1;
    padding: 1.5rem;
    display: flex;
    background: rgba(255, 255, 255, 0.1);
}

.content-columns {
    display: flex;
    gap: 1.5rem;
    width: 100%;
}

.glass-pane {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.5), var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.matrix-panel {
    flex: 1;
    min-width: 400px;
}

.lattice-panel {
    flex: 1.2;
    min-width: 500px;
}

.panel-header {
    margin-bottom: 1rem;
}

.panel-header h2 {
    font-family: var(--font-title);
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 400;
}

.panel-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 0.2rem;
}

/* Matrix Table */
.matrix-container {
    flex-grow: 1;
    overflow: auto;
    margin-bottom: 1rem;
}

.context-matrix {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.context-matrix th {
    background: linear-gradient(135deg, var(--accent-red), #c42f17);
    color: white;
    padding: 12px 10px;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.context-matrix th:last-child {
    border-right: none;
}

.corner-cell {
    background: var(--text-primary) !important;
    font-size: 0.75rem;
}

.context-matrix tbody tr {
    transition: background 0.2s;
}

.context-matrix tbody tr:hover {
    background: rgba(214, 59, 29, 0.05);
}

.context-matrix td {
    padding: 12px;
    text-align: center;
    border-right: 1px solid rgba(139, 0, 0, 0.1);
    border-bottom: 1px solid rgba(139, 0, 0, 0.1);
    transition: all 0.2s;
}

.context-matrix td:first-child {
    font-weight: 700;
    color: var(--accent-red);
    background: rgba(255, 248, 240, 0.8);
    text-align: left;
    padding-left: 16px;
    font-size: 0.85rem;
}

.cell-interactive {
    cursor: pointer;
    position: relative;
    font-size: 1.2rem;
    font-weight: 700;
}

.cell-interactive.filled {
    color: var(--accent-red);
}

.cell-interactive.empty {
    color: rgba(139, 0, 0, 0.2);
}

.cell-interactive:hover {
    background: rgba(255, 180, 0, 0.2);
    transform: scale(1.1);
}

.matrix-legend {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 0;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-box {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 2px solid var(--accent-red);
}

.legend-box.filled {
    background: var(--accent-red);
}

.legend-box.empty {
    background: white;
}

/* Lattice SVG */
.lattice-container {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
}

#latticeSvg {
    display: block;
}

.lattice-edge {
    stroke: var(--edge-default);
    stroke-width: 2px;
    fill: none;
    transition: stroke 0.3s;
}

.lattice-edge.highlighted {
    stroke: var(--accent-red);
    stroke-width: 3px;
}

.concept-node {
    cursor: pointer;
    transition: all 0.3s;
}

.concept-circle {
    fill: var(--node-default);
    stroke: var(--node-border);
    stroke-width: 2.5px;
    filter: drop-shadow(0px 2px 6px rgba(0, 0, 0, 0.15));
    transition: all 0.3s;
}

.concept-node:hover .concept-circle {
    fill: var(--node-hover);
    stroke: var(--accent-gold);
    stroke-width: 3px;
    filter: drop-shadow(0px 4px 12px rgba(255, 180, 0, 0.4));
}

.concept-node.highlighted .concept-circle {
    fill: var(--node-highlight);
    stroke: var(--accent-gold);
    filter: url(#glow);
}

.concept-text {
    font-family: var(--font-family);
    font-size: 11px;
    font-weight: 700;
    fill: var(--text-primary);
    pointer-events: none;
    user-select: none;
    text-anchor: middle;
}

.concept-label {
    font-size: 9px;
    fill: var(--text-secondary);
    pointer-events: none;
    user-select: none;
}

/* Concept Details Panel */
.concept-details {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    min-height: 80px;
    border: 1px solid rgba(139, 0, 0, 0.1);
}

.hint-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
}

.detail-title {
    font-weight: 700;
    color: var(--accent-red);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.detail-content {
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.detail-section {
    margin-bottom: 0.5rem;
}

.detail-section strong {
    color: var(--accent-red);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.concept-node {
    animation: fadeIn 0.4s ease-out;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.icon {
    display: inline-block;
    animation: pulse 2s infinite;
}

/* Responsive adjustments */
@media (max-width: 1400px) {
    .content-columns {
        flex-direction: column;
    }

    .matrix-panel,
    .lattice-panel {
        min-width: auto;
    }
}