/* Fuga prin Carpați — a 3D endless runner on a mountain road (js/fuga-prin-carpati.js).
   Theme-aware like the other game pages: tokens on :root, redefined under body.dark-theme.
   The mountain follows the theme too: a clear summer day in light, dusk over the ridges in dark. */
:root {
    --fc-accent: #15803d;
    --fc-accent-2: #b45309;
    --fc-on-accent: #ffffff;
    --fc-page-bg: #f0fdf4;
    --fc-card-bg: #ffffff;
    --fc-card-border: #bbf7d0;
    --fc-muted: #4b5f52;
    --fc-shadow: 0 10px 30px rgba(20, 83, 45, .16);
    --fc-stage-bg: #9cc9ea;
    --fc-overlay: rgba(10, 25, 15, .42);
    --fc-chip-bg: #f0fdf4;
    --fc-glass: rgba(10, 20, 14, .55);
    --fc-gold: #f59e0b;
    --fc-bar: rgba(255, 255, 255, .28);
}

body.dark-theme {
    --fc-accent: #4ade80;
    --fc-accent-2: #fbbf24;
    --fc-on-accent: #052e16;
    --fc-page-bg: #07110b;
    --fc-card-bg: #102017;
    --fc-card-border: #1f3d2b;
    --fc-muted: #a8c4b2;
    --fc-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    --fc-stage-bg: #151a33;
    --fc-overlay: rgba(3, 8, 5, .6);
    --fc-chip-bg: #16291e;
    --fc-glass: rgba(4, 10, 7, .62);
    --fc-gold: #fbbf24;
    --fc-bar: rgba(255, 255, 255, .2);
}

/* clip, not hidden: the site-wide `body { overflow-x: hidden }` makes <body> a scroll
   container that never scrolls, which silently kills any position: sticky inside. */
.fc-body, body.fc-body#page-top {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--fc-page-bg);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: clip;
}
body.fc-max { overflow: hidden; }
body.fc-playing { overscroll-behavior: none; }
.fc-main { padding-top: 96px; padding-bottom: 40px; }
.fc-game .container, .fc-hero .container { max-width: 900px; }

/* ---- hero ---- */
.fc-hero { text-align: center; padding: 4px 0 12px; }
.fc-hero h1 { font-weight: 800; font-size: clamp(1.6rem, 5vw, 2.3rem); margin: 0 0 6px; display: inline-flex; align-items: center; gap: 12px; }
.fc-hero-icon { width: 46px; height: 46px; border-radius: 14px; display: inline-grid; place-items: center; font-size: 22px; color: #fff; background: linear-gradient(135deg, #16a34a, #0e7490); box-shadow: var(--fc-shadow); }
.fc-lead { max-width: 640px; margin: 0 auto; color: var(--fc-muted); font-size: 1rem; line-height: 1.55; }

/* ---- the stage: the 3D road fills it ---- */
.fc-stage {
    --fc-h: clamp(460px, calc(100vh - 150px), 820px);
    position: relative;
    height: var(--fc-h);
    width: 100%;
    margin: 0 auto;
    background: var(--fc-stage-bg);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--fc-shadow);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    color: #fff;
}
@supports (height: 100svh) {
    .fc-stage { --fc-h: clamp(460px, calc(100svh - 150px), 820px); }
}
.fc-stage:focus-visible { box-shadow: 0 0 0 3px var(--fc-accent), var(--fc-shadow); }
@media (max-width: 575.98px) {
    .fc-stage { width: calc(100% + 24px); margin: 0 -12px; border-radius: 0; }
}
.fc-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
.fc-stage:fullscreen { width: 100%; height: 100%; border-radius: 0; margin: 0; }
.fc-stage:-webkit-full-screen { width: 100%; height: 100%; border-radius: 0; margin: 0; }
.fc-stage.is-max { position: fixed; inset: 0; z-index: 1052; width: 100vw; height: 100vh; margin: 0; border-radius: 0; }
@supports (height: 100dvh) { .fc-stage.is-max { height: 100dvh; } }

/* ---- HUD ---- */
.fc-hud { position: absolute; left: 10px; right: 62px; top: 10px; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.fc-hud[hidden] { display: none; }
.fc-box { display: flex; flex-direction: column; align-items: flex-start; min-width: 104px; padding: 6px 12px 7px; border-radius: 14px; background: var(--fc-glass); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); line-height: 1.1; }
.fc-box-top { font-size: .74rem; font-weight: 700; opacity: .9; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.fc-box-top #fc-mult { color: #fde68a; }
.fc-score { font-size: 1.7rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.fc-box-sub { font-size: .8rem; opacity: .92; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fc-coins { display: flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; background: var(--fc-glass); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); font-variant-numeric: tabular-nums; }
.fc-coins strong { font-size: 1.25rem; font-weight: 900; min-width: 2ch; text-align: right; }
.fc-coins.is-bump strong { animation: fc-bump .25s ease-out; }
@keyframes fc-bump { 40% { transform: scale(1.25); color: #fde68a; } }
.fc-coin-ico { width: 20px; height: 20px; flex: none; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff7c2, #fbbf24 45%, #b45309 100%); box-shadow: inset 0 0 0 2px rgba(146, 64, 14, .55); }

.fc-powers { position: absolute; left: 10px; top: 92px; z-index: 2; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.fc-pw { display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 6px; border-radius: 999px; background: var(--fc-glass); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.fc-pw[hidden] { display: none; }
.fc-pw-ico { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 900; color: #fff; }
.fc-pw-magnet .fc-pw-ico { background: #dc2626; }
.fc-pw-scut .fc-pw-ico { background: #2563eb; }
.fc-pw-x2 .fc-pw-ico { background: #d97706; font-size: 12px; }
.fc-pw-bar { width: 64px; height: 7px; border-radius: 999px; background: var(--fc-bar); overflow: hidden; }
.fc-pw-fill { display: block; height: 100%; width: 100%; border-radius: inherit; background: #fff; transform-origin: left center; }
.fc-pw.is-low .fc-pw-ico { animation: fc-blink .5s steps(2) infinite; }
@keyframes fc-blink { 50% { opacity: .35; } }

.fc-tools { position: absolute; right: 10px; top: 10px; z-index: 4; display: flex; flex-direction: column; gap: 8px; }
.fc-round { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--fc-glass); color: #fff; font-size: 16px; cursor: pointer; touch-action: manipulation; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.fc-round:hover, .fc-round:focus-visible { background: rgba(21, 128, 61, .92); }
.fc-round:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.fc-round[hidden], .fc-round span[hidden] { display: none; }

/* ---- big messages ---- */
.fc-banner { position: absolute; left: 50%; top: 30%; z-index: 3; transform: translate(-50%, -50%) scale(.9); margin: 0; padding: 10px 22px; border-radius: 18px; max-width: 92%; text-align: center; color: #fff; font-weight: 900; font-size: clamp(1.3rem, 6.5vw, 2.3rem); line-height: 1.15; letter-spacing: .02em; text-shadow: 0 3px 12px rgba(0, 0, 0, .5); background: rgba(10, 20, 14, .55); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.fc-banner.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.fc-banner small { display: block; font-size: .5em; font-weight: 700; letter-spacing: 0; opacity: .92; }
.fc-banner.is-good { background: linear-gradient(135deg, rgba(22, 163, 74, .92), rgba(14, 116, 144, .9)); }
.fc-banner.is-gold { background: linear-gradient(135deg, rgba(245, 158, 11, .95), rgba(217, 119, 6, .9)); }
.fc-banner.is-cool { background: linear-gradient(135deg, rgba(37, 99, 235, .9), rgba(14, 165, 233, .9)); }
.fc-banner.is-bad { background: linear-gradient(135deg, rgba(185, 28, 28, .92), rgba(124, 45, 18, .9)); }
.fc-banner.is-count { font-size: clamp(3rem, 18vw, 5.5rem); background: transparent; padding: 0 10px; }

.fc-swipe { position: absolute; left: 50%; bottom: 18px; z-index: 2; transform: translateX(-50%); margin: 0; padding: 8px 14px; border-radius: 999px; background: var(--fc-glass); font-weight: 700; font-size: .92rem; white-space: nowrap; pointer-events: none; max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; }
.fc-swipe[hidden] { display: none; }
.fc-swipe-icon { display: inline-block; animation: fc-swipe 1.6s ease-in-out infinite; }
@keyframes fc-swipe { 0%, 15% { transform: translateX(-6px); opacity: .5; } 60% { transform: translateX(8px); opacity: 1; } 100% { transform: translateX(8px); opacity: 0; } }
.fc-loading { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; margin: 0; padding: 20px; text-align: center; color: #fff; font-weight: 700; background: linear-gradient(#7fb7e3, #3f6b2a); }
.fc-loading[hidden] { display: none; }

/* ---- overlays ---- */
.fc-overlay { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 14px; background: var(--fc-overlay); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); overflow-y: auto; touch-action: manipulation; color: var(--text-color); }
.fc-overlay[hidden] { display: none; }
.fc-card { width: 100%; max-width: 390px; margin: auto; display: flex; flex-direction: column; gap: 10px; padding: 18px 16px; border-radius: 18px; background: var(--fc-card-bg); border: 1px solid var(--fc-card-border); box-shadow: var(--fc-shadow); color: var(--text-color); text-align: center; }
.fc-card h2 { font-weight: 800; font-size: 1.4rem; margin: 0; }
.fc-opt { display: flex; flex-direction: column; gap: 6px; }
.fc-label { font-weight: 700; font-size: .9rem; color: var(--fc-muted); }
.fc-chips { display: flex; gap: 6px; justify-content: center; }
.fc-chip { flex: 1; min-height: 44px; padding: 4px 8px; border-radius: 12px; border: 1px solid var(--fc-card-border); background: var(--fc-chip-bg); color: inherit; font-weight: 700; cursor: pointer; touch-action: manipulation; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.fc-chip[aria-checked="true"] { background: var(--fc-accent); border-color: var(--fc-accent); color: var(--fc-on-accent); }
.fc-chip:focus-visible, .fc-btn:focus-visible { outline: 2px solid var(--fc-accent); outline-offset: 2px; }

.fc-missions { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 10px; border-radius: 14px; background: var(--fc-chip-bg); border: 1px solid var(--fc-card-border); }
.fc-missions:empty { display: none; }
.fc-mhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 800; font-size: .9rem; }
.fc-mhead .fc-multtag { padding: 2px 9px; border-radius: 999px; background: var(--fc-accent-2); color: #fff; font-size: .8rem; }
.fc-m { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 4px 8px; font-size: .86rem; line-height: 1.25; }
.fc-m-ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; border: 2px solid var(--fc-card-border); color: transparent; }
.fc-m.is-done .fc-m-ico { background: var(--fc-accent); border-color: var(--fc-accent); color: var(--fc-on-accent); }
.fc-m.is-done .fc-m-txt { text-decoration: line-through; opacity: .7; }
.fc-m-n { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--fc-muted); font-size: .8rem; }
.fc-m-bar { grid-column: 2 / 4; height: 5px; border-radius: 999px; background: var(--fc-card-border); overflow: hidden; }
.fc-m-bar span { display: block; height: 100%; background: var(--fc-accent); border-radius: inherit; }
.fc-missions-small .fc-m { font-size: .8rem; }

.fc-btn { min-height: 48px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--fc-card-border); background: var(--fc-card-bg); color: inherit; font-weight: 700; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; touch-action: manipulation; }
.fc-btn:hover { border-color: var(--fc-accent); }
.fc-btn[hidden] { display: none; }
.fc-btn:disabled { opacity: .5; cursor: not-allowed; }
.fc-btn-primary { background: var(--fc-accent); border-color: var(--fc-accent); color: var(--fc-on-accent); }
.fc-btn-big { min-height: 56px; font-size: 1.15rem; }
.fc-btn-gold { background: linear-gradient(135deg, #f59e0b, #d97706); border-color: #d97706; color: #fff; }
.fc-bank { font-variant-numeric: tabular-nums; }
.fc-bank::before { content: ""; display: inline-block; width: .9em; height: .9em; margin-right: 4px; vertical-align: -.1em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff7c2, #fbbf24 45%, #b45309 100%); }

.fc-shop-list { display: flex; flex-direction: column; gap: 8px; }
.fc-up { display: grid; grid-template-columns: 38px 1fr auto; gap: 4px 10px; align-items: center; padding: 10px; border-radius: 14px; background: var(--fc-chip-bg); border: 1px solid var(--fc-card-border); text-align: left; }
.fc-up-ico { grid-row: 1 / 3; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 900; }
.fc-up-name { font-weight: 800; font-size: .95rem; }
.fc-up-sub { grid-column: 2; font-size: .78rem; color: var(--fc-muted); }
.fc-up-dots { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.fc-up-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--fc-card-border); }
.fc-up-dots i.is-on { background: var(--fc-accent); }
.fc-up .fc-btn { grid-row: 1 / 3; grid-column: 3; min-height: 44px; padding: 6px 10px; font-size: .88rem; }

.fc-over-icon { width: 54px; height: 54px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 24px; color: #fff; background: linear-gradient(135deg, #16a34a, #0e7490); }
.fc-over-big { margin: 0; font-size: 2.6rem; font-weight: 900; line-height: 1; color: var(--fc-accent); font-variant-numeric: tabular-nums; }
.fc-over-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fc-over-list li { display: flex; flex-direction: column; padding: 8px 6px; border-radius: 12px; background: var(--fc-chip-bg); font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.fc-over-list li small { font-weight: 600; font-size: .72rem; color: var(--fc-muted); }
.fc-over-sub { margin: 0; color: var(--fc-muted); font-size: .92rem; }
.fc-over-sub:empty { display: none; }
.fc-over-sub.is-record { color: var(--fc-accent-2); font-weight: 800; }

.fc-actions { display: flex; justify-content: center; margin: 14px 0 10px; }
.fc-actions .fc-btn { min-width: 180px; }
.fc-record { margin: 12px 0 0; text-align: center; color: var(--fc-muted); font-size: .9rem; line-height: 1.6; }
.fc-record:empty { display: none; }
.fc-reset-wrap { text-align: center; margin: 2px 0 12px; }
.fc-link { border: 0; background: none; padding: 6px; color: var(--fc-muted); font-size: .85rem; text-decoration: underline; cursor: pointer; }

/* ---- help ---- */
.fc-help { margin: 8px auto 0; padding: 12px 14px; border-radius: 14px; background: var(--fc-card-bg); border: 1px solid var(--fc-card-border); }
.fc-help summary { font-weight: 700; cursor: pointer; min-height: 32px; }
.fc-help ul { margin: 10px 0 4px; padding-left: 20px; line-height: 1.55; }
.fc-help li { margin-bottom: 4px; }
.fc-credit { margin: 8px 0 0; font-size: .82rem; color: var(--fc-muted); }
.fc-powered { text-align: center; color: var(--fc-muted); font-size: .85rem; margin: 22px 0 0; }
.fc-powered a { color: var(--fc-accent); }
body.dark-theme .fc-help kbd { background: #1f3d2b; }
body.dark-theme .fc-box, body.dark-theme .fc-coins, body.dark-theme .fc-round, body.dark-theme .fc-pw, body.dark-theme .fc-swipe { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }

@media (max-width: 420px) {
    .fc-main { padding-top: 88px; }
    .fc-score { font-size: 1.5rem; }
    .fc-card { padding: 16px 12px; gap: 9px; }
    .fc-m { font-size: .82rem; }
}
@media (max-height: 560px) and (orientation: landscape) {
    .fc-powers { top: 82px; }
    .fc-card { gap: 7px; padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .fc-swipe-icon, .fc-pw.is-low .fc-pw-ico, .fc-coins.is-bump strong { animation: none; }
    .fc-banner { transition: none; }
}
