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

:root {
    --bg-dark: #0B0E14;
    --bg-card: #1E293B;
    --border-color: #334155;
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --accent-cool: #38BDF8;
    --accent-warm: #F97316;
    --success: #4FD1C5;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'Roboto', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 24px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    text-align: center;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.tagline {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Main */
.main {
    flex: 1;
    padding: 48px 0;
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 48px;
}

.hero h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.hero p {
    font-size: 18px;
    color: var(--text-secondary);
}

/* Calculators Grid */
.calculators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.calc-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.calc-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-cool);
}

.calc-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.calc-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.calc-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    min-height: 42px;
}

.btn-open {
    width: 100%;
    padding: 12px 24px;
    background: var(--accent-cool);
    color: var(--bg-dark);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-open:hover {
    background: #0EA5E9;
    transform: scale(1.02);
}

.btn-open:active {
    transform: scale(0.98);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 22px;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-cool);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.btn-calculate {
    width: 100%;
    padding: 14px 24px;
    background: var(--accent-warm);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.btn-calculate:hover {
    background: #EA580C;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

.result-box {
    margin-top: 24px;
    padding: 20px;
    background: rgba(79, 209, 197, 0.1);
    border: 1px solid var(--success);
    border-radius: 8px;
    display: none;
}

.result-box.show {
    display: block;
    animation: slideUp 0.3s ease;
}

.result-box h4 {
    font-size: 16px;
    color: var(--success);
    margin-bottom: 8px;
}

.result-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.result-details {
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.grade-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.grade-input {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.grade-input input {
    width: 70px;
    text-align: center;
    padding: 10px;
}

.btn-add {
    padding: 10px 20px;
    background: var(--accent-cool);
    color: var(--bg-dark);
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.2s ease;
}

.btn-add:hover {
    background: #0EA5E9;
}

.info-box {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid var(--accent-cool);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Footer */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 32px 0;
    text-align: center;
    margin-top: auto;
}

.footer p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.footer-note {
    font-size: 12px;
    color: #64748B;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h2 {
        font-size: 24px;
    }

    .hero p {
        font-size: 16px;
    }

    .calculators-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .modal-content {
        margin: 20px;
    }

    .result-value {
        font-size: 28px;
    }
}

/* Custom Scrollbar */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #475569;
}