/* Voxel Builder 3D: game box, HUD, menus. Phone first; every tap target is at least 44px. */
:root {
  --vx-bg: #0b1220; --vx-panel: rgba(14, 22, 38, .94); --vx-line: rgba(255, 255, 255, .14);
  --vx-ink: #f2f6ff; --vx-dim: #9fb0cc; --vx-acc: #4fd18b; --vx-acc2: #ffcf4a; --vx-bad: #ff6b5e; --vx-hp: #e5483d; --vx-hu: #d79a38; --vx-air: #4aa8ff;
}
.vx-wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.vx-bar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.vx-bar-top p { margin: 0; color: var(--vx-dim); font-size: 14px; }
.vx-openbtn, .vx-exitbtn { min-height: 44px; min-width: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--vx-line); background: #1a2a46; color: var(--vx-ink); font: 600 15px/1 system-ui, sans-serif; cursor: pointer; }
.vx-openbtn { background: var(--vx-acc); color: #062a17; border-color: transparent; }

#vx-stage { position: relative; width: 100%; aspect-ratio: 16 / 10; max-height: 78vh; min-height: 300px; background: var(--vx-bg); border-radius: 14px; overflow: hidden; color: var(--vx-ink); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; isolation: isolate; }
@media (max-width: 640px) { #vx-stage { aspect-ratio: 4 / 5; max-height: 82vh; min-height: 360px; border-radius: 10px; } }
@media (orientation: landscape) and (max-height: 520px) { #vx-stage { aspect-ratio: 16 / 9; max-height: 92vh; min-height: 240px; } }
#vx-stage.vx-full { position: fixed; inset: 0; z-index: 9999; width: 100vw; height: 100vh; height: 100dvh; max-height: none; aspect-ratio: auto; border-radius: 0; }
body.vx-noscroll { overflow: hidden; }
#game-canvas, #vx-surface { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#vx-surface { z-index: 1; }
#vx-stage #game-canvas { height: 100%; max-width: none; margin: 0; border-radius: 0; box-shadow: none; }
#vx-fade { position: absolute; inset: 0; z-index: 30; pointer-events: none; opacity: 0; }
#vx-exit { position: absolute; top: 58px; right: 8px; z-index: 25; background: rgba(10, 16, 30, .8); }
#vx-exit[hidden], #play-big[hidden] { display: none; }

/* HUD */
.vx-hud { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.vx-hud button { pointer-events: auto; font-family: inherit; }
.vx-vig { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(200, 20, 20, .7)); }
.vx-tint { position: absolute; inset: 0; opacity: 0; background: rgba(40, 90, 200, .35); transition: opacity .2s; }
.vx-cross { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; }
.vx-cross::before, .vx-cross::after { content: ""; position: absolute; background: rgba(255, 255, 255, .85); box-shadow: 0 0 2px #000; }
.vx-cross::before { left: 6px; top: 0; width: 2px; height: 14px; } .vx-cross::after { top: 6px; left: 0; height: 2px; width: 14px; }
.vx-top { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.vx-ibtn { min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--vx-line); background: rgba(10, 16, 30, .72); color: var(--vx-ink); font-weight: 700; font-size: 14px; cursor: pointer; }
.vx-chip { flex: 1 1 auto; min-height: 44px; max-width: 60%; border: 1px solid var(--vx-line); border-radius: 12px; background: rgba(10, 16, 30, .6); color: var(--vx-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px 10px; cursor: pointer; }
.vx-chip b { font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-chip span { font-size: 12px; color: var(--vx-dim); }
.vx-bars { position: absolute; top: 60px; left: 8px; width: 120px; display: grid; gap: 4px; }
.vx-bar { position: relative; height: 14px; border-radius: 7px; background: rgba(0, 0, 0, .5); overflow: hidden; }
.vx-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--vx-hp); }
.vx-bar.hu i { background: var(--vx-hu); } .vx-bar.air i { background: var(--vx-air); }
.vx-bar span { position: relative; z-index: 1; display: block; text-align: center; font-size: 10px; line-height: 14px; font-weight: 700; text-shadow: 0 1px 1px #000; }
.vx-obj { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); width: min(92%, 360px); display: none; background: var(--vx-panel); border: 1px solid var(--vx-line); border-radius: 12px; padding: 8px 10px; pointer-events: none; }
.vx-obj.open { display: block; }
.vx-obj-title { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.vx-obj-row { position: relative; display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 4px 6px; margin-bottom: 3px; border-radius: 6px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.vx-obj-row > * { position: relative; z-index: 1; } .vx-obj-row em { font-style: normal; color: var(--vx-dim); }
.vx-obj-row i { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(79, 209, 139, .25); z-index: 0; }
.vx-obj-row.done span { text-decoration: line-through; color: var(--vx-acc); }
.vx-banners { position: absolute; left: 0; right: 0; top: 26%; display: grid; justify-items: center; gap: 6px; pointer-events: none; padding: 0 12px; }
.vx-banner { max-width: 92%; padding: 8px 14px; border-radius: 12px; background: rgba(10, 16, 30, .82); border: 1px solid var(--vx-line); font-size: 14px; font-weight: 600; text-align: center; opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
.vx-banner.on { opacity: 1; transform: none; }
.vx-hint { position: absolute; left: 50%; bottom: 112px; transform: translateX(-50%); max-width: 90%; padding: 8px 14px; border-radius: 12px; background: rgba(255, 207, 74, .94); color: #261c00; font-weight: 700; font-size: 14px; text-align: center; opacity: 0; transition: opacity .2s; pointer-events: none; }
.vx-hint.on { opacity: 1; }
.vx-hotbar { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); display: flex; gap: 4px; max-width: calc(100% - 16px); overflow-x: auto; padding: 4px; border-radius: 12px; background: rgba(10, 16, 30, .7); border: 1px solid var(--vx-line); pointer-events: auto; touch-action: pan-x; scrollbar-width: none; }
.vx-hotbar::-webkit-scrollbar { display: none; }
.vx-slot { position: relative; flex: 0 0 44px; width: 44px; height: 44px; border-radius: 8px; border: 2px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06); display: grid; place-items: center; cursor: pointer; }
.vx-slot.sel { border-color: var(--vx-acc2); background: rgba(255, 207, 74, .2); }
.vx-slot img { image-rendering: pixelated; width: 32px; height: 32px; pointer-events: none; }
.vx-slot i { position: absolute; right: 2px; bottom: 0; font-size: 11px; font-style: normal; font-weight: 700; text-shadow: 0 1px 2px #000; pointer-events: none; }

/* touch controls only show once a touch pointer was seen */
.vx-stickbase, .vx-btns { display: none; }
.vx-touch .vx-btns { display: block; }
.vx-stickbase { position: absolute; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .08); pointer-events: none; opacity: 0; left: 0; top: 0; }
.vx-touch .vx-stickbase { display: block; }
.vx-stickknob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255, 255, 255, .45); }
.vx-btns { position: absolute; right: 10px; bottom: 70px; width: 170px; height: 170px; pointer-events: none; }
.vx-act { position: absolute; width: 68px; height: 68px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .38); background: rgba(10, 16, 30, .55); color: var(--vx-ink); font-weight: 800; font-size: 13px; touch-action: none; }
.vx-act:active { background: rgba(79, 209, 139, .5); }
.vx-break { right: 0; bottom: 56px; width: 76px; height: 76px; background: rgba(229, 72, 61, .5); }
.vx-place { right: 82px; bottom: 6px; background: rgba(79, 209, 139, .45); }
.vx-jump { right: 0; bottom: 0; width: 64px; height: 64px; }
.vx-down { right: 78px; bottom: 90px; width: 56px; height: 56px; }
@media (max-width: 400px) { .vx-btns { transform: scale(.9); transform-origin: right bottom; } }

/* layer: menus and bag */
#vx-layer { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
#vx-layer.open { pointer-events: auto; background: rgba(6, 10, 20, .55); }
.vx-screen { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; display: flex; justify-content: center; align-items: flex-start; padding: 10px; -webkit-overflow-scrolling: touch; }
.vx-panel { width: min(100%, 470px); margin: auto; background: var(--vx-panel); border: 1px solid var(--vx-line); border-radius: 16px; padding: 16px; display: grid; gap: 10px; }
.vx-panel h1, .vx-panel h2, .vx-panel h3, .vx-panel p { margin: 0; }
.vx-logo { font-size: 28px; line-height: 1.05; text-align: center; letter-spacing: .5px; color: var(--vx-acc); }
.vx-sub, .vx-note, .vx-panel small { color: var(--vx-dim); font-size: 13px; }
.vx-sub { text-align: center; }
.vx-ph { display: flex; align-items: center; gap: 10px; } .vx-ph h2 { font-size: 20px; }
.vx-back { min-width: 44px; min-height: 44px; border-radius: 12px; border: 1px solid var(--vx-line); background: #1a2a46; color: var(--vx-ink); font-size: 20px; cursor: pointer; }
.vx-btn { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--vx-line); background: #1a2a46; color: var(--vx-ink); font: 600 15px/1.1 inherit; cursor: pointer; }
.vx-btn.primary { background: var(--vx-acc); color: #062a17; border-color: transparent; }
.vx-btn:disabled { opacity: .45; cursor: default; }
.vx-btn.danger { background: #4a1a1a; border-color: #8a2d2d; }
.vx-row { display: flex; gap: 8px; } .vx-row > * { flex: 1 1 0; }
.vx-col { display: grid; gap: 8px; }
.vx-mode { display: grid; gap: 2px; text-align: left; min-height: 56px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--vx-line); color: var(--vx-ink); cursor: pointer; font-family: inherit; }
.vx-mode b { font-size: 17px; } .vx-mode span { font-size: 12.5px; color: rgba(255, 255, 255, .78); }
.vx-m-stage { background: linear-gradient(135deg, #1f5f46, #164232); } .vx-m-daily { background: linear-gradient(135deg, #6a4a10, #47320c); }
.vx-m-surv { background: linear-gradient(135deg, #5a2a2a, #3a1c1c); } .vx-m-crea { background: linear-gradient(135deg, #264a82, #1a3258); }
.vx-prof { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vx-lv { flex: 1; display: grid; gap: 3px; }
.vx-xp { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; } .vx-xp i { display: block; height: 100%; background: var(--vx-acc); }
.vx-coins { text-align: center; } .vx-coins b { display: block; font-size: 20px; color: var(--vx-acc2); } .vx-coins.big b { font-size: 26px; }
.vx-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vx-card { position: relative; min-height: 84px; padding: 8px 6px; border-radius: 12px; border: 1px solid var(--vx-line); background: #1a2a46; color: var(--vx-ink); display: grid; gap: 2px; justify-items: center; align-content: center; font-family: inherit; cursor: pointer; text-align: center; }
.vx-card em { font-style: normal; color: var(--vx-acc2); font-weight: 800; } .vx-card b { font-size: 12.5px; }
.vx-card.locked { opacity: .5; } .vx-lock { font-size: 10.5px; color: var(--vx-dim); }
.vx-stars { letter-spacing: 2px; font-size: 14px; } .vx-stars b { color: rgba(255, 255, 255, .22); } .vx-stars b.on { color: var(--vx-acc2); }
.vx-bigstars { color: var(--vx-acc2); font-size: 38px; letter-spacing: 6px; text-align: center; }
.vx-list { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 4px; }
.vx-up { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--vx-line); }
.vx-up > div { display: grid; gap: 2px; } .vx-up span { font-size: 12.5px; color: var(--vx-dim); }
.vx-ach { display: grid; gap: 6px; }
.vx-a { display: grid; gap: 1px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .05); opacity: .6; }
.vx-a.got { opacity: 1; background: rgba(79, 209, 139, .14); } .vx-a span { font-size: 12.5px; color: var(--vx-dim); }
.vx-field { display: grid; gap: 4px; font-size: 13px; color: var(--vx-dim); }
.vx-field input[type=text], .vx-seed { min-height: 44px; border-radius: 10px; border: 1px solid var(--vx-line); background: #0d1626; color: var(--vx-ink); padding: 0 12px; font-size: 16px; }
.vx-set { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.vx-seg { display: flex; gap: 4px; } .vx-seg button { min-height: 44px; min-width: 52px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--vx-line); background: #14213a; color: var(--vx-ink); font-family: inherit; cursor: pointer; }
.vx-seg button.on { background: var(--vx-acc); color: #062a17; }
.vx-sens { width: 140px; min-height: 44px; }
.vx-res { display: grid; gap: 8px; text-align: center; } .vx-meter { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.vx-spin { width: 34px; height: 34px; margin: 6px auto; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .2); border-top-color: var(--vx-acc); animation: vxspin .9s linear infinite; }
@keyframes vxspin { to { transform: rotate(360deg); } }
.vx-small .vx-panel { width: min(100%, 360px); text-align: center; }

/* bag */
.vx-bagpanel { width: min(100%, 520px); }
.vx-tabs { display: flex; gap: 6px; flex-wrap: wrap; } .vx-tabs button { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--vx-line); background: #14213a; color: var(--vx-ink); font-family: inherit; cursor: pointer; }
.vx-tabs button.on { background: var(--vx-acc2); color: #261c00; }
.vx-slots { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; } .vx-slots .vx-slot { width: auto; flex: none; min-width: 0; }
@media (max-width: 440px) { .vx-slots { grid-template-columns: repeat(6, 1fr); } }
.vx-rec { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, .05); }
.vx-rec.off { opacity: .45; } .vx-needs, .vx-ing { font-size: 12px; color: var(--vx-dim); }
.vx-furn, .vx-out { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vx-flag { color: var(--vx-acc2); }
.vx-scroll { overflow-y: auto; max-height: 46vh; touch-action: pan-y; }
.vx-boot { display: none; }
@media (prefers-reduced-motion: reduce) { .vx-spin { animation-duration: 3s; } .vx-banner { transition: none; } }
.vx-tag { font-style: normal; font-size: 11px; font-weight: 800; margin-left: 6px; padding: 2px 7px; border-radius: 999px; background: var(--vx-acc2); color: #261c00; vertical-align: 2px; }
.vx-card.next { border-color: var(--vx-acc2); box-shadow: 0 0 0 2px rgba(255, 207, 74, .35); animation: vx-pulse 1.8s ease-in-out infinite; }
.vx-nexttag { font-size: 10.5px; font-weight: 800; color: var(--vx-acc2); }
@keyframes vx-pulse { 50% { box-shadow: 0 0 0 5px rgba(255, 207, 74, .15); } }
@supports (padding: env(safe-area-inset-top)) {
  .vx-top { top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); }
  .vx-bars { top: calc(max(8px, env(safe-area-inset-top)) + 52px); left: max(8px, env(safe-area-inset-left)); }
  .vx-hotbar { bottom: max(8px, env(safe-area-inset-bottom)); }
  .vx-btns { right: max(10px, env(safe-area-inset-right)); bottom: calc(max(8px, env(safe-area-inset-bottom)) + 62px); }
}
@media (prefers-reduced-motion: reduce) { .vx-card.next { animation: none; } .vx-hint, .vx-vig, .vx-tint { transition: none; } }

/* Shell full screen (native and immersive both set html.pip-immersive): the game box fills the stage under the dock. */
html.pip-immersive .game-wrap { display: flex; flex-direction: column; padding: 0; max-width: none; margin: 0; }
html.pip-immersive .bar-row, html.pip-immersive .game-title, html.pip-immersive #play-big, html.pip-immersive #vx-exit { display: none; }
html.pip-immersive #vx-stage { flex: 1 1 auto; min-height: 0; width: 100%; height: 100%; max-height: none; aspect-ratio: auto; border-radius: 0; }
html.pip-immersive .vx-top { top: max(8px, env(safe-area-inset-top, 0px)); }
html.pip-immersive .vx-hotbar { bottom: max(8px, env(safe-area-inset-bottom, 0px)); }
/* finish: softer panels, lit hotbar slot */
.vx-panel { box-shadow: 0 18px 44px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .08); background-image: linear-gradient(180deg, rgba(255, 255, 255, .05), transparent 40%); }
.vx-hotbar { box-shadow: 0 6px 18px rgba(0, 0, 0, .4); backdrop-filter: blur(4px); }
.vx-slot { transition: transform .12s ease, border-color .12s ease, background .12s ease; }
.vx-slot.sel { transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255, 207, 74, .5), 0 6px 14px rgba(255, 207, 74, .25); }
.vx-chip { box-shadow: 0 3px 10px rgba(0, 0, 0, .3); }
