:root {
  color-scheme: dark;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  background: #101827;
}

* {
  box-sizing: border-box;
}

html,
body,
#game-shell {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: radial-gradient(circle at 50% 20%, #314e69 0%, #172439 55%, #0b111d 100%);
}

#game-shell {
  position: relative;
  touch-action: none;
  user-select: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  image-rendering: pixelated;
}

#loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(15, 27, 45, 0.2), rgba(8, 13, 23, 0.84)),
    radial-gradient(circle at 50% 30%, #638fc0, #253d5d 58%, #111a2c);
  z-index: 5;
  transition: opacity 700ms ease, visibility 700ms ease;
}

#loading.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.brand {
  position: absolute;
  top: 37%;
  width: min(92vw, 620px);
  text-align: center;
  filter: drop-shadow(0 8px 0 rgba(11, 20, 24, 0.45));
}

.brand h1 {
  margin: 0;
  color: #eefac9;
  font-family: Georgia, serif;
  font-size: clamp(38px, 7vw, 76px);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 0.9;
  text-shadow:
    0 3px 0 #7eaa3f,
    0 6px 0 #365b32,
    3px 0 0 #29442c,
    -3px 0 0 #29442c;
}

.brand p {
  margin: 21px 0 0;
  color: #dbe9f2;
  font-size: clamp(10px, 1.4vw, 14px);
  font-weight: 800;
  letter-spacing: 0.36em;
  text-shadow: 0 2px 0 #172033;
}

.brand-leaf {
  display: inline-block;
  margin-bottom: 18px;
  color: #9ad34e;
  font-size: 30px;
  transform: rotate(28deg);
  text-shadow: 0 3px 0 #315c2b;
}

.loader {
  position: absolute;
  bottom: 20%;
  width: min(62vw, 330px);
  height: 8px;
  overflow: hidden;
  border: 2px solid rgba(226, 242, 255, 0.7);
  border-radius: 2px;
  background: rgba(8, 16, 26, 0.55);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
}

.loader span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #6ca33e, #c4e865, #6ca33e);
  transform-origin: left;
  animation: load 650ms ease both;
}

@keyframes load {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

#mobile-controls {
  position: absolute;
  inset: auto 0 18px;
  display: none;
  align-items: end;
  justify-content: space-between;
  padding: 0 20px;
  pointer-events: none;
}

#mobile-controls button {
  width: 64px;
  height: 64px;
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 50%;
  background: rgba(13, 27, 43, .5);
  color: rgba(255,255,255,.85);
  font-size: 22px;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.2);
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

.move-pad {
  display: flex;
  gap: 12px;
}

#mobile-controls .inventory {
  position: absolute;
  right: 20px;
  bottom: 78px;
  width: 50px;
  height: 50px;
  border-color: rgba(177, 214, 142, .5);
  color: #dff1c1;
  font-size: 19px;
}

#mobile-controls .jump {
  margin-left: auto;
  margin-right: 12px;
}

#mobile-controls .action {
  border-color: rgba(255, 216, 104, .55);
  color: #ffe79c;
}

@media (hover: none) and (max-width: 900px), (pointer: coarse) and (max-width: 900px) {
  #mobile-controls { display: flex; }
  #mobile-controls.inventory-open { display: none; }
  #game { cursor: default; }
}
