body {
    margin: 0;
    background: #1e1e1e;
    color: #ffffff;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
}

.controls {
    display: flex;
    gap: 16px;
    padding: 16px 24px;
    background: #252525;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: calc(100% - 48px);
    max-width: 1200px;
    box-sizing: border-box;
    align-items: center;
    flex-wrap: wrap;
}

.controls button {
    border: none;
    background: #333333;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: all 0.2s ease;
}

.controls button:hover {
    background: #444444;
    transform: translateY(-1px);
}

.controls button i {
    font-size: 18px;
}

.controls button.tool.active {
    background: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.3);
}

.controls input[type="number"] {
    width: 60px;
    background: #333333;
    color: #ffffff;
    border: 1px solid #404040;
    border-radius: 6px;
    padding: 4px 8px;
}

.controls input[type="number"]:focus {
    border-color: #0066cc;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.3);
}

.divider {
    width: 1px;
    height: 24px;
    background: #404040;
    margin: 0 8px;
}

#colorPicker {
    width: 40px;
    height: 40px;
    padding: 2px;
    border: 2px solid #404040;
    border-radius: 8px;
    cursor: pointer;
    background: none;
}

#brushSize {
    width: 120px;
    height: 6px;
    border-radius: 3px;
    background: #404040;
    appearance: none;
    cursor: pointer;
}

#brushSize::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #0066cc;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

#brushSize::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#brushSizeDisplay {
    min-width: 30px;
    text-align: center;
    color: #999999;
    font-size: 14px;
}

canvas {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

canvas.select-mode {
    cursor: default;
}

canvas.resize-nw {
    cursor: nw-resize;
}

canvas.resize-ne {
    cursor: ne-resize;
}

canvas.resize-sw {
    cursor: sw-resize;
}

canvas.resize-se {
    cursor: se-resize;
}

canvas.resize-n {
    cursor: n-resize;
}

canvas.resize-e {
    cursor: e-resize;
}

canvas.resize-s {
    cursor: s-resize;
}

canvas.resize-w {
    cursor: w-resize;
}

canvas.rotate {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="%23ffffff" d="M12 5C8.13 5 5 8.13 5 12H2l3.89 3.89.07.14L10 12H7c0-2.76 2.24-5 5-5s5 2.24 5 5-2.24 5-5 5c-1.38 0-2.64-.56-3.54-1.46l-1.41 1.41C8.53 18.43 10.17 19 12 19c3.87 0 7-3.13 7-7s-3.13-7-7-7z"/></svg>') 8 8, auto;
}

button {
    padding: 8px 16px;
    cursor: pointer;
}

.color-history {
    display: flex;
    gap: 6px;
    height: 24px;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid #404040;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.active {
    border: 2px solid #0066cc;
}

.fill-option {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #999999;
}

.fill-option input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #0066cc;
}

.text-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.text-controls input[type="text"],
.text-controls select,
.text-controls input[type="number"],
.resize-controls input[type="number"] {
    padding: 8px 12px;
    border: 1px solid #404040;
    border-radius: 6px;
    background: #333333;
    color: #ffffff;
    font-size: 14px;
    transition: all 0.2s ease;
}

.text-controls input[type="text"]:focus,
.text-controls select:focus,
.text-controls input[type="number"]:focus,
.resize-controls input[type="number"]:focus {
    border-color: #0066cc;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.3);
}

.text-controls select {
    cursor: pointer;
}

.resize-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.resize-controls span {
    color: #999999;
}

.resize-controls button {
    padding: 4px 8px;
}

.page-navigation {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #252525;
    border-radius: 12px;
    margin-top: 20px;
    max-width: calc(100% - 32px);
    overflow: hidden;
    position: relative;
}

#pageList {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 40px;
    gap: 12px;
    padding: 0 12px;
    transition: transform 0.3s ease;
}

.page-navigation button.nav-btn {
    background: #333333;
    border: none;
    color: white;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.page-navigation button.nav-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.page-navigation button.nav-btn:not(:disabled):hover {
    background: #444444;
}

.page-navigation button {
    background: #333333;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}

.page-navigation button:hover {
    background: #444444;
}

.page-navigation button.active {
    background: #0066cc;
}

.page-preview {
    width: 40px;
    height: 60px;
    background: #fff;
    border: 2px solid #404040;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.page-preview.active {
    border-color: #0066cc;
    transform: scale(1.1);
}

.page-preview:hover {
    transform: scale(1.1);
}

.page-number {
    position: absolute;
    top: 2px;
    right: 2px;
    color: #666;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 1px 4px;
    border-radius: 4px;
    min-width: auto;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.canvas-container {
    margin: 20px 0;
    overflow: hidden;
    position: relative;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

#canvas {
    position: relative;
    transform-origin: 0 0;
}

#zoomLevel {
    color: #999999;
    font-size: 14px;
    min-width: 60px;
    text-align: center;
}

.rotation-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ffffff;
    border: 1px solid #00ff00;
    border-radius: 50%;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="%23ffffff" d="M12 5C8.13 5 5 8.13 5 12H2l3.89 3.89.07.14L10 12H7c0-2.76 2.24-5 5-5s5 2.24 5 5-2.24 5-5 5c-1.38 0-2.64-.56-3.54-1.46l-1.41 1.41C8.53 18.43 10.17 19 12 19c3.87 0 7-3.13 7-7s-3.13-7-7-7z"/></svg>') 8 8, auto;
}

.layer-panel {
    display: flex;
    flex-direction: column;
    background: #252525;
    border-radius: 12px;
    padding: 16px;
    gap: 8px;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: #333333;
    border-radius: 6px;
    cursor: move;
}

.layer-preview {
    width: 40px;
    height: 30px;
    background: #ffffff;
    border-radius: 4px;
    border: 1px solid #404040;
}

.layer-item.active {
    background: #444444;
    border: 1px solid #0066cc;
}

.layer-visibility {
    cursor: pointer;
    color: #ffffff;
    opacity: 0.7;
}

.layer-visibility.visible {
    opacity: 1;
}

.layer-name {
    flex-grow: 1;
    color: #ffffff;
}

.layer-opacity {
    width: 60px;
    background: #404040;
    border: none;
    color: #ffffff;
    padding: 2px 4px;
    border-radius: 4px;
}

.layer-blend {
    background: #404040;
    border: none;
    color: #ffffff;
    padding: 2px 4px;
    border-radius: 4px;
}

.layer-controls {
    display: flex;
    gap: 8px;
}

.layer-controls button {
    padding: 4px 8px;
    background: #404040;
    border: none;
    color: #ffffff;
    border-radius: 4px;
    cursor: pointer;
}

.layer-controls button:hover {
    background: #505050;
}

.help-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.help-dialog.active {
    display: flex;
}

.help-content {
    background: #252525;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.help-content h2 {
    margin: 0 0 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.help-content #closeHelp {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
}

.help-content #closeHelp:hover {
    background: #333;
    color: #fff;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.shortcuts-category h3 {
    color: #0066cc;
    margin: 0 0 12px 0;
}

.shortcut-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #333;
}

.shortcut-row span:first-child {
    background: #333;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
}

.shape-history-panel {
    position: absolute;
    right: 10px;
    top: 60px;
    width: 70px;
    background: #252525;
    border: 1px solid #404040;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.shape-history-panel h3 {
    margin: 0 0 8px 0;
    font-size: 12px;
    text-align: center;
    color: #999;
    padding-bottom: 4px;
    border-bottom: 1px solid #404040;
}

#shapeHistory {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

#shapeHistory::-webkit-scrollbar {
    width: 6px;
}

#shapeHistory::-webkit-scrollbar-track {
    background: #333;
    border-radius: 3px;
}

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

#shapeHistory canvas {
    border: 1px solid #404040;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#shapeHistory canvas:hover {
    transform: scale(1.05);
    border-color: #0066cc;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
