html, body {
  margin: 0;
  height: 100%;
  background: #0b0d1e;
  color: #f4f1ea;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
}
#game {
  display: block;
  width: 100vw;
  height: 100dvh;
  touch-action: none;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }

#hud {
  position: fixed;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px calc(8px + env(safe-area-inset-right)) 4px calc(8px + env(safe-area-inset-left));
  background: rgba(10, 12, 30, 0.86);
  border-bottom: 1px solid rgba(120, 135, 220, 0.35);
  user-select: none;
  -webkit-user-select: none;
}
.chip {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
}
.spacer { flex: 1; min-width: 0; }
.icon {
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 19px;
  padding: 0;
}
.icon:active { background: rgba(255, 255, 255, 0.25); }
.icon.off { opacity: 0.45; }

#overlay {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  box-sizing: border-box;
  background: rgba(6, 8, 26, 0.74);
}
#panel {
  width: min(440px, 100%);
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 18px;
  border-radius: 18px;
  border: 2px solid #3d4690;
  background: #171b3a;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
  line-height: 1.4;
}
#panel h1 { margin: 0 0 8px; font-size: 26px; color: #ffd75a; }
#panel p { margin: 8px 0; }
#panel ul { margin: 8px 0; padding-left: 20px; text-align: left; }
#panel li { margin: 5px 0; }
.small { font-size: 13px; color: #b9c0ea; }
.good { color: #7dffb0; font-weight: 700; }
.tag { color: #9fd8ff; font-weight: 700; letter-spacing: 0.04em; }
.icons { display: flex; justify-content: center; gap: 10px; margin: 10px 0; }
.icons img { height: 54px; width: auto; }
#pButtons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }
#pButtons button, .shop-row button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  border: 2px solid #55609f;
  background: #262c5c;
  font-weight: 700;
  font-size: 16px;
}
#pButtons button.primary { background: #ffd75a; border-color: #ffd75a; color: #1a1530; }
#pButtons button:disabled, .shop-row button:disabled { opacity: 0.45; cursor: default; }
.loot-row, .shop-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}
.loot-row img { width: 36px; height: 36px; object-fit: contain; flex: none; }
.info { flex: 1; min-width: 0; }
.big { font-size: 26px; flex: none; width: 36px; text-align: center; }
.lvl { color: #ffd75a; letter-spacing: 2px; white-space: nowrap; }
.shop-row button { min-width: 92px; padding: 0 10px; flex: none; font-size: 15px; }

@media (max-width: 600px) {
  #hud { gap: 4px; }
  .chip { font-size: 13px; padding: 6px 6px; }
  #panel { padding: 14px; }
  #panel h1 { font-size: 22px; }
}
@media (max-height: 500px) {
  #panel { padding: 12px; font-size: 14px; }
  #panel h1 { font-size: 20px; margin-bottom: 4px; }
  .icons img { height: 38px; }
  #pButtons { margin-top: 8px; }
}

#decoy {
  position: fixed;
  z-index: 5;
  right: calc(14px + env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(20, 24, 54, 0.82);
  font-size: 18px;
  font-weight: 700;
  user-select: none;
  -webkit-user-select: none;
}
#decoy:active { background: rgba(60, 70, 130, 0.9); }
#decoy:disabled { opacity: 0.4; }
