body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background-color: #f0f2f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding-top: 20px;
    padding-bottom: 20px;
}

#container {
    text-align: center;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 900px;
    width: 95%;
}

#info-panel {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.stat-box {
    text-align: left;
    min-width: 70px;
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 15px;
    padding-right: 15px;
    border-right: 1px solid #ddd;
}

.toggle-label {
    font-size: 0.9em;
    color: #6c757d;
    font-weight: 600;
}

.toggle-value {
    font-size: 0.9em;
    font-weight: bold;
    color: #333;
    width: 35px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
    -webkit-transform: translateX(20px);
    -ms-transform: translateX(20px);
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}


.label {
    font-size: 0.85em;
    color: #6c757d;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.value {
    font-size: 1.2em;
    font-weight: 600;
    color: #212529;
}

.sub-value {
    font-size: 0.9em;
    color: #adb5bd;
    margin-left: 5px;
}

canvas {
    border: 1px solid #ddd;
    background-color: #fff;
    cursor: crosshair;
    max-width: 100%;
    height: auto;
}

/* Explanations Grid */
#explanation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    width: 100%;
    margin-top: 20px;
    text-align: left;
}

.card {
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
    background: #fff;
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.card p {
    font-size: 0.9em;
    color: #555;
    line-height: 1.5;
    margin-bottom: 10px;
}

.formula {
    display: block;
    background: #f8f9fa;
    padding: 5px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    text-align: center;
}

/* Color Coding */
.sin-card { border-top: 4px solid #dc3545; }
.sin-card h3 { color: #dc3545; }

.cos-card { border-top: 4px solid #0d6efd; }
.cos-card h3 { color: #0d6efd; }

.tan-card { border-top: 4px solid #198754; }
.tan-card h3 { color: #198754; }

.cot-card { border-top: 4px solid #0dcaf0; }
.cot-card h3 { color: #0dcaf0; }

.sec-card { border-top: 4px solid #fd7e14; }
.sec-card h3 { color: #fd7e14; }

.csc-card { border-top: 4px solid #6f42c1; }
.csc-card h3 { color: #6f42c1; }