:root {
    --bg-color: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --accent-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(0, 0, 0, 0.1);
    --input-bg: rgba(255, 255, 255, 0.9);
    --input-border: rgba(0, 0, 0, 0.2);
    --danger: #ef4444;
    --success: #10b981;
}

[data-theme="dark"] {
    --bg-color: #0d1117;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --accent-primary: #58a6ff;
    --accent-hover: #3182ce;
    --accent-gradient: linear-gradient(135deg, #58a6ff, #bc8cff);
    --card-bg: rgba(22, 27, 34, 0.6);
    --card-border: rgba(240, 246, 252, 0.1);
    --input-bg: rgba(13, 17, 23, 0.8);
    --input-border: rgba(240, 246, 252, 0.2);
    --danger: #f85149;
    --success: #2ea043;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    position: relative;
    overflow-x: hidden;
}

/* Dynamic Background Shapes */
.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out alternate;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: #58a6ff;
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 500px;
    height: 500px;
    background: #bc8cff;
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.shape-3 {
    width: 300px;
    height: 300px;
    background: #2ea043;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
    opacity: 0.2;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, -50px) scale(1.1); }
}

.container {
    width: 100%;
    max-width: 800px;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

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

.form-section.divider {
    border-top: 1px solid var(--card-border);
    padding-top: 2rem;
}

.form-section h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    margin-bottom: 0;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

.input-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input, select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

input:focus, select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

/* Subject Row */
.subject-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: end;
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Buttons */
button {
    cursor: pointer;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    width: 100%;
    box-shadow: 0 4px 15px rgba(88, 166, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(88, 166, 255, 0.4);
}

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

.btn-secondary {
    background: rgba(240, 246, 252, 0.1);
    color: var(--text-primary);
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: rgba(240, 246, 252, 0.15);
}

.btn-icon {
    background: rgba(248, 81, 73, 0.1);
    color: var(--danger);
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 10px;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: rgba(248, 81, 73, 0.2);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.visible .modal-content {
    transform: scale(1);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    width: 30px;
    height: 30px;
    padding: 0;
}

.close-btn:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.result-header {
    text-align: center;
    margin-bottom: 2rem;
}

.result-header p {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Circular Chart */
.score-display {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.score-circle {
    width: 200px;
    height: 200px;
}

.circular-chart {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 250px;
}

.circle-bg {
    fill: none;
    stroke: rgba(240, 246, 252, 0.1);
    stroke-width: 2.5;
}

.circle {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    transition: stroke-dasharray 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.percentage {
    fill: var(--text-primary);
    font-size: 0.4em;
    font-weight: bold;
    text-anchor: middle;
}

.label {
    fill: var(--text-secondary);
    font-size: 0.15em;
    text-anchor: middle;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    text-align: center;
}

.stat-box {
    background: rgba(240, 246, 252, 0.05);
    border-radius: 15px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

/* Responsive */
@media (max-width: 600px) {
    .input-grid {
        grid-template-columns: 1fr;
    }
    
    .subject-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        background: rgba(240, 246, 252, 0.03);
        padding: 1rem;
        border-radius: 10px;
        position: relative;
    }
    
    .btn-icon {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 30px;
        height: 30px;
    }
}

.formula-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    background: rgba(240, 246, 252, 0.03);
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border: 1px dashed var(--card-border);
}

.formula-info strong {
    color: var(--accent-primary);
    font-size: 1.05rem;
}

.theme-toggle-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
    background: var(--input-border);
}
