:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #f7f1de;
  background: #1b312c;
  --gold: #efd099;
  --ink: #192b25;
  --edge: clamp(20px, 3.25vw, 54px);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; overflow: hidden; user-select: none; }
[hidden] { display: none !important; }

#view, .vignette { position: fixed; inset: 0; }
#view canvas { display: block; width: 100%; height: 100%; }
.vignette {
  pointer-events: none;
  background:
    linear-gradient(0deg, #0b191bee, #0b191b00 23%),
    linear-gradient(180deg, #10262275, transparent 17%);
}
.vignette::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #101e1b92, #101e1b43 36%, transparent 70%);
}
.playing .vignette::before { display: none; }
.playing .vignette { opacity: .72; }

.hud-top, .hud-bottom {
  position: fixed;
  left: var(--edge);
  right: var(--edge);
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.hud-top { top: clamp(18px, 3.8vh, 39px); align-items: flex-start; }
.location, .world-clock { display: flex; align-items: center; gap: 12px; }
.location { text-shadow: 0 1px 5px #132b25; }
.hud-label {
  color: #fff5dc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.coordinates, .clock-time {
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  white-space: pre;
}
.coordinates { font-size: 11px; letter-spacing: .05em; color: #f0ebd8; }
.compass {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #f7f1de59;
  border-radius: 50%;
  background: #182e28a8;
}
.compass i {
  width: 13px;
  height: 13px;
  background: linear-gradient(135deg, var(--gold) 50%, #f5ebd67a 50%);
  clip-path: polygon(50% 0, 73% 31%, 100% 50%, 71% 69%, 50% 100%, 29% 69%, 0 50%, 27% 31%);
  transform: rotate(24deg);
}
.world-clock {
  min-width: 116px;
  padding: 9px 13px;
  border: 1px solid #faedca45;
  border-radius: 6px;
  background: #192c28ad;
}
.world-clock .hud-label { font-size: 9px; color: #ead8b5; }
.clock-time { margin-top: 1px; font-size: 17px; line-height: 1; font-weight: 650; }
.clock-icon {
  position: relative;
  flex: 0 0 19px;
  height: 19px;
  background: var(--gold);
  clip-path: polygon(50% 0, 60% 23%, 85% 15%, 77% 40%, 100% 50%, 77% 60%, 85% 85%, 60% 77%, 50% 100%, 40% 77%, 15% 85%, 23% 60%, 0 50%, 23% 40%, 15% 15%, 40% 23%);
}
.clock-icon.night {
  background: #d9e6f1;
  clip-path: path('M 11 1 A 9 9 0 1 0 18 13 A 8 8 0 0 1 11 1 Z');
}

.intro {
  position: fixed;
  top: 50%;
  left: max(var(--edge), 7.35vw);
  transform: translateY(-52%);
  max-width: calc(100vw - 2 * var(--edge));
}
.intro h1 {
  margin: 0 0 13px -.045em;
  color: #fff3d8;
  font: 700 clamp(53px, 8vw, 132px)/.97 Georgia, 'Times New Roman', serif;
  letter-spacing: -.069em;
  text-shadow: 0 3px 34px #152d28a8;
}
.intro p {
  margin: 0;
  color: #fff6e4;
  font-size: clamp(14px, 1.5vw, 19px);
  line-height: 1.5;
  text-shadow: 0 2px 12px #10221e;
}
.intro button {
  margin-top: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid #f5e0b6;
  border-radius: 5px;
  padding: 12px 15px 12px 17px;
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 4px 18px #14241f55;
  font: 750 13px/1.25 system-ui, sans-serif;
  cursor: pointer;
}
.intro button:hover { background: #ffe2ac; box-shadow: 0 4px 24px #14241f90; }
.intro button:focus-visible { outline: 2px solid #fff3d8; outline-offset: 4px; }
.start-arrow { font-size: 18px; line-height: 1; }
.intro .status { margin-top: 10px; font-size: 13px; }

.crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 17px;
  height: 17px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: .68;
  filter: drop-shadow(0 0 2px #162722);
}
.crosshair::before, .crosshair::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 1px;
  background: #fffaea;
}
.crosshair::before { width: 15px; height: 2px; }
.crosshair::after { width: 2px; height: 15px; }
.playing .crosshair { opacity: .96; }

.hud-bottom { bottom: clamp(16px, 3.55vh, 42px); align-items: flex-end; }
.inventory { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); text-align: center; }
.selected-block {
  margin-bottom: 9px;
  color: #fff1d1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-shadow: 0 2px 5px #14251c;
}
.hotbar { display: flex; gap: 5px; }
.slot {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(40px, 4.7vw, 62px);
  aspect-ratio: 1;
  border: 1px solid #d8dfc65c;
  border-radius: 5px;
  background: #162b27d6;
  box-shadow: 0 2px 10px #0c191852;
}
.slot.active {
  border-color: var(--gold);
  background: #5a5538e8;
  box-shadow: inset 0 0 0 1px #efd09963, 0 2px 10px #0c191852;
}
.slot span { position: absolute; top: 4px; left: 5px; font-size: 9px; color: #e1e1cdcc; }
.slot.active span { color: #ffdfa4; }
.slot canvas { width: 73%; height: 73%; image-rendering: pixelated; }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 17px; padding: 0 0 8px; }
.control { display: inline-flex; gap: 7px; align-items: center; color: #f3ebd5; font-size: 12px; text-shadow: 0 1px 3px #12241e; }
.keys { display: inline-flex; gap: 3px; }
kbd {
  display: inline-grid;
  min-width: 20px;
  min-height: 21px;
  place-items: center;
  padding: 0 5px;
  border: 1px solid #dee0ca55;
  border-radius: 4px;
  background: #1c302bd9;
  color: #fff3d5;
  font: 600 10px/1 system-ui, sans-serif;
}
.mouse {
  position: relative;
  width: 15px;
  height: 20px;
  border: 1px solid #e2debd;
  border-radius: 6px 6px 7px 7px;
  background: #162b27bd;
  overflow: hidden;
}
.mouse::after { content: ''; position: absolute; top: 0; height: 8px; width: 50%; background: var(--gold); }
.mouse-left::after { left: 0; }
.mouse-right::after { right: 0; }

@media (max-width: 850px) {
  .controls { flex-direction: column; align-items: flex-start; gap: 6px; padding-bottom: 1px; }
  .actions { align-items: flex-end; }
}
@media (max-width: 550px), (max-height: 440px) {
  .controls { display: none; }
  .intro { left: var(--edge); }
  .intro button { margin-top: 16px; }
}
