:root {
    --primary-red: #de2910;
    --primary-gold: #ffde00;
    --bg-gradient: linear-gradient(135deg, #fff1f0 0%, #ffe4e1 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #f5b7b1;
    --success-green: #27ae60;
    --error-red: #c0392b;
    --shadow: 0 4px 12px rgba(222, 41, 16, 0.15);

    --font-main: "Noto Serif SC", serif;
    --font-sans: "Outfit", sans-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-main);
    background: var(--bg-gradient);
    color: var(--text-dark);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 96vw;
    height: 92vh;
    max-width: 1900px;
    background: var(--card-bg);
    border-radius: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

/* Header */
.main-header {
    padding: 1.2rem 2.5rem;
    background: linear-gradient(90deg, #de2910 0%, #b01f0c 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content h1 {
    font-size: 1.8rem;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.highlight {
    font-family: var(--font-title);
    color: var(--primary-gold);
    font-weight: normal;
    margin-left: 10px;
}

.subtitle {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 300;
}

.header-tabs {
    display: flex;
    gap: 12px;
    background: rgba(0, 0, 0, 0.1);
    padding: 4px;
    border-radius: 12px;
}

.tab-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.tab-btn.active {
    background: white;
    color: var(--primary-red);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Main Layout */
.main-stage {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 380px;
    overflow: hidden;
}

.tab-content {
    display: none;
    height: 100%;
    overflow-y: auto;
    padding: 30px;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 30px;
    text-align: center;
}

.section-header h2 {
    font-size: 2rem;
    color: var(--primary-red);
    font-family: var(--font-title);
    margin-bottom: 10px;
}

.section-desc {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Assignments Tab */
.explorer-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 30px;
    height: calc(100% - 100px);
}

.control-panel {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.control-panel h3 {
    color: var(--primary-red);
    margin-bottom: 16px;
    font-size: 1.2rem;
}

.connective-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 10px;
    font-weight: 600;
}

.preset-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.preset-btn {
    padding: 12px;
    background: #fff5f5;
    border: 1px solid #ffccc7;
    border-radius: 8px;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.preset-btn:hover {
    background: #ffccc7;
    transform: translateX(4px);
}

.preset-btn.active {
    background: var(--primary-red);
    color: white;
    border-color: var(--primary-red);
}

.preset-btn .op-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(222, 41, 16, 0.1);
    color: var(--primary-red);
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: bold;
}

.preset-btn.active .op-symbol {
    background: white;
    color: var(--primary-red);
}

.current-connective {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 16px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-light);
}

.current-connective strong {
    color: var(--primary-red);
}

.input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.input-group input {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: var(--font-mono);
}

.input-group button {
    padding: 10px 16px;
    background: var(--primary-red);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

.legend {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.true {
    background: #d4edda;
    border: 2px solid #28a745;
}

.dot.false {
    background: #f8d7da;
    border: 2px solid #dc3545;
}

.truth-table-wrapper {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: auto;
    padding: 2px;
}

.truth-table {
    width: 100%;
    border-collapse: collapse;
}

.truth-table th,
.truth-table td {
    padding: 16px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.truth-table th {
    background: #f8f9fa;
    color: var(--text-dark);
    font-weight: 700;
    position: sticky;
    top: 0;
}

.truth-table tr.row-true {
    background-color: #f0fff4;
}

.truth-table tr.row-true td:last-child {
    color: var(--success-green);
    font-weight: bold;
}

.truth-table tr.row-false {
    background-color: #fff5f5;
}

.truth-table tr.row-false td:last-child {
    color: var(--error-red);
    font-weight: bold;
}

/* Classification Tab */
.type-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.type-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s;
    border-top: 4px solid transparent;
}

.type-card:hover {
    transform: translateY(-5px);
}

.type-card.tautology {
    border-top-color: #f1c40f;
}

.type-card.contradiction {
    border-top-color: #e74c3c;
}

.type-card.satisfiable {
    border-top-color: #3498db;
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.type-card h3 {
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.ideology-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    margin: 12px 0;
    color: white;
}

.tautology .ideology-tag {
    background: #f1c40f;
}

.contradiction .ideology-tag {
    background: #e74c3c;
}

.satisfiable .ideology-tag {
    background: #3498db;
}

.example {
    font-family: var(--font-mono);
    color: var(--text-light);
    font-size: 0.9rem;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 6px;
}

.classifier-tool {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.classifier-input {
    display: flex;
    gap: 12px;
    margin: 24px 0;
}

.classifier-input input {
    flex: 1;
    padding: 14px;
    font-size: 1.1rem;
    border: 2px solid #eee;
    border-radius: 8px;
    font-family: var(--font-mono);
}

.classifier-input button {
    padding: 14px 28px;
    background: var(--primary-red);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: bold;
}

/* Simulator Tab */
.game-container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 40px;
    text-align: center;
}

.mission-panel {
    margin-bottom: 40px;
}

.mission-panel h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.mission-panel h3 span {
    color: var(--primary-red);
    font-family: var(--font-title);
    font-size: 2rem;
}

.formula-display {
    font-size: 1.5rem;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 16px;
    font-family: var(--font-mono);
}

.mission-desc {
    color: var(--text-light);
    font-size: 1.1rem;
}

.controls-area {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.switch-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.switch-label {
    font-weight: 600;
    color: var(--text-dark);
}

/* Switch UI */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-red);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary-red);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.status-monitor {
    margin-bottom: 40px;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    border-radius: 50px;
    background: #f8f9fa;
    transition: all 0.3s;
}

.status-indicator.success {
    background: #d4edda;
    color: #155724;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.status-indicator.fail {
    background: #f8d7da;
    color: #721c24;
}

.status-icon {
    font-size: 1.5rem;
}

.status-text {
    font-weight: bold;
    font-size: 1.2rem;
}

.level-selector {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.level-btn {
    padding: 10px 24px;
    border: 2px solid #eee;
    background: transparent;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.level-btn:hover {
    border-color: var(--primary-red);
    color: var(--primary-red);
}

.level-btn.active {
    background: var(--primary-red);
    color: white;
    border-color: var(--primary-red);
}

/* Sidebar */
.sidebar {
    background: rgba(255, 255, 255, 0.5);
    border-left: 1px solid rgba(255, 255, 255, 0.8);
    padding: 30px;
    overflow-y: auto;
}

.panel-section {
    margin-bottom: 40px;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-gold);
}

.panel-icon {
    font-size: 1.5rem;
}

.panel-header h3 {
    font-size: 1.2rem;
    color: var(--primary-red);
}

.concept-content h4,
.insight-content h4 {
    color: var(--text-dark);
    margin: 16px 0 8px 0;
    font-size: 1rem;
}

.concept-content p,
.insight-content p {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 12px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}