:root {
    --jago-color: #8b5cf6;
    --jago-hover: #7c3aed;
    --jago-light: rgba(139, 92, 246, 0.16);
    --jago-glow: rgba(139, 92, 246, 0.08);
    --jago-gradient: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
    --jago-gradient-hover: linear-gradient(135deg, #7c3aed 0%, #c026d3 100%);
}

.jago-page-shell,
.jago-header-wrapper,
.jago-detail-layout,
.quiz-layout,
.jago-modal,
.jago-card {
    --accent-color: var(--jago-color);
    --accent-hover: var(--jago-hover);
    --accent-light: var(--jago-light);
    --accent-glow: var(--jago-glow);
    --pill-active-bg: var(--jago-gradient);
    --pill-active-border: transparent;
}

.jago-page-shell .button-primary,
.jago-detail-layout .button-primary,
.quiz-layout .button-primary,
.jago-modal .button-primary {
    background: var(--jago-gradient);
    border: none;
}

.jago-page-shell .button-primary:hover,
.jago-detail-layout .button-primary:hover,
.quiz-layout .button-primary:hover,
.jago-modal .button-primary:hover {
    background: var(--jago-gradient-hover);
}

.jago-card {
    cursor: pointer;
}

.jago-card .poll-vote-summary svg {
    fill: var(--color-gold);
    color: var(--color-gold);
}


.jago-card-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.jago-card-meta-item svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.jago-detail-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(18px, 3vw, 28px);
    align-items: start;
    width: 100%;
}

.jago-detail-primary {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.jago-detail-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.jago-detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.leaderboard-header {
    display: grid;
    grid-template-columns: 36px 1fr 60px 72px;
    gap: 8px;
    padding: 8px 12px;
    font-size: calc(var(--font-size-sm) * 0.85);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--copy-muted);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 8px;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 36px 1fr 60px 72px;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.leaderboard-row:hover {
    background: var(--hover-bg);
}

.leaderboard-row-self {
    background: var(--accent-light);
    border: 1px solid var(--accent-color);
    border-radius: var(--radius-sm);
}

.leaderboard-rank {
    font-size: var(--font-size-sm);
    font-weight: 800;
    color: var(--copy-muted);
    text-align: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hover-bg);
    flex-shrink: 0;
}

.leaderboard-rank-gold {
    background: var(--color-warning-bg);
    color: var(--color-gold);
}

.leaderboard-rank-silver {
    background: rgba(148, 163, 184, 0.12);
    color: var(--color-silver);
}

.leaderboard-rank-bronze {
    background: rgba(194, 133, 90, 0.12);
    color: var(--color-bronze);
}

.leaderboard-avatar-group {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.leaderboard-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.leaderboard-name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}

.leaderboard-score {
    font-weight: 800;
    font-size: var(--font-size-sm);
    text-align: right;
    background: var(--jago-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.leaderboard-time {
    font-size: calc(var(--font-size-sm) * 0.9);
    color: var(--copy-muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.jago-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.jago-meta-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: var(--hover-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.jago-meta-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--copy-primary);
    line-height: 1;
}

.jago-meta-label {
    font-size: calc(var(--font-size-sm) * 0.85);
    color: var(--copy-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.jago-result-card {
    text-align: center;
}

.jago-score-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    margin: 16px 0 8px;
}

.jago-score-value {
    font-size: clamp(3rem, 8vw, 4.5rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    background: var(--jago-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.jago-score-unit {
    font-size: var(--font-size-sm);
    color: var(--copy-muted);
    font-weight: 600;
}

.jago-result-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.jago-agreement-rules {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    background: var(--hover-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px;
}

.jago-agreement-rule {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
}

.jago-agreement-rule::before {
    content: "✓";
    color: var(--color-success);
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.quiz-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: calc(100vh - var(--header-height));
}

.quiz-sticky-header {
    position: sticky;
    top: var(--header-height);
    z-index: 50;
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-light);
    padding: 12px clamp(16px, 4vw, 24px);
}

.quiz-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    max-width: var(--container-max);
    margin: 0 auto;
    width: 100%;
}

.quiz-timer-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.quiz-timer-icon {
    display: flex;
    align-items: center;
    color: var(--copy-muted);
}

.quiz-timer-label {
    font-size: var(--font-size-sm);
    color: var(--copy-muted);
    font-weight: 600;
}

.quiz-timer-display {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--copy-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    transition: color 0.3s ease;
}

.quiz-timer-critical {
    color: var(--color-danger);
    animation: timerPulse 1s ease-in-out infinite;
}

.quiz-progress-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 320px;
}

.quiz-progress-text {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--copy-muted);
    white-space: nowrap;
}

.quiz-progress-track {
    flex: 1;
    height: 6px;
    background: var(--hover-bg);
    border-radius: 3px;
    overflow: hidden;
}

.quiz-progress-fill {
    display: block;
    height: 100%;
    background: var(--jago-gradient);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.quiz-body {
    flex: 1;
    padding: clamp(16px, 4vw, 32px) clamp(16px, 4vw, 24px);
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.quiz-questions-list {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.quiz-question-item {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-light);
}

.quiz-question-item:last-child {
    border-bottom: none;
}

.quiz-question-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quiz-question-number {
    font-size: var(--font-size-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--jago-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    width: fit-content;
}

.quiz-question-text {
    font-size: var(--font-size-body);
    font-weight: 500;
    line-height: 1.65;
    color: var(--copy-primary);
}

.quiz-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.quiz-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.quiz-option:hover {
    border-color: var(--accent-color);
    background: var(--accent-light);
}

.quiz-option.selected {
    border-color: var(--accent-color);
    background: var(--accent-light);
    box-shadow: 0 0 0 1px var(--accent-color);
}

.quiz-option.selected .quiz-option-key {
    background: var(--jago-gradient);
    color: #ffffff;
    border-color: transparent;
}

.quiz-option-key {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--copy-muted);
    flex-shrink: 0;
    transition: var(--transition);
}

.quiz-option-text {
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: var(--copy-primary);
    flex: 1;
    padding-top: 4px;
}

.quiz-footer {
    padding-bottom: 80px;
}

.progress-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.progress-bar-track {
    flex: 1;
    height: 8px;
    background: var(--hover-bg);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    display: block;
    height: 100%;
    background: var(--jago-gradient);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-bar-label {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--copy-muted);
    white-space: nowrap;
}

@keyframes timerPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@media (min-width: 860px) {
    .jago-detail-layout {
        grid-template-columns: 1fr minmax(280px, 340px);
    }

    .jago-detail-sidebar {
        position: sticky;
        top: calc(var(--header-height) + 24px);
    }
}

@media (max-width: 768px) {
    .jago-detail-layout {
        grid-template-columns: 1fr;
    }

    .jago-detail-sidebar {
        position: relative;
        top: 0;
    }

    .leaderboard-header,
    .leaderboard-row {
        grid-template-columns: 28px 1fr 52px 60px;
    }

    .quiz-meta-bar {
        gap: 12px;
    }

    .quiz-timer-label {
        display: none;
    }

    .quiz-progress-group {
        max-width: none;
    }
}

@media (max-width: 600px) {
    .quiz-options-grid {
        grid-template-columns: 1fr;
    }
}

.quiz-option.correct {
    border-color: #2e7d32;
    background: rgba(46, 125, 50, 0.1);
    opacity: 1;
}

.quiz-option.error {
    border-color: #c62828;
    background: rgba(198, 40, 40, 0.1);
    opacity: 1;
}

.quiz-option.dimmed {
    opacity: 0.7;
}

.jago-explanation-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.quiz-question-correct {
    color: var(--color-success) !important;
    font-weight: 700;
}

.quiz-question-incorrect {
    color: var(--color-danger) !important;
    font-weight: 700;
}

.quiz-question-empty {
    color: var(--copy-muted) !important;
    font-weight: 700;
}