:root {
    --glass: rgba(11, 18, 27, .68);
    --glass-strong: rgba(8, 13, 20, .90);
    --line: rgba(255, 255, 255, .13);
    --text: #f6f8fb;
    --muted: #b9c4d2;
    --shadow: 0 14px 44px rgba(0, 0, 0, .28);
    --panel-texture: url("images/ui/panel-texture-dark-faceted-seamless.png?v=0220e-release");
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #87bde7; color: var(--text); touch-action: none; }
button, a { font: inherit; -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

#gameShell, #gameCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
}

#gameCanvas {
    display: block;
    outline: none;
    background: linear-gradient(#83bce8, #d7ecf9);
}

.overlay {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    padding: 24px;
    background: rgba(6, 10, 16, .42);
    backdrop-filter: blur(8px);
    z-index: 50;
}
.overlay.visible { display: grid; }
#startOverlay { pointer-events: none; }
#startOverlay .panel { pointer-events: auto; }

.panel {
    width: min(520px, 92vw);
    padding: 30px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, .14);
    background-color: rgba(8, 14, 22, .90);
    background-image:
        linear-gradient(180deg, rgba(255,255,255,.035), rgba(0,0,0,.09)),
        radial-gradient(circle at top left, rgba(86,255,138,.060), transparent 34%),
        radial-gradient(circle at bottom right, rgba(86,255,138,.045), transparent 32%),
        var(--panel-texture);
    background-size: auto, auto, auto, 560px 560px;
    background-position: 0 0, 0 0, 100% 100%, center;
    background-repeat: no-repeat, no-repeat, no-repeat, repeat;
    background-blend-mode: soft-light, screen, screen, normal;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255,255,255,.04);
    text-align: center;
}
.panel.compact { width: min(480px, 92vw); }
.logo { font-weight: 950; font-size: clamp(38px, 8vw, 66px); letter-spacing: -.065em; line-height: .95; }
.logo.small { font-size: clamp(32px, 7vw, 48px); }
.logo { display:flex; justify-content:center; align-items:center; }
.menuLogo { justify-content:flex-start; }
.brandLogoImg { display:block; width:min(100%, 420px); height:auto; filter: drop-shadow(0 10px 26px rgba(0,0,0,.26)); }
.brandLogoStart { width:min(100%, 360px); }
.brandLogoMenu { width:min(100%, 300px); }

.panelText { margin-top: 14px; color: #d7dfeb; font-size: 16px; }
.hint { margin-top: 15px; color: #8f9bac; font-size: 13px; line-height: 1.5; }
.touchHint { display: none; }
.primary {
    margin-top: 20px;
    border: 0;
    border-radius: 14px;
    padding: 13px 22px;
    background: #f8fafc;
    color: #111821;
    font-weight: 900;
    cursor: pointer;
}
.progress { margin-top: 22px; height: 8px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.10); }
#progressBar { width: 0; height: 100%; background: #eaf4ff; transition: width .12s linear; }

.hudPanel {
    border: 1px solid var(--line);
    background: var(--glass);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
}

/* The old top settings bar is intentionally gone. Desktop uses Esc; touch gets this compact button. */
.menuButton {
    display: none;
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    z-index: 30;
    width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 14px;
    font-size: 23px;
    cursor: pointer;
}

#crosshair {
    position: fixed;
    left: 50%;
    top: 50%;
    width: 22px;
    height: 22px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.8));
}
#crosshair span { position: absolute; background: rgba(255,255,255,.95); border-radius: 999px; }
#crosshair span:first-child { width: 16px; height: 2px; left: 3px; top: 10px; }
#crosshair span:last-child { width: 2px; height: 16px; left: 10px; top: 3px; }

#targetInfo {
    position: fixed;
    left: 50%;
    top: calc(50% + 24px);
    transform: translateX(-50%);
    z-index: 10;
    font-size: 11px;
    color: rgba(255,255,255,.88);
    text-shadow: 0 1px 3px rgba(0,0,0,.9);
    pointer-events: none;
}

/* Always-on Quick Picker. */
#hotbar {
    position: fixed;
    left: 50%;
    bottom: max(16px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px;
    border-radius: 17px;
    z-index: 20;
}
#modeBadge {
    align-self: stretch;
    display: grid;
    place-items: center;
    padding: 0 9px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 950;
    letter-spacing: .08em;
    background: rgba(255,255,255,.09);
    color: #dbe6f2;
}
.quickSlots { display: flex; gap: 6px; }
.slot {
    position: relative;
    width: 52px;
    height: 52px;
    padding: 5px;
    border: 2px solid transparent;
    border-radius: 12px;
    background: rgba(255,255,255,.07);
    cursor: pointer;
}
.slot.empty { cursor: default; background: rgba(255,255,255,.035); }
.slot img { width: 100%; height: 100%; object-fit: cover; image-rendering: auto; border-radius: 7px; display: block; }
.slot .slotNumber { position: absolute; right: 5px; bottom: 3px; font-size: 10px; font-weight: 900; text-shadow: 0 1px 3px #000; }
.slot.selected { border-color: rgba(255,255,255,.95); transform: translateY(-3px); background: rgba(255,255,255,.14); }
.materialBoxButton {
    width: 52px;
    height: 52px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 12px;
    background: rgba(255,255,255,.08);
    font-size: 24px;
    font-weight: 800;
    cursor: pointer;
}
.materialBoxButton:hover { background: rgba(255,255,255,.15); }
.hotbarMenuButton {
    display: none;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 12px;
    background: rgba(255,255,255,.08);
    font-size: 22px;
    font-weight: 800;
    cursor: pointer;
}
.hotbarMenuButton:hover { background: rgba(255,255,255,.15); }
html.quest-browser .menuButton { display: none; }
html.quest-browser .hotbarMenuButton { display: grid; place-items: center; }

/* Pause / settings menu. */
.menuOverlay { z-index: 80; background: rgba(6,10,16,.54); backdrop-filter: blur(12px); }
.menuPanel {
    width: min(760px, calc(100vw - 32px));
    max-height: min(760px, calc(100vh - 32px));
    overflow: auto;
    padding: 24px;
    text-align: left;
    background-size: auto, auto, auto, 620px 620px;
}
.menuHeading { display: flex; align-items: flex-start; gap: 20px; justify-content: space-between; }
.menuLogo { font-size: clamp(32px, 6vw, 48px); }
.menuVersion { color: #8f9bac; margin-top: 7px; font-size: 12px; }
.iconClose {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 13px;
    background: rgba(255,255,255,.08);
    color: white;
    font-size: 27px;
    cursor: pointer;
}
.iconClose:hover { background: rgba(255,255,255,.15); }
.menuSectionTitle { margin: 23px 0 10px; color: #91a0b2; font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.menuGrid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.menuGrid.worldGrid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.menuTile {
    min-width: 0;
    min-height: 82px;
    padding: 13px 15px;
    display: grid;
    grid-template-columns: 34px 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    text-align: left;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 15px;
    background: rgba(255,255,255,.055);
    cursor: pointer;
}
.menuTile:hover { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.18); }
.menuTile.strong { background: rgba(255,255,255,.10); }
.menuTile .menuIcon { grid-row: 1 / span 2; align-self: center; justify-self: center; font-size: 24px; }
.menuTile > span:not(.menuIcon) { align-self: end; font-weight: 850; font-size: 14px; }
.menuTile small { align-self: start; color: #8f9bac; margin-top: 3px; font-size: 11px; }
.menuFooter { margin-top: 20px; display: flex; align-items: center; gap: 16px; justify-content: space-between; color: #8090a3; font-size: 11px; }
.lockLink { color: #93a3b5; text-decoration: none; white-space: nowrap; }
.lockLink:hover { color: white; }

/* Material Box. Built around taps/clicks rather than drag/drop so the same UI works on touch. */
.materialPanel {
    width: min(940px, calc(100vw - 28px));
    max-height: min(820px, calc(100vh - 28px));
    overflow: auto;
    padding: 24px;
    text-align: left;
}
.materialSection { margin-top: 22px; }
.materialSection + .materialSection { padding-top: 20px; border-top: 1px solid rgba(255,255,255,.09); }
.materialTitleRow h2 { margin: 0; font-size: 16px; }
.materialTitleRow p { margin: 5px 0 0; color: #8f9bac; font-size: 12px; line-height: 1.45; }
.quickbarEditor { display: grid; grid-template-columns: repeat(6, minmax(74px, 1fr)); gap: 10px; margin-top: 13px; }
.editorSlot {
    position: relative;
    min-height: 92px;
    padding: 9px;
    border: 2px solid rgba(255,255,255,.08);
    border-radius: 15px;
    background: rgba(255,255,255,.04);
    cursor: pointer;
    overflow: hidden;
}
.editorSlot.active { border-color: rgba(255,255,255,.88); background: rgba(255,255,255,.10); }
.editorSlot.empty::after { content: '+'; display: grid; place-items: center; height: 100%; min-height: 70px; color: rgba(255,255,255,.30); font-size: 30px; }
.editorSlot img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.editorSlot .editorName { display: block; margin-top: 7px; font-size: 11px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editorSlot .editorNumber { position: absolute; top: 5px; left: 6px; padding: 2px 5px; border-radius: 6px; background: rgba(0,0,0,.58); font-size: 9px; font-weight: 900; }
.editorRemove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 25px;
    height: 25px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: rgba(7,11,17,.76);
    color: white;
    cursor: pointer;
    font-size: 16px;
}
.materialLibrary { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px,1fr)); gap: 12px; margin-top: 13px; }
.materialCard {
    position: relative;
    min-width: 0;
    padding: 10px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 16px;
    background: rgba(255,255,255,.04);
    cursor: pointer;
}
.materialCard:hover { background: rgba(255,255,255,.09); }
.materialCard.inQuickbar { opacity: .62; }
.materialCard img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border-radius: 11px; }
.materialCard strong { display: block; margin-top: 8px; font-size: 13px; }
.materialCard small { display: block; margin-top: 3px; color: #8998aa; font-size: 10px; }
.materialCard .status { position: absolute; top: 16px; right: 16px; padding: 4px 6px; border-radius: 7px; background: rgba(8,13,20,.75); font-size: 9px; font-weight: 850; }

#mobileHud { display: none; }
.joystick {
    position: fixed;
    left: max(18px, env(safe-area-inset-left));
    bottom: max(28px, env(safe-area-inset-bottom));
    width: 112px;
    height: 112px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(8,13,20,.22);
    backdrop-filter: blur(7px);
    z-index: 25;
}
#joystickKnob {
    position: absolute;
    width: 52px;
    height: 52px;
    left: 30px;
    top: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    border: 1px solid rgba(255,255,255,.28);
    box-shadow: 0 5px 22px rgba(0,0,0,.22);
}
#lookLabel {
    position: fixed;
    right: 18%;
    bottom: 24px;
    color: rgba(255,255,255,.48);
    font-size: 10px;
    z-index: 8;
    pointer-events: none;
}
.mobileActions {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(24px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: 58px 58px;
    gap: 10px;
    z-index: 25;
}
.round {
    width: 58px;
    height: 58px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 50%;
    background: rgba(8,13,20,.46);
    backdrop-filter: blur(8px);
    font-size: 28px;
    font-weight: 800;
}
.round.good { background: rgba(35,113,69,.55); }
.round.danger { background: rgba(133,52,45,.55); }
.hidden { display: none !important; }

#toast {
    position: fixed;
    top: max(18px, env(safe-area-inset-top));
    left: 50%;
    transform: translate(-50%, -12px);
    opacity: 0;
    z-index: 100;
    padding: 9px 13px;
    border-radius: 10px;
    background: rgba(9,15,23,.82);
    border: 1px solid rgba(255,255,255,.13);
    color: white;
    font-size: 13px;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#rotateNotice {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #0b1119;
    color: white;
    place-items: center;
    text-align: center;
    padding: 30px;
}
#rotateNotice > div:first-child { font-size: 70px; margin-bottom: 12px; }
#rotateNotice strong { display: block; font-size: 24px; }
#rotateNotice span { display: block; margin-top: 8px; color: #9facbc; }

@media (pointer: coarse) {
    #mobileHud { display: block; }
    .menuButton { display: block; }
    .desktopHint { display: none; }
    .touchHint { display: block; }
    #hotbar { bottom: max(9px, env(safe-area-inset-bottom)); gap: 5px; padding: 6px; }
    #modeBadge { display: none; }
    .quickSlots { gap: 4px; }
    .slot { width: 44px; height: 44px; padding: 4px; border-radius: 10px; }
    .materialBoxButton, .hotbarMenuButton { width: 44px; height: 44px; border-radius: 10px; }
    .menuPanel, .materialPanel { max-height: calc(100vh - 14px); width: calc(100vw - 14px); padding: 17px; border-radius: 18px; }
    .menuGrid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .menuGrid.worldGrid { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .menuTile { min-height: 72px; padding: 10px; }
    .quickbarEditor { grid-template-columns: repeat(6, minmax(58px,1fr)); gap: 7px; }
    .editorSlot { min-height: 76px; padding: 6px; }
    .materialLibrary { grid-template-columns: repeat(auto-fill, minmax(105px,1fr)); gap: 8px; }
}

@media (pointer: coarse) and (orientation: portrait) {
    html.game-started #rotateNotice { display: grid; }
}

@media (max-width: 700px) {
    .menuGrid, .menuGrid.worldGrid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .quickbarEditor { grid-template-columns: repeat(3, minmax(70px,1fr)); }
}

@media (max-height: 520px) and (pointer: coarse) {
    .menuPanel, .materialPanel { padding: 13px 15px; }
    .menuHeading { align-items: center; }
    .menuLogo { font-size: 27px; }
    .brandLogoMenu { width:min(100%, 220px); }
    .menuVersion { margin-top: 3px; }
    .menuSectionTitle { margin: 12px 0 7px; }
    .menuTile { min-height: 58px; grid-template-columns: 28px 1fr; padding: 7px 9px; }
    .menuTile .menuIcon { font-size: 20px; }
    .menuTile small { display: none; }
    .menuFooter { margin-top: 10px; }
    .materialSection { margin-top: 12px; }
    .materialSection + .materialSection { padding-top: 10px; }
    .materialTitleRow p { display: none; }
    .quickbarEditor { margin-top: 7px; }
    .editorSlot { min-height: 62px; }
    .editorSlot img { aspect-ratio: 1.6; }
    .materialLibrary { margin-top: 7px; }
    .materialCard img { aspect-ratio: 1.7; }
}

/* v0.1.16 — device-local horizon/view-distance setting */
.viewDistanceSetting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 15px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 15px;
    background: rgba(255,255,255,.045);
}
.viewDistanceCopy { min-width: 145px; }
.viewDistanceCopy strong { display: block; font-size: 14px; }
.viewDistanceCopy small { display: block; margin-top: 4px; color: #8f9bac; font-size: 10px; }
.viewDistanceButtons { display: grid; grid-template-columns: repeat(4, minmax(62px, 1fr)); gap: 6px; flex: 1; }
.viewDistanceButtons button {
    min-height: 38px;
    padding: 7px 8px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 10px;
    background: rgba(255,255,255,.055);
    color: white;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: 800;
}
.viewDistanceButtons button:hover { background: rgba(255,255,255,.10); }
.viewDistanceButtons button.selected {
    background: rgba(255,255,255,.16);
    border-color: rgba(255,255,255,.70);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.20);
}
@media (max-width: 700px), (pointer: coarse) {
    .viewDistanceSetting { align-items: stretch; flex-direction: column; gap: 9px; }
    .viewDistanceButtons { width: 100%; }
}
@media (max-width: 430px) {
    .viewDistanceButtons { grid-template-columns: repeat(2, minmax(0,1fr)); }
}


/* v0.2.0 — Material Box category tabs */
.materialTabs {
    display: flex;
    gap: 7px;
    margin-top: 13px;
    padding-bottom: 3px;
    overflow-x: auto;
    scrollbar-width: thin;
    overscroll-behavior-x: contain;
}
.materialTab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 7px 11px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 11px;
    background: rgba(255,255,255,.045);
    color: #dce6f0;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: 800;
}
.materialTab:hover { background: rgba(255,255,255,.09); }
.materialTab.active {
    border-color: rgba(255,255,255,.72);
    background: rgba(255,255,255,.13);
    color: white;
}
.materialTab small {
    min-width: 18px;
    padding: 2px 5px;
    border-radius: 999px;
    background: rgba(0,0,0,.25);
    color: #9eadbc;
    font-size: 9px;
    text-align: center;
}
.materialTab.active small { color: white; }
.categoryTitleRow { margin-top: 14px; }
.materialEmptyState {
    grid-column: 1 / -1;
    min-height: 130px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 7px;
    padding: 24px;
    border: 1px dashed rgba(255,255,255,.12);
    border-radius: 16px;
    color: #8998aa;
    text-align: center;
}
.materialEmptyState strong { color: #dce6f0; font-size: 14px; }
.materialEmptyState span { font-size: 11px; }

@media (pointer: coarse) {
    .materialTabs { gap: 6px; margin-top: 9px; }
    .materialTab { min-height: 42px; padding: 8px 10px; }
}

@media (max-height: 520px) and (pointer: coarse) {
    .materialTabs { margin-top: 7px; }
    .materialTab { min-height: 34px; padding: 5px 8px; font-size: 10px; }
    .categoryTitleRow { margin-top: 8px; }
}

/* v0.2.0 — tabbed pause menu + local world manager */
.gameMenuTabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 22px;
    padding: 6px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 15px;
    background: rgba(255,255,255,.035);
}
.gameMenuTabs button {
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #9dabbc;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .03em;
}
.gameMenuTabs button:hover { background: rgba(255,255,255,.06); color: white; }
.gameMenuTabs button.active {
    border-color: rgba(255,255,255,.16);
    background: rgba(255,255,255,.12);
    color: white;
}
.gameMenuPane { display: none; }
.gameMenuPane.active { display: block; }
.currentWorldCard {
    display: grid;
    gap: 5px;
    margin-bottom: 12px;
    padding: 15px 16px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 15px;
    background: rgba(255,255,255,.055);
}
.currentWorldCard strong { font-size: 16px; }
.currentWorldCard span { color: #8f9bac; font-size: 11px; }
.worldActionsGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.worldActionsGrid .menuTile:last-child { grid-column: 1 / -1; }

.worldManagerOverlay { z-index: 95; }
.worldManagerPanel {
    width: min(980px, calc(100vw - 28px));
    max-height: min(860px, calc(100vh - 28px));
    overflow: auto;
    padding: 24px;
    text-align: left;
}
.worldManagerView { margin-top: 24px; }
.worldManagerToolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}
.worldManagerToolbar > div { display: grid; gap: 4px; }
.worldManagerToolbar strong, .createWorldHeader strong { font-size: 17px; }
.worldManagerToolbar small, .createWorldHeader span { color: #8f9bac; font-size: 11px; line-height: 1.45; }
.primarySmall,
.secondaryButton,
.worldAction {
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 11px;
    padding: 10px 14px;
    font: inherit;
    font-size: 11px;
    font-weight: 900;
    cursor: pointer;
}
.primarySmall { background: #f5f7fb; color: #111821; }
.primarySmall:hover { background: white; }
.primarySmall.big { min-width: 160px; min-height: 44px; }
.primarySmall:disabled { opacity: .55; cursor: default; }
.secondaryButton { background: rgba(255,255,255,.06); color: white; }
.secondaryButton:hover { background: rgba(255,255,255,.11); }
.worldList { display: grid; gap: 10px; }
.worldCard {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 14px 15px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 15px;
    background: rgba(255,255,255,.045);
}
.worldCard.current {
    border-color: rgba(255,255,255,.34);
    background: rgba(255,255,255,.085);
}
.worldCardCopy { min-width: 0; display: grid; gap: 4px; }
.worldCardCopy strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.worldCardCopy span { color: #b9c4d2; font-size: 11px; }
.worldCardCopy small { color: #718095; font-size: 10px; }
.worldCardActions { display: flex; gap: 8px; }
.worldEmptyState {
    min-height: 170px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 7px;
    padding: 28px;
    border: 1px dashed rgba(255,255,255,.14);
    border-radius: 17px;
    color: #8998aa;
    text-align: center;
}
.worldEmptyState strong { color: white; font-size: 16px; }
.worldEmptyState span { max-width: 460px; font-size: 11px; line-height: 1.5; }
.createWorldHeader { display: grid; gap: 5px; }
.worldFormGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 18px;
}
.worldField { display: grid; gap: 7px; color: #cad4df; font-size: 11px; font-weight: 800; }
.worldField small { color: #77879a; font-weight: 600; }
.worldField input {
    width: 100%;
    min-height: 44px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 11px;
    padding: 10px 12px;
    background: rgba(0,0,0,.24);
    color: white;
    outline: none;
    font: inherit;
}
.worldField input:focus { border-color: rgba(255,255,255,.48); }
.worldPresetOptions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}
.worldPresetCard {
    min-height: 150px;
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 16px;
    border: 2px solid rgba(255,255,255,.08);
    border-radius: 16px;
    background: rgba(255,255,255,.04);
    color: white;
    text-align: left;
    cursor: pointer;
    font: inherit;
}
.worldPresetCard:hover { background: rgba(255,255,255,.075); }
.worldPresetCard.selected {
    border-color: rgba(255,255,255,.78);
    background: rgba(255,255,255,.11);
}
.worldPresetCard strong { font-size: 15px; }
.worldPresetCard span { color: #c2ccd8; font-size: 11px; line-height: 1.45; }
.worldPresetCard small { margin-top: auto; color: #7f90a3; font-size: 10px; }
.createWorldActions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

@media (max-width: 760px), (pointer: coarse) {
    .worldManagerPanel { padding: 18px; }
    .worldPresetOptions { grid-template-columns: 1fr; }
    .worldPresetCard { min-height: 92px; }
    .worldFormGrid { grid-template-columns: 1fr; }
    .worldManagerToolbar { align-items: flex-start; }
    .worldActionsGrid { grid-template-columns: 1fr; }
    .worldActionsGrid .menuTile:last-child { grid-column: auto; }
}

@media (max-height: 560px) and (pointer: coarse) {
    .worldManagerPanel { padding: 14px; }
    .worldManagerView { margin-top: 12px; }
    .worldPresetOptions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
    .worldPresetCard { min-height: 105px; padding: 10px; gap: 5px; }
    .worldFormGrid { grid-template-columns: 1fr 1fr; margin-top: 10px; }
    .createWorldActions { margin-top: 10px; }
}

.worldManagerToolbarActions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.secondaryStart {
    margin-top: 9px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 14px;
    padding: 11px 20px;
    background: rgba(255,255,255,.06);
    color: white;
    font-weight: 850;
    cursor: pointer;
}
.secondaryStart:hover { background: rgba(255,255,255,.11); }

/* v0.2.0 world-card actions */
.worldCardActions { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }
.worldAction { border:1px solid rgba(255,255,255,.10); background:rgba(255,255,255,.06); border-radius:10px; padding:8px 11px; cursor:pointer; }
.worldAction:hover { background:rgba(255,255,255,.11); }
.worldAction:disabled { opacity:.36; cursor:not-allowed; }
.dangerSmall:not(:disabled) { color:#ffc2bd; border-color:rgba(255,120,110,.22); }

/* v0.2.2 hidden developer profiler (F3) */
.profilerOverlay {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
    z-index: 10000;
    margin: 0;
    padding: 10px 12px;
    max-width: min(92vw, 620px);
    pointer-events: none;
    white-space: pre-wrap;
    font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: #eaf4ff;
    background: rgba(5, 13, 20, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(4px);
}
.profilerOverlay.hidden { display: none; }


/* v0.2.13e — graphics toggles */
.viewDistanceSetting + .viewDistanceSetting { margin-top: 10px; }
.viewDistanceButtons.binarySettingButtons { grid-template-columns: repeat(2, minmax(92px, 1fr)); }
@media (max-width: 430px) {
    .viewDistanceButtons.binarySettingButtons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* PUGXEL v0.2.16 — desktop custom block designer. */
.gameMenuTabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.customBlocksIntro {
    display: grid;
    grid-template-columns: 1.25fr .95fr;
    gap: 14px;
    padding: 16px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 16px;
    background: rgba(255,255,255,.045);
}
.customBlocksIntro > div:first-child { display: grid; gap: 7px; }
.customBlocksIntro strong { font-size: 15px; }
.customBlocksIntro p { margin: 0; color: #93a1b2; font-size: 11px; line-height: 1.55; }
.customBlocksTips { display: grid; gap: 5px; padding: 12px; border-radius: 13px; background: rgba(255,255,255,.045); }
.customBlocksTips span { color: #91a0b2; font-size: 10px; line-height: 1.45; }
.customBlockDesigner {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(220px, .75fr);
    gap: 16px;
    margin-top: 14px;
}
.customBlockForm, .customBlockPreviewPanel {
    padding: 16px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 16px;
    background: rgba(255,255,255,.045);
}
.customNameField { display: grid; gap: 7px; }
.customNameField span { color: #aab6c4; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.customNameField input {
    width: 100%; box-sizing: border-box; min-height: 42px; padding: 10px 12px;
    border: 1px solid rgba(255,255,255,.12); border-radius: 11px;
    background: rgba(7,11,17,.62); color: white; font: inherit; outline: none;
}
.customNameField input:focus { border-color: rgba(255,255,255,.34); }
.customTextureInputs { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-top: 12px; }
.customTexturePicker {
    position: relative; display: grid; grid-template-rows: auto 1fr auto; gap: 7px;
    min-height: 155px; padding: 10px; border: 1px dashed rgba(255,255,255,.18);
    border-radius: 14px; background: rgba(255,255,255,.03); cursor: pointer; overflow: hidden;
}
.customTexturePicker:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.30); }
.customTextureLabel { font-size: 9px; font-weight: 950; letter-spacing: .12em; color: #9dacbd; }
.customTexturePicker img {
    width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border-radius: 10px;
    background: repeating-conic-gradient(rgba(255,255,255,.07) 0 25%, rgba(255,255,255,.025) 0 50%) 50% / 16px 16px;
}
.customTexturePicker img:not(.loaded) { opacity: .22; }
.customTexturePicker small { color: #8291a3; font-size: 9px; }
.customBlockValidation { min-height: 18px; margin-top: 11px; color: #9aa9b9; font-size: 10px; }
.customBlockValidation.ready { color: #9ee6b0; }
.customBlockValidation.error { color: #ffb1b1; }
.customCreateButton { width: 100%; margin-top: 8px; }
.customCreateButton:disabled { opacity: .35; cursor: default; }
.customBlockPreviewPanel { display: grid; align-content: start; gap: 10px; text-align: center; }
.customBlockPreviewPanel > strong { text-align: left; }
.customBlockPreviewPanel > small { color: #8291a3; font-size: 9px; line-height: 1.45; }
.customCubeStage { height: 230px; display: grid; place-items: center; perspective: 700px; overflow: hidden; }
.customCube {
    position: relative; width: 118px; height: 118px; transform-style: preserve-3d;
    transform: rotateX(-24deg) rotateY(36deg);
    animation: pugxelCustomCubeSpin 9s linear infinite;
}
.cubeFace {
    position: absolute; inset: 0; background-size: cover; background-position: center;
    border: 1px solid rgba(255,255,255,.18); box-shadow: inset 0 0 20px rgba(0,0,0,.09);
    background-color: #3a4552;
}
.cubeFront { transform: translateZ(59px); }
.cubeBack { transform: rotateY(180deg) translateZ(59px); }
.cubeRight { transform: rotateY(90deg) translateZ(59px); }
.cubeLeft { transform: rotateY(-90deg) translateZ(59px); }
.cubeTop { transform: rotateX(90deg) translateZ(59px); }
.cubeBottom { transform: rotateX(-90deg) translateZ(59px); }
@keyframes pugxelCustomCubeSpin {
    0% { transform: rotateX(-25deg) rotateY(20deg); }
    38% { transform: rotateX(-25deg) rotateY(160deg); }
    58% { transform: rotateX(24deg) rotateY(235deg); }
    76% { transform: rotateX(-25deg) rotateY(305deg); }
    100% { transform: rotateX(-25deg) rotateY(380deg); }
}
.customBlocksLibrarySection { margin-top: 16px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,.09); }
.customBlocksLibrary { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 12px; }
.customBlockCard {
    display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 10px;
    padding: 9px; border: 1px solid rgba(255,255,255,.09); border-radius: 14px; background: rgba(255,255,255,.035);
}
.customBlockCard > img { width: 58px; height: 58px; object-fit: cover; border-radius: 10px; }
.customBlockCard > div:nth-child(2) { min-width: 0; display: grid; gap: 4px; }
.customBlockCard strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.customBlockCard small { color: #8392a4; font-size: 9px; }
.customBlockCardActions { display: grid; gap: 5px; }
.customBlockCardActions button { border: 0; border-radius: 8px; padding: 5px 7px; background: rgba(255,255,255,.08); color: #d7e0e9; font-size: 9px; cursor: pointer; }
.customBlockCardActions button:hover { background: rgba(255,255,255,.14); }
html.quest-browser #customBlocksTab, html.quest-browser #customBlocksMenuPane { display: none !important; }
@media (pointer: coarse) {
    #customBlocksTab, #customBlocksMenuPane { display: none !important; }
    .gameMenuTabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
    .customBlocksIntro, .customBlockDesigner { grid-template-columns: 1fr; }
    .customTextureInputs { grid-template-columns: repeat(3, minmax(90px,1fr)); }
}


/* PUGXEL v0.2.16b — world picker visibility/click hotfix. */
.worldCard { cursor: pointer; transition: background .12s ease, border-color .12s ease, transform .12s ease; }
.worldCard:hover, .worldCard:focus-visible {
    background: rgba(255,255,255,.085);
    border-color: rgba(255,255,255,.25);
    outline: none;
}
.worldCard:active { transform: translateY(1px); }
.worldCardActions button { cursor: pointer; }
.worldCardActions .worldAction.primarySmall {
    background: #f5f7fb;
    color: #111821;
    border-color: rgba(255,255,255,.60);
}
.worldCardActions .worldAction.primarySmall:hover { background: #ffffff; color: #080d13; }


/* v0.2.18a portable world/custom-block export */
.exportOverlay { z-index: 125; }
.exportPanel {
    width: min(760px, calc(100vw - 28px));
    max-height: min(820px, calc(100vh - 28px));
    overflow: auto;
    padding: 24px;
    text-align: left;
}
.exportChoiceView { display: grid; gap: 10px; margin-top: 20px; }
.exportChoice {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 5px 16px;
    padding: 16px 17px;
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 15px;
    background: rgba(255,255,255,.055);
    color: white;
    text-align: left;
    cursor: pointer;
}
.exportChoice:hover { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.22); }
.exportChoice:disabled { opacity: .42; cursor: default; }
.exportChoice strong { font-size: 14px; }
.exportChoice span { grid-column: 1; color: #a9b6c6; font-size: 10px; line-height: 1.45; }
.exportChoice small { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: #7f90a3; font-size: 10px; font-weight: 800; }
.exportBlocksView { margin-top: 20px; }
.exportBlocksToolbar { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:12px; }
.exportBlocksToolbar > div:first-child { display:grid; gap:4px; }
.exportBlocksToolbar strong { font-size: 15px; }
.exportBlocksToolbar span { color:#8f9bac; font-size:10px; }
.exportBlocksToolbarActions { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.exportBlocksList { display:grid; grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); gap:9px; max-height:390px; overflow:auto; padding:2px; }
.exportBlockOption {
    display:grid;
    grid-template-columns:auto 48px 1fr;
    align-items:center;
    gap:10px;
    padding:10px;
    border:1px solid rgba(255,255,255,.10);
    border-radius:13px;
    background:rgba(255,255,255,.045);
    cursor:pointer;
}
.exportBlockOption:hover { background:rgba(255,255,255,.08); }
.exportBlockOption input { width:17px; height:17px; accent-color:#f4f7fb; }
.exportBlockOption img { width:48px; height:48px; object-fit:cover; border-radius:9px; }
.exportBlockOption span { min-width:0; display:grid; gap:3px; }
.exportBlockOption strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; }
.exportBlockOption small { color:#7f90a3; font-size:9px; }
.exportBlocksFooter { display:flex; justify-content:space-between; gap:10px; margin-top:15px; }
@media (max-width:760px), (pointer:coarse) {
    .exportPanel { padding:18px; }
    .exportBlocksToolbar { align-items:flex-start; }
    .exportBlocksList { grid-template-columns:1fr; }
}
