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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 320px;
    grid-template-rows: auto 1fr;
    gap: 20px;
    min-height: calc(100vh - 40px);
}

header {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

header h1 {
    font-size: 28px;
    color: #2c3e50;
    margin-bottom: 8px;
}

header p {
    color: #7f8c8d;
    font-size: 14px;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.editor-section, .preview-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

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

.section-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.file-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #f0f0f0;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.file-upload-btn:hover {
    background: #e0e0e0;
}

.file-upload-btn input {
    display: none;
}

#htmlInput {
    flex: 1;
    padding: 16px 20px;
    border: none;
    resize: none;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
    outline: none;
}

#htmlInput::placeholder {
    color: #aaa;
}

#previewFrame {
    flex: 1;
    border: none;
    width: 100%;
    background: #fff;
}

.preview-container {
    flex: 1;
    overflow: auto;
    background: #e8e8e8;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#previewContent {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    transform-origin: top center;
    transition: transform 0.2s;
    min-width: 210mm;
    min-height: 297mm;
    padding: 20px;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zoom-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    background: #f0f0f0;
}

#zoomLevel {
    font-size: 13px;
    color: #666;
    min-width: 45px;
    text-align: center;
}

aside {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: fit-content;
}

aside h3 {
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

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

.setting-group label {
    font-size: 13px;
    color: #666;
}

.setting-group select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.setting-group select:hover {
    border-color: #bbb;
}

.setting-group select:focus {
    border-color: #3498db;
}

.primary-btn {
    padding: 14px 24px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-top: 8px;
}

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

.primary-btn:active {
    transform: scale(0.98);
}

.primary-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

@media (max-width: 900px) {
    .container {
        grid-template-columns: 1fr;
    }
    
    main {
        grid-template-columns: 1fr;
    }
}