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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 1600px;
    height: 90vh;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.app-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.header-controls {
    display: flex;
    gap: 1rem;
}

.language-selector {
    padding: 0.5rem 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
}

.language-selector:hover {
    background: rgba(255, 255, 255, 0.2);
}

.language-selector option {
    background: #6366f1;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.toolbar {
    width: 280px;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    padding: 1.5rem;
    overflow-y: auto;
}

.tool-section {
    margin-bottom: 2rem;
}

.tool-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.tool-btn {
    aspect-ratio: 1;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
}

.tool-btn:hover {
    border-color: #6366f1;
    background: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.tool-btn.active {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-color: #6366f1;
    color: white;
}

.property-controls,
.animation-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.875rem;
    color: #475569;
    font-weight: 500;
}

.color-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

input[type="color"] {
    width: 50px;
    height: 36px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
}

.color-text {
    flex: 1;
    padding: 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.875rem;
}

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

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type="number"] {
    padding: 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
}

.animation-select {
    padding: 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: white;
    color: #6366f1;
    border: 2px solid #6366f1;
}

.btn-secondary:hover {
    background: #f0f9ff;
    transform: translateY(-2px);
}

.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
}

.canvas-header {
    background: white;
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.canvas-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    transition: all 0.3s;
}

.action-btn:hover {
    border-color: #6366f1;
    background: #f0f9ff;
    color: #6366f1;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.zoom-btn {
    width: 32px;
    height: 32px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: #475569;
    transition: all 0.3s;
}

.zoom-btn:hover {
    border-color: #6366f1;
    background: #f0f9ff;
    color: #6366f1;
}

#zoomLevel {
    min-width: 60px;
    text-align: center;
    font-weight: 500;
    color: #475569;
}

.canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 2rem;
}

#svgCanvas {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
    cursor: crosshair;
}

#svgCanvas .shape {
    cursor: move;
    transition: all 0.3s;
}

#svgCanvas .shape:hover {
    filter: brightness(0.95);
}

#svgCanvas .shape.selected {
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.6));
    stroke-dasharray: 5, 5;
    animation: dash 0.5s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -10;
    }
}

.sidebar {
    width: 300px;
    background: #f8fafc;
    border-left: 1px solid #e2e8f0;
    padding: 1.5rem;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.layers-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.layer-item {
    padding: 0.75rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.layer-item:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.layer-item.active {
    border-color: #6366f1;
    background: #f0f9ff;
}

.layer-icon {
    font-size: 1.25rem;
}

.layer-name {
    flex: 1;
    font-size: 0.875rem;
    color: #475569;
}

.layer-visibility {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.6;
    transition: opacity 0.3s;
}

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

.export-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.code-textarea {
    width: 100%;
    min-height: 200px;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    background: white;
    resize: vertical;
}

/* レスポンシブデザイン */
@media (max-width: 1280px) {
    .sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .app-container {
        border-radius: 0;
        height: 100vh;
        max-width: 100%;
    }
    
    .toolbar {
        width: 200px;
    }
    
    .tool-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .header {
        padding: 0.75rem 1rem;
    }
    
    .app-title {
        font-size: 1.25rem;
    }
}

/* スクロールバーのスタイリング */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-container {
    animation: fadeIn 0.5s ease-out;
}

/* トーストメッセージ */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #10b981;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}