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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: block;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.container-fluid {
    width: 100%;
    padding: 20px;
    background: white;
}

h1 {
    font-size: 2.5em;
    text-align: center;
    margin-bottom: 10px;
    color: #2c3e50;
}

h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
    color: #2c3e50;
}

h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #34495e;
}

.subtitle {
    text-align: center;
    font-size: 1.1em;
    color: #7f8c8d;
    margin-bottom: 30px;
}

.instructions {
    background: #ecf0f1;
    padding: 20px;
    border-radius: 6px;
    margin: 30px 0;
}

.instructions ol {
    margin-left: 20px;
}

.instructions li {
    margin: 10px 0;
}

.btn {
    padding: 12px 30px;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #3498db;
    color: white;
    display: block;
    margin: 30px auto;
}

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

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-icon {
    background: transparent;
    border: 1px solid #ddd;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 18px;
}

.note {
    text-align: center;
    color: #7f8c8d;
    font-size: 0.9em;
}

.curves-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 20px;
}

.preview-panel, .curves-panel {
    background: #fafafa;
    padding: 20px;
    border-radius: 6px;
}

.preview-container {
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    margin-bottom: 15px;
}

#preview-canvas {
    max-width: 100%;
    max-height: 500px;
    display: block;
}

.image-counter {
    text-align: center;
    font-weight: 500;
    color: #555;
}

.curves-container {
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 20px;
}

#curves-svg {
    display: block;
    width: 100%;
    height: auto;
}

.curves-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.action-bar {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    border-top: 2px solid #ecf0f1;
}

.progress-container {
    margin: 40px 0;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #ecf0f1;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    text-align: center;
    font-size: 1.2em;
    font-weight: 500;
}

.collage-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.sidebar-left {
    background: #fafafa;
    padding: 15px;
    border-radius: 6px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.photo-item {
    aspect-ratio: 1;
    border-radius: 4px;
    overflow: hidden;
    cursor: grab;
    border: 2px solid #ddd;
    transition: border-color 0.3s;
}

.photo-item:hover {
    border-color: #3498db;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.collage-main {
    background: #fafafa;
    padding: 20px;
    border-radius: 6px;
}

.collage-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.tool-group {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.tool-label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
    margin-right: 10px;
}

.hint {
    font-size: 13px;
    color: #7f8c8d;
    margin: 10px 0;
    padding: 8px;
    background: #f0f8ff;
    border-radius: 4px;
    text-align: center;
}

.tool-btn {
    min-width: 50px;
    height: 50px;
    padding: 0 10px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    border-color: #3498db;
    background: #e3f2fd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.tool-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.page-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pages-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-items: center;
}

.page-wrapper {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.a4-page {
    width: 595px;
    height: 842px;
    background: white;
    border: 1px solid #ddd;
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 0;
}

.photo-cell {
    border: 1px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.3s;
}

.photo-cell:hover {
    border-color: #3498db;
    box-shadow: inset 0 0 10px rgba(52, 152, 219, 0.1);
}

.photo-cell.filled {
    background: transparent;
    border-style: solid;
}

.photo-cell.filled:hover {
    border-color: #2ecc71;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.3);
}

.photo-cell img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center center;
    pointer-events: auto;
}

.photo-cell .placeholder {
    color: #ccc;
    font-size: 14px;
}

.export-settings {
    background: #fafafa;
    padding: 30px;
    border-radius: 6px;
    margin: 30px 0;
}

.setting-group {
    margin: 20px 0;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.setting-group select,
.setting-group input[type="range"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.setting-group input[type="checkbox"] {
    margin-right: 8px;
}

.export-progress {
    margin: 30px 0;
}

#export-status {
    text-align: center;
    font-weight: 500;
    margin-top: 15px;
}

@media (max-width: 1200px) {
    .curves-layout {
        grid-template-columns: 1fr;
    }
    
    .collage-layout {
        grid-template-columns: 1fr;
    }
    
    .a4-page {
        transform: scale(0.7);
        transform-origin: top center;
    }
}
