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

html {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
}

/* Content Wrapper with Ads */
.content-wrapper {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
}

/* Side Ads */
.side-ad {
    width: 300px;
    position: sticky;
    top: 20px;
    flex-shrink: 0;
    display: none; /* Hidden by default on mobile */
}

.side-ad a {
    display: block;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.side-ad a:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.side-ad img {
    width: 100%;
    height: auto;
    display: block;
}

/* Show ads on larger screens */
@media (min-width: 1400px) {
    .side-ad {
        display: block;
    }
}

.container {
    width: 100%;
    max-width: 800px;
    flex: 1;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.screen.active {
    display: block;
}

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

.card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Welcome Screen */
.welcome-card {
    text-align: center;
}

.title {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 10px;
}

.description {
    font-size: 1rem;
    color: #999;
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 30px;
    text-align: left;
}

.input-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.input-group input {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.jenjang-selection {
    margin-bottom: 30px;
}

.jenjang-selection h3 {
    color: #333;
    margin-bottom: 20px;
}

.jenjang-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.jenjang-btn {
    padding: 25px 20px;
    border: 3px solid #e0e0e0;
    background: white;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
    font-weight: 600;
}

.jenjang-btn .emoji {
    font-size: 2rem;
    margin-bottom: 8px;
}

.jenjang-btn:hover {
    transform: translateY(-5px);
    border-color: #667eea;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.2);
}

.jenjang-btn.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

/* Category Selection (SMA) */
.category-selection {
    margin-bottom: 30px;
}

.category-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.category-btn {
    padding: 25px 20px;
    border: 3px solid #e0e0e0;
    background: white;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.category-btn .emoji {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.category-btn .category-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: #333;
}

.category-btn .category-desc {
    font-size: 0.85rem;
    color: #666;
}

.category-btn:hover {
    transform: translateY(-5px);
    border-color: #667eea;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.2);
}

.category-btn.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.category-btn.selected .category-name,
.category-btn.selected .category-desc {
    color: white;
}

/* Subject Selection */
.subject-selection {
    margin-bottom: 30px;
}

.subject-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.subject-btn {
    padding: 20px;
    border: 3px solid #e0e0e0;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.subject-btn:hover {
    transform: translateY(-3px);
    border-color: #667eea;
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.2);
}

.subject-btn.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.btn {
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(56, 239, 125, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Quiz Screen */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: white;
    padding: 15px 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.quiz-info {
    display: flex;
    gap: 10px;
}

.badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
}

.user-badge {
    background: #f5f5f5;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    color: #333;
}

.progress-info {
    font-weight: 600;
    color: #667eea;
}

.quiz-card {
    margin-bottom: 20px;
}

.question-container {
    margin-bottom: 30px;
}

.question-text {
    font-size: 1.4rem;
    color: #333;
    line-height: 1.6;
}

.options-container {
    display: grid;
    gap: 15px;
    margin-bottom: 30px;
}

.option {
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 15px;
}

.option:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.option.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.option-label {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.option.selected .option-label {
    background: white;
    color: #667eea;
}

.option-text {
    flex: 1;
    font-size: 1rem;
}

.quiz-actions {
    display: flex;
    gap: 15px;
    justify-content: space-between;
}

.quiz-actions .btn {
    flex: 1;
}

/* Result Screen */
.result-card {
    text-align: center;
}

.result-title {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 30px;
}

.score-display {
    margin-bottom: 40px;
}

.score-circle {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.score-number {
    font-size: 4rem;
    font-weight: 700;
}

.score-label {
    font-size: 1.5rem;
    opacity: 0.9;
}

.result-details {
    text-align: left;
    margin-bottom: 30px;
    max-height: 400px;
    overflow-y: auto;
}

.result-item {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 10px;
    border-left: 4px solid #e0e0e0;
}

.result-item.correct {
    background: #e8f5e9;
    border-left-color: #4caf50;
}

.result-item.incorrect {
    background: #ffebee;
    border-left-color: #f44336;
}

.result-item-header {
    font-weight: 600;
    margin-bottom: 5px;
}

.result-item-detail {
    font-size: 0.9rem;
    color: #666;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Leaderboard Screen */
.leaderboard-card {
    text-align: center;
}

.jenjang-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.tab-btn {
    padding: 10px 25px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.tab-btn:hover {
    border-color: #667eea;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.leaderboard-container {
    margin-bottom: 30px;
    max-height: 500px;
    overflow-y: auto;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 20px;
    margin-bottom: 10px;
    background: #f8f9ff;
    border-radius: 12px;
    transition: all 0.3s;
}

.leaderboard-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.leaderboard-item.top-1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
}

.leaderboard-item.top-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
}

.leaderboard-item.top-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #e9c9a0 100%);
}

.rank {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    margin-right: 20px;
}

.leaderboard-info {
    flex: 1;
    text-align: left;
}

.leaderboard-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.leaderboard-time {
    font-size: 0.85rem;
    color: #666;
}

.leaderboard-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-leaderboard {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .content-wrapper {
        padding: 15px;
        gap: 0;
    }

    .side-ad {
        display: none !important; /* Ensure ads are hidden on mobile */
    }

    .container {
        padding: 15px;
    }

    .card {
        padding: 25px;
    }

    .title {
        font-size: 2rem;
    }

    .jenjang-buttons {
        grid-template-columns: 1fr;
    }

    .category-buttons {
        grid-template-columns: 1fr;
    }

    .subject-buttons {
        grid-template-columns: 1fr;
    }

    .quiz-header {
        flex-direction: column;
        gap: 10px;
    }

    .question-text {
        font-size: 1.2rem;
    }

    .quiz-actions {
        flex-direction: column;
    }

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

    .score-number {
        font-size: 3rem;
    }

    /* Mobile-friendly dashboard button */
    .dashboard-link {
        margin-top: 30px;
        padding: 0 10px;
        position: relative;
        z-index: 10;
    }

    .btn-outline {
        width: 100%;
        max-width: 100%;
        padding: 22px 25px;
        font-size: 1.15rem;
        min-height: 64px;
        border-width: 3px;
        font-weight: 700;
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.3);
        touch-action: manipulation;
    }

    .btn-outline:active {
        transform: scale(0.96);
        background: #667eea;
        color: white;
        border-color: #667eea;
    }
}

/* ===========================
   DASHBOARD LEADERBOARD STYLES
   =========================== */

.dashboard-link {
    margin-top: 30px;
    text-align: center;
    position: relative;
    z-index: 10;
}

.btn-outline {
    background: transparent;
    border: 3px solid #667eea;
    color: #667eea;
    padding: 18px 30px;
    font-size: 1.1rem;
    font-weight: 700;
    min-height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 400px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.3);
    touch-action: manipulation;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.btn-outline:active {
    transform: scale(0.98);
    background: #5568d3;
    color: white;
}

.dashboard-card {
    max-width: none;
    padding: 30px;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 30px;
}

.weekly-announcement {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border: 3px solid #ff9800;
    border-radius: 15px;
    padding: 20px;
    margin: 20px auto;
    max-width: 600px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 20px rgba(255, 152, 0, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 5px 20px rgba(255, 152, 0, 0.3);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 8px 25px rgba(255, 152, 0, 0.5);
    }
}

.announcement-icon {
    font-size: 3rem;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.announcement-content {
    flex: 1;
    text-align: left;
}

.announcement-content strong {
    display: block;
    font-size: 1.1rem;
    color: #d84315;
    margin-bottom: 5px;
}

.announcement-content p {
    margin: 0;
    font-size: 0.95rem;
    color: #e65100;
    font-weight: 600;
}

.period-toggle {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.period-btn {
    padding: 12px 30px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.period-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.period-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.period-btn .emoji {
    font-size: 1.2rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.leaderboard-section {
    background: #f8f9fa;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.leaderboard-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.section-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-icon {
    font-size: 1.5rem;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.section-content {
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
}

/* Dashboard Leaderboard Items */
.dashboard-leaderboard-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: white;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.dashboard-leaderboard-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.dashboard-rank {
    font-size: 1.5rem;
    font-weight: 700;
    min-width: 40px;
    text-align: center;
}

.dashboard-leaderboard-item.rank-1 .dashboard-rank {
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.dashboard-leaderboard-item.rank-2 .dashboard-rank {
    color: #C0C0C0;
}

.dashboard-leaderboard-item.rank-3 .dashboard-rank {
    color: #CD7F32;
}

.dashboard-info {
    flex: 1;
}

.dashboard-name {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    margin-bottom: 3px;
}

.dashboard-school {
    font-size: 0.85rem;
    color: #666;
}

.dashboard-score {
    font-size: 1.3rem;
    font-weight: 700;
    color: #667eea;
    min-width: 60px;
    text-align: right;
}

.dashboard-leaderboard-item.rank-1 {
    background: linear-gradient(135deg, #fff9e6 0%, #fff4cc 100%);
    border: 2px solid #FFD700;
}

.dashboard-leaderboard-item.rank-2 {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border: 2px solid #C0C0C0;
}

.dashboard-leaderboard-item.rank-3 {
    background: linear-gradient(135deg, #fff0e6 0%, #ffe6cc 100%);
    border: 2px solid #CD7F32;
}

.empty-leaderboard {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.loading {
    text-align: center;
    padding: 30px;
    color: #667eea;
    font-weight: 600;
}

/* Responsive Dashboard */
@media (max-width: 768px) {
    .dashboard-card {
        padding: 20px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .weekly-announcement {
        flex-direction: column;
        padding: 15px;
        gap: 10px;
        text-align: center;
    }

    .announcement-icon {
        font-size: 2.5rem;
    }

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

    .announcement-content strong {
        font-size: 1rem;
    }

    .announcement-content p {
        font-size: 0.9rem;
    }

    .period-toggle {
        flex-direction: column;
        gap: 10px;
    }

    .period-btn {
        width: 100%;
        justify-content: center;
    }

    .dashboard-leaderboard-item {
        padding: 10px;
        gap: 10px;
    }

    .dashboard-rank {
        font-size: 1.2rem;
        min-width: 30px;
    }

    .dashboard-name {
        font-size: 0.9rem;
    }

    .dashboard-school {
        font-size: 0.75rem;
    }

    .dashboard-score {
        font-size: 1.1rem;
    }
}

/* Scrollbar styling for section content */
.section-content::-webkit-scrollbar {
    width: 6px;
}

.section-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.section-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.section-content::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* ===========================
   SEO FOOTER STYLES
   =========================== */

.seo-footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 50px 20px 20px;
    margin-top: 50px;
    width: 100%;
    flex-shrink: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section {
    padding: 0 15px;
}

.footer-section h3 {
    color: #3498db;
    font-size: 1.3rem;
    margin-bottom: 15px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.footer-section p {
    line-height: 1.8;
    color: #ecf0f1;
    margin-bottom: 15px;
}

.footer-section strong {
    color: #f39c12;
    font-weight: 700;
}

.footer-list {
    list-style: none;
    padding: 0;
}

.footer-list li {
    padding: 8px 0;
    color: #ecf0f1;
    line-height: 1.6;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-list li:last-child {
    border-bottom: none;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    padding-top: 30px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
    margin: 10px 0;
    color: #bdc3c7;
    line-height: 1.6;
}

.footer-bottom strong {
    color: #3498db;
    font-weight: 700;
}

.footer-keywords {
    font-size: 0.85rem;
    color: #95a5a6;
    line-height: 1.8;
    margin-top: 15px;
}

/* Responsive Footer */
@media (max-width: 768px) {
    .seo-footer {
        padding: 30px 15px 20px;
        margin-top: 30px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .footer-section {
        padding: 0;
    }

    .footer-section h3 {
        font-size: 1.15rem;
    }

    .footer-section p {
        font-size: 0.9rem;
    }

    .footer-list li {
        font-size: 0.9rem;
        padding: 6px 0;
    }

    .footer-bottom p {
        font-size: 0.85rem;
    }

    .footer-keywords {
        font-size: 0.75rem;
    }
}

