: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;
    --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;
}

/* Galaxy Container */
.galaxy-container {
    max-width: 1000px;
    margin: 0 auto;
}

.control-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mode-toggle {
    display: flex;
    background: #f1f3f5;
    padding: 4px;
    border-radius: 8px;
}

.mode-btn {
    padding: 6px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.3s;
}

.mode-btn.active {
    background: white;
    color: var(--primary-red);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.control-bar select {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #ddd;
    font-size: 1rem;
}

.stars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.star-card {
    background: white;
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.star-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.star-card.active {
    border-color: var(--primary-red);
    background: #fff5f5;
    box-shadow: 0 0 20px rgba(222, 41, 16, 0.2);
}

.star-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #ccc;
    transition: all 0.3s;
}

.star-card.active .star-icon {
    color: var(--primary-gold);
    text-shadow: 0 0 10px var(--primary-gold);
    transform: scale(1.2);
}

.star-label {
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.star-binary {
    font-family: var(--font-mono);
    color: var(--text-light);
    font-size: 0.9rem;
}

.formula-output {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    text-align: center;
}

.math-display {
    font-size: 1.5rem;
    margin: 20px 0;
    color: var(--primary-red);
    min-height: 40px;
}

.ideology-note {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-dark);
}

/* Generator */
.generator-container {
    max-width: 1000px;
    margin: 0 auto;
}

.input-section {
    display: flex;
    gap: 12px;
    margin-bottom: 40px;
}

.input-section input {
    flex: 1;
    padding: 16px;
    font-size: 1.2rem;
    border: 2px solid #eee;
    border-radius: 8px;
    font-family: var(--font-mono);
}

.gen-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 0 24px;
    background: var(--primary-red);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}

.action-btn.secondary {
    background: #34495e;
}

.process-view {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.step-card {
    flex: 1;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    min-height: 300px;
}

.step-card.highlight {
    border: 2px solid var(--primary-gold);
    background: #fffdf0;
}

.step-title {
    font-weight: bold;
    margin-bottom: 16px;
    color: var(--primary-red);
    font-size: 1.1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.arrow-divider {
    font-size: 2rem;
    color: #ccc;
    align-self: center;
}

.truth-table-mini {
    font-size: 0.9rem;
    max-height: 240px;
    overflow-y: auto;
}

.truth-table-mini table {
    width: 100%;
    border-collapse: collapse;
}

.truth-table-mini th,
.truth-table-mini td {
    padding: 6px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.row-true {
    background: #d4edda;
}

.row-false {
    background: #f8d7da;
}

.minterm-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.minterm-item {
    background: #f8f9fa;
    padding: 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    border-left: 3px solid var(--primary-red);
}

.final-result {
    font-size: 1.2rem;
    text-align: center;
    padding-top: 40px;
    color: var(--text-dark);
}

/* Unification */
.comparison-stage {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}

.formula-box {
    flex: 1;
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.formula-box h3 {
    color: var(--text-light);
    margin-bottom: 12px;
    font-size: 1rem;
}

.formula-box input {
    width: 100%;
    padding: 12px;
    font-size: 1.2rem;
    border: 2px solid #eee;
    border-radius: 8px;
    font-family: var(--font-mono);
    margin-bottom: 16px;
}

.pdnf-preview {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-light);
    min-height: 50px;
    word-break: break-all;
}

.center-status {
    width: 140px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.status-icon {
    font-size: 3rem;
}

.status-text {
    font-weight: bold;
    color: var(--text-light);
}

#uniCheckBtn {
    padding: 8px 20px;
    background: var(--primary-red);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}

.ideology-footer {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.quote-card {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border-left: 5px solid var(--primary-gold);
}

.quote-card p {
    font-size: 1.4rem;
    font-family: var(--font-title);
    color: var(--primary-red);
    margin-bottom: 12px;
}

.quote-card .sub {
    font-size: 1rem;
    font-family: var(--font-main);
    color: var(--text-light);
    margin-bottom: 0;
}

/* 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;
}