/* Quarryvale game screen: canvas, HUD, hotbar, touch controls, start overlay. */

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
  background: var(--night);
}

/* crosshair */
#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0.9;
}
#crosshair .ch-h,
#crosshair .ch-v {
  position: absolute;
  background: rgba(244, 236, 224, 0.92);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}
#crosshair .ch-h { left: 0; top: 12px; width: 26px; height: 2px; }
#crosshair .ch-v { left: 12px; top: 0; width: 2px; height: 26px; }

/* top bar */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.8rem;
  font-size: 0.8rem;
  background: linear-gradient(180deg, rgba(23, 20, 31, 0.85), rgba(23, 20, 31, 0));
  pointer-events: auto;
}
#topbar .brand {
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sand);
  text-decoration: none;
}
#topbar #seed-label,
#topbar #clock {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  background: rgba(23, 20, 31, 0.6);
  border: 1px solid rgba(244, 236, 224, 0.14);
  color: var(--bone-dim);
  white-space: nowrap;
}
#topbar .spacer { flex: 1; }
#topbar button {
  font: inherit;
  font-size: 0.74rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(244, 236, 224, 0.2);
  background: rgba(23, 20, 31, 0.65);
  color: var(--bone);
  cursor: pointer;
}
#topbar button:hover { border-color: var(--clay-hi); color: var(--sand); }

/* targeted block name */
#target-label {
  position: fixed;
  left: 50%;
  top: calc(50% + 26px);
  transform: translateX(-50%);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bone-dim);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  min-height: 1rem;
}

#toast {
  position: fixed;
  left: 50%;
  top: 14%;
  transform: translate(-50%, -8px);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: rgba(23, 20, 31, 0.85);
  border: 1px solid rgba(226, 207, 164, 0.35);
  color: var(--sand);
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* hotbar */
#hotbar {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: var(--radius);
  background: rgba(23, 20, 31, 0.55);
  border: 1px solid rgba(244, 236, 224, 0.14);
  backdrop-filter: blur(6px);
  max-width: calc(100vw - 16px);
}
.hslot {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  border: 2px solid rgba(244, 236, 224, 0.16);
  background: rgba(18, 15, 26, 0.65);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.hslot img {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
}
.hslot .hnum {
  position: absolute;
  left: 4px;
  top: 2px;
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--bone-dim);
  opacity: 0.75;
}
.hslot.sel {
  border-color: var(--clay-hi);
  background: rgba(201, 112, 63, 0.25);
  box-shadow: 0 0 0 2px rgba(226, 143, 86, 0.35), 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* touch controls: shown on coarse pointers, or when ?touch=1 forces them */
#touch-layer { display: none; }
@media (pointer: coarse) {
  #touch-layer { display: block; }
}
body.force-touch #touch-layer { display: block; }
#touch-layer .touch-off-hint { display: none; }

#touch-layer .t-pad {
  position: fixed;
  left: 18px;
  bottom: 96px;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(23, 20, 31, 0.62), rgba(23, 20, 31, 0.32));
  border: 2px solid rgba(244, 236, 224, 0.24);
  touch-action: none;
  pointer-events: auto;
}
#touch-layer .t-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--sand), var(--clay) 80%);
  border: 2px solid rgba(244, 236, 224, 0.5);
  transition: transform 0.05s linear;
}
#touch-layer .t-btn {
  position: fixed;
  border: 2px solid rgba(244, 236, 224, 0.3);
  border-radius: 14px;
  background: rgba(23, 20, 31, 0.62);
  color: var(--bone);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.85rem 1rem;
  touch-action: none;
  pointer-events: auto;
}
#touch-layer .t-jump { right: 20px; bottom: 190px; border-color: rgba(143, 174, 92, 0.6); }
#touch-layer .t-break { right: 20px; bottom: 128px; border-color: rgba(201, 112, 63, 0.7); }
#touch-layer .t-place { right: 112px; bottom: 128px; border-color: rgba(79, 143, 150, 0.7); }

/* start overlay */
#start {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(700px 420px at 50% 30%, rgba(201, 112, 63, 0.22), transparent 70%),
    rgba(13, 11, 22, 0.82);
  z-index: 20;
  transition: opacity 0.35s ease;
}
#start.hidden { opacity: 0; pointer-events: none; }
.start-card {
  width: min(520px, calc(100vw - 32px));
  padding: 1.6rem 1.8rem;
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(36, 31, 46, 0.95), rgba(18, 15, 26, 0.95));
  border: 1px solid rgba(244, 236, 224, 0.16);
  box-shadow: var(--shadow);
  text-align: center;
}
.start-card h1 {
  margin: 0;
  font-size: clamp(1.9rem, 6vw, 2.9rem);
  letter-spacing: 0.06em;
  background: linear-gradient(90deg, var(--sand), var(--clay-hi) 55%, var(--teal-hi));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.start-card .tag { margin: 0.35rem 0 1rem; color: var(--bone-dim); }
.mini-controls {
  list-style: none;
  margin: 0 0 1.1rem;
  padding: 0;
  text-align: left;
  font-size: 0.85rem;
  color: var(--bone-dim);
  line-height: 1.7;
}
.mini-controls b { color: var(--sand); font-weight: 700; }
.start-card .hint { margin: 0.8rem 0 0; font-size: 0.75rem; color: rgba(216, 203, 184, 0.75); }

@media (max-width: 560px) {
  .hslot { width: 40px; height: 40px; }
  .hslot img { width: 30px; height: 30px; }
  #topbar #seed-label { display: none; }
  #touch-layer .t-pad { width: 112px; height: 112px; bottom: 84px; }
  #touch-layer .t-jump { bottom: 168px; }
  #touch-layer .t-place { bottom: 108px; right: 104px; }
}
