/* Rimfell - game UI */
:root {
  --ink: #0b1220;
  --slate: #16202f;
  --rim: #7fd4c1;
  --amber: #f0b429;
  --bone: #eef3ee;
  --muted: #9fb0bd;
  --edge: rgba(127, 212, 193, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #0b1220;
  color: var(--bone);
  font-family: ui-monospace, "SFMono-Regular", "DejaVu Sans Mono", Menlo, Consolas, monospace;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
  touch-action: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

#hud { position: fixed; inset: 0; pointer-events: none; }

/* crosshair */
#crosshair {
  position: absolute;
  left: 50%; top: 50%;
  width: 22px; height: 22px;
  transform: translate(-50%, -50%);
  opacity: 0.9;
}
#crosshair .bar { position: absolute; background: var(--bone); box-shadow: 0 0 0 1px rgba(0,0,0,0.55); }
#crosshair .bar.h { left: 0; right: 0; top: 10px; height: 2px; }
#crosshair .bar.v { top: 0; bottom: 0; left: 10px; width: 2px; }

/* top bar */
#topbar {
  position: absolute;
  top: 10px; left: 12px; right: 12px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
  letter-spacing: 0.04em;
}
#topbar .brand {
  display: flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: 0.22em;
  color: var(--rim); font-weight: 700;
}
#topbar .mark {
  width: 12px; height: 12px; display: inline-block;
  background: linear-gradient(135deg, var(--rim) 0 45%, var(--amber) 45% 100%);
  transform: rotate(45deg);
}
#clock { color: var(--bone); }
#seedtag { color: var(--muted); }
#topbar button {
  pointer-events: auto;
  font: inherit; font-size: 11px;
  color: var(--bone);
  background: rgba(22, 32, 47, 0.8);
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
}
#topbar button:hover { background: rgba(127, 212, 193, 0.18); }
#new-world { border-color: rgba(240, 180, 41, 0.5); }

/* hotbar */
#hotbar {
  position: absolute;
  left: 50%; bottom: 18px;
  transform: translateX(-50%);
  display: flex; gap: 6px;
  padding: 6px;
  background: rgba(11, 18, 32, 0.62);
  border: 1px solid rgba(238, 243, 238, 0.14);
  border-radius: 10px;
  pointer-events: auto;
}
.slot {
  position: relative;
  width: 54px; height: 54px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(23, 33, 47, 0.85);
  border: 1px solid rgba(238, 243, 238, 0.14);
  border-radius: 8px;
  cursor: pointer;
}
.slot img { width: 36px; height: 36px; image-rendering: pixelated; }
.slot .key {
  position: absolute; top: 3px; left: 5px;
  font-size: 10px; color: var(--muted);
}
.slot .label {
  position: absolute; bottom: 2px; left: 0; right: 0;
  font-size: 9px; text-align: center; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.slot[aria-selected="true"] {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(240, 180, 41, 0.35), 0 4px 14px rgba(0,0,0,0.4);
  background: rgba(240, 180, 41, 0.12);
}
.slot[aria-selected="true"] .label { color: var(--amber); }

#toast {
  position: absolute;
  left: 50%; bottom: 86px;
  transform: translateX(-50%) translateY(6px);
  font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--amber);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#hint {
  position: absolute;
  left: 12px; bottom: 12px;
  font-size: 11px; color: var(--muted);
  max-width: 62ch;
}

/* start gate */
#start {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: radial-gradient(120% 90% at 50% 30%, rgba(11,18,32,0.45), rgba(11,18,32,0.9));
  pointer-events: auto;
  z-index: 5;
}
#start.show { display: flex; }
#start .panel {
  max-width: 420px;
  padding: 28px 30px;
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: rgba(15, 24, 38, 0.88);
  text-align: center;
}
#start h1 {
  margin: 0 0 8px;
  font-size: 34px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--rim);
}
#start p { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.5; }
#start .small { font-size: 11px; margin-top: 16px; margin-bottom: 0; }
#begin {
  font: inherit; font-size: 15px;
  padding: 12px 26px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--amber), #d99519);
  border: 0; border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.1em; text-transform: uppercase;
}
#begin:hover { filter: brightness(1.08); }

/* touch controls */
#touch-controls { display: none; }
body.touch #touch-controls.show { display: block; }
body.touch #hint { display: none; }

.pad {
  position: fixed;
  left: 18px; bottom: 96px;
  width: 128px; height: 128px;
  border-radius: 50%;
  background: rgba(11, 18, 32, 0.5);
  border: 1px solid var(--edge);
  pointer-events: auto;
  touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
.pad .knob {
  width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--rim), #2e8f7c);
  opacity: 0.85;
}
.pad .padlabel {
  position: absolute; bottom: -16px; left: 0; right: 0;
  text-align: center; font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.14em;
}
.tbtn {
  position: fixed;
  pointer-events: auto;
  touch-action: none;
  font: inherit; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--bone);
  background: rgba(22, 32, 47, 0.78);
  border: 1px solid var(--edge);
  border-radius: 10px;
  cursor: pointer;
}
.tbtn.jump { right: 22px; bottom: 104px; width: 82px; height: 62px; }
.tbtn.break { right: 116px; bottom: 150px; width: 82px; height: 56px; border-color: rgba(240,180,41,0.55); }
.tbtn.place { right: 22px; bottom: 178px; width: 82px; height: 56px; }
.tbtn:active { background: rgba(127, 212, 193, 0.28); }

@media (max-width: 560px) {
  .slot { width: 42px; height: 42px; }
  .slot img { width: 28px; height: 28px; }
  .slot .label { display: none; }
  #hint { display: none; }
  #seedtag { display: none; }
}
