/* Ade Discover Everything — adventure notebook theme on top of Bulma */
:root {
    --ade-night: #1c140d;
    --ade-night-2: #2a1d12;
    --ade-ink: #3b2614;
    --ade-ink-soft: #6b4a2b;
    --ade-paper: #f4e7c9;
    --ade-paper-2: #ead6ab;
    --ade-gold: #d9a441;
    --ade-rust: #a5401f;
    --ade-red: #b3261e;
    --ade-green: #3f6b3a;
    --ade-blue: #2e5470;
    --ade-radius: 10px;
    --ade-title-font: "Cinzel", Georgia, serif;
    --ade-body-font: "Lora", Georgia, "Times New Roman", serif;
    --ade-stamp-font: "Special Elite", "Courier New", monospace;
    --bulma-body-family: var(--ade-body-font);
    --bulma-family-primary: var(--ade-body-font);
}

html {
    background: var(--ade-night);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.ade {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--ade-body-font);
    color: var(--ade-ink);
    background: transparent;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}
/* Fixed layer instead of background-attachment: fixed, which iOS Safari ignores. */
body.ade::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(217, 164, 65, .16), transparent 55%),
        radial-gradient(ellipse at 90% 100%, rgba(165, 64, 31, .18), transparent 50%),
        repeating-linear-gradient(0deg, rgba(244, 231, 201, .035) 0 1px, transparent 1px 48px),
        repeating-linear-gradient(90deg, rgba(244, 231, 201, .035) 0 1px, transparent 1px 48px);
}

/* ---------- Navbar ---------- */
.ade-navbar.navbar {
    background: rgba(20, 14, 9, .92);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(217, 164, 65, .25);
    position: sticky;
    top: 0;
    z-index: 30;
    padding-top: env(safe-area-inset-top);
}
.ade-navbar .navbar-item,
.ade-navbar .navbar-link {
    color: var(--ade-paper);
    font-family: var(--ade-title-font);
    letter-spacing: .04em;
}
.ade-navbar a.navbar-item:hover,
.ade-navbar a.navbar-item.is-active,
.ade-navbar a.navbar-item:focus-visible {
    background: rgba(217, 164, 65, .14);
    color: var(--ade-gold);
}
.ade-navbar .navbar-burger { color: var(--ade-paper); }
.ade-navbar .navbar-burger:hover { background: rgba(217, 164, 65, .14); }
.ade-navbar .navbar-menu.is-active {
    background: var(--ade-night-2);
    box-shadow: 0 12px 24px rgba(0, 0, 0, .4);
}
.ade-brand { gap: .5rem; }
.ade-brand__compass { color: var(--ade-gold); }
.ade-brand__name {
    font-family: var(--ade-title-font);
    font-weight: 800;
    font-size: 1.35rem;
    color: var(--ade-paper);
}

/* Léo counter: head + score badge, top right */
.leo-counter {
    position: relative;
    padding: .25rem .9rem .25rem .5rem !important;
}
.navbar-brand .leo-counter { margin-left: auto; }
.leo-counter__head {
    width: 44px;
    height: 44px;
    max-height: none !important;
    border-radius: 50%;
    border: 2px solid var(--ade-gold);
    background: var(--ade-paper);
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}
.leo-counter__badge {
    position: absolute;
    right: .1rem;
    bottom: .05rem;
    min-width: 1.6rem;
    padding: 0 .35rem;
    border-radius: 999px;
    background: var(--ade-red);
    border: 2px solid var(--ade-night);
    color: #fff;
    font-family: var(--ade-body-font);
    font-weight: 600;
    font-size: .78rem;
    line-height: 1.25rem;
    text-align: center;
}

/* ---------- Layout ---------- */
.ade-main {
    flex: 1;
    padding: 1.5rem 0 3rem;
}
.ade-footer {
    text-align: center;
    padding: 1.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
    color: rgba(244, 231, 201, .45);
    font-family: var(--ade-stamp-font);
    font-size: .85rem;
}
.ade-flash { margin-bottom: 1.25rem; }

/* ---------- Hero ---------- */
.ade-hero { padding: 1.5rem 0 2rem; color: var(--ade-paper); }
.ade-hero--small { padding: .5rem 0 1.25rem; }
.ade-hero__compass {
    width: 72px;
    height: 72px;
    color: var(--ade-gold);
    animation: ade-spin 40s linear infinite;
}
.ade-kicker {
    font-family: var(--ade-stamp-font);
    text-transform: uppercase;
    letter-spacing: .25em;
    font-size: .8rem;
    color: var(--ade-gold);
    margin-bottom: .35rem;
}
.ade-kicker--dark { color: var(--ade-rust); }
.ade-title {
    font-family: var(--ade-title-font);
    font-weight: 800;
    font-size: clamp(2.6rem, 11vw, 4.2rem);
    line-height: 1;
    color: var(--ade-paper);
    text-shadow: 0 3px 0 rgba(0, 0, 0, .45);
}
.ade-title span {
    display: block;
    font-size: .36em;
    letter-spacing: .3em;
    margin-top: .6rem;
    color: var(--ade-gold);
    text-transform: uppercase;
}
.ade-title--small { font-size: clamp(2rem, 9vw, 3rem); }
.score-line {
    margin-top: .5rem;
    font-family: var(--ade-stamp-font);
    color: var(--ade-gold);
    font-size: 1.1rem;
}
.section-heading {
    font-family: var(--ade-title-font);
    color: var(--ade-paper);
    font-size: 1.4rem;
    margin: 2rem 0 1rem;
    text-align: center;
}

/* ---------- Paper cards ---------- */
.paper {
    position: relative;
    background-color: var(--ade-paper);
    background-image:
        radial-gradient(circle at 15% 20%, rgba(255, 255, 255, .45), transparent 40%),
        radial-gradient(circle at 85% 90%, rgba(150, 100, 40, .16), transparent 45%),
        linear-gradient(180deg, var(--ade-paper), var(--ade-paper-2));
    border-radius: var(--ade-radius);
    padding: 1.5rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow:
        inset 0 0 40px rgba(120, 75, 25, .25),
        0 10px 25px rgba(0, 0, 0, .45);
    color: var(--ade-ink);
    animation: ade-rise .45s ease-out both;
}
.paper::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px dashed rgba(107, 74, 43, .35);
    border-radius: calc(var(--ade-radius) - 4px);
    pointer-events: none;
}
@media (min-width: 769px) {
    .paper { padding: 2rem 2.25rem; }
}
.paper__title {
    font-family: var(--ade-title-font);
    font-weight: 800;
    font-size: 1.35rem;
    color: var(--ade-ink);
    margin-bottom: .85rem;
    line-height: 1.25;
}
.paper__title--big { font-size: clamp(1.5rem, 6vw, 2rem); }
.paper__text { font-size: 1.05rem; line-height: 1.7; }
.paper__note {
    font-family: var(--ade-stamp-font);
    color: var(--ade-ink-soft);
    margin-top: .75rem;
}
.paper--modal { margin: 0 1rem; animation: none; }
.paper--admin { animation: none; }
.paper .label, .paper strong { color: var(--ade-ink); }
.paper .help { color: var(--ade-ink-soft); }
.paper .input, .paper .textarea, .paper .select select {
    background: #fffaf0;
    border-color: #c9ab78;
    color: var(--ade-ink);
    font-family: var(--ade-body-font);
}
.paper .input:focus, .paper .textarea:focus, .paper .select select:focus {
    border-color: var(--ade-rust);
    box-shadow: 0 0 0 .15em rgba(165, 64, 31, .25);
}

/* Passport stamp */
.stamp {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: .2rem .65rem;
    border: 3px double var(--ade-red);
    border-radius: 6px;
    color: var(--ade-red);
    font-family: var(--ade-stamp-font);
    font-size: .8rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    transform: rotate(8deg);
    opacity: .8;
    background: rgba(244, 231, 201, .6);
}
.stamp--green { color: var(--ade-green); border-color: var(--ade-green); }
.stamp--blue { color: var(--ade-blue); border-color: var(--ade-blue); }
.paper > .stamp + .paper__title,
.paper > .stamp + .ade-kicker,
.paper > .stamp + .padlock { margin-top: 1.25rem; }

.padlock { display: block; font-size: 2.2rem; text-align: center; }
.riddle-text {
    font-style: italic;
    font-size: 1.15rem;
    line-height: 1.7;
    padding: 1rem 1.25rem;
    border-left: 4px solid var(--ade-gold);
    background: rgba(255, 250, 235, .55);
    border-radius: 0 8px 8px 0;
}
.challenge-image { margin: 1.25rem 0 0; }
.challenge-image img {
    display: block;
    width: 100%;
    border-radius: 8px;
    border: 6px solid #fffaf0;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .25);
    transform: rotate(-1deg);
}

/* ---------- Buttons ---------- */
.button { font-family: var(--ade-title-font); font-weight: 600; letter-spacing: .03em; }
.button.is-large, .button.is-medium { min-height: 3.25rem; }
.button.is-ade {
    background: linear-gradient(180deg, #a86a32, #7f4a1d);
    color: #fff7e6;
    border: 1px solid #5d3612;
    box-shadow: 0 3px 0 #4b2a0e, 0 6px 14px rgba(0, 0, 0, .25);
}
.button.is-ade:hover, .button.is-ade:focus-visible { background: linear-gradient(180deg, #b77739, #8b5222); color: #fff; }
.button.is-ade:active { transform: translateY(2px); box-shadow: 0 1px 0 #4b2a0e; }
.button.is-ade[disabled] { opacity: .65; }
.button.is-ade-ghost {
    background: transparent;
    color: var(--ade-ink);
    border: 2px dashed var(--ade-ink-soft);
}
.button.is-ade-ghost:hover { background: rgba(107, 74, 43, .1); color: var(--ade-ink); }
.ade-link { color: var(--ade-gold); font-family: var(--ade-stamp-font); }
.ade-link:hover { color: var(--ade-paper); }

/* ---------- Countdown ---------- */
.countdown {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
    margin: 1.25rem 0 .5rem;
}
.countdown__unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: .75rem .25rem;
    border-radius: 8px;
    background: var(--ade-night-2);
    color: var(--ade-paper);
    box-shadow: inset 0 0 0 1px rgba(217, 164, 65, .45), 0 4px 10px rgba(0, 0, 0, .3);
}
.countdown__value {
    font-family: var(--ade-title-font);
    font-weight: 800;
    font-size: clamp(1.6rem, 8vw, 2.4rem);
    color: var(--ade-gold);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.countdown__label {
    font-family: var(--ade-stamp-font);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .1em;
}

/* ---------- Hint ---------- */
.hint-box {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    background: rgba(217, 164, 65, .18);
    border: 1px solid rgba(165, 64, 31, .35);
}
.hint-box__title { font-family: var(--ade-title-font); font-weight: 800; margin-bottom: .35rem; }
.hint-box__title::before { content: "🗝 "; }
.hint-box__penalty {
    margin-top: .5rem;
    font-family: var(--ade-stamp-font);
    color: var(--ade-red);
    font-size: .9rem;
}

/* ---------- Upload ---------- */
.file-drop {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 12rem;
    border: 2px dashed var(--ade-ink-soft);
    border-radius: 10px;
    background: rgba(255, 250, 235, .6);
    cursor: pointer;
    overflow: hidden;
    transition: border-color .2s, background .2s;
}
.file-drop:hover, .file-drop:focus-within { border-color: var(--ade-rust); background: rgba(255, 250, 235, .9); }
.file-drop__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}
.file-drop__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    padding: 1.5rem;
    text-align: center;
    pointer-events: none;
}
.file-drop__icon { font-size: 2.5rem; }
.file-drop__placeholder small { color: var(--ade-ink-soft); }
.file-drop__preview {
    display: block;
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    background: #1c140d;
    pointer-events: none;
}
.upload-status { margin: 1rem 0; }
.upload-status__label { font-family: var(--ade-stamp-font); margin-bottom: .35rem; }
.upload-status.is-success .upload-status__label { color: var(--ade-green); font-weight: 600; }
.progress.is-ade { --bulma-progress-value-background-color: var(--ade-rust); height: .9rem; }
.progress.is-ade::-webkit-progress-value { background-color: var(--ade-rust); }
.progress.is-ade::-moz-progress-bar { background-color: var(--ade-rust); }

/* ---------- Riddle attempts ---------- */
.attempts summary { cursor: pointer; font-family: var(--ade-stamp-font); color: var(--ade-ink-soft); }
.attempts ul { margin: .5rem 0 0 1.25rem; list-style: disc; }

/* ---------- Finale ---------- */
.finale-stats {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}
.finale-stats div {
    display: flex;
    flex-direction: column;
    min-width: 8rem;
    padding: .75rem 1rem;
    border-radius: 8px;
    background: var(--ade-night-2);
    color: var(--ade-paper);
}
.finale-stats strong { font-family: var(--ade-title-font); font-size: 2rem; color: var(--ade-gold); }
.finale-stats span { font-family: var(--ade-stamp-font); font-size: .8rem; }

/* ---------- Gallery ---------- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}
@media (min-width: 769px) {
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.5rem; }
}
.gallery-card {
    background: #fffaf0;
    padding: .5rem .5rem .75rem;
    border-radius: 4px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .4);
    color: var(--ade-ink);
    animation: ade-rise .45s ease-out both;
}
.gallery-card:nth-child(odd) { transform: rotate(-1deg); }
.gallery-card:nth-child(even) { transform: rotate(1deg); }
.gallery-card__thumb {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: #1c140d;
    cursor: zoom-in;
    aspect-ratio: 1;
    overflow: hidden;
}
.gallery-card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.gallery-card__thumb:hover img { transform: scale(1.04); }
.gallery-card__value {
    position: absolute;
    right: .35rem;
    bottom: .35rem;
    padding: .05rem .45rem;
    border-radius: 999px;
    background: var(--ade-red);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
}
.gallery-card__body { padding: .5rem .25rem 0; font-size: .85rem; }
.gallery-card__title { font-family: var(--ade-title-font); font-weight: 800; font-size: .95rem; margin-bottom: .2rem; }
.gallery-card__desc {
    color: var(--ade-ink-soft);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: .25rem;
}
.gallery-card__meta { font-family: var(--ade-stamp-font); font-size: .78rem; }

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 7, 4, .93);
    padding: 3.5rem .5rem;
}
.lightbox[hidden] { display: none; }
.lightbox__figure { max-width: 100%; max-height: 100%; text-align: center; }
.lightbox__figure img {
    max-width: 100%;
    max-height: calc(100vh - 9rem);
    max-height: calc(100dvh - 9rem);
    border: 6px solid #fffaf0;
    border-radius: 3px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.lightbox__figure figcaption { color: var(--ade-paper); margin-top: .75rem; font-family: var(--ade-stamp-font); }
.lightbox__close, .lightbox__nav {
    position: absolute;
    border: 0;
    background: rgba(244, 231, 201, .12);
    color: var(--ade-paper);
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}
.lightbox__close:hover, .lightbox__nav:hover { background: rgba(244, 231, 201, .25); }
.lightbox__close { top: calc(.75rem + env(safe-area-inset-top)); right: .75rem; }
.lightbox__nav { top: 50%; transform: translateY(-50%); }
.lightbox__nav--prev { left: .5rem; }
.lightbox__nav--next { right: .5rem; }
body.has-lightbox { overflow: hidden; }

/* ---------- Modal ---------- */
.modal-background { background: rgba(10, 7, 4, .85); }

/* ---------- Fatal error ---------- */
.fatal { max-width: 640px; margin: 4rem auto; padding: 1rem; }
.fatal__debug { margin-top: 1rem; max-height: 40vh; overflow: auto; font-size: .75rem; white-space: pre-wrap; }

/* ---------- Admin ---------- */
.ade-admin .paper::before { display: none; }
.ade-admin .paper { padding: 1.25rem 1.5rem; }
.ade-admin .paper__title { font-size: 1.1rem; }
.admin-title {
    font-family: var(--ade-title-font);
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--ade-paper);
    margin-bottom: 1rem;
}
.admin-heading { margin-bottom: .5rem; flex-wrap: wrap; }
.admin-narrow { max-width: 420px; margin: 3rem auto; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}
.stat {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border-radius: var(--ade-radius);
    background: var(--ade-night-2);
    box-shadow: inset 0 0 0 1px rgba(217, 164, 65, .3);
}
.stat__value { font-family: var(--ade-title-font); font-size: 1.8rem; font-weight: 800; color: var(--ade-gold); }
.stat__label { color: var(--ade-paper); font-size: .85rem; }
.timeline-list li { padding: .45rem 0; border-bottom: 1px solid rgba(107, 74, 43, .2); }
.timeline-list li:last-child { border-bottom: 0; }
.timeline-list__date { display: block; font-family: var(--ade-stamp-font); font-size: .75rem; color: var(--ade-ink-soft); }
.admin-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .75rem; }
.admin-thumb { display: block; color: var(--ade-ink); font-size: .8rem; }
.admin-thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; }
.admin-preview img { max-width: 220px; border-radius: 6px; display: block; margin-bottom: .5rem; }
.admin-captures { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.admin-capture img { width: 100%; border-radius: 6px; display: block; margin-bottom: .5rem; }
.admin-capture__title { font-family: var(--ade-title-font); font-weight: 800; }
.tag.is-ade-tag { background: var(--ade-red); color: #fff; }
.is-inline { display: inline; }
.is-nowrap { white-space: nowrap; }
.ade-admin .table { background: transparent; color: var(--ade-ink); }
.ade-admin .table th { color: var(--ade-ink); }
.ade-admin .table.is-striped tbody tr:nth-child(even) { background: rgba(107, 74, 43, .08); }

/* Sortable queue */
.queue-list { list-style: none; margin: 0; }
.queue-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .6rem .75rem;
    margin-bottom: .5rem;
    background: #fffaf0;
    border: 1px solid #d8c093;
    border-radius: 8px;
    transition: box-shadow .15s, opacity .15s;
}
.queue-item.is-dragging { opacity: .85; box-shadow: 0 10px 22px rgba(0, 0, 0, .3); border-color: var(--ade-rust); }
.queue-item--locked { background: rgba(217, 164, 65, .2); }
.queue-item__handle {
    border: 0;
    background: transparent;
    font-size: 1.4rem;
    line-height: 1;
    padding: .35rem .5rem;
    cursor: grab;
    touch-action: none;
    color: var(--ade-ink-soft);
    border-radius: 6px;
}
.queue-item__handle:focus-visible { outline: 2px solid var(--ade-rust); }
.queue-item__handle:active { cursor: grabbing; }
.queue-item__title { flex: 1 1 10rem; font-weight: 600; }
.queue-item__actions { margin-bottom: 0 !important; }
.queue-item__actions form { display: inline; }
.queue-item__actions .button { margin-bottom: 0 !important; }
.reorder-status { min-height: 1.2em; color: var(--ade-green); }
.reorder-status.is-error { color: var(--ade-red); }

/* ---------- Animations ---------- */
@keyframes ade-rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; }
}
@keyframes ade-spin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
