* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: #2c3e50;
    color: white;
    padding: 25px;
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.8;
}

.content {
    display: flex;
    flex-wrap: wrap;
    padding: 25px;
}

.input-section {
    flex: 1;
    min-width: 300px;
    padding: 20px;
}

.preview-section {
    flex: 1;
    min-width: 300px;
    padding: 20px;
    background: #f8f9fa;
    border-left: 1px solid #eee;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #2c3e50;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.input-group {
    margin-bottom: 25px;
    position: relative;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.code-input {
    width: 100%;
    min-height: 100px;
    padding: 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    font-family: 'Courier New', monospace;
    line-height: 1.5;
    tab-size: 4;
    position: relative;
    background: #fff;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    overflow-y: auto;
    color: #2c3e50;
}

.code-input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.code-input:empty::before {
    content: attr(data-placeholder);
    color: #999;
}

.input-wrapper {
    position: relative;
    width: 100%;
}

.error-mark {
    position: relative;
    display: inline;
    pointer-events: none;
    background: rgba(255, 0, 0, 0.1);
    border-radius: 3px;
    padding: 0 2px;
}

@keyframes wave {
    0% {
        background-position: bottom left;
    }

    100% {
        background-position: bottom right;
    }
}

.code-input br {
    display: block;
    content: "";
    margin-top: 0;
}

.instruction {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    font-size: 14px;
    line-height: 1.6;
}

.instruction p {
    margin-bottom: 10px;
}

.instruction code {
    background: #d1e7ff;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.preview-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
}

.preview-box {
    height: 150px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.5s;
    cursor: pointer;
}

.preview-text {
    font-size: 18px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.code-container {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
}

.example-section {
    margin-top: 25px;
}

.examples {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.example {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.example:hover {
    background: #bbdefb;
    transform: translateY(-3px);
}

.example-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #2c3e50;
}

.example-code {
    font-family: monospace;
    font-size: 12px;
    color: #3498db;
}

.error {
    color: #e74c3c;
    font-weight: bold;
    margin-top: 10px;
    display: none;
}

.success {
    color: #2ecc71;
    font-weight: bold;
    margin-top: 10px;
    display: none;
}

#errors-summary {
    margin-top: 10px;
    display: none;
}

#errors-summary .error-icon {
    color: #e74c3c;
    margin-right: 5px;
}

#errors-summary .arrow-icon {
    margin-left: 5px;
    transition: transform 0.3s;
}

#errors-summary.expanded .arrow-icon {
    transform: rotate(180deg);
}

#errors-summary .error-list {
    margin-top: 10px;
    padding: 10px;
    background: #fff3f3;
    border-radius: 5px;
    display: none;
}

#errors-summary .error-list.show {
    display: block;
}

#errors-summary .error-item {
    padding: 5px 0;
    cursor: pointer;
}

#errors-summary .error-item:hover {
    color: #c0392b;
}

#errors-summary .error-item.active {
    background-color: #ffe6e6;
    padding: 5px 10px;
    margin: 0 -10px;
}

.suggestion {
    background: #fff8e1;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    display: none;
}

.suggestion-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 10px;
}

.suggestion-btn:hover {
    background: #2980b9;
}

.color-name-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    position: relative;
}

.color-name-list::before {
    content: '\f53f';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: -25px;
    top: 50%;
    transform: translateY(-50%);
    color: #2c3e50;
    font-size: 16px;
}

.color-chip {
    padding: 4px 8px;
    padding-left: 22px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    color: white;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    position: relative;
}

.color-chip::before {
    content: '\f53f';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    opacity: 0.8;
}

footer {
    text-align: center;
    padding: 20px;
    background: #ecf0f1;
    color: #7f8c8d;
    font-size: 14px;
}

/* 新增样式：优质打印选项 */
.pretty-print-container {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.pretty-print-label {
    margin-left: 8px;
    font-size: 14px;
    color: #2c3e50;
    cursor: pointer;
}

.pretty-print-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 10px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .content {
        flex-direction: column;
        padding: 15px;
    }

    .input-section,
    .preview-section {
        padding: 15px;
        min-width: 100%;
    }

    .preview-section {
        border-left: none;
        border-top: 1px solid #eee;
    }

    .instruction {
        font-size: 13px;
        padding: 12px;
    }

    .examples {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .color-chip {
        padding: 3px 6px;
        font-size: 11px;
    }

    .code-container {
        font-size: 14px;
        padding: 15px;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .preview-box {
        height: 120px;
    }

    .preview-text {
        font-size: 16px;
        text-align: center;
        padding: 0 10px;
    }
}