* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #2b2622;
  color: #2b2622;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

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

#hud {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: calc(12px + env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 200px);
}

.chip {
  align-self: flex-start;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.94);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  font-size: 15px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.stats {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(43, 38, 34, 0.78);
  color: #fff8ee;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.meter {
  width: 70px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}
#energy {
  height: 100%;
  width: 100%;
  background: #ffb347;
  border-radius: 4px;
}

#minimap {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  width: 160px;
  height: 160px;
  border-radius: 14px;
  background: #2b2622;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 252, 246, 0.9);
}

#buttons {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(28px + env(safe-area-inset-bottom));
  display: flex;
  gap: 12px;
}
#buttons button {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 2px solid rgba(255, 252, 246, 0.9);
  background: rgba(43, 38, 34, 0.72);
  color: #fff8ee;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  touch-action: none;
  cursor: pointer;
}
#buttons button.down { background: #c4622d; }

#intro {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(43, 38, 34, 0.55);
  backdrop-filter: blur(3px);
}
#intro .card {
  width: 100%;
  max-width: 440px;
  padding: 28px 28px 24px;
  border-radius: 18px;
  background: #fffaf2;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  -webkit-user-select: text;
  user-select: text;
}
#intro h1 { margin: 0 0 6px; font-size: 32px; letter-spacing: -0.02em; }
#intro .sub { margin: 0 0 16px; color: #6b5f55; line-height: 1.45; }
#intro ul { margin: 0 0 22px; padding: 0; list-style: none; line-height: 1.9; font-size: 15px; }
#intro button {
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: #c4622d;
  color: #fff;
  font: inherit;
  font-size: 17px;
  font-weight: 650;
  cursor: pointer;
}
#intro button:disabled { background: #cbbfb2; cursor: default; }

#credit {
  position: fixed;
  left: calc(8px + env(safe-area-inset-left));
  bottom: calc(6px + env(safe-area-inset-bottom));
  font-size: 10px;
  color: rgba(43, 38, 34, 0.75);
  background: rgba(255, 252, 246, 0.7);
  padding: 2px 6px;
  border-radius: 6px;
}
#credit a { color: inherit; }

@media (max-width: 600px) {
  #minimap { width: 110px; height: 110px; }
  #hud { max-width: calc(100vw - 146px); }
  .chip { font-size: 13px; padding: 6px 11px; }
}

@media (hover: hover) and (pointer: fine) {
  #buttons { display: none; }
}
