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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    position: relative;
}

.brand {
    margin-bottom: 20px;
}

.brand-name {
    display: inline-block;
    font-size: 0.95em;
    font-weight: 500;
    letter-spacing: 0.5px;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.brand-name:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

header h1 {
    font-size: 2.8em;
    font-weight: 600;
    margin-bottom: 12px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1.15em;
    opacity: 0.85;
    font-weight: 400;
    margin-bottom: 20px;
}

.stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 6px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.stat-item svg {
    opacity: 0.8;
}

.workspace {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.control-panel {
    display: flex;
    flex-direction: column;
    gap: 25px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding-right: 10px;
}

.control-panel::-webkit-scrollbar {
    width: 8px;
}

.control-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb:hover {
    background: #555;
}

section {
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

section:last-child {
    border-bottom: none;
}

h2 {
    font-size: 1.25em;
    margin-bottom: 16px;
    color: #1d1d1f;
    font-weight: 600;
    letter-spacing: -0.3px;
}

/* 上传区域 */
.upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f9f9f9;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f0f0ff;
}

.upload-placeholder {
    color: #666;
}

.upload-placeholder svg {
    margin-bottom: 10px;
    color: #999;
}

.image-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f0f0ff;
    border-radius: 6px;
    margin-top: 10px;
}

.btn-small {
    padding: 5px 15px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-small:hover {
    background: #ff5252;
}

/* 字幕输入 */
#subtitleInput {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.3s;
}

#subtitleInput:focus {
    outline: none;
    border-color: #667eea;
}

.subtitle-count {
    margin-top: 8px;
    font-size: 0.9em;
    color: #666;
}

/* 样式设置 */
.style-group {
    margin-bottom: 20px;
}

.style-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

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

input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.value-display {
    min-width: 50px;
    text-align: right;
    font-weight: 600;
    color: #667eea;
}

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

input[type="color"] {
    width: 50px;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
}

.color-text-input {
    flex: 1;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-family: monospace;
    font-size: 14px;
}

.color-text-input:focus {
    outline: none;
    border-color: #667eea;
}

.button-group {
    display: flex;
    gap: 10px;
}

.btn-toggle {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.btn-toggle:hover {
    border-color: #667eea;
    color: #667eea;
}

.btn-toggle.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.stroke-options,
.shadow-options,
.background-options {
    margin-top: 10px;
    padding-left: 20px;
    border-left: 3px solid #eee;
}

/* 导出按钮 */
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.05em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    letter-spacing: 0.3px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.export-options {
    margin-top: 10px;
    display: flex;
    gap: 20px;
}

.export-options label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

/* 预览区域 */
.preview-panel {
    display: flex;
    flex-direction: column;
}

.preview-panel h2 {
    margin-bottom: 15px;
}

.preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 8px;
    min-height: 500px;
    position: relative;
    overflow: auto;
}

.preview-placeholder {
    text-align: center;
    color: #999;
}

.preview-placeholder svg {
    margin-bottom: 15px;
    opacity: 0.5;
}

#previewCanvas {
    max-width: 100%;
    max-height: 100%;
    display: none;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#previewCanvas.show {
    display: block;
}

/* Footer */
footer {
    margin-top: 40px;
    text-align: center;
    color: white;
    opacity: 0.8;
}

.footer-content {
    padding: 20px;
}

.footer-brand {
    font-size: 1em;
    font-weight: 500;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.footer-text {
    font-size: 0.85em;
    opacity: 0.7;
    font-weight: 300;
}

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

    .control-panel {
        max-height: none;
    }
    
    header h1 {
        font-size: 2.2em;
    }
    
    .stats {
        flex-direction: column;
        gap: 10px;
    }
}

