/* QuestWorld web game: the look of the Android app (layouts *_historical.xml and *_scifi.xml).
   1dp of the app = 1px here. Images are the app's drawables; 9-patches are border-images. */

@font-face {
    font-family: 'Bad Script';
    src: url('../fonts/bad_script.ttf') format('truetype');
    font-display: swap;
}

:root {
    --h-text: #3d1b17;
    --h-text-inactive: rgba(61, 27, 23, 0.6);
    --h-activate: #F4D58A;
    --h-bg: #0e0600;
    --s-text: #ffffff;
    --s-text-inactive: rgba(255, 255, 255, 0.6);
    --s-footer: #9066d2;
    --s-dark: #251b3b;
    --guide-historical: #7A3F16;
    --guide-scifi: #870BAF;
    --finish-blue: #1759dc;
    --finish-purple: #8d06cc;
    --finish-green: #009345;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --footer-height: calc(65px + var(--safe-bottom));
    --font: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    background: #000;
    overscroll-behavior: none;
}

body {
    font-family: var(--font);
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    color: var(--s-text);
    touch-action: manipulation;
}

#app {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: #1d1530;
}

/* Tablets and computers: the game keeps the phone proportions in the middle of the screen */
@media (min-width: 600px) {
    html, body {
        background: #07040c radial-gradient(ellipse at center, #2a1f42 0%, #07040c 70%) fixed;
    }

    #app {
        left: 50%;
        right: auto;
        width: min(480px, 100vw);
        transform: translateX(-50%);
        box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 60px rgba(0, 0, 0, 0.8);
    }
}

@media (min-width: 600px) and (min-height: 700px) {
    #app {
        top: 24px;
        bottom: 24px;
        border-radius: 18px;
    }
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

button:disabled {
    opacity: 0.45;
    cursor: default;
}

img {
    -webkit-user-drag: none;
    user-select: none;
}

input, textarea {
    font: inherit;
    /* 16px and more: iOS doesn't zoom into the field */
    font-size: 16px;
}

.screen {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-width: none;
}

.scroll::-webkit-scrollbar {
    display: none;
}

.caps {
    text-transform: uppercase;
}

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

/* ============================================================================================ backgrounds */

.bg-scifi {
    background: #382B4E url('../img/scifi_bg.webp') center / 100% 100% no-repeat;
    color: var(--s-text);
}

/* BackgroundLayout: the parchment tile scaled to the width and mirrored downwards */
.bg-parchment {
    background: var(--h-bg) url('../img/historical_tile_mirror.webp') top center / 100% auto repeat-y;
    color: var(--h-text);
}

.bg-historical-dark {
    background: var(--h-bg);
    color: var(--h-text);
}

.panel-scifi {
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(0, 0, 0, 0.25);
}

/* ============================================================================================ headers */

.header {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 5;
    text-align: center;
    pointer-events: none;
}

.header .title {
    display: block;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    pointer-events: auto;
}

.header-historical {
    height: calc(103px + var(--safe-top));
    padding-top: var(--safe-top);
    background: url('../img/historical_header_and_shadow.webp') bottom center / 100% 103px no-repeat,
        linear-gradient(#caa56d, #caa56d) top / 100% var(--safe-top) no-repeat;
    color: var(--h-text);
}

.header-historical .title {
    height: 65px;
    line-height: 65px;
}

.header-historical .title.script {
    font-family: 'Bad Script', cursive;
    font-size: 18px;
    text-transform: none;
}

.header-scifi {
    height: calc(65px + var(--safe-top));
    padding-top: var(--safe-top);
    background: url('../img/scifi_header_active.png') bottom center / 100% 65px no-repeat;
    color: var(--s-text);
}

.header-scifi .title {
    height: 65px;
    line-height: 65px;
}

.header-scifi .title.big {
    font-size: 20px;
    font-weight: normal;
    text-transform: none;
}

/* ============================================================================================ footer */

.footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    height: var(--footer-height);
    padding-bottom: var(--safe-bottom);
}

.footer-icons {
    position: relative;
    height: 65px;
    display: flex;
    align-items: center;
}

.footer-tab {
    flex: 1 1 0;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-mask {
    display: inline-block;
    width: 36px;
    height: 36px;
    background-color: currentColor;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
}

.footer-historical {
    background: url('../img/historical_footer_background.webp') top center / 100% 65px no-repeat,
        url('../img/historical_footer_background_all.webp') top center / 100% 65px no-repeat,
        #2a1508;
}

.footer-historical .footer-tab {
    color: var(--h-text);
}

.footer-historical .footer-tab.active {
    color: var(--h-activate);
}

.footer-scifi .footer-icons {
    align-items: flex-end;
    padding-bottom: 10px;
}

.footer-scifi .footer-tab {
    height: 36px;
    color: var(--s-footer);
}

.footer-scifi .footer-tab.active {
    flex-grow: 1.2;
    margin-bottom: 10px;
    color: #fff;
}

.footer-glow {
    position: absolute;
    left: 0;
    right: 0;
    bottom: var(--safe-bottom);
    height: 80px;
    display: flex;
    pointer-events: none;
}

.footer-glow span {
    flex: 1 1 0;
    padding-top: 20px;
    background: url('../img/scifi_footer_inactive.webp') center / contain no-repeat content-box;
}

.footer-glow span.active {
    flex-grow: 1.2;
    padding-top: 0;
    background-image: url('../img/scifi_footer_active.webp');
}

/* ============================================================================================ buttons */

.btn-scifi {
    min-height: 48px;
    padding: 6px 12px;
    color: #fff;
    font-size: 16px;
    text-transform: uppercase;
    border-style: solid;
    border-image: url('../img/button_bg_scifi.png') 8 13 10 15 fill / 8px 13px 10px 15px stretch;
}

.btn-scifi-plate {
    min-height: 50px;
    padding: 6px 14px;
    color: #fff;
    text-transform: uppercase;
    border-style: solid;
    border-image: url('../img/scifi_rectangle_btn.png') 0 4 0 3 fill / 0 4px 0 3px stretch;
}

.btn-scifi-left {
    color: #fff;
    text-transform: uppercase;
    border-style: solid;
    border-image: url('../img/scifi_solution_left_btn.png') 0 36 0 0 fill / 0 36px 0 0 stretch;
}

.btn-scifi-right {
    color: #fff;
    text-transform: uppercase;
    border-style: solid;
    border-image: url('../img/scifi_solution_right_btn.png') 0 4 0 48 fill / 0 4px 0 48px stretch;
}

.btn-link {
    color: inherit;
    text-decoration: underline;
    padding: 10px;
    opacity: 0.8;
}

/* ============================================================================================ dialogs */

.overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    animation: fade-in 0.15s ease-out;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dialog-in {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.dialog {
    animation: dialog-in 0.18s ease-out;
}

.dialog-historical {
    position: relative;
    width: calc(100% - 40px);
    max-width: 560px;
    /* 200dp like the app; the longer texts of the web version make it grow */
    min-height: 200px;
    max-height: 80%;
    display: flex;
    flex-direction: column;
    background: url('../img/historical_tile.webp') center / 100% 100% no-repeat;
    color: var(--h-text);
}

.dialog-historical .dialog-title {
    height: 60px;
    flex: 0 0 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 30px;
    text-align: center;
    background: url('../img/historical_header_background.webp') center / 100% 100% no-repeat;
}

.dialog-historical .dialog-message {
    flex: 1 1 auto;
    min-height: 85px;
    overflow-y: auto;
    padding: 8px max(30px, 9%);
    text-align: center;
    display: flex;
    flex-direction: column;
}

.dialog-historical .dialog-message > div {
    margin: auto 0;
}

.dialog-historical .dialog-buttons {
    height: 55px;
    flex: 0 0 55px;
    display: flex;
    background: url('../img/historical_footer_background.webp') center / 100% 100% no-repeat;
}

.dialog-historical .dialog-buttons button {
    flex: 1 1 0;
    color: var(--h-text);
    text-transform: uppercase;
    font-weight: 500;
}

.dialog-scifi {
    position: relative;
    width: min(calc(100% - 32px), 560px);
    max-height: 85%;
    display: flex;
    flex-direction: column;
    padding: 24px;
    color: #fff;
    border-style: solid;
    border-image: url('../img/scifi_dialog_background.png') 68 67 126 0 fill / 68px 67px 126px 0 stretch;
    border-width: 0;
}

.dialog-scifi .dialog-body {
    overflow-y: auto;
    min-height: 0;
}

.dialog-scifi .dialog-title {
    font-weight: bold;
    font-size: 19px;
    text-align: center;
    padding-bottom: 12px;
}

.dialog-scifi .dialog-title:empty {
    display: none;
}

.dialog-scifi .dialog-message {
    font-size: 18px;
    line-height: 1.4;
    text-align: center;
    padding-bottom: 16px;
}

.dialog-scifi .dialog-buttons {
    display: flex;
    gap: 8px;
    padding-top: 8px;
}

.dialog-scifi .dialog-buttons button {
    flex: 1 1 0;
    min-width: 0;
    /* one line like the app (lines=1, ellipsize=end) */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================================================ toast, banner */

.toast {
    position: absolute;
    left: 50%;
    bottom: calc(var(--footer-height) + 24px);
    transform: translateX(-50%);
    z-index: 200;
    max-width: calc(100% - 48px);
    padding: 10px 18px;
    border-radius: 20px;
    background: rgba(40, 40, 40, 0.92);
    color: #fff;
    font-size: 14px;
    text-align: center;
    animation: fade-in 0.2s ease-out;
    pointer-events: none;
}

/* The first entry into a challenge's range (the app vibrates): a glow around the screen and a notice */
.arrival {
    position: absolute;
    inset: 0;
    z-index: 90;
    pointer-events: none;
}

.arrival::before {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 0 0 rgba(255, 214, 107, 0);
    animation: arrival-glow 1.1s ease-in-out 3;
}

.arrival.scifi::before {
    animation-name: arrival-glow-scifi;
}

@keyframes arrival-glow {
    0%, 100% { box-shadow: inset 0 0 0 0 rgba(255, 214, 107, 0); }
    50% { box-shadow: inset 0 0 40px 12px rgba(255, 214, 107, 0.75); }
}

@keyframes arrival-glow-scifi {
    0%, 100% { box-shadow: inset 0 0 0 0 rgba(100, 255, 224, 0); }
    50% { box-shadow: inset 0 0 40px 12px rgba(203, 106, 239, 0.8); }
}

.arrival-card {
    position: absolute;
    left: 50%;
    bottom: calc(var(--footer-height) + 70px);
    transform: translateX(-50%);
    min-width: 220px;
    max-width: calc(100% - 48px);
    padding: 14px 22px;
    text-align: center;
    animation: arrival-card 3.4s ease-out forwards;
}

.arrival-card strong {
    display: block;
    font-size: 20px;
    margin-bottom: 4px;
}

.arrival.historical .arrival-card {
    background: #e2c793 url('../img/historical_tile.webp') center / cover no-repeat;
    border: 2px solid var(--h-text);
    border-radius: 4px;
    box-shadow: 0 0 0 4px rgba(244, 213, 138, 0.6), 0 6px 18px rgba(0, 0, 0, 0.55);
    color: var(--h-text);
    font-family: 'Bad Script', cursive;
    font-size: 19px;
    padding: 16px 34px;
}

.arrival.historical .arrival-card strong {
    font-size: 26px;
    color: #000;
}

.arrival.scifi .arrival-card {
    background: rgba(24, 16, 38, 0.97);
    border: 1px solid rgba(203, 106, 239, 0.8);
    border-radius: 6px;
    box-shadow: 0 0 24px rgba(203, 106, 239, 0.6);
    color: #fff;
}

@keyframes arrival-card {
    0% { opacity: 0; transform: translate(-50%, -12px) scale(0.92); }
    10% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

.footer-tab.pulse .icon-mask {
    animation: tab-pulse 0.8s ease-in-out 4;
}

@keyframes tab-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* ============================================================================================ guides (Driver.js) */

.driver-popover.qw-guide {
    font-family: var(--font);
    min-width: 0;
    width: min(320px, calc(100vw - 32px));
    max-width: min(320px, calc(100vw - 32px));
    padding: 18px 18px 14px;
    border-radius: 10px;
    animation: guide-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes guide-in {
    from { opacity: 0; transform: translateY(8px) scale(0.94); }
    to { opacity: 1; transform: none; }
}

.driver-popover.qw-guide .driver-popover-title {
    font-size: 20px;
    line-height: 1.25;
    padding-right: 4px;
}

.driver-popover.qw-guide .driver-popover-description {
    margin-top: 8px;
    font-size: 15px;
    line-height: 1.45;
}

.driver-popover.qw-guide .driver-popover-footer {
    margin-top: 16px;
    justify-content: flex-end;
}

.driver-popover.qw-guide .driver-popover-progress-text,
.driver-popover.qw-guide .driver-popover-prev-btn,
.driver-popover.qw-guide .driver-popover-close-btn {
    display: none !important;
}

.driver-popover.qw-guide .driver-popover-next-btn {
    min-width: 110px;
    padding: 9px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
    text-shadow: none;
}

/* the highlighted element breathes while the guide is open */
.driver-active .driver-active-element {
    animation: guide-target 1.6s ease-in-out infinite;
}

@keyframes guide-target {
    0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0)); }
    50% { filter: drop-shadow(0 0 10px var(--guide-glow, rgba(203, 106, 239, 0.9))); }
}

/* historical: a parchment card */
/* historical: a parchment card on a dark wooden mat (a light halo clashed with the dark frame) */
.driver-popover.qw-guide-historical {
    --guide-card: #2b170b;
    background: #e3c998 url('../img/historical_tile.webp') center / cover no-repeat;
    border: 2px solid #1d0c09;
    border-radius: 6px;
    box-shadow:
        0 0 0 7px #2b170b,
        0 0 0 8px rgba(214, 180, 119, 0.55),
        0 14px 34px rgba(0, 0, 0, 0.75);
    color: var(--h-text);
}

.driver-popover.qw-guide-historical .driver-popover-arrow {
    border-width: 12px;
    margin: 0 -1px;
}

.driver-popover.qw-guide-historical .driver-popover-title {
    font-family: 'Bad Script', cursive;
    font-size: 25px;
    font-weight: normal;
    color: #000;
}

.driver-popover.qw-guide-historical .driver-popover-description {
    color: var(--h-text);
}

.driver-popover.qw-guide-historical .driver-popover-next-btn {
    background: var(--h-text);
    border: 1px solid #1d0c09;
    color: var(--h-activate);
    box-shadow: 0 2px 0 #1d0c09;
}

.driver-active:has(.qw-guide-historical) {
    --guide-glow: rgba(255, 214, 107, 0.95);
}

/* scifi: a glowing glass card */
.driver-popover.qw-guide-scifi {
    --guide-card: #1c1230;
    background: linear-gradient(160deg, rgba(58, 38, 92, 0.96), rgba(22, 14, 38, 0.96));
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(203, 106, 239, 0.75);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset, 0 0 28px rgba(203, 106, 239, 0.45), 0 12px 30px rgba(0, 0, 0, 0.6);
    color: #fff;
}

.driver-popover.qw-guide-scifi .driver-popover-title {
    color: #fff;
    font-weight: 700;
    text-shadow: 0 0 12px rgba(203, 106, 239, 0.8);
}

.driver-popover.qw-guide-scifi .driver-popover-description {
    color: rgba(255, 255, 255, 0.86);
}

.driver-popover.qw-guide-scifi .driver-popover-next-btn {
    background: linear-gradient(#E9C1FB, #AB6BEF 55%, #8D4BE9);
    border: 0;
    color: #fff;
    box-shadow: 0 0 14px rgba(203, 106, 239, 0.6);
}

/* the arrow in the colour of the card */
.driver-popover.qw-guide .driver-popover-arrow {
    border-width: 9px;
}

.driver-popover.qw-guide .driver-popover-arrow-side-top { border-top-color: var(--guide-card); }
.driver-popover.qw-guide .driver-popover-arrow-side-bottom { border-bottom-color: var(--guide-card); }
.driver-popover.qw-guide .driver-popover-arrow-side-left { border-left-color: var(--guide-card); }
.driver-popover.qw-guide .driver-popover-arrow-side-right { border-right-color: var(--guide-card); }

/* ============================================================================================ loading */

.loading-logo {
    width: 96px;
    height: 96px;
    animation: logo-colors 1.2s steps(1) infinite;
    background: url('../img/logo_orange.png') center / contain no-repeat;
}

@keyframes logo-colors {
    0% { background-image: url('../img/logo_orange.png'); }
    16.6% { background-image: url('../img/logo_light_green.png'); }
    33.3% { background-image: url('../img/logo_dark_green.png'); }
    50% { background-image: url('../img/logo_purple.png'); }
    66.6% { background-image: url('../img/logo_pink.png'); }
    83.3% { background-image: url('../img/logo_red.png'); }
}

.center-column {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    gap: 18px;
}

/* ============================================================================================ login, access code */

.login-logo {
    width: 200px;
    height: 200px;
    background-color: #fff;
    -webkit-mask: url('../img/ic_launcher_foreground.png') center / 150% no-repeat;
    mask: url('../img/ic_launcher_foreground.png') center / 150% no-repeat;
}

.login-name {
    font-size: 30px;
    font-weight: bold;
    margin-bottom: 22px;
}

.login-info {
    max-width: 320px;
    font-size: 15px;
    line-height: 1.4;
    opacity: 0.85;
}

.gis-button {
    min-height: 44px;
    display: flex;
    justify-content: center;
}

.code-screen {
    display: flex;
    flex-direction: column;
}

.code-content {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(65px + var(--safe-top));
    bottom: 0;
    padding: 20px 20px calc(20px + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.code-info {
    text-align: center;
    font-size: 15px;
    opacity: 0.85;
    max-width: 340px;
}

.pin {
    position: relative;
    display: flex;
    gap: 5px;
    justify-content: center;
}

.pin input {
    position: absolute;
    inset: 0;
    width: 100%;
    opacity: 0;
    font-size: 16px;
    caret-color: transparent;
    text-transform: uppercase;
}

.pin-box {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #fff;
    font-size: 19px;
    text-transform: uppercase;
}

.pin-box.caret {
    box-shadow: inset 0 -3px 0 #CB6AEF;
}

.code-actions {
    display: flex;
    gap: 5px;
    width: 100%;
    max-width: 330px;
}

.code-actions .apply {
    flex: 1 1 auto;
    font-size: 19px;
}

.code-actions .icon-button {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.demo {
    width: 100%;
    max-width: 420px;
    margin-top: auto;
}

.demo h2 {
    font-size: 15px;
    font-weight: normal;
    text-align: center;
    margin: 0 0 10px;
    opacity: 0.85;
}

.demo-quest {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    margin-bottom: 8px;
}

.demo-quest img {
    width: 76px;
    height: 56px;
    object-fit: cover;
    flex: 0 0 76px;
}

.demo-quest .demo-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 15px;
}

.demo-quest .demo-title small {
    display: block;
    opacity: 0.7;
}

.demo-quest .btn-scifi-plate {
    min-height: 40px;
    font-size: 12px;
    flex: 0 0 auto;
}

.signout {
    font-size: 13px;
}

.debug-login {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 13px;
}

.debug-login input {
    width: 90px;
    padding: 6px;
}

/* ============================================================================================ wizard */

.wizard {
    transition: background-color 0.5s ease;
    color: #fff;
}

.wizard-slide {
    position: absolute;
    left: 20px;
    right: 20px;
    top: calc(20px + var(--safe-top));
    bottom: calc(76px + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    animation: fade-in 0.35s ease-out;
}

.wizard-animation {
    width: 100%;
    height: 280px;
    max-height: 45vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wizard-animation img {
    max-width: 100%;
    max-height: 100%;
}

.wizard-text {
    margin: 30px 0 50px;
    font-size: 23px;
    line-height: 1.3;
    white-space: pre-line;
}

.wizard-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(56px + var(--safe-bottom));
    padding: 0 12px var(--safe-bottom);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.12);
}

.wizard-bar button {
    min-width: 88px;
    height: 48px;
    font-size: 15px;
    text-transform: uppercase;
}

.wizard-dots {
    display: flex;
    gap: 8px;
}

.wizard-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
}

.wizard-dots span.active {
    background: #fff;
}

/* ============================================================================================ game shell */

.game .tab-page {
    position: absolute;
    inset: 0;
}

/* ============================================================================================ challenge tab */

.challenge-tabs {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--safe-top);
    z-index: 6;
    height: 65px;
    display: flex;
}

.challenge-tabs button {
    flex: 1 1 0;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    padding: 4px 2px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theme-historical .challenge-tabs button {
    color: var(--h-text);
}

.theme-historical .challenge-tabs button.selected {
    color: var(--h-activate);
}

.theme-scifi .challenge-tabs {
    left: 10px;
    right: 10px;
}

.theme-scifi .challenge-tabs button {
    color: #fff;
    background: url('../img/scifi_header_inactive.png') center / 100% 100% no-repeat;
}

.theme-scifi .challenge-tabs button.selected {
    background-image: url('../img/scifi_header_active.png');
}

.gameplay-page {
    position: absolute;
    inset: 0;
}

.gameplay-page.entering {
    animation: page-fade 0.6s cubic-bezier(0, 0, 0.2, 1);
}

@keyframes page-fade {
    from { opacity: 0.25; }
    to { opacity: 1; }
}

/* historical page: the parchment scrolls under the header */
.gameplay-historical {
    background: var(--h-bg);
}

.gameplay-historical .page-scroll {
    position: absolute;
    inset: 0;
}

.gameplay-historical .page-inner {
    min-height: 100%;
    padding: calc(65px + var(--safe-top)) max(34px, 9%) calc(65px + var(--footer-height)) max(44px, 11%);
}

.gameplay-historical .challenge-title {
    font-family: 'Bad Script', cursive;
    font-size: 21px;
    color: #000;
    margin: 0 0 8px;
    font-weight: normal;
}

.gameplay-historical .challenge-text {
    font-family: 'Bad Script', cursive;
    font-size: 19px;
    color: var(--h-text);
    white-space: pre-line;
    line-height: 1.35;
}

.gameplay-historical .challenge-number {
    text-align: right;
    padding: 10px 5px 0 0;
    color: var(--h-text);
}

.gameplay-historical .check-row {
    display: flex;
    margin-top: 8px;
}

.gameplay-historical .check-row button {
    flex: 1 1 0;
    min-height: 48px;
    color: var(--h-text);
    text-transform: uppercase;
    font-weight: 500;
}

.gameplay-historical .check-row .check {
    text-align: left;
    padding-left: 12px;
}

.image-frame {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.gameplay-historical .image-frame img.challenge-image {
    display: block;
    max-width: 100%;
    max-height: 200px;
    padding: 12px 11px;
}

.gameplay-historical .image-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--h-text);
    -webkit-mask: url('../img/historical_image_border.png') center / 100% 100% no-repeat;
    mask: url('../img/historical_image_border.png') center / 100% 100% no-repeat;
    pointer-events: none;
}

/* scifi page: a faint panel between the tabs and the buttons */
.gameplay-scifi {
    background: #382B4E url('../img/scifi_bg.webp') center / 100% 100% no-repeat;
}

.gameplay-scifi .page-scroll {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(65px + var(--safe-top));
    bottom: calc(45px + var(--footer-height));
    padding: 10px 0;
}

.gameplay-scifi .page-inner {
    padding: 0 20px;
}

.gameplay-scifi .challenge-number {
    text-align: right;
    padding-top: 10px;
    margin-right: 5px;
}

.gameplay-scifi .challenge-title {
    font-size: 21px;
    font-weight: normal;
    margin: 12px 0 12px;
}

.gameplay-scifi .challenge-text {
    font-size: 19px;
    white-space: pre-line;
    line-height: 1.3;
}

.gameplay-scifi .image-frame img.challenge-image {
    display: block;
    max-width: 100%;
    max-height: 200px;
}

.check-container {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: var(--footer-height);
    height: 45px;
    display: flex;
    gap: 10px;
}

.check-container button {
    flex: 1 1 0;
    font-size: 14px;
    padding: 5px;
}

.check-container .check {
    padding-right: 15px;
}

.invisible {
    visibility: hidden;
}

/* the logo looking around when the question opens (SearchingAnimation) */
.searching {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 108px;
    height: 108px;
    margin: -54px 0 0 -54px;
    z-index: 4;
    pointer-events: none;
    background: url('../img/ic_launcher_foreground.png') center / 200% no-repeat;
    animation: searching 1s linear 2 forwards;
}

@keyframes searching {
    0% { transform: rotate(0deg) translateX(40px) rotate(0deg); opacity: 1; }
    99% { opacity: 1; }
    100% { transform: rotate(360deg) translateX(40px) rotate(-360deg); opacity: 0; }
}

/* ============================================================================================ answers */

.answer-text {
    position: relative;
    margin: 10px 0 6px;
}

.answer-text input {
    width: 100%;
    padding: 18px 0 6px;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 18px;
}

.answer-text label {
    position: absolute;
    left: 0;
    top: 18px;
    font-size: 18px;
    transition: all 0.15s ease;
    pointer-events: none;
}

.answer-text input:focus + label,
.answer-text input:not(:placeholder-shown) + label {
    top: 0;
    font-size: 12px;
}

.theme-historical .answer-text input {
    color: var(--h-text);
}

.theme-historical .answer-text label {
    color: var(--h-text);
}

.theme-scifi .answer-text input {
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.8);
}

.theme-scifi .answer-text input:focus {
    border-bottom: 2px solid #fff;
}

.theme-scifi .answer-text label {
    color: #fff;
}

.choices {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0;
}

.choice {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    line-height: 1.25;
    cursor: pointer;
    text-align: left;
}

.choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice .mark {
    flex: 0 0 43px;
    width: 43px;
    height: 43px;
    background: center / contain no-repeat;
}

.theme-historical .choice {
    color: var(--h-text);
}

.theme-historical .choice .mark {
    background-image: url('../img/historical_radio_off.png');
}

.theme-historical .choice.checked .mark {
    background-image: url('../img/historical_radio_on.png');
}

.theme-scifi .choice .mark {
    background-image: url('../img/radio_scifi_off.png');
}

.theme-scifi .choice.checked .mark {
    background-image: url('../img/radio_scifi_on.png');
}

.object-slot {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
}

.theme-historical .object-slot {
    height: 330px;
    background: url('../img/historical_inventory_border.webp') center / 100% 100% no-repeat;
}

.theme-historical .object-slot .slot-image {
    flex: 6 1 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--h-text);
}

.theme-historical .object-slot .slot-title {
    flex: 1 1 0;
    color: var(--h-text);
}

.theme-scifi .object-slot .slot-image {
    width: 100%;
    min-height: 161px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-style: solid;
    border-image: url('../img/scifi_slot_background.png') 51 47 69 44 fill / 51px 47px 69px 44px stretch;
}

.theme-scifi .object-slot .slot-title {
    margin: 4px 0 8px;
}

.object-slot img {
    max-width: 80%;
    max-height: 220px;
    object-fit: contain;
}

.theme-scifi .object-slot .plus {
    width: 147px;
    height: 161px;
    max-width: 60%;
    background: url('../img/scifi_plus.png') center / contain no-repeat;
}

.plus-historical {
    font-size: 110px;
    line-height: 1;
    font-weight: 300;
}

/* ============================================================================================ wheel lock */

.wheel-lock {
    position: relative;
    margin: 16px 0 12px;
    padding: 18px;
    border-radius: 18px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.wheel-lock.historical {
    background: linear-gradient(#8A7058, #574130 50%, #34251C);
    box-shadow: 0 0 0 2px #302017, inset 0 0 0 0.5px #AC9272, 0 4px 8px rgba(0, 0, 0, 0.45);
}

.wheel-lock.scifi {
    border-radius: 8px;
    background: linear-gradient(#514263, #251b3b 50%, #171020);
    box-shadow: 0 0 0 2px #100A19, inset 0 0 0 0.5px #7C6695, 0 4px 8px rgba(0, 0, 0, 0.45);
}

.wheel-lock .screw {
    position: absolute;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.wheel-lock.historical .screw {
    background: radial-gradient(circle at 35% 35%, #F2D08A, #B17A2E 55%, #5C3A12);
}

.wheel-lock.scifi .screw {
    border-radius: 2px;
    background: radial-gradient(circle at 35% 35%, #CFC2E6, #7C6695 55%, #2D2140);
}

.wheel-lock .screw.tl { left: 5px; top: 5px; }
.wheel-lock .screw.tr { right: 5px; top: 5px; }
.wheel-lock .screw.bl { left: 5px; bottom: 5px; }
.wheel-lock .screw.br { right: 5px; bottom: 5px; }

.wheel-lock .pointer {
    position: absolute;
    top: 50%;
    width: 6px;
    height: 10px;
    margin-top: -5px;
}

.wheel-lock .pointer.left {
    left: 5px;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.wheel-lock .pointer.right {
    right: 5px;
    clip-path: polygon(100% 0, 0 50%, 100% 100%);
}

.wheel-lock.historical .pointer { background: #D9BF91; }
.wheel-lock.scifi .pointer { background: #9165CE; }

.wheel-lock .rail {
    position: absolute;
    left: 50%;
    width: 80px;
    height: 6px;
    margin-left: -40px;
    border-radius: 3px;
}

.wheel-lock .rail.top { top: 6px; }
.wheel-lock .rail.bottom { bottom: 6px; }
.wheel-lock.historical .rail { background: linear-gradient(#34251C, #8A7058); }
.wheel-lock.scifi .rail { background: linear-gradient(#171020, #594471); }

.wheel-recess {
    position: relative;
    display: flex;
    height: 174px;
    overflow: hidden;
    border-radius: 7px;
}

.wheel-lock.historical .wheel-recess {
    background: #241711;
    box-shadow: inset 0 0 0 1px #8B7059;
}

.wheel-lock.scifi .wheel-recess {
    border-radius: 4px;
    background: #110C1D;
    box-shadow: inset 0 0 0 1px #594471;
}

.wheel-column {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    height: 174px;
    overflow: hidden;
    perspective: 400px;
    cursor: grab;
    outline: none;
}

/* 3D drums (wheelLock3d.js) under transparent columns which keep the dragging */
.wheel-drums {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.wheel-drums canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.wheel-recess.is-3d .wheel-column {
    background: none !important;
    box-shadow: none !important;
}

/* the upper and the lower row turn away into the shadow of the housing */
.wheel-recess.is-3d .wheel-column::before,
.wheel-recess.is-3d .wheel-column::after {
    height: 40%;
}

.wheel-recess.is-3d .wheel-column::before {
    background: linear-gradient(rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.4) 40%, rgba(0, 0, 0, 0));
}

.wheel-recess.is-3d .wheel-column::after {
    background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.4) 60%, rgba(0, 0, 0, 0.78));
}

/* the lit letters of the 3D drums are the activation; a light over the metal only blurs them */
.wheel-lock .wheel-recess.is-3d .wheel-glow {
    display: none;
}

/* sci-fi: a dark recess, and a scan of light from left to right as the drums light up one by one */
.wheel-lock.scifi .wheel-recess.is-3d {
    background: #020306;
    box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.35);
}

.wheel-lock.scifi .wheel-recess.is-3d::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -30%;
    width: 30%;
    z-index: 4;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(90deg, rgba(0, 240, 255, 0), rgba(0, 240, 255, 0.28) 70%, rgba(190, 255, 255, 0.7) 96%, rgba(0, 240, 255, 0));
    mix-blend-mode: screen;
}

.wheel-lock.scifi.activated .wheel-recess.is-3d::before {
    animation: wheel-scan 0.9s cubic-bezier(0.45, 0, 0.55, 1) both;
}

@keyframes wheel-scan {
    0% { left: -30%; opacity: 1; }
    85% { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .wheel-lock.scifi.activated .wheel-recess.is-3d::before { animation: none; }
}

.wheel-recess.is-3d .wheel-column.flash::after {
    background: linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.35) 50%, rgba(255, 255, 255, 0));
}

/* a glass pane over the window */
.wheel-recess.is-3d::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.04) 38%, rgba(255, 255, 255, 0) 55%);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7), inset 0 -1px 0 rgba(255, 255, 255, 0.12);
}

.wheel-column + .wheel-column {
    box-shadow: -3px 0 0 rgba(0, 0, 0, 0.55), -2.5px 0 0 rgba(255, 255, 255, 0.18);
}

.wheel-lock.historical .wheel-column {
    background: linear-gradient(#80674F, #C6AF8B 50%, #826951);
}

.wheel-lock.scifi .wheel-column {
    background: linear-gradient(#241A34, #473559 50%, #22182F);
}

.wheel-column::before,
.wheel-column::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 36%;
    z-index: 2;
    pointer-events: none;
}

.wheel-column::before {
    top: 0;
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
}

.wheel-column::after {
    bottom: 0;
    background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.7));
}

.wheel-item {
    position: absolute;
    left: 0;
    right: 0;
    top: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    white-space: nowrap;
    overflow: hidden;
    backface-visibility: hidden;
    border-top: 1px solid rgba(0, 0, 0, 0.18);
}

.wheel-lock.historical .wheel-item {
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: bold;
    color: var(--h-text);
    text-shadow: 0 1px 0 rgba(218, 203, 166, 0.6);
}

.wheel-lock.scifi .wheel-item {
    font-weight: 500;
    letter-spacing: 0.04em;
    color: #fff;
}

.wheel-item img {
    height: 44px;
    max-width: 100%;
    object-fit: contain;
}

.wheel-glow {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 90px;
    margin-top: -45px;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wheel-lock.historical .wheel-glow {
    background: radial-gradient(ellipse at center, rgba(201, 156, 91, 0.4), rgba(201, 156, 91, 0) 70%);
}

.wheel-lock.scifi .wheel-glow {
    background: radial-gradient(ellipse at center, rgba(100, 255, 224, 0.4), rgba(100, 255, 224, 0) 70%);
}

.wheel-lock.activated .wheel-glow {
    opacity: 1;
}

.wheel-lock.historical.activated .wheel-item.center {
    color: #FFD66B;
    text-shadow: 0 0 8px rgba(255, 214, 107, 0.9);
}

.wheel-lock.scifi.activated .wheel-item.center {
    color: #64FFE0;
    text-shadow: 0 0 8px rgba(100, 255, 224, 0.9);
}

.wheel-column.flash::after {
    background: linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.35) 50%, rgba(255, 255, 255, 0));
    top: 30%;
    height: 40%;
    animation: wheel-flash 0.7s ease-in-out;
}

@keyframes wheel-flash {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

.wheel-lock.shake {
    animation: wheel-shake 0.36s ease-out;
}

@keyframes wheel-shake {
    0% { transform: translateX(0) scale(1, 1); }
    20% { transform: translateX(-6px) scale(1.015, 0.985); }
    45% { transform: translateX(5px) scale(0.995, 1.005); }
    65% { transform: translateX(-3px) scale(1, 1); }
    85% { transform: translateX(2px); }
    100% { transform: translateX(0) scale(1, 1); }
}

.wheel-feedback {
    padding: 12px;
    margin-bottom: 16px;
    text-align: center;
}

.wheel-feedback.historical {
    background: #4E301D;
    border: 1px solid #86532C;
    border-radius: 10px;
    color: #D6B477;
    font-family: Georgia, 'Times New Roman', serif;
}

.wheel-feedback.scifi {
    background: rgba(27, 19, 41, 0.93);
    border: 1px solid #594471;
    border-radius: 6px;
    color: #D5C7E8;
    font-weight: 500;
}

.wheel-feedback.appear {
    animation: feedback-appear 0.26s ease-out;
}

@keyframes feedback-appear {
    from { opacity: 0.72; transform: scale(0.985); }
    to { opacity: 1; transform: scale(1); }
}

.wheel-metrics {
    display: flex;
    align-items: center;
}

.wheel-metrics > div {
    flex: 1 1 0;
}

.wheel-metrics .value {
    font-size: 26px;
}

.wheel-metrics .label {
    font-size: 14px;
}

.wheel-metrics .divider {
    flex: 0 0 1px;
    width: 1px;
    height: 40px;
}

.wheel-feedback.historical .divider,
.wheel-feedback.historical .hr { background: #86532C; }
.wheel-feedback.scifi .divider,
.wheel-feedback.scifi .hr { background: #594471; }

.wheel-feedback .hr {
    height: 1px;
    margin: 12px 0;
}

.wheel-checks {
    margin-bottom: 14px;
    font-size: 14px;
}

.wheel-progress {
    height: 4px;
    margin-top: 8px;
    border-radius: 2px;
    overflow: hidden;
}

.wheel-feedback.historical .wheel-progress { background: #86532C; }
.wheel-feedback.scifi .wheel-progress { background: #594471; }

.wheel-progress span {
    display: block;
    height: 100%;
    border-radius: 2px;
}

.wheel-feedback.historical .wheel-progress span { background: #D6B477; }
.wheel-feedback.scifi .wheel-progress span { background: #9066d2; }

.wheel-check {
    width: 100%;
    min-height: 56px;
    padding: 12px 16px;
    border-radius: 5px;
    font-weight: bold;
    box-shadow: 0 3px 3px rgba(0, 0, 0, 0.3);
}

.wheel-feedback.historical .wheel-check {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 17px;
    color: #241711;
    border: 1px solid #86532C;
    background: linear-gradient(#D9BF91, #B99461);
}

.wheel-feedback.scifi .wheel-check {
    font-size: 15px;
    color: #fff;
    border: 1px solid #594471;
    background: linear-gradient(#9165CE, #6943A2);
}

.wheel-ready {
    min-height: 56px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.wheel-feedback.historical .wheel-ready { color: #D6B477; font-size: 17px; }
.wheel-feedback.scifi .wheel-ready { color: #64FFE0; font-size: 15px; }

/* ============================================================================================ inventory */

.inventory-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 8px;
}

.inventory-item {
    position: relative;
    padding-top: 30px;
    text-align: center;
}

.inventory-item .frame {
    position: relative;
    height: 200px;
}

.inventory-item .frame img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 5px;
    object-fit: contain;
}

.inventory-item .item-title {
    font-size: 15px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding: 2px 4px 0;
}

.theme-historical .inventory-item .frame {
    border-style: solid;
    border-image: url('../img/historical_inventory_frame.png') 92 94 95 92 fill / 92px 94px 95px 92px stretch;
}

.theme-historical .inventory-item.selected .frame {
    border-image-source: url('../img/historical_inventory_frame_selected.png');
}

.theme-scifi .inventory-item .frame {
    background: url('../img/scifi_slot.webp') center / 100% 100% no-repeat;
}

.theme-scifi .inventory-item.selected .frame {
    background-image: url('../img/scifi_slot_selected.webp');
}

.inventory-historical .page-scroll {
    position: absolute;
    inset: 0;
}

.inventory-historical .page-inner {
    min-height: 100%;
    padding: calc(60px + var(--safe-top)) max(24px, 7%) calc(65px + 50px + var(--footer-height));
}

.inventory-scifi .page-scroll {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(65px + var(--safe-top));
    bottom: calc(55px + var(--footer-height));
    padding: 10px;
}

.combine-bar {
    position: absolute;
    z-index: 6;
    display: flex;
    align-items: stretch;
}

.combine-bar button {
    min-width: 0;
}

.inventory-historical .combine-bar {
    left: 40px;
    right: 40px;
    bottom: var(--footer-height);
    height: 50px;
    padding-top: 6px;
    background: url('../img/historical_combine_bg.webp') center / 100% 100% no-repeat;
    color: var(--h-text);
    font-size: 17px;
    text-transform: uppercase;
}

.inventory-historical .combine-bar button {
    flex: 1 1 0;
    color: var(--h-text);
    text-transform: uppercase;
}

.inventory-historical .combine-bar .sep {
    width: 1px;
    margin: 10px 0 12px;
    background: var(--h-text);
}

.inventory-scifi .combine-bar {
    left: 10px;
    right: 10px;
    bottom: var(--footer-height);
    height: 55px;
}

.inventory-scifi .combine-bar .spacer { flex: 1.5 1 0; }
.inventory-scifi .combine-bar .combine { flex: 3.5 1 0; }
.inventory-scifi .combine-bar .cancel,
.inventory-scifi .combine-bar .done { flex: 1.75 1 0; }

.zoom-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: var(--footer-height);
    z-index: 8;
    display: flex;
    flex-direction: column;
    padding: calc(var(--safe-top) + 12px) 20px 15px;
}

.zoom-panel .zoom-title {
    font-size: 16px;
    text-align: center;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.zoom-panel .zoom-image {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}

.zoom-panel .zoom-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform-origin: 0 0;
}

.zoom-panel .zoom-description {
    font-size: 16px;
    max-height: 35%;
    overflow-y: auto;
    white-space: pre-line;
    padding-top: 8px;
}

.zoom-panel.historical {
    padding-left: max(44px, 11%);
    padding-right: max(34px, 9%);
}

/* ============================================================================================ map */

.map-page .map-canvas {
    position: absolute;
    background: #cfc6b0;
}

.map-page.historical {
    background: #000;
}

.map-page.historical .map-canvas,
.map-page.historical .map-frame {
    left: 12px;
    right: 12px;
    top: calc(60px + var(--safe-top));
    bottom: 0;
}

/* the map ends under the middle of the frame's side rolls (x ≈ 48 and 725 of 768), outside them is black */
.map-page.historical .map-canvas {
    left: calc(12px + (100% - 24px) * 0.0625);
    right: calc(12px + (100% - 24px) * 0.056);
    bottom: var(--footer-height);
}

.map-page .map-frame {
    position: absolute;
    z-index: 3;
    pointer-events: none;
}

.map-page.historical .map-frame {
    background: url('../img/historical_map_middle.webp') top center / 100% 100% no-repeat;
    bottom: calc(var(--footer-height) - 10px);
}

.map-page.scifi .map-canvas,
.map-page.scifi .map-frame {
    left: 12px;
    right: 12px;
    top: calc(65px + var(--safe-top) + 12px);
    bottom: calc(var(--footer-height) + 12px);
}

.map-page.scifi .map-frame {
    border-style: solid;
    border-image: url('../img/scifi_slot_map.png') 61 60 61 62 / 61px 60px 61px 62px stretch;
}

.map-button {
    position: absolute;
    z-index: 4;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.map-page.historical .map-button {
    top: calc(60px + var(--safe-top) + 30px);
}

.map-page.scifi .map-button {
    top: calc(65px + var(--safe-top) + 30px);
}

.map-notice {
    position: absolute;
    z-index: 4;
    left: 28px;
    right: 28px;
    bottom: calc(var(--footer-height) + 24px);
    padding: 10px 14px;
    border-radius: 6px;
    background: rgba(20, 12, 30, 0.85);
    color: #fff;
    font-size: 14px;
    text-align: center;
}

.map-debug {
    position: absolute;
    z-index: 4;
    left: 28px;
    top: calc(65px + var(--safe-top) + 30px);
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 200, 0.9);
    color: #333;
    font-size: 11px;
}

/* ============================================================================================ team */

.team-historical .page-scroll,
.team-scifi .page-scroll {
    position: absolute;
    inset: 0;
}

.team-historical .page-inner {
    min-height: 100%;
    padding: calc(65px + var(--safe-top) + 20px) max(34px, 9%) calc(65px + var(--footer-height)) max(44px, 11%);
}

.team-scifi .page-inner {
    padding: calc(65px + var(--safe-top)) 0 calc(var(--footer-height) + 20px);
}

.team-scifi .players {
    padding: 10px 20px;
}

.player-row {
    height: 48px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-row .player-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-row .player-name small {
    font-size: 13px;
    opacity: 0.7;
}

.player-row .status {
    width: 48px;
    height: 32px;
    flex: 0 0 48px;
    background: center / contain no-repeat;
}

.player-row .status.synced { background-image: url('../img/ic_synced_green.png'); }
.player-row .status.offline { background-image: url('../img/ic_not_synced_red.png'); }

.theme-historical .player-row .status {
    background: none;
    background-color: var(--h-text);
    -webkit-mask: center / contain no-repeat;
    mask: center / contain no-repeat;
}

.theme-historical .player-row .status.synced {
    -webkit-mask-image: url('../img/ic_synced_green.png');
    mask-image: url('../img/ic_synced_green.png');
}

.theme-historical .player-row .status.offline {
    -webkit-mask-image: url('../img/ic_not_synced_red.png');
    mask-image: url('../img/ic_not_synced_red.png');
}

.sync-switch {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 0;
    font-size: 15px;
    line-height: 1.35;
    cursor: pointer;
}

.team-scifi .sync-switch {
    padding: 16px 20px;
}

.switch {
    position: relative;
    flex: 0 0 36px;
    width: 36px;
    height: 20px;
}

.switch input {
    position: absolute;
    opacity: 0;
}

.switch .track {
    position: absolute;
    left: 2px;
    right: 2px;
    top: 3px;
    height: 14px;
    border-radius: 7px;
}

.switch .thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease;
}

.switch.on .thumb {
    transform: translateX(16px);
}

.theme-historical .switch .track { background: #a1793c; }
.theme-historical .switch.on .track { background: #714605; }
.theme-historical .switch .thumb { background: #806339; }
.theme-historical .switch.on .thumb { background: #392000; }
.theme-scifi .switch .track { background: #655691; }
.theme-scifi .switch.on .track { background: #b6b6ec; }
.theme-scifi .switch .thumb { background: #503f7b; }
.theme-scifi .switch.on .thumb { background: #ffffff; }

.switch.disabled {
    opacity: 0.5;
}

.team-note {
    font-size: 14px;
    opacity: 0.85;
    padding: 6px 0 12px;
}

.team-scifi .team-note {
    padding: 6px 20px 12px;
}

.team-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 20px 0;
}

.team-scifi .team-actions {
    padding: 20px;
}

.team-historical .team-actions button {
    min-height: 48px;
    color: var(--h-text);
    text-transform: uppercase;
    font-weight: 500;
    border-top: 1px solid rgba(61, 27, 23, 0.3);
}

.debug-panel {
    margin-top: 20px;
    padding: 10px;
    border: 1px dashed currentColor;
    font-size: 13px;
}

.debug-panel button {
    display: block;
    width: 100%;
    padding: 8px;
    text-align: left;
    text-decoration: underline;
}

/* ============================================================================================ AR tab */

.ar-page.historical .ar-frame,
.ar-page.scifi .ar-frame {
    position: absolute;
    left: 12px;
    right: 12px;
    top: calc(65px + var(--safe-top));
    bottom: calc(var(--footer-height) + 12px);
}

.ar-page.historical .ar-frame {
    top: calc(60px + var(--safe-top));
    background: url('../img/historical_map_middle.webp') top center / 100% 100% no-repeat;
}

.ar-page.scifi .ar-frame {
    border-style: solid;
    border-image: url('../img/scifi_slot_map.png') 61 60 61 62 / 61px 60px 61px 62px stretch;
}

.ar-camera {
    position: absolute;
    left: 25px;
    right: 25px;
    top: 25px;
    bottom: 25px;
    overflow: hidden;
    background: #111;
}

.ar-page.scifi .ar-camera {
    left: 8px;
    right: 8px;
    top: 8px;
    bottom: 8px;
    background: rgba(0, 0, 0, 0.5);
}

.ar-camera video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ar-counter {
    position: absolute;
    left: 60px;
    right: 20px;
    top: calc(var(--safe-top) + 72px);
    z-index: 4;
    font-size: 19px;
}

.ar-page.historical .ar-counter {
    color: var(--h-text);
    top: calc(var(--safe-top) + 64px);
}

.ar-message {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(100% - 60px);
    max-width: 380px;
    transform: translate(-50%, -50%);
    padding: 16px;
    border-radius: 6px;
    text-align: center;
    background: rgba(14, 14, 16, 0.72);
    color: #fff;
    font-size: 15px;
    line-height: 1.4;
}

.ar-message .btn-scifi {
    margin-top: 12px;
    width: 100%;
}

.ar-page.historical .ar-message {
    background: rgba(233, 214, 170, 0.92);
    color: var(--h-text);
    border: 1px solid rgba(61, 27, 23, 0.4);
}

.ar-page.historical .ar-message .btn-scifi {
    border: 0;
    border-image: none;
    background: var(--h-text);
    color: var(--h-activate);
    border-radius: 4px;
}

/* ============================================================================================ finish */

.finish {
    background: #6aa8e8 url('../img/final_bg.webp') center / cover no-repeat;
    color: #fff;
}

.finish .finish-scroll {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: calc(65px + var(--safe-bottom));
    padding-top: var(--safe-top);
}

.finish-next {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(65px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    width: 100%;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    border-style: solid;
    border-image: url('../img/button_bg_scifi.png') 8 13 10 15 fill / 8px 13px 10px 15px stretch;
}

.congrats-text {
    padding: 25px 50px 0;
    color: var(--finish-blue);
    text-align: center;
}

.congrats-text h1 {
    font-size: 23px;
    margin: 0 0 8px;
}

.congrats-text p {
    font-size: 21px;
    margin: 0;
}

.final-cup {
    display: block;
    width: 80%;
    max-width: 420px;
    margin-top: 40px;
}

.confetti-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.survey-card {
    margin: 8px;
    padding: 10px;
    border-radius: 3px;
    background: #fff;
    color: var(--finish-green);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.survey-card input {
    width: 100%;
    padding: 12px 4px;
    border: 0;
    border-bottom: 1px solid var(--finish-green);
    outline: none;
    color: var(--finish-green);
    text-align: center;
}

.survey-card input::placeholder {
    color: var(--finish-green);
    opacity: 0.8;
}

.survey-card h2 {
    font-size: 19px;
    font-weight: normal;
    margin: 6px 0 12px;
}

.stars {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 16px 0;
}

.stars button {
    width: 44px;
    height: 44px;
    font-size: 40px;
    line-height: 44px;
    color: #cfcfcf;
}

.stars button.on {
    color: var(--finish-green);
}

.quote-info {
    margin: 30px 20px 0;
    color: var(--finish-purple);
    font-size: 19px;
    font-weight: bold;
    text-align: center;
}

.quote-box {
    position: relative;
    margin: 20px 0;
    padding: 70px 50px;
    background: rgba(0, 0, 0, 0.067);
    font-size: 17px;
    line-height: 1.4;
    text-align: center;
    white-space: pre-line;
}

.quote-box::before {
    content: '';
    position: absolute;
    left: 20px;
    right: 20px;
    top: 0;
    bottom: 0;
    border-style: solid;
    /* quote.9.png tinted white like the app */
    border-image: url('../img/quote_white.png') 62 249 65 274 / 62px 249px 65px 274px stretch;
    pointer-events: none;
    opacity: 0.95;
}

.quote-bye {
    padding: 0 30px;
    font-size: 19px;
    text-align: center;
}

/* the last screen: a glass card over the watercolour background */
.end-card {
    width: 100%;
    max-width: 360px;
    padding: 30px 24px 26px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.62);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
    box-shadow: 0 18px 40px rgba(40, 20, 90, 0.25);
    text-align: center;
    animation: end-card-in 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}

@keyframes end-card-in {
    from { opacity: 0; transform: translateY(18px) scale(0.96); }
    to { opacity: 1; transform: none; }
}

.end-logo {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    box-shadow: 0 6px 16px rgba(40, 20, 90, 0.25);
}

.end-title {
    margin: 16px 0 8px;
    color: #1d1630;
    font-size: 25px;
    line-height: 1.2;
}

.end-text {
    margin: 0 0 24px;
    color: #4a4460;
    font-size: 15px;
    line-height: 1.5;
}

.end-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.end-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 20px;
    border-radius: 26px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.end-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex: none;
}

.end-btn.primary {
    color: #fff;
    background: linear-gradient(135deg, #8d4bff, #5b2bd6);
    box-shadow: 0 8px 20px rgba(91, 43, 214, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.end-btn.secondary {
    color: #5b2bd6;
    background: rgba(255, 255, 255, 0.75);
    box-shadow: inset 0 0 0 2px rgba(91, 43, 214, 0.55);
}

.end-btn:active {
    transform: scale(0.97);
}

@media (hover: hover) {
    .end-btn.primary:hover { box-shadow: 0 10px 26px rgba(91, 43, 214, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25); transform: translateY(-1px); }
    .end-btn.secondary:hover { background: #fff; }
}

.end-btn:focus-visible {
    outline: 3px solid rgba(91, 43, 214, 0.45);
    outline-offset: 3px;
}

.install-hint {
    font-size: 13px;
    opacity: 0.85;
    max-width: 320px;
}

.boot-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1d1530;
}

/* БГ | EN on the screens before the game (LanguageSwitch) */
.header .lang-switch {
    position: absolute;
    top: calc(var(--safe-top) + 18px);
    right: 14px;
    min-width: 42px;
    height: 29px;
    padding: 0 10px;
    border: 1px solid currentColor;
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    font: inherit;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    pointer-events: auto;
    cursor: pointer;
}
