/* DOM overlay for Idle Junkyard Empire 3D.
   #ui-root is pointer-events:none; ONLY interactive leaves opt back in, so
   the WebGL canvas receives all world input with zero coordinate
   forwarding. */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%; height: 100%;
    background: #D4A96A;
    overflow: hidden;
    /* CrazyGames embeds the game in an iframe on a scrolling page: stop
       wheel / PageDown scrolls inside the game from chaining to that page. */
    overscroll-behavior: none;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    position: fixed;
    inset: 0;
    font-family: var(--font-body);
}

#app {
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1920px;   /* same ultrawide cap as the 2D game */
    height: 100vh;
    height: 100dvh;
}

#gl { display: block; width: 100%; height: 100%; }

#ui-root {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

/* ── World-anchored labels (projected each frame / at spawn) ── */
#world-labels { position: absolute; inset: 0; pointer-events: none; }

.float-text {
    position: absolute;
    left: 0; top: 0;
    transform: translate(-50%, -100%);
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px #000, 0 0 4px rgba(0,0,0,0.7);
    white-space: nowrap;
    opacity: 0;
    will-change: transform, opacity;
}
.float-text.on {
    animation: floatRise 1.1s ease-out forwards;
}
@keyframes floatRise {
    0%   { opacity: 0; transform: translate(-50%, -100%) scale(0.5); }
    12%  { opacity: 1; transform: translate(-50%, -110%) scale(1.15); }
    100% { opacity: 0; transform: translate(-50%, -240%) scale(1.0); }
}

.world-bar {
    position: absolute;
    left: 0; top: 0;
    width: 54px; height: 8px;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.8);
    border-radius: 4px;
    overflow: hidden;
    will-change: transform;
}
.world-bar > i {
    display: block;
    height: 100%;
    width: 100%;
    background: var(--buy);
    transform-origin: left center;
    transform: scaleX(1);
}

/* Worker status bubble (📱 🥪 💤 ❗ … STRIKE) — readable at gameplay zoom. */
.wk-bubble {
    position: absolute;
    left: 0; top: 0;
    pointer-events: none;
    will-change: transform;
}
.wk-bubble > span {
    position: relative;
    display: block;
    min-width: 34px; height: 34px;
    padding: 0 7px;
    box-sizing: border-box;
    border-radius: 17px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    color: #2C3E50;
    font: 800 20px/34px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-align: center;
    animation: wk-bubble-bob 1.4s ease-in-out infinite;
}
.wk-bubble > span::after {
    content: '';
    position: absolute;
    left: 50%; bottom: -6px;
    margin-left: -6px;
    border: 6px solid transparent;
    border-bottom: 0;
    border-top-color: rgba(255, 255, 255, 0.96);
}
.wk-bubble.strike > span { background: #E74C3C; color: #fff; font-size: 13px; letter-spacing: 0.5px; }
.wk-bubble.strike > span::after { border-top-color: #E74C3C; }
.wk-bubble.alert > span { background: #F1C40F; }
.wk-bubble.alert > span::after { border-top-color: #F1C40F; }
.wk-bubble.wait > span { color: #7F8C8D; }
@keyframes wk-bubble-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .wk-bubble > span { animation: none; } }

.pile-label {
    position: absolute;
    left: 0; top: 0;
    transform: translate(-50%, -100%);
    font-size: 13px;
    font-weight: bold;
    color: var(--buy-lt);
    text-shadow: 0 1px 2px #000;
    will-change: transform;
}

/* Cash total above a banknote-bundle stack (one per pile cluster). */
.cash-label {
    position: absolute;
    left: 0; top: 0;
    display: flex; align-items: center; gap: 3px;
    padding: 1px 9px 1px 3px;
    background: var(--paper, #FFF4DC);
    border: 2px solid var(--outline, #12171D);
    border-radius: 999px;
    box-shadow: 0 3px 0 var(--outline, #12171D);
    font-family: var(--font-display, sans-serif);
    font-size: 16px; line-height: 20px;
    color: var(--buy-dk, #1F8A2E);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
    will-change: transform;
}
.cash-label svg { width: 20px; height: 20px; flex: none; }

/* Banknote flying from a collected stack to the money counter (Juice.billFly). */
.bill-fx {
    position: absolute; left: 0; top: 0;
    width: 30px; height: 16px; margin: -8px 0 0 -15px;
    background: #3E9B4F;
    border: 2px solid var(--outline, #12171D);
    border-radius: 3px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, .35);
    pointer-events: none;
    will-change: transform, opacity;
}
.bill-fx::after {
    content: '$';
    position: absolute; left: 9px; top: 0; bottom: 0; width: 8px;
    background: var(--paper, #FFF4DC);
    color: #1F8A2E;
    font: 10px/12px var(--font-display, sans-serif);
    text-align: center;
}

/* ── Debug overlay ── */
#debug-overlay {
    position: absolute;
    bottom: calc(6px + env(safe-area-inset-bottom));
    right: calc(8px + env(safe-area-inset-right));
    font-size: 11px;
    font-family: monospace;
    color: #EAF2F8;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 8px;
    border-radius: 6px;
    pointer-events: none;
    white-space: pre;
}

/* ── R15 title shot + loading screen (Nati's World UI line) ──────────── */
#boot-splash {
    position: fixed; inset: 0; z-index: 99999;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
    background: radial-gradient(circle at 50% 40%, #29445f, #0e141c 70%);
    color: #fff; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#boot-splash .boot-logo { font-weight: 800; font-size: 34px; letter-spacing: 0.5px; text-shadow: 0 2px 12px rgba(0,0,0,.35); }
#boot-splash .boot-logo span { color: #ffe27a; }
#boot-splash .boot-bar { width: 280px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; }
#boot-splash .boot-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #7fd4ff, #b8f28a); transition: width .2s ease; }
#boot-splash .boot-status { font-size: 12px; color: rgba(255,255,255,.7); }

/* ── Cheat panel (backtick) ─────────────────────────────────────────── */
#cheat-panel {
    position: absolute; z-index: 60; top: calc(70px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right));
    width: min(340px, calc(100vw - 20px)); max-height: calc(100% - 90px);
    display: none; flex-direction: column; border-radius: 14px; overflow: hidden;
    pointer-events: auto; color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#cheat-panel.open { display: flex; animation: cheat-in .18s var(--spring-open); }
@keyframes cheat-in { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
#cheat-panel .cheat-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; font-weight: 800; font-size: 15px; border-bottom: 1px solid rgba(255,255,255,.12);
}
#cheat-panel .cheat-x { background: none; border: 0; color: var(--ink); font-size: 16px; cursor: pointer; padding: 4px 8px; }
#cheat-panel .cheat-scroll { overflow-y: auto; padding: 8px 12px 14px; }
#cheat-panel .cheat-sec { margin: 12px 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .5px; color: #ffe27a; }
#cheat-panel .cheat-row { display: flex; gap: 6px; margin-bottom: 6px; }
#cheat-panel .cheat-wrap { flex-wrap: wrap; }
#cheat-panel .cheat-btn {
    flex: 1 1 auto; min-height: 34px; padding: 6px 8px; border-radius: 9px; cursor: pointer;
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); color: var(--ink);
    font: 600 12px/1.15 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#cheat-panel .cheat-btn:hover { background: rgba(40,90,140,.6); }
#cheat-panel .cheat-btn:disabled { opacity: .4; cursor: not-allowed; }
#cheat-panel .cheat-sm { flex: 0 1 auto; font-size: 11px; text-transform: capitalize; }
#cheat-panel .cheat-wide { flex: 1 1 100%; }
#cheat-panel .cheat-hero {
    width: 100%; min-height: 44px; font-size: 15px; font-weight: 800; color: #1d2733;
    background: linear-gradient(180deg, #ffe27a, #f1c40f); border-color: rgba(255,255,255,.6);
}
#cheat-panel .cheat-hero:hover { background: linear-gradient(180deg, #fff0a8, #f4d03f); }
#cheat-panel .cheat-danger { background: rgba(192,57,43,.35); border-color: rgba(231,76,60,.6); }
#cheat-panel .cheat-note { font-size: 11px; color: var(--ink-dim); margin: 6px 2px 2px; line-height: 1.35; }
#cheat-panel .cheat-done { font-size: 12px; color: var(--buy-lt); padding: 6px 2px; }
#cheat-open-btn {
    position: absolute; z-index: 30; left: calc(12px + env(safe-area-inset-left)); top: calc(62px + env(safe-area-inset-top));
    pointer-events: auto;
}
#ui-root.title-mode #cheat-panel, #ui-root.title-mode #cheat-open-btn { visibility: hidden; }
#cheat-panel.glass { background: rgba(14, 22, 32, 0.93); }

