:root {
  color-scheme: dark;
  --forest-950: #102d28;
  --forest-900: #173f36;
  --forest-700: #2f725c;
  --forest-500: #4f9877;
  --paper: #f4f0e5;
  --paper-strong: #fffdf6;
  --coral: #e87561;
  --slate: #7f9daa;
  --sky: #9ac9d6;
  --ink: #15332d;
  --line: rgba(255,255,255,.28);
  --shadow: rgba(0,0,0,.62);
  --hud: rgba(17,17,17,.78);
  --hud-solid: #242424;
  --hud-mid: #626262;
  --slot: #8b8b8b;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --control-min: 48px;
  --pixel-radius: 0px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { min-height: 100dvh; color: #fff; background: #76b8d6; }
button, input, a { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid #fff36b; outline-offset: 3px; }
[hidden] { display: none !important; }

.voxel-game { position: fixed; inset: 0; width: 100vw; height: 100dvh; min-height: 100dvh; overflow: hidden; isolation: isolate; background: #76b8d6; }
#voxel-canvas { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; cursor: crosshair; }
.voxel-game[data-pointer-locked="true"] #voxel-canvas { cursor: none; }
.voxel-game[data-view="overview"] #voxel-canvas { cursor: pointer; }
.look-zone { position: absolute; z-index: 2; top: calc(var(--safe-top) + 64px); right: 0; bottom: calc(var(--safe-bottom) + 70px); left: 42%; display: none; touch-action: none; }
.game-hud { position: absolute; z-index: 10; inset: 0; pointer-events: none; }
.game-hud button, .game-hud a, .game-hud input, .hotbar, .hotbar-tools, .joystick { pointer-events: auto; }

.sign-editor { position: absolute; z-index: 48; left: 50%; top: 50%; width: min(500px, calc(100vw - 28px)); padding: 0 16px 16px; transform: translate(-50%, -50%); border: 4px solid; border-color: #fff #3f3f3f #3f3f3f #fff; color: #202020; background: #b8b8b8; box-shadow: 8px 8px 0 rgba(0,0,0,.48); text-shadow: none; }
.sign-editor > header { min-height: 62px; margin: 0 -16px 14px; padding: 8px 10px 8px 14px; display: grid; grid-template-columns: 1fr 48px; align-items: center; gap: 10px; border-bottom: 3px solid #555; background: #8d8d8d; }
.sign-editor > header div { display: grid; gap: 2px; }
.sign-editor > header small { color: #3b3b3b; font-size: 8px; letter-spacing: .14em; }
.sign-editor > header strong { font-size: 17px; text-shadow: 1px 1px #fff; }
.sign-editor > header button { width: 48px; height: 48px; border: 2px solid; border-color: #fff #555 #555 #fff; color: #222; background: #999; cursor: pointer; font-size: 24px; }
.sign-editor > label { display: block; margin-bottom: 7px; font-size: 11px; font-weight: 900; }
.sign-input-row { min-height: 58px; display: grid; grid-template-columns: minmax(0,1fr) 52px; align-items: center; border: 3px solid; border-color: #555 #fff #fff #555; background: #2f2f2f; }
.sign-input-row input { min-width: 0; height: 52px; padding: 0 12px; border: 0; outline: 0; color: #fff; background: transparent; font-size: 18px; }
.sign-input-row span { color: #fff36b; font-size: 10px; text-align: center; }
.sign-editor p { margin: 8px 0 14px; color: #444; font-size: 10px; line-height: 1.5; }
.sign-editor-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 8px; }
.sign-editor-actions button { min-height: 48px; border: 3px solid; border-color: #fff #555 #555 #fff; color: #222; background: #999; cursor: pointer; font-weight: 900; }
.sign-editor-actions button.is-primary { color: #fff; background: var(--forest-700); text-shadow: 1px 1px #000; }
.sign-editor-actions button:disabled { opacity: .55; cursor: wait; }

.hud-top { position: absolute; top: calc(var(--safe-top) + 12px); right: calc(var(--safe-right) + 12px); left: calc(var(--safe-left) + 12px); display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.world-card, .presence-overview, .sync-chip, .target-hint, .desktop-help, .pixel-button, .game-drawer, .member-card, .incoming-card, .toast {
  border: 2px solid #0b0b0b;
  border-radius: var(--pixel-radius);
  color: #fff;
  background: var(--hud);
  box-shadow: inset 2px 2px rgba(255,255,255,.2), inset -2px -2px rgba(0,0,0,.55), 3px 3px 0 rgba(0,0,0,.34);
  text-shadow: 2px 2px 0 rgba(0,0,0,.78);
}
.world-card { min-height: 54px; display: grid; grid-template-columns: 32px minmax(0, auto) auto; align-items: center; gap: 9px; padding: 7px 9px; }
.spark-pixel { width: 32px; height: 32px; padding: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; background: #bd3d55; box-shadow: inset 3px 3px rgba(255,255,255,.25), inset -3px -3px rgba(55,0,0,.32); }
.spark-pixel i { background: #fff0ad; box-shadow: inset -2px -2px rgba(78,39,0,.24); }
.world-copy { min-width: 0; display: grid; gap: 2px; }
.world-copy strong { font-size: 13px; letter-spacing: -.04em; white-space: nowrap; }
.world-state { max-width: 230px; overflow: hidden; color: #d6ecf2; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.mode-chip { align-self: stretch; min-width: 62px; display: grid; place-items: center; padding: 4px 7px; border-left: 2px solid rgba(255,255,255,.28); color: #fff17b; font-size: 10px; font-weight: 900; }
.presence-overview { position: absolute; left: 0; top: 64px; min-height: 46px; padding: 6px 9px; display: flex; align-items: center; gap: 8px; pointer-events: auto; cursor: pointer; text-align: left; }
.presence-overview > i { width: 11px; height: 11px; flex: 0 0 auto; background: #ffd55c; box-shadow: inset -2px -2px rgba(0,0,0,.25); }
.presence-overview > span { display: grid; gap: 1px; }
.presence-overview strong { color: #fff; font-size: 11px; line-height: 1.1; white-space: nowrap; }
.presence-overview small { max-width: 250px; overflow: hidden; color: #d6ecf2; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.presence-overview[data-state="live"] > i { background: #70dc94; }
.presence-overview[data-state="stale"] > i, .presence-overview[data-state="connecting"] > i { background: #ffd55c; }
.presence-overview[data-state="error"] > i { background: #ff725f; }
.presence-overview[data-state="stale"] strong, .presence-overview[data-state="error"] strong { color: #fff09a; }

.hud-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.hud-actions .pixel-button { display: inline-flex; }
.voxel-game[data-view="third"] .hud-actions [data-build-toggle] { display: none; }
.pixel-button { min-width: var(--control-min); min-height: var(--control-min); padding: 5px 8px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font-size: 10px; font-weight: 900; }
.pixel-button:hover { background: rgba(36,36,36,.94); transform: translateY(-1px); }
.pixel-button:active { transform: translate(2px, 2px); box-shadow: inset 2px 2px rgba(0,0,0,.62), 1px 1px 0 rgba(0,0,0,.3); }
.pixel-button[aria-pressed="true"] { color: #fff36b; background: rgba(47,114,92,.94); }
.control-glyph { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.38); color: #fff; background: #555; box-shadow: inset 2px 2px rgba(255,255,255,.22), inset -2px -2px rgba(0,0,0,.42); font-size: 11px; text-shadow: 1px 1px #000; }

.target-layer { position: absolute; inset: 0; pointer-events: none; }
.crosshair { --target-color: rgba(255,255,255,.96); position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; display: block; transform: translate(-50%, -50%); filter: drop-shadow(1px 1px 0 #000); }
.crosshair i { position: absolute; display: block; background: var(--target-color); }
.crosshair i:nth-child(1) { width: 6px; height: 2px; left: 0; top: 9px; }
.crosshair i:nth-child(2) { width: 6px; height: 2px; right: 0; top: 9px; }
.crosshair i:nth-child(3) { width: 2px; height: 6px; left: 9px; top: 0; }
.crosshair i:nth-child(4) { width: 2px; height: 6px; left: 9px; bottom: 0; }
.voxel-game[data-target="interact"] .crosshair { --target-color: #78efac; }
.voxel-game[data-target="place"] .crosshair { --target-color: #71dcff; }
.voxel-game[data-target="break"] .crosshair { --target-color: #ff765f; }
.voxel-game[data-target="locked"] .crosshair { --target-color: #a8aaa4; }
.target-hint { position: absolute; left: 50%; top: calc(50% + 34px); min-height: 28px; max-width: min(620px, calc(100vw - 36px)); margin: 0; padding: 6px 9px; opacity: 0; transform: translate(-50%, 5px); transition: opacity .12s ease, transform .12s ease; font-size: 10px; font-weight: 900; white-space: nowrap; }
.voxel-game[data-target="interact"] .target-hint, .voxel-game[data-target="place"] .target-hint, .voxel-game[data-target="break"] .target-hint, .voxel-game[data-target="locked"] .target-hint { opacity: 1; transform: translateX(-50%); }

.overview-guide { position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 18px); min-height: 46px; max-width: min(560px, calc(100vw - 32px)); padding: 8px 12px; display: none; align-items: center; gap: 11px; transform: translateX(-50%); border: 2px solid rgba(19,48,42,.92); color: var(--forest-950); background: rgba(255,253,246,.9); box-shadow: 4px 4px 0 rgba(15,44,38,.24); text-shadow: none; }
.overview-guide strong { flex: 0 0 auto; color: var(--forest-900); font-size: 11px; }
.overview-guide span { color: #365b52; font-size: 9px; line-height: 1.4; }
.overview-guide-touch, .overview-guide-build { display: none; }
.overview-target-status { display: none; max-width: 320px; overflow: hidden; padding-left: 10px; border-left: 1px solid rgba(19,48,42,.32); color: #173f35 !important; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.voxel-game[data-view="overview"] .overview-guide { display: flex; }
.voxel-game[data-view="overview"][data-mode="build"] .overview-guide { bottom: calc(var(--safe-bottom) + 82px); }
.voxel-game[data-view="overview"][data-mode="build"] .overview-target-status { display: inline; }
.voxel-game[data-mode="build"] .overview-guide-explore { display: none; }
.voxel-game[data-view="overview"][data-mode="build"] .overview-guide-build.overview-guide-desktop { display: inline; }
.voxel-game[data-view="overview"] .sync-chip[data-state="live"],
.voxel-game[data-view="overview"] .sync-chip[data-state="saved"] { display: none; }
.voxel-game[data-view="overview"] .target-layer,
.voxel-game[data-view="overview"] .desktop-help,
.voxel-game[data-view="overview"] .look-zone { display: none !important; }
.voxel-game[data-view="overview"][data-mode="explore"] .hotbar-shell,
.voxel-game[data-view="overview"][data-mode="explore"] .mobile-controls { display: none !important; }
.voxel-game[data-view="third"] .hotbar-shell { display: none; }
.voxel-game[data-view="third"] .break-action,
.voxel-game[data-view="third"] .rotate-action { display: none !important; }
.voxel-game[data-view="first"][data-mode="explore"] .hotbar-shell { display: none; }
.voxel-game[data-view="first"][data-mode="explore"] .break-action,
.voxel-game[data-view="first"][data-mode="explore"] .rotate-action { display: none !important; }

.desktop-help { position: absolute; left: calc(var(--safe-left) + 12px); bottom: calc(var(--safe-bottom) + 12px); display: flex; flex-wrap: wrap; max-width: calc(50vw - 310px); gap: 8px 10px; padding: 7px 8px; color: #efefef; font-size: 8px; }
.desktop-help { animation: help-dismiss 10s ease forwards; }
@keyframes help-dismiss { 0%, 72% { opacity: 1; visibility: visible; } 100% { opacity: 0; visibility: hidden; } }
.desktop-help span { display: flex; align-items: center; gap: 5px; }
kbd { min-width: 25px; min-height: 22px; padding: 2px 5px; border: 1px solid #111; border-bottom-width: 3px; border-radius: 0; display: inline-grid; place-items: center; color: #fff; background: #666; box-shadow: inset 1px 1px rgba(255,255,255,.26); font-size: 8px; font-weight: 900; text-shadow: 1px 1px #000; }
.sync-chip { position: absolute; right: calc(var(--safe-right) + 12px); bottom: calc(var(--safe-bottom) + 12px); min-height: 32px; padding: 5px 8px; display: flex; align-items: center; gap: 7px; font-size: 9px; font-weight: 900; }
.sync-chip i { width: 9px; height: 9px; background: #ffd55c; box-shadow: inset -2px -2px rgba(0,0,0,.24); }
.sync-chip[data-state="saved"] i, .sync-chip[data-state="live"] i { background: #70dc94; }
.sync-chip[data-state="readonly"] i, .sync-chip[data-state="error"] i { background: #ff725f; }

.hotbar-shell { position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 10px); transform: translateX(-50%); display: flex; align-items: flex-end; gap: 7px; pointer-events: auto; }
.hotbar { display: grid; grid-template-columns: repeat(9, 54px); gap: 0; padding: 3px; border: 3px solid #111; background: #3b3b3b; box-shadow: inset 2px 2px #7f7f7f, inset -2px -2px #1a1a1a, 3px 3px 0 rgba(0,0,0,.32); }
.hotbar-slot, .hotbar-tool { position: relative; min-width: 54px; min-height: 54px; padding: 4px; display: grid; place-items: center; border: 2px solid; border-color: #bdbdbd #353535 #353535 #bdbdbd; border-radius: 0; color: #fff; background: var(--slot); cursor: pointer; text-shadow: 1px 1px #000; }
.hotbar-slot:hover, .hotbar-tool:hover { background: #a2a2a2; }
.hotbar-slot.is-selected, .hotbar-slot[aria-pressed="true"] { z-index: 2; border: 4px solid #fff; box-shadow: 0 0 0 2px #111; background: #979797; }
.slot-key { position: absolute; left: 3px; top: 2px; color: #fff; font-size: 8px; text-shadow: 1px 1px #000; }
.slot-icon { width: 30px; height: 30px; display: block; border: 1px solid rgba(0,0,0,.5); background: var(--slate); box-shadow: inset 5px 5px rgba(255,255,255,.18), inset -6px -6px rgba(0,0,0,.24); image-rendering: pixelated; transform: rotate(-3deg); }
.build-item-thumbnail { display: block; border: 0; background: transparent !important; box-shadow: none; image-rendering: pixelated; object-fit: contain; transform: none; }
.hotbar-slot[data-prefab-id] .build-item-thumbnail { width: 38px; height: 38px; }
.inventory-item .build-item-thumbnail, .creative-current-item .build-item-thumbnail { object-fit: contain; }
.slot-name { position: absolute; left: 50%; bottom: calc(100% + 14px); min-width: max-content; max-width: 160px; padding: 5px 7px; border: 2px solid #111; display: none; transform: translateX(-50%); color: #fff; background: rgba(16,16,16,.86); font-size: 9px; font-weight: 900; }
.hotbar-slot.is-selected .slot-name { display: block; }
.hotbar-tools { display: flex; gap: 4px; }
.desktop-build-tool { min-width: 48px; min-height: 54px; padding: 4px 7px; border: 2px solid; border-color: #bdbdbd #353535 #353535 #bdbdbd; border-radius: 0; color: #fff; background: #555; cursor: pointer; font-size: 9px; font-weight: 900; text-shadow: 1px 1px #000; }
.voxel-v2-place { background: #34785f; }
.voxel-v2-break { background: #934b40; }
.hotbar-tool { min-width: 48px; min-height: 54px; padding: 2px 5px; font-size: 9px; font-weight: 900; }
.hotbar-tool .slot-icon { width: 20px; height: 20px; }
.voxel-v2-undo { min-width: 48px; min-height: 54px; border: 2px solid; border-color: #bdbdbd #353535 #353535 #bdbdbd; border-radius: 0; color: #fff; background: #666; cursor: pointer; font-size: 9px; text-shadow: 1px 1px #000; }
.voxel-v2-inventory { min-width: 48px; min-height: 54px; }

.mobile-controls { display: none; }

.game-drawer { position: absolute; z-index: 30; top: 50%; left: 50%; width: min(720px, calc(100vw - 32px)); max-height: min(78dvh, 680px); overflow: hidden; transform: translate(-50%, -50%); border-width: 4px; background: #c6c6c6; box-shadow: inset 3px 3px #fff, inset -3px -3px #555, 8px 8px 0 rgba(0,0,0,.48); text-shadow: none; }
.game-drawer::before { content: ""; position: fixed; z-index: -1; inset: -100vh -100vw; background: rgba(0,0,0,.46); pointer-events: auto; }
.game-drawer > header { min-height: 58px; padding: 9px 11px; display: grid; grid-template-columns: minmax(150px,1fr) auto 48px; align-items: center; gap: 12px; border-bottom: 3px solid #555; color: #222; }
.game-drawer header div { display: grid; gap: 2px; }
.game-drawer header small { color: #555; font-size: 8px; letter-spacing: .12em; }
.game-drawer header strong { font-size: 17px; text-shadow: 1px 1px #fff; }
.game-drawer header button, .card-close { width: var(--control-min); height: var(--control-min); border: 2px solid; border-color: #fff #555 #555 #fff; border-radius: 0; color: #222; background: #999; cursor: pointer; font-size: 23px; text-shadow: 1px 1px #fff; }
.drawer-tabs { display: flex; gap: 3px; }
.game-drawer .drawer-tabs button { width: auto; min-width: var(--control-min); height: var(--control-min); min-height: var(--control-min); padding: 0 8px; font-size: 9px; font-weight: 900; }
.drawer-body { max-height: calc(min(78dvh, 680px) - 58px); padding: 16px; overflow: auto; overscroll-behavior: contain; color: #202020; }
.search-panel { display: grid; gap: 9px; }
.search-panel label { font-size: 11px; font-weight: 900; }
.search-field { min-height: 50px; display: grid; grid-template-columns: 1fr auto; align-items: center; border: 3px solid; border-color: #555 #fff #fff #555; background: #2f2f2f; }
.search-field input { min-width: 0; height: 46px; padding: 0 12px; border: 0; outline: 0; color: #fff; background: transparent; font-size: 15px; }
.search-field kbd { margin-right: 8px; }
.search-results, .member-list { display: grid; gap: 6px; }
.member-empty { margin: 0; padding: 24px 12px; color: #4d4d4d; font-size: 11px; line-height: 1.65; text-align: center; }
.search-results:empty::before { content: "输入名字，自动走到 TA 身边"; padding: 22px 6px; color: #4d4d4d; font-size: 11px; text-align: center; }
.search-results > [data-member-id], .member-list > button { min-height: 58px; padding: 8px 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; column-gap: 10px; border: 2px solid; border-color: #fff #555 #555 #fff; color: #202020; background: #aaa; text-align: left; }
.member-list > button > strong { grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-list > button > span { grid-column: 1; color: #454545; font-size: 10px; }
.member-list > button > em { grid-column: 2; grid-row: 1 / span 2; color: var(--forest-900); font-size: 9px; font-style: normal; font-weight: 900; }
.search-results > [data-member-id] > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results > [data-member-id] > span { overflow: hidden; color: #454545; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.search-results > [data-member-id] > button { grid-column: 2; grid-row: 1 / span 2; min-width: 88px; }
.status-panel { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.status-panel button { min-height: 76px; padding: 10px; display: grid; gap: 4px; border: 3px solid; border-color: #fff #555 #555 #fff; color: #222; background: #aaa; cursor: pointer; text-align: left; }
.status-panel button span { color: #4d4d4d; font-size: 10px; }
.status-panel button[aria-pressed="true"] { color: #fff; background: var(--forest-700); text-shadow: 1px 1px #000; }
.status-panel button[aria-pressed="true"] span { color: #d8f3e4; }
.inventory-panel { display: grid; gap: 12px; }
.creative-catalog-hero { min-height: 92px; padding: 13px 15px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 16px; border: 3px solid; border-color: #fff #45675d #45675d #fff; color: #fff; background: var(--forest-700); box-shadow: inset 3px 3px rgba(255,255,255,.15), inset -3px -3px rgba(0,0,0,.28); }
.creative-catalog-hero > div:first-child { display: grid; gap: 4px; }
.creative-catalog-hero small { color: #c8ebdc; font-size: 8px; font-weight: 900; letter-spacing: .12em; }
.creative-catalog-hero strong { font-size: 18px; line-height: 1; text-shadow: 2px 2px rgba(0,0,0,.35); }
.creative-catalog-hero p { max-width: 48ch; margin: 2px 0 0; color: #effcf6; font-size: 10px; line-height: 1.55; }
.creative-catalog-rules { display: grid; gap: 5px; justify-items: stretch; }
.creative-catalog-rules span { min-height: 25px; padding: 5px 8px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.42); color: #fff9b4; background: rgba(15,54,44,.42); font-size: 8px; font-weight: 900; white-space: nowrap; }
.creative-current-item { min-height: 74px; padding: 8px 10px; display: grid; grid-template-columns: 78px minmax(0,1fr) auto; align-items: center; gap: 10px; border: 3px solid; border-color: #fff #666 #666 #fff; color: #202020; background: #b7b7b7; }
.creative-current-item .inventory-swatch { width: 76px; height: 54px; }
.creative-current-item > span { min-width: 0; display: grid; gap: 3px; }
.creative-current-item small { color: #4a4a4a; font-size: 8px; }
.creative-current-item strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.creative-current-item em { color: #365b52; font-size: 9px; font-style: normal; font-weight: 900; white-space: nowrap; }
.creative-catalog-tabs { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; padding: 3px; border: 2px solid #666; background: #888; }
.creative-catalog-tabs button { min-height: 40px; padding: 6px 8px; border: 2px solid; border-color: #eee #555 #555 #eee; color: #222; background: #b9b9b9; cursor: pointer; font-size: 9px; font-weight: 900; }
.creative-catalog-tabs button:hover { background: #ccc; }
.creative-catalog-tabs button:active { transform: translate(1px,1px); }
.creative-catalog-tabs button[aria-pressed="true"] { border-color: #fff36b #6a5e18 #6a5e18 #fff36b; color: #fff; background: var(--forest-700); text-shadow: 1px 1px #000; }
.creative-catalog-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; }
.inventory-item { position: relative; min-height: 168px; padding: 8px 8px 9px; display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: 92px auto auto; align-items: center; gap: 7px; border: 3px solid; border-color: #fff #5a5a5a #5a5a5a #fff; color: #222; background: #aaa; cursor: pointer; text-align: left; }
.inventory-item:hover { background: #bdbdbd; transform: translateY(-1px); }
.inventory-item:active { transform: translate(2px,2px); }
.inventory-item[aria-pressed="true"] { border-color: #fff36b #675a13 #675a13 #fff36b; color: #fff; background: #466e60; text-shadow: 1px 1px #000; }
.inventory-swatch { width: 100%; height: 92px; display: block; border: 2px solid #222; background: #eef0e8 !important; box-shadow: 2px 2px 0 rgba(0,0,0,.24); image-rendering: pixelated; object-fit: contain; }
.inventory-copy { min-width: 0; display: grid; gap: 4px; }
.inventory-copy strong { overflow: hidden; font-size: 10px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.inventory-copy small { color: inherit; opacity: .72; font-size: 8px; }
.inventory-action { min-height: 27px; display: grid; place-items: center; border-top: 1px solid rgba(0,0,0,.25); color: #224f41; font-size: 8px; font-weight: 900; }
.inventory-item[aria-pressed="true"] .inventory-action { color: #fff9a8; }

.member-card { position: absolute; z-index: 34; right: calc(var(--safe-right) + 18px); bottom: calc(var(--safe-bottom) + 82px); width: min(350px, calc(100vw - 36px)); padding: 13px; display: grid; grid-template-columns: 54px 1fr 48px; gap: 10px; }
.card-close { grid-column: 3; grid-row: 1; color: #fff; background: #555; text-shadow: 1px 1px #000; }
.member-pixel-avatar { grid-column: 1; grid-row: 1 / span 2; width: 54px; height: 66px; padding: 7px 9px 0; display: grid; align-content: end; background: #76b8d6; box-shadow: inset 3px 3px rgba(255,255,255,.25), inset -3px -3px rgba(0,0,0,.24); }
.member-pixel-avatar::before { content: ""; width: 34px; height: 30px; background: #e8b08b; border-top: 9px solid #493a31; box-shadow: inset 6px 0 #e8b08b, inset -6px 0 #d79370; }
.member-pixel-avatar i { width: 36px; height: 24px; display: block; background: var(--coral); box-shadow: inset -7px -5px rgba(0,0,0,.18); }
.member-card-copy { align-self: center; }
.member-card h2 { margin: 0 0 4px; font-size: 17px; }
.member-card p { margin: 0; color: #d8ebe5; font-size: 10px; }
.member-card-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.member-card-actions button { min-height: var(--control-min); border: 2px solid #0b0b0b; border-radius: 0; color: #fff; background: #555; cursor: pointer; font-weight: 900; text-shadow: 1px 1px #000; }
.member-card-actions button.is-primary { background: var(--forest-700); }

.game-drawer button, .member-card button, .search-results > [data-member-id] > button, .member-list > button, .incoming-card button, .voxel-v2-undo { min-height: var(--control-min); border: 2px solid var(--forest-950); color: var(--forest-950); background: var(--paper-strong); cursor: pointer; font-weight: 850; }
.search-results > [data-member-id] > button, .incoming-card button { color: #fff; background: var(--forest-700); text-shadow: 1px 1px #000; }
.incoming-card { position: absolute; z-index: 36; left: 50%; top: calc(var(--safe-top) + 78px); width: min(440px, calc(100vw - 28px)); min-height: 64px; padding: 9px 11px; display: flex; align-items: center; gap: 8px; transform: translateX(-50%); }
.incoming-card strong { flex: 1 1 160px; font-size: 11px; line-height: 1.45; }
.incoming-card button { min-width: 68px; padding: 6px 9px; }
.toast { position: absolute; z-index: 45; left: 50%; top: calc(var(--safe-top) + 78px); max-width: min(440px, calc(100vw - 28px)); min-height: 38px; padding: 8px 11px; transform: translate(-50%, -12px); opacity: 0; pointer-events: none; transition: opacity .12s ease, transform .12s ease; font-size: 10px; font-weight: 900; }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

.fallback { position: absolute; z-index: 60; inset: 0; min-height: 100dvh; padding: calc(var(--safe-top) + 36px) calc(var(--safe-right) + 24px) calc(var(--safe-bottom) + 28px) calc(var(--safe-left) + 24px); display: grid; align-content: center; justify-items: center; gap: 14px; color: #fff; background: #202020; text-align: center; }
.fallback-mark { width: 68px; height: 68px; padding: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; border: 3px solid #fff; }
.fallback-mark i { background: var(--coral); box-shadow: inset -4px -4px rgba(0,0,0,.22); }
.fallback h1 { margin: 0; font-size: clamp(24px, 5vw, 42px); }
.fallback p { max-width: 460px; margin: 0; color: #c9c9c9; font-size: 13px; line-height: 1.7; }
.fallback-members { width: min(620px, 100%); max-height: 30dvh; overflow: auto; }
.fallback-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.fallback-actions button, .fallback-actions a { min-height: var(--control-min); padding: 0 16px; border: 2px solid #fff; display: inline-flex; align-items: center; justify-content: center; color: #111; background: #fff; cursor: pointer; text-decoration: none; }
.fallback-actions a { color: #fff; background: transparent; }

@media (max-width: 1100px) {
  .control-label { display: none; }
  .pixel-button { width: var(--control-min); padding: 4px; }
  .desktop-help { display: none; }
  .hotbar { grid-template-columns: repeat(9, 50px); }
  .hotbar-slot { min-width: 50px; min-height: 50px; }
}

@media (max-width: 760px), (pointer: coarse) {
  .voxel-game { min-height: 100dvh; }
  .look-zone { display: block; }
  .hud-top { top: calc(var(--safe-top) + 7px); right: calc(var(--safe-right) + 7px); left: calc(var(--safe-left) + 7px); gap: 6px; }
  .world-card { min-height: 48px; grid-template-columns: 26px minmax(0, 1fr); gap: 6px; padding: 5px 6px; }
  .spark-pixel { width: 26px; height: 26px; padding: 3px; gap: 2px; }
  .world-copy strong { max-width: 116px; overflow: hidden; font-size: 10px; text-overflow: ellipsis; }
  .world-state { max-width: 116px; font-size: 7px; }
  .presence-overview { top: 55px; max-width: calc(100vw - 94px); min-height: 43px; padding: 5px 7px; }
  .presence-overview small { max-width: min(210px, calc(100vw - 145px)); }
  .mode-chip { display: none; }
  .hud-actions { flex-wrap: nowrap; gap: 4px; }
  .pixel-button { min-width: 58px; width: 58px; min-height: var(--control-min); padding: 3px; }
  .control-glyph { width: 42px; height: 27px; font-size: 10px; letter-spacing: .04em; }
  .hud-actions [data-view-toggle], .hud-actions [data-member-toggle] { display: inline-flex; }
  .hud-actions [data-search-toggle], .hud-actions [data-status-toggle] { display: none; }
  .voxel-game:is([data-view="first"], [data-view="overview"]) .hud-actions [data-build-toggle] { display: inline-flex; }
  [data-build-toggle] { position: fixed; right: calc(var(--safe-right) + 14px); top: calc(var(--safe-top) + 170px); }
  [data-view-toggle] { position: fixed; right: calc(var(--safe-right) + 14px); top: calc(var(--safe-top) + 62px); }
  [data-member-toggle] { position: fixed; right: calc(var(--safe-right) + 14px); top: calc(var(--safe-top) + 116px); }
  .target-hint { max-width: calc(100vw - 38px); overflow: hidden; font-size: 8px; text-overflow: ellipsis; }
  .sync-chip { right: auto; left: calc(var(--safe-left) + 10px); bottom: calc(var(--safe-bottom) + 190px); min-height: 28px; padding: 4px 6px; font-size: 7px; }
  .hotbar-shell { right: calc(var(--safe-right) + 6px); bottom: calc(var(--safe-bottom) + 6px); left: calc(var(--safe-left) + 6px); width: auto; transform: none; overflow: hidden; gap: 4px; }
  .hotbar { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 48px; gap: 0; min-width: 0; overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: x proximity; scrollbar-color: #fff36b rgba(0,0,0,.28); scrollbar-width: thin; }
  .hotbar::-webkit-scrollbar { display: block; height: 4px; }
  .hotbar::-webkit-scrollbar-track { background: rgba(0,0,0,.28); }
  .hotbar::-webkit-scrollbar-thumb { background: #fff36b; }
  .hotbar-slot { min-width: 48px; min-height: 48px; scroll-snap-align: start; }
  .slot-key { display: none; }
  .slot-name { bottom: calc(100% + 11px); }
  .hotbar-tools { flex: 0 0 auto; }
  .desktop-build-tool { display: none; }
  .hotbar-tool, .voxel-v2-undo, .voxel-v2-inventory { min-width: 48px; min-height: 48px; }
  .mobile-controls { display: block; }
  .voxel-game[data-view="overview"][data-mode="build"] .joystick,
  .voxel-game[data-view="overview"][data-mode="build"] .jump-action,
  .voxel-game[data-view="overview"][data-mode="build"] .land-action,
  .voxel-game[data-view="overview"][data-mode="build"] .descend-action { display: none !important; }
  .joystick { position: absolute; left: calc(var(--safe-left) + 18px); bottom: calc(var(--safe-bottom) + 70px); width: 112px; height: 112px; border: 3px solid rgba(255,255,255,.82); border-radius: 50%; background: rgba(20,20,20,.32); box-shadow: inset 0 0 0 2px rgba(0,0,0,.36), 3px 3px 0 rgba(0,0,0,.24); touch-action: none; }
  .joystick::before, .joystick::after { content: ""; position: absolute; left: 50%; top: 50%; background: rgba(255,255,255,.42); transform: translate(-50%, -50%); }
  .joystick::before { width: 64px; height: 2px; }
  .joystick::after { width: 2px; height: 64px; }
  .joystick i { position: absolute; left: calc(50% - 24px); top: calc(50% - 24px); width: 48px; height: 48px; border: 3px solid #fff; border-radius: 50%; background: rgba(68,68,68,.9); box-shadow: inset 3px 3px rgba(255,255,255,.22), 3px 3px 0 rgba(0,0,0,.42); }
  .mobile-actions { position: absolute; right: calc(var(--safe-right) + 16px); bottom: calc(var(--safe-bottom) + 70px); width: 122px; height: 122px; display: grid; grid-template-columns: 52px 66px; grid-template-rows: 52px 66px; gap: 4px; align-items: end; justify-items: end; }
  .round-action { width: var(--control-min); height: var(--control-min); padding: 0; border: 3px solid #fff; border-radius: 0; color: #fff; background: rgba(45,45,45,.88); box-shadow: inset 2px 2px rgba(255,255,255,.2), inset -2px -2px rgba(0,0,0,.45), 3px 3px 0 rgba(0,0,0,.48); cursor: pointer; font-size: 12px; font-weight: 900; touch-action: manipulation; text-shadow: 1px 1px #000; }
  .round-action:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0,0,0,.5); }
  .primary-action { grid-column: 2; grid-row: 2; width: 66px; height: 66px; background: rgba(47,114,92,.94); }
  .jump-action { grid-column: 1; grid-row: 2; }
  .rotate-action { grid-column: 2; grid-row: 1; }
  .break-action { grid-column: 1; grid-row: 1; background: rgba(176,76,60,.92); }
  .land-action { position: absolute; left: 0; top: -54px; background: rgba(111,75,45,.92); }
  .descend-action { position: absolute; right: 0; top: -54px; background: rgba(45,70,112,.92); }
  .game-drawer { top: auto; right: calc(var(--safe-right) + 5px); bottom: calc(var(--safe-bottom) + 5px); left: calc(var(--safe-left) + 5px); width: auto; max-height: min(76dvh, 620px); transform: none; border-width: 3px; }
  .game-drawer > header { grid-template-columns: 1fr 48px; gap: 7px; }
  .game-drawer > header > div { display: none; }
  .drawer-tabs { min-width: 0; overflow-x: auto; }
  .drawer-body { max-height: calc(76dvh - 58px); padding: 11px; }
  .inventory-panel { gap: 8px; }
  .creative-catalog-hero { min-height: 0; padding: 10px; grid-template-columns: 1fr; gap: 9px; }
  .creative-catalog-hero strong { font-size: 15px; }
  .creative-catalog-rules { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .creative-catalog-rules span { padding: 4px 3px; font-size: 7px; white-space: normal; text-align: center; }
  .creative-current-item { grid-template-columns: 68px minmax(0,1fr); }
  .creative-current-item .inventory-swatch { width: 66px; height: 48px; }
  .creative-current-item em { grid-column: 1 / -1; padding-top: 5px; border-top: 1px solid #777; text-align: center; }
  .creative-catalog-tabs { grid-template-columns: repeat(4,minmax(72px,1fr)); overflow-x: auto; }
  .creative-catalog-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
  .inventory-item { min-height: 146px; padding: 7px 6px; grid-template-columns: minmax(0,1fr); grid-template-rows: 74px auto auto; gap: 6px; }
  .inventory-swatch { width: 100%; height: 74px; }
  .member-card { right: calc(var(--safe-right) + 7px); bottom: calc(var(--safe-bottom) + 7px); left: calc(var(--safe-left) + 7px); width: auto; }
  .member-card-actions { grid-template-columns: 1fr; }
  .incoming-card, .toast { top: calc(var(--safe-top) + 64px); }
  .incoming-card { align-items: stretch; flex-wrap: wrap; }
  .incoming-card strong { flex-basis: 100%; }
  .incoming-card button { flex: 1 1 0; min-width: var(--control-min); }
  .overview-guide { right: calc(var(--safe-right) + 8px); bottom: calc(var(--safe-bottom) + 8px); left: calc(var(--safe-left) + 8px); min-height: 42px; max-width: none; padding: 7px 9px; transform: none; }
  .overview-guide strong { font-size: 11px; }
  .overview-guide-desktop { display: none; }
  .overview-guide-touch { display: inline; font-size: 9px; }
  .overview-guide-build { display: none; }
  .voxel-game[data-mode="build"] .overview-guide-explore { display: none; }
  .voxel-game[data-view="overview"][data-mode="build"] .overview-guide-build.overview-guide-desktop { display: none; }
  .voxel-game[data-view="overview"][data-mode="build"] .overview-guide-build.overview-guide-touch { display: inline; }
  .voxel-game[data-view="overview"][data-mode="build"] .overview-guide { right: auto; bottom: calc(var(--safe-bottom) + 202px); left: calc(var(--safe-left) + 8px); max-width: 220px; }
  .overview-guide span { font-size: 9px; line-height: 1.5; }
  .overview-target-status { max-width: 200px; padding-left: 0; border-left: 0; white-space: normal; }
  .voxel-game[data-view="overview"] .sync-chip { bottom: calc(var(--safe-bottom) + 58px); }
}

@media (max-width: 420px) {
  .world-card { width: 148px; }
  .world-copy strong, .world-state { max-width: 102px; }
  .joystick { left: calc(var(--safe-left) + 12px); width: 106px; height: 106px; }
  .mobile-actions { right: calc(var(--safe-right) + 12px); }
  .target-hint { max-width: calc(100vw - 26px); }
  .creative-catalog-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .sign-editor { top: auto; bottom: calc(var(--safe-bottom) + 8px); transform: translateX(-50%); }
  .sign-editor-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition-duration: .01ms !important; } }
@media (prefers-contrast: more) { .world-card, .pixel-button, .game-drawer, .member-card, .sync-chip, .target-hint { border-color: #fff; background: #000; } }
