:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f5f3e6;
  background: #1a3434;
  --muted: #c2cebc;
  --accent: #e6edac;
  --edge: clamp(20px, 3.3vw, 56px);
}

* { box-sizing: border-box; }
html, body, #game { width: 100%; height: 100%; margin: 0; overflow: hidden; }
#game { position: relative; isolation: isolate; }
.viewport { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: -2; }
.shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg, #101f1bd6 0%, #101f1b90 19%, #101f1b23 51%, transparent 72%),
    linear-gradient(0deg, #0b171ade, transparent 24%, transparent 83%, #142d355e);
  opacity: .84;
  transition: opacity .4s;
}
.hud-top, .hud-bottom {
  position: absolute;
  left: var(--edge);
  right: var(--edge);
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
.hud-top { top: clamp(20px, 4vh, 42px); }
.world, .clock { display: flex; align-items: center; gap: 12px; }
.world-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #eaf0cd55;
  border-radius: 5px;
  background: #1a2e28b0;
}
.world-mark span {
  width: 22px;
  height: 24px;
  background: conic-gradient(from 60deg at 50% 49%, #75894e 0deg 120deg, #a5b977 120deg 240deg, #e1e9ac 240deg);
  clip-path: polygon(50% 0, 100% 24%, 100% 75%, 50% 100%, 0 75%, 0 24%);
}
.eyebrow, .kicker, .selection, .position, kbd, .slot-number {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: .18em; color: var(--muted); }
.world-name { margin-top: 3px; font-size: 15px; font-weight: 650; letter-spacing: -.025em; }
.world-name, .world .eyebrow { text-shadow: 0 1px 6px #10211c; }
.clock {
  min-width: 125px;
  position: relative;
  padding: 8px 14px 11px 10px;
  border: 1px solid #f0f4d841;
  border-radius: 5px;
  background: #182d27c9;
  overflow: hidden;
  gap: 9px;
}
.celestial { font-size: 21px; width: 25px; text-align: center; color: #f5d88f; line-height: 1; }
.time { margin-top: 2px; font: 600 13px ui-monospace, SFMono-Regular, Consolas, monospace; }
.clock-track { position: absolute; inset: auto 0 0; height: 2px; background: #f0f4d827; }
.clock-track span { display: block; height: 100%; background: #ebd48e; transform: scaleX(.29); transform-origin: left; }

.intro { position: absolute; top: 50%; left: var(--edge); transform: translateY(-52%); max-width: calc(100% - var(--edge) * 2); }
.intro[hidden] { display: none; }
.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: clamp(9px, 1vw, 11px);
  font-weight: 700;
  letter-spacing: .21em;
  text-shadow: 0 1px 6px #13261e;
}
.kicker::before { content: ""; width: 19px; height: 1px; background: currentColor; }
h1 {
  margin: 10px 0 14px -.055em;
  font-size: clamp(58px, 8.8vw, 144px);
  line-height: .91;
  letter-spacing: -.085em;
  font-weight: 835;
  text-shadow: 0 4px 32px #12251e56;
}
h1 span { color: var(--accent); }
.intro p { margin: 0 0 27px; font-size: clamp(13px, 1.25vw, 17px); color: #e3e8d9; text-shadow: 0 1px 6px #10211c; }
#enter {
  cursor: pointer;
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  gap: 25px;
  padding: 12px 15px;
  border: 1px solid #f4f7c6;
  border-radius: 4px;
  background: var(--accent);
  color: #263326;
  box-shadow: 0 4px 15px #0b181846;
  font: 750 13px/1.2 system-ui, sans-serif;
}
#enter span { font-size: 16px; line-height: 1; }
#enter[hidden] { display: none; }
#enter:hover, #enter:focus-visible { background: #f5f8cb; }

.hud-bottom { bottom: clamp(20px, 4vh, 44px); align-items: end; }
.controls { display: grid; gap: 6px; color: #e0e7d8; font-size: 11px; font-weight: 600; text-shadow: 0 1px 5px #0e211a; }
.controls > div { display: flex; align-items: center; gap: 3px; }
.controls span { margin-left: 5px; }
.controls .play-controls { display: none; }
.play-controls span + kbd { margin-left: 8px; }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 19px;
  padding: 0 4px;
  border: 1px solid #eff3dd4d;
  border-radius: 3px;
  background: #172d28a6;
  color: #f0f2e5;
  font-size: 10px;
}
.wide-key { padding-inline: 6px; }
.inventory { position: absolute; left: 50%; transform: translateX(-50%); text-align: center; }
.selection {
  margin-bottom: 8px;
  color: #f4f6dd;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-shadow: 0 1px 6px #111d16, 0 1px 3px #111d16;
}
.hotbar {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid #e6efcd42;
  border-radius: 7px;
  background: #10221dbf;
  box-shadow: 0 4px 18px #06141145;
  pointer-events: auto;
}
.slot {
  width: clamp(39px, 4.2vw, 55px);
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  color: #e0e5d2;
  background: #d8e8cb13;
  border: 1px solid #dfe8d12e;
  border-radius: 4px;
  cursor: pointer;
}
.slot[aria-pressed="true"] { color: #f0f2bd; background: #dde6a52c; border-color: #e2eaa8; box-shadow: inset 0 0 0 1px #e2eaa83b; }
.slot canvas { width: 74%; height: 74%; image-rendering: pixelated; }
.slot-number { position: absolute; top: 3px; left: 4px; font-size: 9px; }
.position { display: flex; align-items: center; gap: 7px; color: #d7e0ce; font-size: 10px; letter-spacing: .08em; text-shadow: 0 1px 4px #07130e; }
.heading { color: var(--accent); min-width: 25px; text-align: center; border: 1px solid #edf3d35c; border-radius: 3px; padding: 4px 3px; background: #172d28a6; }
.crosshair { display: none; position: absolute; left: 50%; top: 50%; width: 15px; height: 15px; transform: translate(-50%, -50%); pointer-events: none; }
.crosshair::before, .crosshair::after { content: ""; position: absolute; background: #f5f6e9; box-shadow: 0 0 2px 1px #1729209c; border-radius: 1px; }
.crosshair::before { inset: 7px 0; }
.crosshair::after { inset: 0 7px; }
.playing .crosshair { display: block; }
.playing .shade { opacity: .37; background: linear-gradient(0deg, #0b171ad9, transparent 19%, transparent 87%, #132a3461); }
.entered .controls .play-controls { display: flex; }
.playing .slot { cursor: default; }

@media (max-width: 680px) {
  .position { display: none; }
  .controls { display: none; }
  .intro { transform: translateY(-55%); }
}
