:root {
  color-scheme: dark;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  background: #0d1210;
  color: #dce6dd;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --field-green: #a2e47a;
  --field-muted: #798a7a;
  --field-line: #29362c;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: radial-gradient(ellipse at 50% 40%, #19251b 0, #0d1210 68%); }
button, a { font: inherit; }
a { color: inherit; }
.voxel-topbar { height: 58px; padding-inline: clamp(18px, 4vw, 54px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--field-line); color: #91a18e; font-size: 9px; letter-spacing: .1em; }
.voxel-brand { color: var(--field-green); font-size: 13px; font-weight: 800; letter-spacing: .05em; text-decoration: none; }
.voxel-brand span { color: var(--field-muted); font-size: 9px; font-weight: 400; }
.voxel-topbar nav { display: flex; gap: 24px; align-items: center; }
.voxel-topbar nav a { color: #7a897b; text-decoration: none; }
.voxel-topbar nav a:hover, .voxel-topbar nav span { color: var(--field-green); }
.engine-status { display: flex; align-items: center; gap: 8px; }
.engine-status i, .game-topline i { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--field-green); box-shadow: 0 0 9px #a2e47a88; }
.voxel-shell { width: min(1240px, calc(100% - 48px)); margin: 38px auto 24px; }
.voxel-heading { display: flex; min-height: 68px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-tag { margin: 0 0 8px; color: var(--field-green); font-size: 9px; letter-spacing: .13em; }
h1 { margin: 0; color: #eaf2e9; font-family: ui-sans-serif, system-ui, sans-serif; font-size: clamp(26px, 4vw, 36px); font-weight: 550; letter-spacing: -.045em; }
.heading-note { margin: 15px 0 0; color: var(--field-muted); font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; }
.game-shell { position: relative; overflow: hidden; isolation: isolate; border: 1px solid #394b3b; background: #17251b; box-shadow: 0 22px 80px #0006; aspect-ratio: 16 / 9; }
#voxel-view { width: 100%; height: 100%; display: block; outline: 0; cursor: crosshair; }
.game-shell:fullscreen, .game-shell:-webkit-full-screen { position: fixed; inset: 0; z-index: 1000; width: 100vw; height: 100vh; aspect-ratio: auto; border: 0; }
.game-shell:fullscreen #voxel-view, .game-shell:-webkit-full-screen #voxel-view { width: 100%; height: 100%; }
.game-vignette { position: absolute; z-index: 1; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 52%, #03080566 100%); }
.game-topline { position: absolute; z-index: 2; inset: 13px 15px auto; display: flex; justify-content: space-between; color: #d9e8d5; font-size: 8px; letter-spacing: .1em; text-shadow: 0 1px 5px #000; pointer-events: none; }
.game-topline span:first-child { display: flex; align-items: center; gap: 8px; }
.game-topline .sky-clock { margin-left: auto; margin-right: 18px; color: #e4edcd; }
.fullscreen-toggle { position: absolute; z-index: 4; top: 34px; right: 12px; width: 32px; height: 28px; display: grid; place-items: center; padding: 0; border: 1px solid #b7c7b477; border-radius: 3px; background: #101810c9; color: #e4eedf; font: inherit; font-size: 17px; line-height: 1; cursor: pointer; touch-action: manipulation; }
.fullscreen-toggle:hover, .fullscreen-toggle:focus-visible { border-color: var(--field-green); color: var(--field-green); outline: none; }
.fullscreen-toggle[aria-pressed="true"] { color: var(--field-green); }
.game-shell.pointer-locked .fullscreen-toggle { display: none; }
.flashlight-status { color: #849381; }
.flashlight-status.active { color: #f4d58d; }
.flight-status { color: #849381; }
.flight-status.active { color: #a2e47a; }
.aim-dot { position: absolute; z-index: 2; top: 50%; left: 50%; width: 14px; height: 14px; transform: translate(-50%, -50%); pointer-events: none; filter: drop-shadow(0 1px 2px #000); }
.aim-dot i, .aim-dot b { position: absolute; display: block; background: #eff9df; }
.aim-dot i { left: 1px; top: 6px; width: 12px; height: 2px; }
.aim-dot b { left: 6px; top: 1px; width: 2px; height: 12px; }
.reticle-readout { position: absolute; z-index: 2; top: calc(50% + 13px); left: 50%; color: #d7edbd66; font-size: 8px; transform: translateX(-50%); pointer-events: none; }
.enter-screen { position: absolute; z-index: 3; inset: 0; width: 100%; display: grid; align-content: center; justify-items: center; gap: 10px; border: 0; background: #09110ba8; cursor: pointer; transition: background .15s; }
.enter-screen:hover { background: #09110b83; }
.enter-screen[hidden] { display: none; }
.enter-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid #a2e47a99; border-radius: 50%; color: var(--field-green); font-size: 18px; }
.enter-screen strong { color: #edf5e8; font-size: 10px; letter-spacing: .15em; }
.enter-screen small { color: #aab9a6; font-size: 9px; }
.voxel-toast { position: absolute; z-index: 4; bottom: 18px; left: 50%; padding: 8px 12px; transform: translate(-50%, 8px); opacity: 0; background: #101810e8; color: #c6e995; font-size: 9px; pointer-events: none; transition: .18s; }
.voxel-toast.visible { transform: translate(-50%, 0); opacity: 1; }
.npc-prompt { position: absolute; z-index: 4; left: 50%; bottom: 56px; padding: 8px 11px; transform: translateX(-50%); border: 1px solid #a2e47a66; background: #101810e8; color: #e4eedf; font-size: 9px; letter-spacing: .08em; pointer-events: none; white-space: nowrap; }
.npc-prompt kbd { margin-left: 7px; color: var(--field-green); }
.npc-prompt[hidden], .npc-dialogue[hidden], .npc-talk-touch[hidden] { display: none; }
.npc-dialogue { position: absolute; z-index: 6; left: 50%; bottom: 55px; width: min(340px, calc(100% - 32px)); padding: 13px 16px; transform: translateX(-50%); border: 1px solid #a2e47a88; background: #101810ed; color: #e4eedf; font-size: 11px; line-height: 1.5; text-align: center; box-shadow: 0 5px 25px #0007; pointer-events: none; }
.coordinates { position: absolute; z-index: 2; right: 14px; bottom: 13px; display: flex; gap: 12px; color: #b9c8b466; font-size: 8px; pointer-events: none; }
.coordinates b { color: #e0ebd399; font-weight: 450; }
.mobile-ui { display: none; }

.voxel-toolbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--field-line); }
.toolbar-controls, .inventory { display: flex; align-items: center; gap: 10px; }
.toolbar-label, .inventory-label { color: var(--field-muted); font-size: 8px; letter-spacing: .1em; }
.wasd { display: grid; justify-items: center; gap: 3px; }
.wasd > span { display: flex; gap: 3px; }
kbd { min-width: 20px; height: 19px; padding: 2px 4px; display: inline-grid; place-items: center; border: 1px solid #465748; border-bottom-width: 2px; border-radius: 3px; color: #d5e1d3; font: inherit; font-size: 8px; line-height: 1; }
.wasd kbd { min-width: 17px; height: 15px; font-size: 7px; }
.space-key { min-width: 45px; font-size: 7px; }
.toolbar-divider { height: 24px; margin-inline: 2px; border-left: 1px solid var(--field-line); }
.mouse-controls { color: #95a492; font-size: 8px; }
.mouse-controls b { color: #dbe6d8; font-size: 7px; font-weight: 500; }
.mouse-controls span { padding-inline: 3px; color: #536252; }
.inventory { gap: 5px; }
.inventory-label { margin-right: 5px; }
.block-slot { position: relative; width: 36px; height: 39px; display: grid; place-items: center; border: 1px solid var(--field-line); background: #121a13; cursor: pointer; }
.block-slot:hover { border-color: #61775d; }
.block-slot.selected { border-color: var(--field-green); box-shadow: inset 0 0 0 1px #a2e47a44, 0 0 12px #a2e47a18; }
.block-slot kbd { position: absolute; right: 2px; bottom: 2px; min-width: 12px; height: 12px; padding: 0; border: 0; color: #aab9a6; font-size: 7px; }
.swatch { width: 16px; height: 16px; border: 1px solid #ffffff33; box-shadow: inset -3px -3px #0003; }
.swatch.grass { background: #6fb85a; }
.swatch.dirt { background: #986b43; }
.swatch.stone { background: #8d9890; }
.swatch.wood { background: #aa7742; }
.swatch.sand { background: #d9bc78; }
.swatch.torch { background: radial-gradient(circle at 50% 28%, #fff2a3 0 16%, #ff9b33 17% 42%, transparent 44%), linear-gradient(90deg, transparent 40%, #956037 41% 59%, transparent 60%); }
.voxel-footer { min-height: 40px; display: flex; justify-content: space-between; align-items: center; color: #596959; font-size: 7px; letter-spacing: .09em; }
#fps-count { white-space: nowrap; }

@media (max-width: 780px) {
  .voxel-shell { width: min(100% - 28px, 680px); margin-top: 24px; }
  .voxel-toolbar { align-items: flex-start; flex-direction: column; padding-block: 13px; }
  .toolbar-controls { width: 100%; justify-content: space-between; gap: 5px; }
  .inventory { align-self: flex-end; }
}
@media (max-width: 520px) {
  .voxel-topbar { height: 50px; padding-inline: 13px; }
  .voxel-topbar nav { gap: 9px; font-size: 7px; }
  .engine-status { font-size: 0; }
  .engine-status i { width: 7px; height: 7px; }
  .voxel-shell { width: calc(100% - 20px); margin-top: 15px; }
  .voxel-heading { min-height: 56px; margin-bottom: 10px; }
  .heading-note { max-width: 120px; font-size: 10px; text-align: right; }
  .game-shell { aspect-ratio: 4 / 3; }
  .toolbar-controls { flex-wrap: wrap; justify-content: flex-start; column-gap: 7px; }
  .toolbar-divider { margin-inline: 1px; }
  .mouse-controls { font-size: 7px; }
  .voxel-footer { font-size: 6px; flex-wrap: wrap; gap: 5px 10px; }
  #fps-count { margin-left: auto; }
}

@media (pointer: coarse) and (max-width: 1100px) {
  .voxel-shell { width: calc(100% - 20px); margin-top: 14px; }
  .game-shell { aspect-ratio: 16 / 9; touch-action: none; }
  .mobile-ui { position: absolute; z-index: 5; inset: 0; display: none; pointer-events: none; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
  .game-shell.mobile-active .mobile-ui { display: block; }
  .move-pad { position: absolute; left: 16px; bottom: 17px; width: 108px; height: 108px; display: grid; place-items: center; color: #e2ebd8; pointer-events: auto; touch-action: none; }
  .move-pad-ring { position: absolute; inset: 0; border: 1px solid #e2ebd866; border-radius: 50%; background: #09110b66; box-shadow: inset 0 0 0 12px #ffffff08; }
  .touch-stick { position: absolute; width: 42px; height: 42px; border: 1px solid #d9e9cfaa; border-radius: 50%; background: #8ea78499; box-shadow: 0 2px 10px #0008; }
  .move-pad small { position: absolute; bottom: 7px; font-size: 7px; letter-spacing: .12em; text-shadow: 0 1px 4px #000; }
  .touch-look-hint { position: absolute; top: 50%; right: 21%; color: #f0f5e655; font-size: 8px; letter-spacing: .12em; transform: translateY(-50%); text-shadow: 0 1px 4px #000; }
  .touch-hotbar { position: absolute; left: 50%; bottom: 17px; display: flex; gap: 4px; transform: translateX(-50%); pointer-events: auto; }
  .touch-hotbar button, .touch-actions button, .touch-exit { min-width: 40px; min-height: 44px; border: 1px solid #b7c7b477; border-radius: 4px; background: #101810c9; color: #e4eedf; font: inherit; font-size: 10px; font-weight: 700; touch-action: manipulation; }
  .touch-hotbar button.selected { border-color: var(--field-green); color: var(--field-green); box-shadow: inset 0 0 0 1px #a2e47a55; }
  .touch-actions { position: absolute; right: 14px; bottom: 17px; display: grid; grid-template-columns: repeat(2, 54px); gap: 5px; pointer-events: auto; }
  .touch-actions button { min-height: 44px; font-size: 8px; }
  .npc-prompt { display: none; }
  .npc-talk-touch { position: absolute; z-index: 6; left: 50%; bottom: 72px; min-width: 68px; min-height: 38px; transform: translateX(-50%); border: 1px solid #a2e47a; border-radius: 4px; background: #101810e8; color: var(--field-green); font: inherit; font-size: 9px; font-weight: 700; pointer-events: auto; touch-action: manipulation; }
  .npc-dialogue { bottom: 118px; }
  .mobile-ui.flight-enabled [data-touch-action="jump"] { visibility: hidden; }
  .touch-flight-controls { position: absolute; right: 14px; bottom: 166px; display: none; grid-template-columns: repeat(2, 54px); gap: 5px; pointer-events: auto; }
  .mobile-ui.flight-enabled .touch-flight-controls { display: grid; }
  .touch-flight-controls button { min-height: 38px; border: 1px solid #b7c7b477; border-radius: 4px; background: #101810c9; color: #e4eedf; font: inherit; font-size: 8px; font-weight: 700; touch-action: none; }
  .touch-flight-controls button:active { background: #38503a; }
  .touch-actions button:active, .touch-hotbar button:active, .touch-exit:active { background: #38503a; }
  .touch-exit { position: absolute; z-index: 11; top: 34px; right: 12px; min-width: 42px; min-height: 28px; font-size: 8px; pointer-events: auto; }
  .game-shell.mobile-active .fullscreen-toggle { right: 62px; }
  .rotate-prompt { display: none; }
}

@media (pointer: coarse) and (max-width: 1100px) and (orientation: portrait) {
  .game-shell.mobile-active .rotate-prompt { position: absolute; z-index: 10; inset: 0; display: grid; align-content: center; justify-items: center; gap: 9px; background: #0d1512f2; color: #edf5e8; text-align: center; pointer-events: auto; }
  .rotate-prompt strong { color: var(--field-green); font-size: 13px; letter-spacing: .12em; }
  .rotate-prompt span { color: #b5c2b3; font-size: 11px; }
}
