* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background-color: #ffffff;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部 */
.header {
    text-align: center;
    padding: 30px 20px;
    background: #ffffff;
    color: #24292e;
    border-bottom: 1px solid #e1e4e8;
    margin-bottom: 30px;
    border-radius: 0;
}

.header-content h1 {
    font-size: 2em;
    margin-bottom: 8px;
    font-weight: 600;
    color: #24292e;
}

.subtitle {
    font-size: 0.95em;
    color: #586069;
    letter-spacing: 0;
}

/* 主内容区 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    flex: 1;
}

/* 编辑区 - 为输入框腾出更多空间 */
.config-section {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 6px;
    padding: 20px;
    border: 1px solid #e1e4e8;
}

.preview-section {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 6px;
    padding: 20px;
    border: 1px solid #e1e4e8;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e1e4e8;
}

.section-header h2 {
    font-size: 1.2em;
    color: #24292e;
    font-weight: 600;
}

.preview-status {
    font-size: 0.75em;
    color: #586069;
    padding: 2px 8px;
    background: #f1f3f5;
    border-radius: 3px;
}

/* 设置组 - 更紧凑的布局 */
.settings-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 15px;
    padding: 15px;
    background: #f6f8fa;
    border-radius: 6px;
    border: 1px solid #e1e4e8;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-item label {
    font-weight: 600;
    font-size: 0.85em;
    color: #495057;
}

.theme-select, .font-select {
    padding: 6px 10px;
    border: 1px solid #d1d5da;
    border-radius: 3px;
    font-size: 0.875em;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.theme-select:hover, .font-select:hover {
    border-color: #0366d6;
}

.theme-select:focus, .font-select:focus {
    outline: none;
    border-color: #0366d6;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #dee2e6;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0366d6;
    cursor: pointer;
    transition: background 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    background: #0256cc;
}

.slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0366d6;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

#paddingValue, #lineHeightValue {
    font-size: 0.875em;
    color: #0366d6;
    font-weight: 500;
    margin-left: 10px;
    min-width: 45px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-container .slider {
    flex: 1;
}

.checkbox-item {
    grid-column: auto;
}

.checkbox-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #0366d6;
}

.text-input {
    padding: 6px 10px;
    border: 1px solid #d1d5da;
    border-radius: 3px;
    font-size: 0.875em;
    background-color: white;
    transition: border-color 0.2s;
    font-family: 'Monaco', 'Menlo', monospace;
}

.text-input:focus {
    outline: none;
    border-color: #0366d6;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

/* 文本区域 - 优化尺寸 */
#codeInput {
    flex: 1;
    padding: 12px;
    border: 1px solid #d1d5da;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875em;
    line-height: 1.6;
    resize: none;
    background-color: #fafbfc;
    color: #24292e;
    transition: border-color 0.2s;
    margin-bottom: 15px;
    min-height: 350px;
    max-height: 600px;
}

#codeInput:focus {
    outline: none;
    border-color: #0366d6;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

#codeInput::placeholder {
    color: #adb5bd;
}

/* 按钮组 - 紧凑样式 */
.button-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.btn {
    padding: 6px 12px;
    border: 1px solid #d1d5da;
    border-radius: 3px;
    font-size: 0.875em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: #0366d6;
    border-color: #0366d6;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0256cc;
    border-color: #0256cc;
}

.btn-primary:active:not(:disabled) {
    background: #0249b8;
}

.btn-secondary {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #22863a;
    border-color: #22863a;
}

.btn-secondary:disabled {
    background: #f1f3f5;
    border-color: #d1d5da;
    color: #959da5;
    cursor: not-allowed;
}

.btn-tertiary {
    background: #0366d6;
    border-color: #0366d6;
    color: white;
}

.btn-tertiary:hover:not(:disabled) {
    background: #0256cc;
    border-color: #0256cc;
}

.btn-tertiary:disabled {
    background: #f1f3f5;
    border-color: #d1d5da;
    color: #959da5;
    cursor: not-allowed;
}

.btn-info {
    background: white;
    border-color: #d1d5da;
    color: #24292e;
}

.btn-info:hover:not(:disabled) {
    background: #f6f8fa;
    border-color: #c6cbd1;
}

.btn-info:disabled {
    background: #f1f3f5;
    border-color: #d1d5da;
    color: #959da5;
    cursor: not-allowed;
}

.btn-warning {
    background: white;
    border-color: #d1d5da;
    color: #d73a49;
}

.btn-warning:hover:not(:disabled) {
    background: #f6f8fa;
    border-color: #c6cbd1;
}

.btn-warning:disabled {
    background: #f1f3f5;
    border-color: #d1d5da;
    color: #959da5;
    cursor: not-allowed;
}

/* 预览区 */
.preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafbfc;
    border-radius: 3px;
    border: 1px solid #e1e4e8;
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.empty-state {
    text-align: center;
    color: #586069;
}

.empty-icon {
    margin-bottom: 12px;
    color: #c6cbd1;
}

.empty-icon-svg {
    font-size: 64px;
    line-height: 1;
}

.empty-state p {
    font-size: 1.1em;
}

/* 代码预览 */
.code-preview {
    width: 100%;
    padding: 20px;
    background: #282c34;
    color: #abb2bf;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #3e4451;
}

.file-name {
    color: #abb2bf;
    font-size: 0.9em;
    font-weight: 500;
}

.file-dots {
    display: flex;
    gap: 8px;
}

.file-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.file-dots span:nth-child(1) {
    background: #ff5f56;
}

.file-dots span:nth-child(2) {
    background: #ffbd2e;
}

.file-dots span:nth-child(3) {
    background: #27c93f;
}

#codePreview pre {
    margin: 0;
    overflow-x: auto;
}

#codePreview code {
    background: none !important;
    color: #abb2bf !important;
    padding: 0 !important;
    font-size: 0.95em;
    line-height: 1.6;
}

/* 代码高亮颜色 */
.token.keyword {
    color: #c678dd !important;
}

.token.string {
    color: #98c379 !important;
}

.token.function {
    color: #61afef !important;
}

.token.number {
    color: #d19a66 !important;
}

.token.comment {
    color: #5c6370 !important;
}

/* 主题变体 */
.code-preview.light-theme {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.code-preview.light-theme .code-header {
    border-bottom-color: #ddd;
}

.code-preview.light-theme code {
    color: #333 !important;
}

.code-preview.monokai-theme {
    background: #272822;
    color: #f8f8f2;
}

.code-preview.gradient-theme {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
}

.code-preview.gradient-theme code {
    color: white !important;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .settings-group {
        grid-template-columns: repeat(2, 1fr);
    }

    .button-group {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .header-content h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 0.95em;
    }

    .config-section, .preview-section {
        padding: 15px;
    }

    .settings-group {
        grid-template-columns: repeat(2, 1fr);
    }

    .button-group {
        grid-template-columns: repeat(2, 1fr);
    }

    #codeInput {
        min-height: 280px;
        max-height: 500px;
    }

    .preview-container {
        min-height: 300px;
    }
}

/* 加载动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.code-preview {
    animation: fadeIn 0.3s ease;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f3f5;
}

::-webkit-scrollbar-thumb {
    background: #c6cbd1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #959da5;
}

/* ===== 通知系统 ===== */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.notification {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 3px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideInRight 0.2s ease;
    font-size: 0.875em;
    border: 1px solid #e1e4e8;
}

.notification-icon {
    font-weight: bold;
    min-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-message {
    flex: 1;
}

.notification-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #999;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    color: #333;
}

.notification-success {
    background: #28a745;
    color: white;
    border-left: 3px solid #22863a;
}

.notification-error {
    background: #d73a49;
    color: white;
    border-left: 3px solid #cb2431;
}

.notification-warning {
    background: #ffd33d;
    color: #24292e;
    border-left: 3px solid #f1c40f;
}

.notification-info {
    background: #0366d6;
    color: white;
    border-left: 3px solid #0256cc;
}

.notification-loading {
    background: #0366d6;
    color: white;
    border-left: 3px solid #0256cc;
}

.notification-loading .notification-icon {
    animation: spin 1s linear infinite;
}

/* 通知退出动画 */
.notification-exit {
    animation: slideOutRight 0.3s ease forwards !important;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.notification-exit {
    animation: slideOutRight 0.3s ease;
}

@media (max-width: 600px) {
    .notification-container {
        left: 10px;
        right: 10px;
        max-width: none;
    }

    .settings-group {
        grid-template-columns: 1fr;
    }

    .button-group {
        grid-template-columns: 1fr;
    }

    #codeInput {
        min-height: 250px;
        max-height: 400px;
    }
}

/* ===== 加载指示器 ===== */
#loader {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-text {
    color: white;
    font-size: 1.1em;
    margin-top: 20px;
    text-align: center;
}

/* ===== 格式化工具按钮 ===== */
.formatter-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin: 10px 0;
    padding: 15px;
    background: #f0f4f8;
    border-radius: 8px;
    border: 1px dashed #dee2e6;
}

.formatter-options {
    display: contents;
}

/* ===== 导出分辨率选择 ===== */
.export-size-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 10px;
}

.export-size-selector label {
    font-weight: 600;
    font-size: 0.85em;
    white-space: nowrap;
    color: #333;
}

.export-size-buttons {
    display: flex;
    gap: 6px;
}

.export-size-btn {
    padding: 4px 10px;
    background: white;
    border: 1px solid #d1d5da;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.75em;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.export-size-btn:hover {
    border-color: #0366d6;
    background: #f6f8fa;
}

.export-size-btn.active {
    background: #0366d6;
    color: white;
    border-color: #0366d6;
}

/* ===== 通用图标样式 ===== */
.btn-icon {
    display: none;
}

.icon-inline {
    display: none;
}

/* ===== 文案内容区 ===== */
.content-section {
    margin-top: 40px;
    padding: 24px 20px 10px;
    background: #ffffff;
    border-radius: 0;
    border-top: 1px solid #e1e4e8;
}

.content-intro h2 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: #111827;
}

.content-intro p {
    font-size: 0.95em;
    color: #4b5563;
    line-height: 1.8;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.content-card {
    background: #f6f8fa;
    border-radius: 3px;
    border: 1px solid #e1e4e8;
    padding: 16px;
}

.content-card h3 {
    font-size: 1.05em;
    margin-bottom: 10px;
    color: #111827;
}

.content-card ul {
    padding-left: 18px;
    font-size: 0.92em;
    color: #4b5563;
    line-height: 1.7;
}

.content-block {
    margin-top: 24px;
}

.content-block h3 {
    font-size: 1.1em;
    margin-bottom: 8px;
    color: #111827;
}

.content-block p {
    font-size: 0.94em;
    color: #4b5563;
    line-height: 1.8;
    margin-bottom: 8px;
}

.content-block ul,
.content-block ol {
    padding-left: 20px;
    font-size: 0.94em;
    color: #4b5563;
    line-height: 1.8;
}

.content-block li + li {
    margin-top: 4px;
}

.faq-list {
    margin-top: 8px;
}

.faq-item + .faq-item {
    margin-top: 12px;
}

.faq-item dt {
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.faq-item dd {
    margin-left: 0;
    font-size: 0.94em;
    color: #4b5563;
    line-height: 1.8;
}

.content-block code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    background: #f3f4f6;
    padding: 2px 4px;
    border-radius: 4px;
}

@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .content-section {
        padding: 20px 14px 6px;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }
}
