* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-red: #d63b1d;
    --primary-gold: #ffb400;
    --success-green: #10b981;
    --danger-red: #ff3b30;
    --beidou-blue: #003d99;
    --bg-light: #f8f9fa;
    --text-dark: #2c3e50;
    --border-color: #e0e0e0;
}

body {
    font-family: "Noto Serif SC", "Outfit", sans-serif;
    background: linear-gradient(135deg, #001a33, #003d99);
    color: var(--text-dark);
    min-height: 100vh;
    padding: 20px;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* 头部 */
.app-header {
    background: linear-gradient(135deg, var(--primary-red), #c7351a);
    color: white;
    padding: 24px 32px;
}

.header-content h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.header-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    font-style: italic;
}

/* 主内容区 */
.main-content {
    display: flex;
    min-height: calc(100vh - 180px);
}

/* 左侧控制面板 */
.control-panel {
    width: 360px;
    background: var(--bg-light);
    padding: 24px;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
}

.panel-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.panel-section h3 {
    font-size: 1rem;
    color: var(--primary-red);
    margin-bottom: 16px;
    font-weight: 700;
}

.param-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.param-row label {
    font-size: 0.9rem;
    font-weight: 600;
}

.param-row select,
select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    background: white;
}

.param-info {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.param-info div {
    margin-bottom: 8px;
}

.param-info strong {
    color: var(--primary-red);
    font-size: 1rem;
}

/* 高亮区域 - 编码输入 */
.highlight-section {
    background: linear-gradient(135deg, rgba(214, 59, 29, 0.05), rgba(255, 180, 0, 0.05));
    border: 2px solid var(--primary-red);
}

.message-input {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    border: 2px solid var(--primary-red);
    border-radius: 8px;
    margin-bottom: 12px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 2px;
}

.message-input:focus {
    outline: none;
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 3px rgba(255, 180, 0, 0.2);
}

.message-bytes {
    background: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--primary-red);
    margin-bottom: 16px;
    min-height: 32px;
    text-align: center;
}

/* 按钮样式 */
.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-large {
    font-size: 1.2rem;
    padding: 18px;
}

.btn-primary {
    background: var(--primary-red);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #b32b12;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(214, 59, 29, 0.3);
}

.btn-danger {
    background: var(--danger-red);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #e0301c;
}

.btn-success {
    background: var(--success-green);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #0d9668;
}

.btn-reset {
    background: rgba(255, 59, 48, 0.1);
    color: var(--danger-red);
    border: 2px solid var(--danger-red);
}

.btn-reset:hover {
    background: var(--danger-red);
    color: white;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 错误控制 */
.error-control {
    margin-bottom: 16px;
}

.error-control label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.error-control #errorCountDisplay {
    color: var(--danger-red);
    font-size: 1.2rem;
    font-weight: 700;
}

.error-control input[type="range"] {
    width: 100%;
    margin-top: 8px;
}

/* 统计区域 */
.stats-section {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(78, 205, 196, 0.05));
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.stat-item span {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 6px;
}

.stat-item strong {
    font-size: 1.4rem;
    color: var(--primary-red);
}

.stat-item.success strong {
    color: var(--success-green);
}

/* 右侧可视化区域 */
.visualization-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* 卫星场景 */
.satellite-container {
    background: rgba(0, 26, 51, 0.3);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
}

#satelliteSvg {
    display: block;
}

/* 数据流 */
.data-flow {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.data-stage {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 2px solid var(--border-color);
}

.data-stage h4 {
    font-size: 0.9rem;
    color: var(--primary-red);
    margin-bottom: 12px;
    text-align: center;
}

.byte-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    min-height: 80px;
    align-items: center;
}

.empty-hint {
    color: #999;
    font-size: 0.8rem;
    text-align: center;
    width: 100%;
}

.byte-item {
    background: linear-gradient(135deg, #f0f0f0, #e8e8e8);
    border: 2px solid #ccc;
    border-radius: 6px;
    padding: 8px 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    min-width: 36px;
    text-align: center;
}

.byte-item.data {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05));
    border-color: var(--success-green);
    color: #065f46;
}

.byte-item.parity {
    background: linear-gradient(135deg, rgba(255, 180, 0, 0.2), rgba(255, 180, 0, 0.05));
    border-color: var(--primary-gold);
    color: #92400e;
}

.byte-item.error {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.3), rgba(255, 59, 48, 0.1));
    border-color: var(--danger-red);
    color: var(--danger-red);
    animation: errorPulse 0.6s ease 3;
}

.byte-item.corrected {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.4), rgba(16, 185, 129, 0.15));
    border-color: var(--success-green);
    animation: correctedPulse 0.6s ease 3;
}

@keyframes errorPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

@keyframes correctedPulse {

    0%,
    100% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.1);
        filter: brightness(1.3);
    }
}

/* 处理日志 */
.process-log {
    background: linear-gradient(135deg, rgba(0, 61, 153, 0.05), rgba(0, 61, 153, 0.02));
    border: 2px solid var(--beidou-blue);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.process-log h4 {
    color: var(--primary-red);
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.process-steps {
    font-size: 0.9rem;
    line-height: 1.8;
}

.process-steps div {
    margin-bottom: 8px;
}

/* 思政内容 */
.ideology-box {
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.05), rgba(255, 180, 0, 0.05));
    border: 2px solid var(--primary-red);
    border-radius: 12px;
    padding: 20px;
}

.ideology-box h4 {
    color: var(--primary-red);
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.ideology-box p {
    font-size: 0.9rem;
    line-height: 1.8;
    color: #444;
}

/* 滚动条 */
.control-panel::-webkit-scrollbar,
.visualization-area::-webkit-scrollbar {
    width: 8px;
}

.control-panel::-webkit-scrollbar-track,
.visualization-area::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.control-panel::-webkit-scrollbar-thumb,
.visualization-area::-webkit-scrollbar-thumb {
    background: var(--primary-red);
    border-radius: 4px;
}

/* 响应式 */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .control-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .data-flow {
        grid-template-columns: repeat(2, 1fr);
    }
}