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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #1a1a2e;
    color: #eee;
    overflow: hidden;
    height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
header {
    background: #16213e;
    padding: 10px 20px;
    border-bottom: 2px solid #0f3460;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

header h1 {
    font-size: 1.5rem;
    color: #e94560;
    margin-right: 20px;
}

.toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: #0f3460;
    color: #fff;
}

.btn:hover:not(:disabled) {
    background: #1a4a7a;
    transform: translateY(-1px);
}

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

.btn.primary {
    background: #e94560;
}

.btn.primary:hover:not(:disabled) {
    background: #ff6b6b;
}

.btn.accent {
    background: #533483;
}

.btn.accent:hover:not(:disabled) {
    background: #7b5aa6;
}

.btn.success {
    background: #2ecc71;
}

.btn.success:hover:not(:disabled) {
    background: #27ae60;
}

.btn.tool.active {
    background: #e94560;
    box-shadow: 0 0 0 2px #fff;
}

.info {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: #aaa;
    margin-left: auto;
}

.info span {
    background: #0f3460;
    padding: 4px 12px;
    border-radius: 4px;
}

/* Main Content */
main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#canvasContainer {
    flex: 1;
    position: relative;
    background: #0a0a0a;
    overflow: hidden;
    cursor: grab;
}

#canvasContainer.panning {
    cursor: grabbing;
}

#canvasContainer.selecting {
    cursor: crosshair;
}

#mainCanvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center center;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: #222;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

#overlayCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#dropZone {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 60px 80px;
    border: 3px dashed #0f3460;
    border-radius: 20px;
    background: rgba(15, 52, 96, 0.3);
    transition: all 0.3s;
}

#dropZone.dragover {
    border-color: #e94560;
    background: rgba(233, 69, 96, 0.2);
}

#dropZone p {
    font-size: 1.2rem;
    color: #888;
    margin: 10px 0;
}

#dropZone.hidden {
    display: none;
}

/* Sidebar */
#sidebar {
    width: 280px;
    background: #16213e;
    border-left: 2px solid #0f3460;
    padding: 20px;
    overflow-y: auto;
}

#sidebar h3 {
    color: #e94560;
    font-size: 1rem;
    margin: 20px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #0f3460;
}

#sidebar h3:first-child {
    margin-top: 0;
}

#sidebar p {
    color: #888;
    font-size: 0.9rem;
    margin: 5px 0;
}

#sidebar label {
    display: block;
    color: #aaa;
    font-size: 0.85rem;
    margin: 10px 0 5px 0;
}

#sidebar input, #sidebar select {
    width: 100%;
    padding: 8px;
    border: 1px solid #0f3460;
    border-radius: 4px;
    background: #0a0a0a;
    color: #fff;
    font-size: 0.9rem;
}

.shortcuts {
    font-size: 0.85rem;
}

.shortcuts p {
    margin: 8px 0;
}

kbd {
    background: #0f3460;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
}

/* Loading */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#loading.hidden {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #0f3460;
    border-top-color: #e94560;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#loading p {
    margin-top: 20px;
    color: #fff;
    font-size: 1.1rem;
}

/* Info boxes */
.info-box {
    background: #0f3460;
    padding: 10px;
    border-radius: 6px;
    margin: 10px 0;
}

.info-box p {
    margin: 5px 0;
}

.value {
    color: #2ecc71;
    font-weight: bold;
}

/* Selection rectangle */
.selection-rect {
    fill: rgba(233, 69, 96, 0.2);
    stroke: #e94560;
    stroke-width: 2;
    stroke-dasharray: 5,5;
}

/* Responsive */
@media (max-width: 1024px) {
    #sidebar {
        width: 240px;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .info {
        margin-left: 0;
        justify-content: center;
    }
    
    #sidebar {
        display: none;
    }
}