:root {
    --bg-dark: #0a0a12;
    --bg-gradient: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --accent-primary: #00f3ff;
    --accent-secondary: #bc13fe;
    --accent-tertiary: #ff0055;
    --font-main: 'Outfit', sans-serif;
    --modal-overlay: rgba(0, 0, 0, 0.85);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background: var(--bg-dark);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    background-size: cover;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 4rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Utility */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

h1,
h2,
h3 {
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

strong {
    color: #fff;
    font-weight: 600;
}

/* Header */
header {
    text-align: center;
    padding: 4rem 0 2rem;
    position: relative;
}

header h1 {
    font-size: 3.5rem;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 15px rgba(0, 243, 255, 0.3));
}

header p {
    font-size: 1.2rem;
    color: var(--text-muted);
}

/* Banner / Alerts */
.rules-banner {
    background: rgba(255, 60, 0, 0.1);
    border: 1px solid rgba(255, 60, 0, 0.3);
    border-left: 4px solid var(--accent-tertiary);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 3rem;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.rules-banner h2 {
    color: var(--accent-tertiary);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rules-banner ul {
    list-style: none;
    margin-top: 1rem;
}

.rules-banner li {
    position: relative;
    padding-left: 1.5rem;
}

.rules-banner li::before {
    content: "!";
    position: absolute;
    left: 0;
    color: var(--accent-tertiary);
    font-weight: bold;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    padding: 2rem;
    padding-bottom: 2rem;
    backdrop-filter: blur(12px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0.7;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 243, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.card h2 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

.card-section {
    margin-bottom: 1.5rem;
}

.card-section h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.review-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

ul.checklist {
    list-style: none;
}

ul.checklist li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    display: flex;
    /* Allow icon to sit next to text */
    align-items: flex-start;
    gap: 0.5rem;
}

ul.checklist li::before {
    content: "✓";
    color: var(--accent-secondary);
    flex-shrink: 0;
    margin-top: 0.1em;
}

.help-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-primary);
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    margin-left: 0.5rem;
    flex-shrink: 0;
    margin-top: 0.2em;
    /* Align with text */
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.help-icon:hover {
    background: var(--accent-primary);
    color: #000;
    box-shadow: 0 0 8px var(--accent-primary);
}

/* Buttons */
.card-actions {
    margin-top: auto;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.8rem;
    align-items: center;
}

.btn-guide {
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
    z-index: 10;
}

.btn-guide:hover {
    background: var(--accent-primary);
    color: #000;
    box-shadow: 0 0 15px var(--accent-primary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-overlay);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: #1a1a2e;
    border: 1px solid var(--accent-secondary);
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.8);
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 12, 41, 0.95);
    position: sticky;
    top: 0;
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.modal-header h2 {
    margin: 0;
    color: var(--accent-secondary);
    font-size: 1.3rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 0.8;
    padding: 0 0.5rem;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #fff;
}

.modal-body {
    padding: 2.5rem;
    font-size: 1.05rem;
    color: var(--text-main);
}

.modal-body h3 {
    color: var(--accent-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

.modal-body h4 {
    color: #fff;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.modal-body ul,
.modal-body ol {
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.modal-body li {
    margin-bottom: 0.75rem;
}

.modal-body p {
    margin-bottom: 1.25rem;
}

/* MathJax Override for Colors */
.mjx-chtml {
    color: #e0e0e0 !important;
    font-size: 110%;
}

@keyframes modalPop {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Footer */
footer {
    text-align: center;
    margin-top: 4rem;
    padding: 2rem;
    color: var(--text-muted);
    border-top: 1px solid var(--card-border);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
}

/* Staggered delay */
.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

.delay-4 {
    animation-delay: 0.4s;
}

.delay-5 {
    animation-delay: 0.5s;
}

.delay-6 {
    animation-delay: 0.6s;
}

.delay-7 {
    animation-delay: 0.7s;
}

.delay-8 {
    animation-delay: 0.8s;
}

.delay-9 {
    animation-delay: 0.9s;
}

.delay-10 {
    animation-delay: 1.0s;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2.5rem;
    }

    .container {
        padding: 1rem;
    }
}

/* All Distributions Feature Styles */
.btn-header {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--accent-secondary);
    color: var(--accent-secondary);
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    margin-top: 1.5rem;
    display: inline-block;
}

.btn-header:hover {
    background: var(--accent-secondary);
    color: #fff;
    box-shadow: 0 0 20px var(--accent-secondary);
}

.dist-category-title {
    color: var(--accent-tertiary);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
}

.dist-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.dist-item h4 {
    color: var(--accent-primary);
    margin-top: 0;
    font-size: 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.dist-props {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.dist-prop-item strong {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Practice Problems */
.btn-practice {
    position: relative;
    background: rgba(255, 0, 85, 0.1);
    border: 1px solid var(--accent-tertiary);
    color: var(--accent-tertiary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
    z-index: 10;
}

.btn-practice:hover {
    background: var(--accent-tertiary);
    color: #fff;
    box-shadow: 0 0 15px var(--accent-tertiary);
}

.btn-sol {
    position: relative;
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
    z-index: 10;
    text-decoration: none;
    text-align: center;
}

.btn-sol:hover {
    background: var(--accent-primary);
    color: #000;
    box-shadow: 0 0 15px var(--accent-primary);
}

.spoiler {
    background-color: rgba(0, 243, 255, 0.1);
    color: var(--accent-primary);
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    transition: all 0.2s;
    border: 1px solid rgba(0, 243, 255, 0.2);
}

.spoiler::before {
    content: none;
}

.spoiler:hover {
    background-color: rgba(0, 243, 255, 0.2);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.1);
}

.practice-qa {
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.practice-qa h4 {
    color: var(--accent-tertiary) !important;
    border-bottom: none !important;
    margin-bottom: 0.5rem !important;
}

/* Input Validation Error */
.input-error {
    border-color: #ff4444 !important;
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.4) !important;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(5px);
    }

    50% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }

    100% {
        transform: translateX(0);
    }
}

/* Fixed Home Button */
.btn-home-fixed {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    width: 45px;
    height: 45px;
    background: rgba(15, 12, 41, 0.8);
    border: 1px solid var(--accent-primary);
    border-radius: 50%;
    color: var(--accent-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    font-size: 1.5rem;
    z-index: 9999;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.btn-home-fixed:hover {
    background: var(--accent-primary);
    color: #000;
    box-shadow: 0 0 20px var(--accent-primary);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .btn-home-fixed {
        top: 1rem;
        left: 1rem;
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }
}