* {
    box-sizing: border-box;
}

body {
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    background-color: #222;
    color: #fff;
    margin: 0;
    padding: 0;
}

a {
    text-decoration: none;
    color: #33C3C8;
}

/* ── Game container ─────────────────────────────────── */
.container {
    margin: 0 auto;
    max-width: 375px;
    width: 100%;
    padding: 0 10px;
    display: block;
}

.header {
    font-size: 45px;
    font-weight: bold;
    margin: 0 auto;
    text-align: center;
    height: 58px;
}

.header-img {
    max-height: 55px;
    display: block;
    margin: 0 auto;
}

.header-img-small {
    max-height: 36px;
}

.image-container {
    margin: 8px auto;
    text-align: center;
}

.image {
    max-width: 100%;
    max-height: 360px;
    display: block;
    margin: 0 auto;
}

.progress-row {
    text-align: center;
    font-size: 30px;
    margin: 6px auto;
}

.progress-blocks {
    display: block;
    text-align: center;
}

.guess-row {
    display: flex;
    gap: 6px;
    margin: 6px auto;
    width: 100%;
}

.guess-input {
    flex: 1;
    color: #fff;
    background-color: #000;
    border: 3px solid #ddd;
    font-size: 18px;
    font-family: 'Courier New', Courier, monospace;
    padding: 5px;
    min-width: 0;
}

.guess-input:disabled {
    color: #fff;
    background-color: #000;
}

.btn-guess {
    color: #fff;
    background-color: #33C3C8;
    border: none;
    font-size: 18px;
    font-weight: bold;
    padding: 5px 12px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-guess:disabled {
    opacity: 0.5;
    cursor: default;
}

.validation-msg {
    font-size: 18px;
    color: #f00;
    text-align: center;
}

.answer-panel {
    margin: 6px auto;
    width: 100%;
}

.answer {
    font-weight: bold;
    text-align: center;
    background-color: #000;
    font-size: 18px;
    font-family: 'Courier New', Courier, monospace;
    padding: 5px;
    display: block;
    margin: 5px auto;
    width: 100%;
}

.correct {
    color: limegreen;
    border: 3px solid limegreen;
}

.incorrect {
    color: red;
    border: 3px solid red;
}

.end-game-text {
    font-size: 12px;
    text-align: center;
    white-space: pre-line;
    margin: 8px 0;
}

.citation {
    font-size: 10px;
    color: #aaa;
    text-align: center;
}

.share-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0;
    align-items: stretch;
}

.btn-share, .btn-stats, .btn-ics {
    width: 100%;
    color: #fff;
    background-color: #33C3C8;
    border: none;
    font-size: 18px;
    font-weight: bold;
    padding: 8px 0;
    cursor: pointer;
    text-align: center;
    display: block;
}

.btn-share:hover, .btn-stats:hover, .btn-ics:hover {
    background-color: #25a0a5;
}

.social-icons {
    text-align: center;
    margin-top: 8px;
}

.social-icons a {
    margin: 0 5px;
}

.error-panel {
    text-align: center;
    padding: 40px;
    color: #aaa;
}

/* ── Admin login ────────────────────────────────────── */
.admin-login-container {
    max-width: 320px;
    margin: 60px auto;
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.login-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 16px;
    background: #333;
    border: 1px solid #555;
    border-radius: 4px;
    color: #fff;
}

.login-error {
    color: #e55;
    margin: 0;
}

/* ── Admin styles ───────────────────────────────────── */
.admin-container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 16px;
}

.admin-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #444;
    padding-bottom: 8px;
    flex-wrap: wrap;
}

.admin-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-admin-nav {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 14px;
}

.btn-admin-nav.active {
    background: #33C3C8;
    border-color: #33C3C8;
}

.admin-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.admin-select {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    padding: 4px 8px;
    font-size: 14px;
}

.admin-input {
    background: #000;
    color: #fff;
    border: 2px solid #555;
    padding: 5px;
    font-size: 14px;
    width: 100%;
    max-width: 300px;
}

.btn-admin {
    background: #33C3C8;
    color: #fff;
    border: none;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.btn-admin:disabled {
    opacity: 0.5;
    cursor: default;
}

.btn-admin-small {
    background: #444;
    color: #fff;
    border: 1px solid #666;
    padding: 3px 8px;
    cursor: pointer;
    font-size: 12px;
}

.entries-list {
    width: 100%;
    min-height: 200px;
    margin-bottom: 12px;
}

.blur-previews {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 8px 0;
}

.blur-preview {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 1px solid #444;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    width: 100%;
}

.admin-message {
    color: #33C3C8;
    margin-top: 8px;
}

.admin-error {
    color: #f00;
}

.tmdb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tmdb-table th, .tmdb-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #333;
    text-align: left;
}

.tmdb-thumb {
    width: 46px;
    height: 46px;
    object-fit: cover;
}

.imported {
    color: limegreen;
}

.admin-login {
    max-width: 300px;
    width: 100%;
    margin: 80px auto;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Stats ──────────────────────────────────────────── */
.stats-container {
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px;
    display: block;
}

.stats-container .header {
    height: auto;
    margin-bottom: 8px;
}

.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px 0;
}

.stat-card {
    background: #333;
    border: 1px solid #444;
    padding: 12px 16px;
    min-width: 100px;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #33C3C8;
}

.stat-label {
    font-size: 11px;
    color: #aaa;
    margin-top: 4px;
}

.timeframe-buttons {
    display: flex;
    gap: 8px;
    margin: 12px 0;
    position: relative;
    z-index: 10;
}

.btn-timeframe {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 14px;
}

.btn-timeframe.active {
    background: #33C3C8;
    border-color: #33C3C8;
}

.wrong-answers {
    font-size: 12px;
    color: #ccc;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

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

/* ── Help / Instructions overlay ───────────────────── */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 500;
}

.modal-backdrop.visible {
    display: block;
}

.instructions-panel {
    position: fixed;
    top: -420px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    border: 1px solid #555;
    padding: 20px;
    width: min(360px, 92vw);
    z-index: 600;
    transition: top 0.4s ease;
}

.instructions-panel.visible {
    top: 60px;
}

.instructions-close {
    position: absolute;
    top: 8px;
    right: 12px;
    cursor: pointer;
    font-size: 18px;
    color: #aaa;
    line-height: 1;
    background: none;
    border: none;
    color: #ccc;
}

.instructions-close:hover {
    color: #fff;
}

.instructions-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 12px;
    text-align: center;
}

.instructions-text {
    font-size: 13px;
    color: #ccc;
    margin-bottom: 12px;
    line-height: 1.5;
}

.instructions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.instructions-table td {
    padding: 6px 4px;
    vertical-align: top;
}

.instructions-table .tile {
    font-size: 20px;
    padding-right: 10px;
    white-space: nowrap;
}

/* ── Blazor error UI ────────────────────────────────── */
#blazor-error-ui {
    background: #b32020;
    color: white;
    padding: 8px;
    text-align: center;
    display: none;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
}

/* ── ApexCharts dark theme overrides ───────────────── */

/* Chart background */
.apexcharts-canvas,
.apexcharts-canvas svg {
    background: transparent !important;
}

/* Axis labels and titles */
.apexcharts-xaxis-label tspan,
.apexcharts-yaxis-label tspan,
.apexcharts-xaxis-title-text,
.apexcharts-yaxis-title-text,
.apexcharts-text tspan {
    fill: #ccc !important;
}

/* Grid lines */
.apexcharts-gridline {
    stroke: #444 !important;
}

/* Tick marks */
.apexcharts-xcrosshairs,
.apexcharts-ycrosshairs {
    stroke: #666 !important;
}

/* Legend text */
.apexcharts-legend-text {
    color: #ccc !important;
    fill: #ccc !important;
}

/* Toolbar icons (hamburger/download button) */
.apexcharts-toolbar svg,
.apexcharts-menu-icon svg,
.apexcharts-toolbar-custom-icon svg {
    fill: #aaa !important;
}

.apexcharts-toolbar svg:hover,
.apexcharts-menu-icon:hover svg {
    fill: #fff !important;
}

/* Download/export dropdown menu */
.apexcharts-menu {
    background: #2a2a2a !important;
    border: 1px solid #555 !important;
    color: #ccc !important;
}

.apexcharts-menu-item {
    color: #ccc !important;
}

.apexcharts-menu-item:hover {
    background: #3a3a3a !important;
    color: #fff !important;
}

/* Tooltips */
.apexcharts-tooltip {
    background: #2a2a2a !important;
    border: 1px solid #555 !important;
    color: #ccc !important;
}

.apexcharts-tooltip-title {
    background: #333 !important;
    border-bottom: 1px solid #555 !important;
    color: #fff !important;
}

.apexcharts-tooltip-text,
.apexcharts-tooltip-text-y-label,
.apexcharts-tooltip-text-y-value {
    color: #ccc !important;
}

/* X-axis tooltip bubble */
.apexcharts-xaxistooltip {
    background: #2a2a2a !important;
    border-color: #555 !important;
    color: #ccc !important;
}

.apexcharts-xaxistooltip:after {
    border-bottom-color: #2a2a2a !important;
}

.apexcharts-xaxistooltip:before {
    border-bottom-color: #555 !important;
}

/* ── Responsive tweaks ──────────────────────────────── */
@media (max-width: 400px) {
    .progress-row {
        font-size: 24px;
    }

    .btn-share, .btn-stats, .btn-ics,
    .btn-guess, .guess-input {
        font-size: 16px;
    }

    .answer {
        font-size: 16px;
    }

    .stat-card {
        min-width: 80px;
        padding: 8px 10px;
    }

    .stat-value {
        font-size: 16px;
    }

    .admin-nav {
        gap: 4px;
    }

    .btn-admin-nav {
        padding: 5px 10px;
        font-size: 13px;
    }
}
