:root { color-scheme: dark; }
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; font-family: system-ui, sans-serif; }
#scene { position: fixed; inset: 0; display: block; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui button { pointer-events: auto; }
#hud { z-index: 6; position: fixed; top: 10px; left: 50%; transform: translateX(-50%); }
.hudrow { display: flex; gap: 10px; }
.chip {
  background: rgba(20, 32, 38, 0.72); color: #f6ecd8; border: 1px solid rgba(246, 236, 216, .25);
  border-radius: 999px; padding: 6px 14px; font-size: 15px; backdrop-filter: blur(4px);
}
.chip.coins b { color: #ffd97a; } .chip.time b { color: #f6ecd8; }
#prompt {
  z-index: 5; position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%);
  color: #fff; background: rgba(20, 32, 38, .75); padding: 8px 16px; border-radius: 10px;
  font-size: 15px; opacity: 0; transition: opacity .2s; white-space: nowrap; max-width: 92vw;
  text-align: center;
}
#toast {
  z-index: 7; position: fixed; top: 56px; left: 50%; transform: translateX(-50%);
  color: #1c2b33; background: #ffd97a; padding: 8px 18px; border-radius: 12px;
  font-size: 15px; font-weight: 600; opacity: 0; transition: opacity .25s;
}
#fbar {
  z-index: 5; display: none; position: fixed; bottom: 150px; left: 50%; transform: translateX(-50%);
  width: min(320px, 76vw); height: 26px; background: rgba(20, 32, 38, .8);
  border: 1px solid rgba(246, 236, 216, .35); border-radius: 8px;
}
#fzone { position: absolute; top: 0; bottom: 0; background: #5fd07a; border-radius: 6px; opacity: .85; }
#fmark { position: absolute; top: -5px; bottom: -5px; width: 4px; background: #fff; box-shadow: 0 0 8px #fff; }
.panel {
  background: rgba(18, 30, 36, .92); color: #f6ecd8; border-radius: 18px; padding: 28px 32px;
  max-width: min(560px, 92vw); border: 1px solid rgba(255, 217, 122, .35); text-align: center;
}
.panel h1 { font-size: 30px; color: #ffd97a; margin-bottom: 10px; }
.panel .tag { margin-bottom: 14px; color: #cfe0d8; }
.howto { list-style: none; text-align: left; font-size: 14px; line-height: 1.7; margin-bottom: 16px; }
.howto b { color: #ffd97a; }
#overlay-start, #overlay-end {
  z-index: 10; position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: auto; background: rgba(8, 14, 18, .45);
}
#overlay-end { display: none; }
.panel button, #shop button {
  background: #ffd97a; color: #1c2b33; border: 0; border-radius: 12px; padding: 12px 26px;
  font-size: 16px; font-weight: 700; cursor: pointer;
}
.panel button:hover { background: #ffe6a6; }
#shop {
  z-index: 11; display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(18, 30, 36, .94); color: #f6ecd8; padding: 22px; border-radius: 16px;
  border: 1px solid rgba(255, 217, 122, .4); pointer-events: auto; text-align: center;
  width: min(520px, 92vw);
}
#shop h2 { color: #ffd97a; margin-bottom: 14px; }
.shopgrid { display: grid; gap: 10px; margin-bottom: 12px; }
#shop button { font-size: 14px; padding: 12px; font-weight: 500; text-align: center; line-height: 1.5; }
#shop .cost { color: #b3541e; font-weight: 700; }
#shopClose { background: #89a0a8 !important; }
#touch { z-index: 2; position: fixed; inset: 0; display: none; }
#camzone { position: absolute; top: 0; right: 0; width: 58%; height: 62%;
  pointer-events: auto; touch-action: none; }
#stick {
  pointer-events: auto; touch-action: none;
  position: absolute; left: 20px; bottom: 24px; width: 118px; height: 118px; border-radius: 50%;
  background: rgba(20, 32, 38, .45); border: 2px solid rgba(246, 236, 216, .4);
}
#knob {
  pointer-events: none;
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; background: rgba(255, 217, 122, .8);
}
#btns { z-index: 3; position: absolute; right: 18px; bottom: 24px; display: flex; flex-direction: column; gap: 12px; }
#btns button {
  touch-action: none;
  width: 82px; height: 82px; border-radius: 50%; border: 0; background: rgba(255, 217, 122, .92);
  color: #1c2b33; font-size: 18px; font-weight: 800; line-height: 1.1;
}
#btns button small { font-size: 9px; font-weight: 500; display: block; }
#btnShop { background: rgba(137, 160, 168, .92) !important; }
@media (max-width: 480px) {
  .chip { font-size: 13px; padding: 5px 10px; }
  #prompt { bottom: 150px; font-size: 13px; }
}
