html {
    font-size: 15px;
    position: relative;
    min-height: 100%;
}

body {
    background: var(--app-bg);
}

/* Bootstrap utilities like .d-flex use !important and would otherwise override the hidden attribute. */
[hidden] {
    display: none !important;
}

.app-navbar {
    background: var(--app-nav-bg);
}

.navbar .nav-link.active {
    font-weight: 600;
    border-bottom: 2px solid #fff;
}

.page-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.page-title h1 {
    font-size: 1.6rem;
    margin: 0;
}

.card {
    border-color: var(--app-border);
}

.stat-tile .stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-tile .stat-label {
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    font-size: .78rem;
    letter-spacing: .04em;
}

.pre-line {
    white-space: pre-line;
}

.question-text {
    white-space: pre-wrap;
}

.table td, .table th {
    vertical-align: middle;
}

.table-compact td, .table-compact th {
    padding: .35rem .5rem;
}

.config-table input[type=number] {
    max-width: 6.5rem;
}

.config-table .diff-inputs input {
    max-width: 4.2rem;
}

.config-table tr.selected-row {
    background: var(--app-selected-row);
}

.answer-row .form-check-input {
    margin-top: .55rem;
}

.correct-answer {
    font-weight: 600;
    color: var(--app-correct);
}

.version-preview .question {
    break-inside: avoid;
    margin-bottom: 1.1rem;
}

.version-preview .answers {
    list-style: none;
    padding-left: 1.6rem;
    margin-bottom: 0;
}

.open-lines {
    border-bottom: 1px dotted var(--app-line);
    height: 1.6rem;
    margin-left: 1.6rem;
}

.busy-overlay {
    position: fixed;
    inset: 0;
    background: var(--app-overlay);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.busy-box {
    background: var(--app-surface);
    padding: 2rem 2.5rem;
    border-radius: .75rem;
    text-align: center;
    max-width: 90vw;
}

.row-error {
    background: var(--app-row-error) !important;
}

.row-warning {
    background: var(--app-row-warning) !important;
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    background: var(--app-surface);
    border-top: 1px solid var(--app-border);
    padding: .75rem 1rem;
    z-index: 10;
}

@media (max-width: 767.98px) {
    .page-title h1 {
        font-size: 1.35rem;
    }
}

/* Two-factor setup: the QR code stays black on white in every theme (scanners need the contrast). */
.qr-code { width: 13rem; max-width: 100%; background: #fff; border-radius: .5rem; padding: .25rem; }
.qr-code svg { display: block; width: 100%; height: auto; }

/* Logo in the main bar: a light rim keeps the blue tile visible on the dark navy bar. */
.brand-logo { width: 2rem; height: 2rem; border-radius: .45rem; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); transition: transform .2s; }
.navbar-brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }

/* Cookie notice at the bottom of the screen. */
.cookie-notice { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 1080; max-width: 46rem; margin: 0 auto;
    display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between;
    padding: .75rem 1rem; border-radius: .6rem; background: var(--bs-body-bg); color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color); font-size: .9rem; }
.cookie-notice[hidden] { display: none; }

/* Terms and privacy policy. */
.legal-text h2 { font-size: 1.1rem; margin-top: 1.5rem; }
.legal-text h2:first-child { margin-top: 0; }
.legal-text li { margin-bottom: .35rem; }
.legal-text table { font-size: .875rem; }

/* Voluntary tips page: calm, no pressure. */
.support-cup { font-size: 3rem; line-height: 1; margin-bottom: .5rem; }
.support-facts { max-width: 34rem; margin: 1.5rem auto 0; }
.support-facts li { position: relative; padding-left: 1.6rem; margin-bottom: .5rem; }
.support-facts li::before { content: "✓"; position: absolute; left: 0; color: var(--bs-success); font-weight: 700; }

/* Images of questions: never wider than the page, not taller than about half a screen. */
.question-image { max-width: 100%; max-height: 22rem; height: auto; width: auto; background: #fff; }

/* Administrator's site statistics: bar chart without a chart library */
.traffic-chart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 180px;
    border-bottom: 1px solid var(--bs-border-color);
}

.traffic-chart .bar {
    flex: 1 1 0;
    min-width: 2px;
    position: relative;
    background: rgba(var(--bs-primary-rgb), .18);
    border-radius: 3px 3px 0 0;
}

.traffic-chart .bar .visitors {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgb(var(--bs-primary-rgb));
    border-radius: 3px 3px 0 0;
}

.traffic-legend .swatch {
    display: inline-block;
    width: .8rem;
    height: .8rem;
    border-radius: 2px;
    vertical-align: -1px;
}

.traffic-legend .swatch.views { background: rgba(var(--bs-primary-rgb), .18); border: 1px solid var(--bs-border-color); }
.traffic-legend .swatch.visitors { background: rgb(var(--bs-primary-rgb)); }
