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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #8B0000 0%, #DC143C 100%);
    min-height: 100vh;
    padding: 5px;
}

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

header {
    text-align: center;
    color: white;
    margin-bottom: 8px;
}

header h1 {
    font-size: 1.5em;
    margin-bottom: 2px;
}

header p {
    font-size: 0.85em;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.control-panel, .visualization-panel {
    background: white;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.section {
    margin-bottom: 8px;
}

.section h2 {
    color: #8B0000;
    margin-bottom: 6px;
    font-size: 0.95em;
}

.shape-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.shape-btn {
    padding: 6px 4px;
    border: 2px solid #8B0000;
    background: white;
    color: #8B0000;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.75em;
    font-weight: bold;
    transition: all 0.3s;
}

.shape-btn:hover {
    background: #fff5f5;
}

.shape-btn.active {
    background: #8B0000;
    color: white;
}

.input-group {
    margin-bottom: 6px;
}

.input-group label {
    display: block;
    margin-bottom: 2px;
    color: #333;
    font-weight: 600;
    font-size: 0.8em;
}

.input-group input {
    width: calc(100% - 60px);
    padding: 5px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 0.85em;
}

.input-group input:focus {
    outline: none;
    border-color: #8B0000;
}

.unit {
    margin-left: 5px;
    color: #666;
    font-size: 0.8em;
}

.calculate-btn {
    width: 100%;
    padding: 8px;
    background: linear-gradient(135deg, #8B0000 0%, #DC143C 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.calculate-btn:hover {
    transform: translateY(-2px);
}

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

.results-section {
    background: #f8f9ff;
    padding: 8px;
    border-radius: 6px;
}

#formulas {
    background: white;
    padding: 6px;
    border-radius: 5px;
    margin-bottom: 6px;
    border-left: 3px solid #8B0000;
}

.formula-item {
    margin: 3px 0;
    color: #333;
    font-family: 'Courier New', monospace;
    font-size: 0.75em;
}

#calculations {
    background: white;
    padding: 6px;
    border-radius: 5px;
    border-left: 3px solid #DC143C;
}

.calc-item {
    margin: 4px 0;
    padding: 5px;
    background: #fff5f5;
    border-radius: 4px;
    font-weight: 600;
    color: #333;
    font-size: 0.8em;
}

.calc-value {
    color: #8B0000;
    font-size: 1em;
}

.visualization-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.visualization-panel h2 {
    color: #8B0000;
    margin-bottom: 6px;
    font-size: 0.95em;
}

#canvas {
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
    max-height: 400px;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .shape-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #canvas {
        width: 100%;
        height: auto;
    }
}


.unit-toggle {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.unit-toggle label {
    font-size: 0.85em;
    font-weight: 600;
    color: #333;
}

.unit-toggle select {
    padding: 5px 8px;
    border: 2px solid #8B0000;
    border-radius: 5px;
    font-size: 0.85em;
    background: white;
    color: #8B0000;
    cursor: pointer;
    font-weight: 600;
}


.shape-type-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.type-btn {
    flex: 1;
    padding: 8px;
    border: 2px solid #8B0000;
    background: white;
    color: #8B0000;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: bold;
    transition: all 0.3s;
}

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

.type-btn.active {
    background: #8B0000;
    color: white;
}
