/* ==========================================================================
   MOTN (Monarch of the Nerds) - Unified Styles
   ========================================================================== */

/* The palette is terminal.css's (--background, --foreground, --accent). These
   derive the layering and the dimmed text from it, so a theme change is one
   edit there. */
:root {
    --bg-primary: var(--background);
    --bg-secondary: color-mix(in srgb, var(--foreground) 6%, transparent);
    --text: var(--foreground);
    --text-secondary: color-mix(in srgb, var(--foreground) 65%, transparent);
}

/* Pulse Animation */
@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Flash Messages */
.flash-message {
    padding: 15px;
    margin-bottom: 20px;
    border: 2px solid;
    background: color-mix(
        in srgb,
        var(--foreground) 5%,
        transparent
    );
}

.flash-error {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.flash-success {
    border-color: var(--accent);
    color: var(--accent);
}

.flash-info {
    border-color: var(--foreground);
    color: var(--foreground);
}

/* Warning Box (shared by index and rules) */
.warning-box {
    background: color-mix(in srgb, #ff6b6b 10%, transparent);
    border: 2px solid #ff6b6b;
    padding: 20px;
    margin: 20px 0;
    border-radius: 0;
}

.warning-box h4 {
    color: #ff6b6b;
    margin: 0 0 15px 0;
    font-size: 16px;
}

.warning-box p {
    margin: 0;
    color: var(--foreground);
}

/* ==========================================================================
   Layout Components
   ========================================================================== */

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.container.narrow {
    max-width: 800px;
}

/* Header */
.header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 30px;
    border: 2px solid var(--accent);
    padding: 20px;
    background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.logo {
    border: none;
    width: 300px;
}

.header h1 {
    margin: 0;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
}

.header p {
    margin: 10px 0 0 0;
    opacity: 0.8;
}

/* ==========================================================================
   Buttons
   --------------------------------------------------------------------------
   Every button on the site is `.btn`, plus a variant class for its size. A
   task's own buttons should use it too, so they match without copying rules.
   ========================================================================== */

.btn {
    display: inline-block;
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    font-family: inherit;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    background: var(--accent);
    color: var(--background);
    box-shadow: 0 0 15px var(--accent);
}

/* The admin dashboard's heavier variant: thicker border, tinted on hover
   rather than inverted. */
.btn-admin {
    border-width: 4px;
    padding: 5px 18px;
    transition: background 0.15s linear;
}

.btn-admin:hover {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent);
    box-shadow: none;
}

/* Navigation Buttons */
.nav-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
}

.nav-btn {
    padding: 10px 20px;
    font-size: clamp(0.75rem, 3.5vw, 1rem);
    white-space: nowrap;
}

@media (max-width: 480px) {
    .nav-btn {
        padding: 5px 5px;
    }
}

/* ==========================================================================
   Auth Page
   ========================================================================== */

/* The login and register pages centre one box in the viewport. */
body.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.auth-container {
    background: color-mix(
        in srgb,
        var(--foreground) 3%,
        transparent
    );
    padding: 40px;
    border: 2px solid var(--accent);
    width: 100%;
    max-width: 450px;
    box-shadow: 0 0 30px
        color-mix(in srgb, var(--accent) 20%, transparent);
}

/* Auth-specific header overrides */
.auth-container .header {
    text-align: center;
    margin-bottom: 30px;
    border: none;
    padding: 0;
    background: transparent;
    display: block;
}

.auth-container .header h1 {
    color: var(--accent);
    margin-bottom: 15px;
    text-shadow: 0 0 10px var(--accent);
}

.auth-container .header p {
    color: var(--foreground);
    opacity: 0.8;
    margin: 0;
}

.form-group {
    margin-bottom: 25px;
}

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

.form-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--foreground);
    background: transparent;
    color: var(--foreground);
    font-family: inherit;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 15px
        color-mix(in srgb, var(--accent) 30%, transparent);
}

/* The whole group leans in while its input has focus. */
.form-group:focus-within {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

.submit-btn {
    width: 100%;
    padding: 15px;
    font-size: 16px;
}

.submit-btn:hover {
    box-shadow: 0 0 20px var(--accent);
}

/* Flag form submit button (smaller variant) */
.flag-form .submit-btn {
    width: auto;
    padding: 12px 24px;
}

.flag-form .submit-btn:hover {
    box-shadow: 0 0 15px var(--accent);
}

.switch-mode {
    text-align: center;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid var(--foreground);
}

.switch-mode a {
    color: var(--accent);
    text-decoration: none;
    font-weight: bold;
}

.switch-mode a:hover {
    text-shadow: 0 0 5px var(--accent);
}

.ctf-icon {
    font-size: clamp(28px, 8vw, 48px);
    white-space: nowrap;
    margin-bottom: 20px;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
}

/* ==========================================================================
   CTF/Index Page
   ========================================================================== */

/* User Info Section */
.user-info {
    border: 2px solid var(--foreground);
    padding: 20px;
    margin-bottom: 30px;
    background: color-mix(
        in srgb,
        var(--foreground) 3%,
        transparent
    );
}

.user-info h3 {
    margin: 0 0 10px 0;
    color: var(--accent);
}

/* Progress Bar */
.progress-bar {
    background: color-mix(
        in srgb,
        var(--foreground) 20%,
        transparent
    );
    height: 25px;
    border: 2px solid var(--foreground);
    margin: 15px 0;
    overflow: hidden;
}

.progress-fill {
    background: var(--accent);
    height: 100%;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px var(--accent);
}

/* Task Cards */
.task {
    border: 2px solid var(--foreground);
    padding: 25px;
    margin-bottom: 25px;
    background: color-mix(
        in srgb,
        var(--foreground) 2%,
        transparent
    );
    position: relative;
}

.task.completed {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 3%, transparent);
}

.task.current {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 5%, transparent);
    box-shadow: 0 0 20px
        color-mix(in srgb, var(--accent) 20%, transparent);
}

.task h3 {
    margin: 0 0 15px 0;
    color: var(--accent);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-title {
    color: var(--accent);
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 5px var(--accent);
    margin-bottom: 20px;
}

.task.current .task-title {
    color: var(--accent);
    animation: pulse 2s infinite;
}

.task p {
    margin: 0 0 20px 0;
    line-height: 1.6;
}

.task-description {
    margin: 0 0 20px 0;
    line-height: 1.6;
    color: var(--foreground);
}

.task-description code {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
    padding: 2px 6px;
    border: 1px solid var(--accent);
    font-family: inherit;
}

.task-description pre {
    background: color-mix(
        in srgb,
        var(--foreground) 5%,
        transparent
    );
    border: 1px solid var(--foreground);
    padding: 15px;
    overflow-x: auto;
    margin: 15px 0;
}

.task-description a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--accent);
}

.task-description a:hover {
    text-shadow: 0 0 5px var(--accent);
}

.task-description img {
    max-width: 100%;
    height: auto;
    border: 2px solid var(--accent);
    margin: 15px 0;
    display: block;
    box-shadow: 0 0 10px
        color-mix(in srgb, var(--accent) 30%, transparent);
}

.task-description img:hover {
    box-shadow: 0 0 20px var(--accent);
    transition: all 0.3s ease;
}

/* Task Status Icon */
.task-status {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
}

.task.completed .task-status {
    color: var(--accent);
}

.task.current .task-status {
    color: var(--accent);
    animation: pulse 2s infinite;
}

/* Flag Form */
.flag-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
}

.flag-input {
    flex: 1;
    background: transparent;
    border: 2px solid var(--foreground);
    color: var(--foreground);
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
}

.flag-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px
        color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Points Display */
.points {
    background: var(--accent);
    color: var(--background);
    padding: 8px 12px;
    border-radius: 0;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid var(--accent);
}

.total-points {
    color: var(--accent);
    font-weight: bold;
    font-size: 16px;
    text-shadow: 0 0 5px var(--accent);
}

.speed-count {
    color: #ff6b6b;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 0 0 5px #ff6b6b;
    margin-top: 5px;
}

/* ==========================================================================
   Leaderboard Page
   ========================================================================== */

.leaderboard-table {
    border: 2px solid var(--accent);
    background: color-mix(
        in srgb,
        var(--foreground) 2%,
        transparent
    );
}

.table-header {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid var(--accent);
}

.table-header h2 {
    margin: 0;
    font-size: 24px;
    text-shadow: 0 0 5px var(--accent);
}

.table-content {
    padding: 0;
}

.user-row {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--foreground);
    transition: all 0.3s ease;
    background: color-mix(
        in srgb,
        var(--foreground) 1%,
        transparent
    );
}

.user-row:hover {
    background: color-mix(in srgb, var(--accent) 5%, transparent);
    box-shadow: 0 0 20px
        color-mix(in srgb, var(--accent) 20%, transparent);
}

.user-row.speed-placed {
    border-left: 4px solid #ff6b6b;
    background: color-mix(in srgb, #ff6b6b 3%, transparent);
}

.user-row.speed-placed:hover {
    background: color-mix(in srgb, #ff6b6b 5%, transparent);
    box-shadow: 0 0 20px
        color-mix(in srgb, #ff6b6b 20%, transparent);
}

.user-row:last-child {
    border-bottom: none;
}

.rank {
    width: 80px;
    text-align: center;
    font-weight: bold;
    font-size: 20px;
}

.rank.gold {
    color: #f39c12;
    text-shadow: 0 0 10px #f39c12;
}

.rank.silver {
    color: #95a5a6;
    text-shadow: 0 0 10px #95a5a6;
}

.rank.bronze {
    color: #e67e22;
    text-shadow: 0 0 10px #e67e22;
}

.username {
    flex: 1;
    font-weight: bold;
    font-size: 16px;
    color: var(--accent);
}

.stats {
    display: flex;
    gap: 25px;
    align-items: center;
}

.stat {
    text-align: center;
    min-width: 80px;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: var(--accent);
}

.stat-label {
    font-size: 12px;
    color: var(--foreground);
    text-transform: uppercase;
    opacity: 0.7;
}

/* Leaderboard points variant */
.leaderboard-table .points {
    padding: 10px 15px;
    font-size: 14px;
    box-shadow: 0 0 10px var(--accent);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--foreground);
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--accent);
}

/* ==========================================================================
   Rules Page
   ========================================================================== */

.rules-section {
    border: 2px solid var(--foreground);
    padding: 25px;
    margin-bottom: 25px;
    background: color-mix(
        in srgb,
        var(--foreground) 2%,
        transparent
    );
}

.rules-section h2 {
    color: var(--accent);
    margin: 0 0 20px 0;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 10px;
}

.rules-section h3 {
    color: var(--accent);
    margin: 20px 0 10px 0;
    font-size: 18px;
}

.rules-section p {
    margin: 0 0 15px 0;
    line-height: 1.6;
}

.rules-section ul {
    margin: 15px 0;
    padding-left: 20px;
}

.rules-section li {
    margin: 8px 0;
    line-height: 1.5;
}

.highlight-box {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border: 2px solid var(--accent);
    padding: 20px;
    margin: 20px 0;
    border-radius: 0;
}

.highlight-box h4 {
    color: var(--accent);
    margin: 0 0 15px 0;
    font-size: 16px;
}

.highlight-box p {
    margin: 0;
    color: var(--foreground);
}

.speed-bonus-example {
    background: color-mix(in srgb, #ff6b6b 5%, transparent);
    border: 2px solid #ff6b6b;
    padding: 20px;
    margin: 20px 0;
}

.speed-bonus-example h4 {
    color: #ff6b6b;
    margin: 0 0 15px 0;
}

.points-breakdown {
    display: flex;
    gap: 20px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.point-item {
    background: color-mix(in srgb, var(--accent) 5%, transparent);
    border: 1px solid var(--accent);
    padding: 10px 15px;
    text-align: center;
    min-width: 120px;
}

.point-item .value {
    color: var(--accent);
    font-size: 18px;
    font-weight: bold;
}

.point-item .label {
    color: var(--foreground);
    font-size: 12px;
    opacity: 0.8;
}

.progression-diagram {
    background: color-mix(
        in srgb,
        var(--foreground) 3%,
        transparent
    );
    border: 2px solid var(--foreground);
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.progression-diagram h4 {
    color: var(--accent);
    margin: 0 0 15px 0;
}

.task-flow {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    flex-wrap: wrap;
    gap: 10px;
}

.task-step {
    background: color-mix(in srgb, var(--accent) 5%, transparent);
    border: 2px solid var(--accent);
    padding: 15px;
    text-align: center;
    flex: 1;
    min-width: 120px;
}

.task-step .step-number {
    color: var(--accent);
    font-size: 20px;
    font-weight: bold;
}

.task-step .step-desc {
    color: var(--foreground);
    font-size: 12px;
    margin-top: 5px;
}

.arrow {
    color: var(--accent);
    font-size: 24px;
    margin: 0 10px;
}

/* ==========================================================================
   Admin Dashboard
   ========================================================================== */

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

.admin-header {
    text-align: center;
    margin-bottom: 30px;
    border: 2px solid var(--accent);
    padding: 20px;
    background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.admin-header h1 {
    margin: 0;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent);
}

.admin-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.admin-nav-btn {
    font-size: clamp(0.75rem, 3.5vw, 1rem);
    white-space: nowrap;
}

@media (max-width: 480px) {
    .admin-nav-btn {
        padding: 5px 5px;
    }
}

.admin-nav-btn:hover,
.admin-nav-btn.active {
    background: var(--accent);
    color: var(--background);
    box-shadow: 0 0 15px var(--accent);
}

.admin-section {
    display: none;
    background-color: var(--bg-secondary);
    padding: 25px;
    border-radius: 8px;
    border: 2px solid var(--foreground);
    margin-bottom: 20px;
}

.admin-section.active {
    display: block;
}

/* Admin Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--bg-primary);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 2px solid var(--accent);
}

.stat-number {
    font-size: 2em;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 10px;
}

/* Admin-specific stat-label (different from leaderboard) */
.admin-container .stat-label {
    color: var(--text-secondary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 1;
}

/* Admin Users List */
.users-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.user-card {
    background-color: var(--bg-primary);
    padding: 20px;
    border-radius: 8px;
    border: 2px solid var(--foreground);
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent);
}

.user-card.selected {
    border-color: var(--accent);
    background-color: color-mix(in srgb, var(--accent) 10%, var(--bg-primary));
}

.user-name {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 10px;
}

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

.user-detail {
    background-color: var(--bg-primary);
    padding: 25px;
    border-radius: 8px;
    border: 2px solid var(--accent);
    margin-bottom: 20px;
}

.user-detail h3 {
    color: var(--accent);
    margin-bottom: 20px;
    text-align: center;
}

/* Admin Task Progress */
.task-progress {
    margin-bottom: 20px;
}

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background-color: var(--bg-secondary);
    border-radius: 4px;
    border: 1px solid var(--foreground);
}

.task-info {
    flex: 1;
}

/* Admin-specific task-title (different from index page) */
.admin-container .task-title {
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 5px;
    font-size: inherit;
    text-shadow: none;
}

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

/* Admin-specific task-status (different from index page) */
.admin-container .task-status {
    margin-left: 20px;
    position: static;
    top: auto;
    right: auto;
    font-size: inherit;
}

.status-completed {
    margin-right: 20px;
    color: #00ff00;
    font-weight: bold;
}

.status-incomplete {
    margin-right: 20px;
    color: #ff4444;
}

.mark-complete-btn {
    font-size: 12px;
}

.mark-complete-btn:disabled {
    background: var(--text-secondary);
    color: var(--bg-primary);
    cursor: not-allowed;
    border-color: var(--text-secondary);
}

/* Admin Tables */
.attempts-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.attempts-table th,
.attempts-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--accent);
}

.attempts-table th {
    background-color: var(--bg-primary);
    font-weight: bold;
    color: var(--accent);
}

.attempts-table tr:hover {
    background-color: var(--bg-secondary);
}

.correct-flag {
    color: #00ff00;
    font-weight: bold;
}

.incorrect-flag {
    color: #ff4444;
}

/* Admin Filters */
.filters {
    background-color: var(--bg-primary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--foreground);
}

.filter-group {
    display: inline-block;
    margin-right: 20px;
    margin-bottom: 10px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--accent);
}

.filter-group input,
.filter-group select {
    padding: 8px;
    border: 1px solid var(--accent);
    border-radius: 4px;
    background-color: var(--bg-secondary);
    color: var(--text);
    font-family: 'Fira Code', monospace;
}

/* Admin Buttons */
.export-btn,
.back-btn {
    margin-bottom: 20px;
}

/* Admin Success Rate Colors */
.success-rate {
    font-weight: bold;
}

.high-rate {
    color: #00ff00;
}

.medium-rate {
    color: #ffff00;
}

.low-rate {
    color: #ff4444;
}

/* Admin Stats Section */
.stats-section {
    background-color: var(--bg-secondary);
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 2px solid var(--foreground);
}

.stats-section h3 {
    color: var(--accent);
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5em;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.stats-table th,
.stats-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--accent);
}

.stats-table th {
    background-color: var(--bg-primary);
    font-weight: bold;
    color: var(--accent);
}

.stats-table tr:hover {
    background-color: var(--bg-primary);
}

/* Admin Chart Container */
.chart-container {
    background-color: var(--bg-secondary);
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 2px solid var(--foreground);
}

.chart-container h3 {
    color: var(--accent);
    margin-bottom: 20px;
    text-align: center;
}

/* Admin-specific progress bar (different from main site) */
.admin-container .progress-bar {
    background: var(--bg-secondary);
    height: 20px;
    border: 1px solid var(--foreground);
    margin: 10px 0;
    border-radius: 10px;
    overflow: hidden;
}

.admin-container .progress-fill {
    background: var(--accent);
    height: 100%;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px var(--accent);
}

/* ==========================================================================
   Media Queries
   ========================================================================== */

/* Leaderboard Responsive */
@media (max-width: 600px) {
    .stats {
        flex-direction: column;
        gap: 10px;
    }

    .user-row {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .rank {
        width: auto;
    }
}

/* Rules Responsive */
@media (max-width: 768px) {
    .task-flow {
        flex-direction: column;
    }

    .arrow {
        transform: rotate(90deg);
        margin: 10px 0;
    }

    .points-breakdown {
        justify-content: center;
    }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.centered {
    text-align: center;
}

/* Images inside a task card (chessboard, colour swatches). */
.task-image {
    max-width: 100%;
    height: auto;
    border: 2px solid var(--accent);
}

/* Where a task shows the checker's feedback instead of a plain "wrong". */
.task-feedback {
    margin-top: 15px;
    padding: 10px;
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
    background: color-mix(in srgb, var(--foreground) 5%, transparent);
}

/* --- Admin dashboard: replaces inline style attributes ------------------- */

.progress-bar.tall {
    height: 30px;
}

.rate-summary {
    text-align: center;
    margin: 20px 0;
}

.rate-number {
    font-size: 3em;
    color: var(--accent);
    font-weight: bold;
}

.rate-caption {
    color: var(--text-secondary);
    margin-top: 10px;
}

.rate-verdict {
    margin-top: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.progress-cell {
    width: 200px;
}

.admin-error {
    color: #ff4444;
}

.task-progress-summary {
    margin-bottom: 20px;
    text-align: center;
}

.task-progress-summary .summary-name {
    font-size: 1.2em;
    color: var(--accent);
    margin-bottom: 10px;
}

.task-progress-summary .summary-stats {
    color: var(--text-secondary);
}

/* --- Admin dashboard: paging, live section ------------------------------- */

.section-note,
.live-note {
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: 0.9em;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.pager-btn {
    background: transparent;
    border: 2px solid var(--foreground);
    color: var(--foreground);
    padding: 6px 14px;
    cursor: pointer;
}

.pager-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

#page-info {
    color: var(--text-secondary);
}

.empty-row td {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* ==========================================================================
   Per-task styles
   --------------------------------------------------------------------------
   One block per task slug, and nothing else. A task that needs more than a
   few rules should carry its own <style> in templates/tasks/<slug>.html; when
   a task retires, its block here is what gets deleted.
   ========================================================================== */

/* tabs */
.qr-grid {
    display: grid;
    grid-template-columns: repeat(2, 150px);
    grid-template-rows: repeat(2, 150px);
    gap: 0;
    padding: 0;
    margin: 0;
}

.qr-grid img {
    width: 150px;
    height: 150px;
    display: block;
    object-fit: contain;
    background: #fff;
    margin: 0;
    padding: 0;
    box-shadow: none !important;
    filter: none;
    transition: none;
}

.qr-grid img:hover {
    box-shadow: none !important;
    filter: none;
}

/* gameboy */
.gb {
    margin: 20px 0;
}

/* Everything on the console is placed as a percentage of the shell image, so
   the whole thing scales with the card and stays on its buttons at any size. */
.gb-console {
    position: relative;
    width: min(100%, 420px);
    margin: 0 auto;
    container-type: inline-size;
}

/* Two classes, to outrank the theme's `img` (8px border, padding) and the
   card's `.task-description img` (2px border, margin, glow): every percentage
   below is measured off the artwork, so the console must be the bare image and
   nothing else. */
.gb .gb-shell {
    display: block;
    width: 100%;
    height: auto;
    border: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
    /* The shell is scenery: clicks belong to the screen and the hotspots. */
    pointer-events: none;
    user-select: none;
}

.gb .gb-shell:hover {
    box-shadow: none;
}

.gb.gb-focused .gb-console {
    /* drop-shadow follows the cut-out silhouette, so the console itself glows
       while the screen has the keyboard. */
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 45%, transparent));
}

/* The transparent window in the shell, measured off the image. */
.gb-window {
    position: absolute;
    left: 25.634%;
    top: 14.9%;
    width: 50.423%;
    height: 25.346%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* The window is a touch taller than 160x144, exactly as the real glass is:
       the darkest DMG shade fills the slack above and below the picture. */
    background: #0f380f;
}

.gb-screen {
    display: block;
    width: 100%;
    height: auto;
    /* 160x144 blown up: keep the pixels square, not smeared. */
    image-rendering: pixelated;
    outline: none;
}

.gb-boot {
    position: absolute;
    background: var(--background);
    padding: 4% 6%;
    font-size: clamp(9px, 4cqw, 14px);
}

.gb-boot:hover {
    box-shadow: 0 0 20px var(--accent);
}

.gb-boot:disabled {
    opacity: 0.4;
    cursor: default;
}

.gb.gb-running .gb-boot {
    display: none;
}

/* The shell's own buttons: invisible until held, then lit. */
.gb-hot {
    position: absolute;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    /* A finger sliding across the pad must not select text or scroll the page. */
    touch-action: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 80ms ease, box-shadow 80ms ease;
}

.gb-hot.lit {
    background: color-mix(in srgb, var(--accent) 55%, transparent);
    box-shadow: 0 0 12px 3px color-mix(in srgb, var(--accent) 65%, transparent);
}

/* The light has to sit exactly on the drawn button, but a d-pad arm is barely
   20px wide on a phone. The hit area is this pseudo-element, padded out past
   the artwork; what lights up is still the element itself. */
.gb-hot::before {
    content: "";
    position: absolute;
    inset: -35%;
}

.gb-a::before,
.gb-b::before {
    inset: -20%;
}

/* Select and Start are only a few pixels apart, so these grow upwards and
   downwards rather than into each other. */
.gb-select::before,
.gb-start::before {
    inset: -60% -4%;
}

.gb-up,
.gb-down,
.gb-left,
.gb-right {
    width: 8.451%;
    height: 4.557%;
}

.gb-up {
    left: 19.155%;
    top: 61.137%;
}

.gb-down {
    left: 19.155%;
    top: 70.096%;
}

.gb-left {
    left: 10.704%;
    top: 65.694%;
}

.gb-right {
    left: 27.606%;
    top: 65.694%;
}

.gb-a,
.gb-b {
    width: 12.394%;
    height: 6.759%;
    border-radius: 50%;
}

.gb-a {
    left: 80.563%;
    top: 62.98%;
}

.gb-b {
    left: 63.662%;
    top: 67.127%;
}

/* Select and Start sit at an angle on the shell, so their hotspots do too. */
.gb-select,
.gb-start {
    width: 14.085%;
    height: 3.379%;
    border-radius: 999px;
    transform: rotate(-20deg);
}

.gb-select {
    left: 32.394%;
    top: 79.263%;
}

.gb-start {
    left: 49.296%;
    top: 79.109%;
}

.gb-status {
    margin: 15px 0 10px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9em;
    min-height: 1.2em;
}

.gb-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.gb-buttons .btn {
    padding: 10px 18px;
    font-size: 14px;
}

.gb-buttons .btn:hover {
    box-shadow: 0 0 20px var(--accent);
}
