:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, sans-serif;
  color: #faf6e9;
  background: #263d3d;
  --line: #fff7e62e;
  --accent: #f4d399;
  --glass: #172420dd;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  overflow: hidden;
  user-select: none;
}

#view {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.hud-header,
.hud-footer {
  position: fixed;
  left: clamp(16px, 3vw, 38px);
  right: clamp(16px, 3vw, 38px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  pointer-events: none;
}

.hud-header {
  top: 26px;
  align-items: start;
}

.world-id {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 12px;
  text-shadow: 0 2px 8px #0d1e18e0;
}

.world-mark {
  display: grid;
  place-items: center;
  position: relative;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass);
}

.world-mark::before {
  content: "";
  position: absolute;
  top: 8px;
  right: 9px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.world-mark i {
  width: 24px;
  height: 18px;
  background: #f1ddaf;
  clip-path: polygon(0 95%, 35% 23%, 59% 67%, 76% 42%, 100% 95%);
}

h1 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 500;
  line-height: 1;
}

#coordinates {
  margin: 6px 0 0;
  font: 600 10px/1 ui-monospace, monospace;
  letter-spacing: .08em;
  color: #faf6e1;
  white-space: pre;
}

.compass {
  position: relative;
  width: 200px;
  height: 38px;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, black 23% 77%, transparent);
  text-shadow: 0 1px 5px #17251d;
}

.compass-needle {
  position: absolute;
  z-index: 1;
  top: 0;
  left: calc(50% - 3px);
  border: 3px solid transparent;
  border-top: 5px solid var(--accent);
}

.compass-tick {
  position: absolute;
  left: 50%;
  top: 11px;
  width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font: 600 10px/1 ui-monospace, monospace;
  letter-spacing: .04em;
}

.compass-tick::before {
  content: "";
  width: 1px;
  height: 5px;
  background: #fff8e380;
}

.compass-tick.major::before { height: 8px; background: #fff8e3c9; }

.clock {
  justify-self: end;
  min-width: 124px;
  padding: 9px 11px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass);
}

.clock-face { display: flex; align-items: center; gap: 10px; }
.clock-readout { display: flex; flex-direction: column; gap: 3px; }

#phase-label {
  color: #e7ddc7;
  font-size: 9px;
  line-height: 1;
  font-weight: 650;
  letter-spacing: .11em;
  text-transform: uppercase;
}

#time-label { font: 500 16px/1 ui-monospace, monospace; }

.phase-icon {
  position: relative;
  width: 10px;
  height: 10px;
  margin: 0 6px;
  border: 1px solid var(--accent);
  border-radius: 50%;
}

.phase-icon::before,
.phase-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  top: -5px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 16px var(--accent), -8px 8px var(--accent), 8px 8px var(--accent);
}

.phase-icon::after { transform-origin: 1px 9px; transform: rotate(45deg); }
.phase-icon.night { border: 0; box-shadow: -3px 2px 0 1px #d8e8ff; transform: translate(1px, -1px); }
.phase-icon.night::before, .phase-icon.night::after { display: none; }

.clock-track {
  position: relative;
  height: 2px;
  margin-top: 9px;
  border-radius: 2px;
  background: linear-gradient(90deg, #7081a4, #87849e 19%, #dca96d 29%, #eddeb0 52%, #dca96d 71%, #7081a4 84%);
  opacity: .78;
}

.clock-track i {
  position: absolute;
  top: -2px;
  left: 29%;
  width: 2px;
  height: 6px;
  background: #fff9e6;
  box-shadow: 0 0 4px #fff4cd;
}

.start {
  position: fixed;
  top: 47%;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 9px;
  transform: translate(-50%, -50%);
}

#start-button {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 19px 10px 11px;
  border: 1px solid #f7e2bb70;
  border-radius: 9px;
  background: #192720ed;
  color: #fff6e4;
  box-shadow: 0 6px 25px #10241d66;
  font: 620 14px/1 system-ui, sans-serif;
  letter-spacing: .01em;
  white-space: nowrap;
  cursor: pointer;
}

#start-button:hover,
#start-button:focus-visible { background: #314237; border-color: var(--accent); }
#start-button:disabled { cursor: default; }

.play-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 5px;
  background: #f3d49b;
}

.play-icon::after {
  content: "";
  margin-left: 2px;
  border-left: 7px solid #2c3023;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

#status {
  position: absolute;
  top: 100%;
  margin: 9px 0 0;
  width: max-content;
  max-width: 80vw;
  padding: 6px 10px;
  border-radius: 5px;
  background: var(--glass);
  font-size: 12px;
  text-align: center;
}

.crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 17px;
  height: 17px;
  transform: translate(-50%, -50%);
  color: #fff9e9;
  filter: drop-shadow(0 1px 2px #111e1a);
  pointer-events: none;
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  background: currentColor;
  border-radius: 1px;
}

.crosshair::before { left: 8px; top: 1px; width: 1px; height: 15px; }
.crosshair::after { left: 1px; top: 8px; width: 15px; height: 1px; }

.hud-footer {
  bottom: 24px;
  align-items: end;
}

.inventory { justify-items: center; display: grid; gap: 7px; }

#selected-block {
  margin: 0;
  border: 1px solid #fff7e61c;
  border-radius: 4px;
  padding: 4px 9px;
  background: var(--glass);
  color: #fff0d2;
  font-size: 10px;
  line-height: 1.1;
  font-weight: 650;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.hotbar {
  display: flex;
  gap: 5px;
  margin: 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  list-style: none;
  background: #182520ed;
  box-shadow: 0 5px 20px #10241d56;
}

.slot {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 49px;
  border: 1px solid #fff6db18;
  border-radius: 5px;
  background: #f4e9c908;
}

.slot.selected {
  border-color: var(--accent);
  background: #f4d39926;
  box-shadow: inset 0 0 12px #f4d39913;
}

.slot kbd {
  position: absolute;
  top: 3px;
  left: 5px;
  color: #eeead3a8;
  font: 600 9px/1 ui-monospace, monospace;
}

.slot.selected kbd { color: var(--accent); }
.slot canvas { width: 37px; height: 37px; margin: 3px 0 0 2px; }

.bindings {
  display: grid;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-shadow: 0 1px 6px #0d1e18, 0 1px 3px #0d1e18;
}

.bindings > div { display: flex; align-items: center; gap: 8px; }
.bindings.editing { justify-self: end; }
.bindings.editing > div { justify-content: end; }
.key-group { display: flex; gap: 3px; }

.bindings kbd {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--glass);
  color: #faefd4;
  font: 600 9px/1 ui-monospace, monospace;
}

@media (max-width: 660px) {
  .hud-header, .hud-footer { grid-template-columns: 1fr 1fr; }
  .compass { display: none; }
  .inventory { grid-row: 1; grid-column: 1 / -1; margin-bottom: 10px; }
  .movement, .editing { grid-row: 2; }
}
