:root {
    --logic-blue: #2563eb;
    --truth-green: #059669;
    --false-red: #dc2626;
    --governance-gold: #d97706;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --bg-light: #f8fafc;
    --border-color: #e2e8f0;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    --font-family: "Noto Serif SC", "Outfit", serif;
    --font-mono: "JetBrains Mono", monospace;
    --font-title: "Ma Shan Zheng", cursive;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 50%, #93c5fd 100%);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 96vw;
    height: 92vh;
    max-width: 1900px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 3px solid var(--logic-blue);
}

/* Header */
.main-header {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--logic-blue) 0%, #1e40af 100%);
    border-bottom: 3px solid #1e40af;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    font-size: 1.6rem;
    color: white;
    margin-bottom: 4px;
}

.highlight {
    font-family: var(--font-title);
    font-size: 1.9rem;
    color: #fbbf24;
}

.subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    font-style: italic;
}

.mode-selector {
    display: flex;
    gap: 8px;
}

.mode-btn {
    padding: 8px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-family: var(--font-family);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mode-btn.active {
    background: white;
    color: var(--logic-blue);
    border-color: white;
}

/* Main Stage */
.main-stage {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 360px;
    overflow: hidden;
}

.mode-content {
    display: none;
    height: 100%;
    overflow-y: auto;
}

.mode-content.active {
    display: block;
}

.content-area {
    padding: 30px;
    background: linear-gradient(180deg, #f8fafc 0%, white 100%);
}

.content-area h2 {
    font-size: 1.8rem;
    color: var(--logic-blue);
    margin-bottom: 8px;
    font-family: var(--font-title);
}

.section-desc {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Propositions Builder */
.examples-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.example-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--border-color);
}

.example-card h3 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: var(--logic-blue);
}

.prop-item {
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: 10px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--logic-blue);
    transition: all 0.3s;
}

.prop-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.prop-item.compound {
    border-left-color: var(--governance-gold);
}

.prop-text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.6;
}

.prop-text strong {
    color: var(--logic-blue);
    font-weight: 700;
}

.truth-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.truth-badge.true {
    background: rgba(5, 150, 105, 0.1);
    color: var(--truth-green);
    border: 1px solid var(--truth-green);
}

.truth-badge.false {
    background: rgba(220, 38, 38, 0.1);
    color: var(--false-red);
    border: 1px solid var(--false-red);
}

/* Connectives */
.connective-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.connective-card {
    background: white;
    border-radius: 14px;
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 2px solid;
    transition: all 0.3s;
}

.connective-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.connective-card[data-type="not"] {
    border-color: #ef4444;
}

.connective-card[data-type="and"] {
    border-color: #3b82f6;
}

.connective-card[data-type="or"] {
    border-color: #8b5cf6;
}

.connective-card[data-type="implies"] {
    border-color: #059669;
}

.connective-card[data-type="iff"] {
    border-color: #d97706;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.symbol {
    font-size: 2rem;
    font-weight: bold;
    color: var(--logic-blue);
}

.connective-card .formula {
    background: var(--bg-light);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-family: var(--font-mono);
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.connective-card .example {
    font-size: 0.85rem;
    line-height: 1.8;
}

.connective-card .example p {
    margin: 4px 0;
}

.connective-card .example strong {
    color: var(--logic-blue);
}

/* Truth Table */
.expression-builder {
    background: white;
    padding: 20px;
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.expression-builder h3 {
    font-size: 1.1rem;
    margin-bottom: 14px;
    color: var(--logic-blue);
}

.builder-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.builder-controls select {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    cursor: pointer;
}

.builder-controls button {
    padding: 10px 24px;
    background: var(--logic-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: var(--font-family);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.builder-controls button:hover {
    background: #1e40af;
    transform: translateY(-2px);
}

.truth-table-container {
    background: white;
    padding: 20px;
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}

.truth-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.truth-table th,
.truth-table td {
    padding: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.truth-table th {
    background: var(--logic-blue);
    color: white;
    font-weight: 600;
}

.truth-table td {
    font-family: var(--font-mono);
    font-weight: 600;
}

.truth-table td.true {
    background: rgba(5, 150, 105, 0.1);
    color: var(--truth-green);
}

.truth-table td.false {
    background: rgba(220, 38, 38, 0.1);
    color: var(--false-red);
}

/* Sidebar */
.sidebar {
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
    border-left: 3px solid var(--logic-blue);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.panel-section {
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.panel-icon {
    font-size: 1.2rem;
}

.panel-header h3 {
    font-size: 1rem;
    color: var(--logic-blue);
}

.knowledge-content,
.insight-content {
    font-size: 0.85rem;
    line-height: 1.7;
}

.knowledge-content h4,
.insight-content h4 {
    color: var(--governance-gold);
    margin: 12px 0 6px 0;
    font-size: 0.95rem;
}

.knowledge-content h4:first-child,
.insight-content h4:first-child {
    margin-top: 0;
}

.knowledge-content p,
.insight-content p {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.knowledge-content ul {
    margin-left: 20px;
    color: var(--text-secondary);
}

.knowledge-content li {
    margin: 6px 0;
}

.formula-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.formula-item {
    background: var(--bg-light);
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid var(--logic-blue);
}

.formula-item strong {
    display: block;
    margin-bottom: 8px;
    color: var(--logic-blue);
}

.formula-item p {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin: 4px 0;
    color: var(--text-primary);
}