/* How the page looks: the 3D view filling the window, and everything drawn on top of it. */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #2b1d12;
  color: #fff8ec;
  font-family: system-ui, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

[hidden] {
  display: none !important;
}

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

/* Coins, bag, pickaxe and depth, along the top. */
#hud {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: none;
}

#hud div {
  background: rgba(43, 29, 18, 0.75);
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 600;
}

#coins {
  color: #ffd75e;
}

#bag.full {
  color: #ff8a7a;
}

/* The dot in the middle of the view, which is where you dig. */
#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

#message,
#shopPrompt {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(43, 29, 18, 0.85);
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
  max-width: calc(100% - 32px);
}

#message {
  top: 32%;
}

#shopPrompt {
  bottom: 18%;
}

/* The title screen and the shop. */
.screen {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(30, 20, 12, 0.55);
  overflow-y: auto;
}

.panel {
  background: #4a311d;
  border: 3px solid #c8913f;
  border-radius: 16px;
  padding: 20px 24px;
  max-width: 460px;
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
}

h1 {
  margin: 0 0 8px;
  color: #ffd75e;
  font-size: 2.2rem;
}

h2 {
  margin: 0;
  color: #ffd75e;
}

h3 {
  margin: 16px 0 4px;
}

.small {
  font-size: 0.9rem;
  opacity: 0.85;
}

.coins {
  color: #ffd75e;
  font-weight: 700;
  font-size: 1.2rem;
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

button {
  font: inherit;
  font-weight: 700;
  color: #2b1d12;
  background: #ffd75e;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

button.big {
  font-size: 1.2rem;
  padding: 12px 28px;
}

#newWorld,
#closeShop {
  background: #e8d6b5;
}

ul {
  margin: 4px 0 10px;
  padding-left: 20px;
}

.links {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.links a {
  color: #ffd75e;
}

/* Phone controls, only shown on touch screens. */
.touchOnly {
  display: none;
}

body.touch.playing .touchOnly {
  display: block;
}

body.touch #shopPrompt {
  display: none;
}

#pad {
  position: fixed;
  left: 24px;
  bottom: 24px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.4);
}

#knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  pointer-events: none;
}

#buttons {
  position: fixed;
  right: 20px;
  bottom: 24px;
  grid-template-columns: auto auto;
  gap: 12px;
  align-items: end;
}

body.touch.playing #buttons {
  display: grid;
}

#buttons button {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  padding: 0;
  opacity: 0.9;
}

#digButton {
  width: 92px !important;
  height: 92px !important;
  background: #ff9f43;
}
