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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

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

header p {
    color: #666;
    font-size: 1rem;
}

main {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.controls-panel {
    flex: 1;
    min-width: 300px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.canvas-panel {
    flex: 1;
    min-width: 350px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#triangle-canvas {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.control-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.control-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.control-section h2 {
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 12px;
    font-weight: 600;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.type-btn {
    padding: 8px 16px;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.type-btn:hover {
    background: #ebf5fb;
}

.type-btn.active {
    background: #3498db;
    color: white;
}

.label-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.label-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.label-row label {
    flex: 1;
    font-size: 0.9rem;
    color: #555;
}

.label-row input {
    width: 80px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.label-row input:focus {
    outline: none;
    border-color: #3498db;
}

.trig-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.trig-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.trig-group h3 {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.trig-btn {
    padding: 6px 12px;
    border: 1px solid #9b59b6;
    background: white;
    color: #9b59b6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.trig-btn:hover {
    background: #f5eef8;
}

.trig-btn.active {
    background: #9b59b6;
    color: white;
}

.selected-trig {
    margin-top: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

#selected-trig-display {
    font-weight: 600;
    color: #9b59b6;
}

.small-btn {
    padding: 4px 10px;
    font-size: 0.8rem;
    border: 1px solid #ccc;
    background: white;
    border-radius: 4px;
    cursor: pointer;
}

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

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #555;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.export-section {
    background: #f8f9fa;
    margin: -20px;
    margin-top: 0;
    padding: 20px;
    border-radius: 0 0 12px 12px;
}

.export-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.primary-btn {
    flex: 1;
    padding: 12px 20px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s ease;
}

.primary-btn:hover {
    background: #219a52;
}

.secondary-btn {
    flex: 1;
    padding: 12px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s ease;
}

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

.hint {
    font-size: 0.85rem;
    color: #666;
    text-align: center;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 0.9rem;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    main {
        flex-direction: column;
    }
    
    .canvas-panel {
        order: -1;
    }
    
    #triangle-canvas {
        width: 100%;
        max-width: 400px;
        height: auto;
    }
    
    .export-buttons {
        flex-direction: column;
    }
}
