:root {
    --primary: #3a5a78;
    --secondary: #1e3a5f;
    --accent: #ff6b6b;
    --light: #f8f9fa;
    --dark: #2d3436;
    --correct: #2ecc71;
    --incorrect: #e74c3c;
    --background: #f5f7fa;
    --card-shadow: 0 10px 20px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.7;
    color: var(--dark);
    margin: 0;
    padding: 0;
    background-color: var(--background);
    background-image: linear-gradient(135deg, #f5f7fa 0%, #e4e8ed 100%);
}

header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 3rem 0;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--accent);
}

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

h1 {
    margin: 0;
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin: 0.5rem 0 0;
    font-weight: 300;
}

h2 {
    color: var(--secondary);
    border-bottom: 3px solid var(--accent);
    padding-bottom: 0.5rem;
    margin-top: 2.5rem;
    font-size: 1.8rem;
    font-weight: 600;
}

h3 {
    color: var(--primary);
    margin-top: 1.8rem;
    font-size: 1.4rem;
    font-weight: 500;
}

/* Rule Cards */
.rule-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--card-shadow);
    border-left: 5px solid var(--accent);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.rule-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

.rule-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--accent);
}

.example {
    background-color: rgba(74, 111, 165, 0.05);
    border-left: 4px solid var(--secondary);
    padding: 1.2rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    position: relative;
}

.example::before {
    content: "Example";
    position: absolute;
    top: -12px;
    left: 20px;
    background: white;
    padding: 0 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--secondary);
    font-style: normal;
}

.incorrect {
    color: var(--incorrect);
    font-weight: 500;
}

.correct {
    color: var(--correct);
    font-weight: 500;
}

.rule-number {
    display: inline-block;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    text-align: center;
    line-height: 36px;
    margin-right: 12px;
    font-weight: 600;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Navigation */
nav {
    background: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

nav li {
    margin: 0 10px;
}

nav a {
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
    padding: 10px 18px;
    border-radius: 30px;
    transition: var(--transition);
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

nav a:hover {
    color: var(--primary);
    background: rgba(58, 90, 120, 0.1);
}

nav a::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--accent);
    transition: var(--transition);
}

nav a:hover::before {
    width: 70%;
}

/* Footer */
footer {
    background: linear-gradient(135deg, var(--dark), #1a1a1a);
    color: white;
    text-align: center;
    padding: 3rem 0;
    margin-top: 4rem;
    position: relative;
}

footer::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--accent);
}

footer p {
    margin: 0.5rem 0;
    opacity: 0.8;
}

/* Practice Section */
.practice-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin: 2.5rem 0;
    border: none;
    box-shadow: var(--card-shadow);
    position: relative;
}

.practice-section::before {
    content: "Practice";
    position: absolute;
    top: -12px;
    left: 20px;
    background: var(--accent);
    color: white;
    padding: 0 15px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
}

.difficulty-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    backdrop-filter: blur(5px);
}

.difficulty-selector label {
    font-weight: 600;
    color: var(--secondary);
    font-size: 1rem;
    margin-right: 5px;
}

.difficulty-dropdown {
    padding: 0.6rem 1rem;
    border: 2px solid var(--primary);
    border-radius: 8px;
    background-color: white;
    color: var(--dark);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 1em;
}

.difficulty-dropdown:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.difficulty-dropdown:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.2);
}

.difficulty-dropdown[value="easy"] {
    border-color: var(--correct);
    color: var(--correct);
}

.difficulty-dropdown[value="medium"] {
    border-color: #f39c12;
    color: #f39c12;
}

.difficulty-dropdown[value="hard"] {
    border-color: var(--incorrect);
    color: var(--incorrect);
}

.practice-question {
    margin-bottom: 1.5rem;
    display: none;
}

.practice-question.active {
    display: block;
}

.question-text {
    font-weight: 600;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--dark);
}

.options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin: 1.5rem 0;
}

.option {
    position: relative;
    margin-bottom: 0.8rem;
    cursor: pointer;
    padding: 1rem 1.5rem 1rem 3.5rem;
    border-radius: 8px;
    transition: var(--transition);
    background-color: white;
    border: 1px solid #e0e0e0;
    font-size: 1rem;
}

.option:hover {
    background-color: rgba(74, 111, 165, 0.05);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.option.selected {
    background-color: rgba(74, 111, 165, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(74, 111, 165, 0.2);
}

.radio-check {
    position: absolute;
    top: 1.1rem;
    left: 1.2rem;
    height: 1.3rem;
    width: 1.3rem;
    background-color: white;
    border: 2px solid #ccc;
    border-radius: 50%;
    transition: var(--transition);
}

.option:hover .radio-check {
    border-color: var(--primary);
}

.option.selected .radio-check {
    border-color: var(--primary);
    background-color: var(--primary);
}

.radio-check::after {
    content: "";
    position: absolute;
    display: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: white;
}

.option input:checked ~ .radio-check::after {
    display: block;
}

.option.correct-answer {
    background-color: rgba(46, 204, 113, 0.1);
    border-color: var(--correct);
    color: var(--dark);
}

.option.correct-answer .radio-check {
    border-color: var(--correct);
    background-color: var(--correct);
}

.option.incorrect-answer {
    background-color: rgba(231, 76, 60, 0.1);
    border-color: var(--incorrect);
    color: var(--dark);
}

.option.incorrect-answer .radio-check {
    border-color: var(--incorrect);
    background-color: var(--incorrect);
}

.explanation {
    margin-top: 1.5rem;
    padding: 1.2rem;
    background-color: rgba(74, 111, 165, 0.05);
    border-left: 4px solid var(--secondary);
    display: none;
    border-radius: 0 8px 8px 0;
    animation: fadeIn 0.3s ease;
}

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

.explanation.show {
    display: block;
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
}

button {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

button:hover {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.confirm-btn {
    margin-top: 1.5rem;
    display: none;
    background: linear-gradient(135deg, var(--accent), #ff8e8e);
    width: 100%;
}

.confirm-btn:hover {
    background: linear-gradient(135deg, #ff8e8e, var(--accent));
}

.score-display {
    text-align: center;
    margin: 1.5rem 0;
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--secondary);
    padding: 0.8rem;
    background-color: white;
    border-radius: 30px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Group Headers */
.group-header {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    color: white;
    padding: 2.5rem;
    margin: 4rem 0 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
}

.group-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--accent);
}

.group-header h2 {
    color: white;
    border-bottom: 3px solid var(--accent);
    padding-bottom: 0.5rem;
    display: inline-block;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.group-header p {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.1rem;
    opacity: 0.9;
    line-height: 1.6;
}

/* GitHub Banner */
.follow-github {
    text-align: center;
    font-size: 1.3rem;
    font-weight: bold;
    background: linear-gradient(135deg, #fff3cd, #ffe69c);
    color: #856404;
    padding: 1.5rem;
    border-radius: 12px;
    margin: 3rem 0;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
}

.follow-github::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: #ffc107;
}

.follow-github a {
    color: #0c5460;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    position: relative;
}

.follow-github a:hover {
    color: var(--primary);
}

.follow-github a::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.follow-github a:hover::after {
    width: 100%;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    nav ul {
        gap: 5px;
    }
    
    nav a {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .rule-card, .practice-section {
        padding: 1.5rem;
    }
    
    .group-header {
        padding: 1.8rem;
        margin: 3rem 0 1.5rem;
    }
    
    .group-header h2 {
        font-size: 1.6rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    nav ul {
        flex-direction: column;
        align-items: center;
    }
    
    nav li {
        margin: 5px 0;
    }
    
    .rule-number {
        width: 30px;
        height: 30px;
        line-height: 30px;
        font-size: 0.9rem;
    }
    
    .options {
        gap: 0.5rem;
    }
    
    .option {
        padding: 0.8rem 1rem 0.8rem 3rem;
    }
    
    .radio-check {
        top: 0.9rem;
    }
}

/* GitHub Section */
.github-section {
    background: linear-gradient(135deg, #2b3137, #24292e);
    color: white;
    padding: 2.5rem;
    border-radius: 12px;
    margin: 4rem 0;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    border-left: 5px solid var(--accent);
}

.github-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--accent);
}

.github-content {
    display: flex;
    align-items: center;
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.github-icon {
    font-size: 4rem;
    color: var(--accent);
    flex-shrink: 0;
}

.github-section h3 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.github-section p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.github-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.github-button:hover {
    background: #ff5252;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.github-button:active {
    transform: translateY(0);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .github-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .github-icon {
        font-size: 3rem;
    }
}