* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0e2a3a; color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; }
#c { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }

#hud { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 10px; right: 10px;
  display: flex; justify-content: space-between; pointer-events: none; z-index: 5; }
.pill { background: rgba(0,0,0,.45); backdrop-filter: blur(6px); padding: 8px 14px; border-radius: 999px;
  font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
#timer.low { color: #ff6b6b; animation: pulse .6s infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }

#popups { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.pop { position: absolute; left: 50%; top: 42%; transform: translateX(-50%); font-weight: 900; font-size: 30px;
  text-shadow: 0 2px 6px rgba(0,0,0,.6); animation: rise .9s ease-out forwards; }
.pop.good { color: #b8ff7a; } .pop.bad { color: #ff6b6b; } .pop.gold { color: #ffd84a; font-size: 36px; }
@keyframes rise { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -70px; } }

#joy { position: fixed; left: calc(24px + env(safe-area-inset-left)); bottom: calc(28px + env(safe-area-inset-bottom));
  width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.25); z-index: 5; }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border-radius: 50%; background: rgba(255,255,255,.55); box-shadow: 0 2px 10px rgba(0,0,0,.3); }

.screen { position: fixed; inset: 0; display: grid; place-items: center; z-index: 10;
  background: radial-gradient(circle at 50% 30%, rgba(14,42,58,.55), rgba(5,15,22,.85)); padding: 16px; }
.screen[hidden], #hud[hidden], #joy[hidden] { display: none; }
.card { width: min(100%, 380px); max-height: 92vh; overflow: auto; background: rgba(20, 30, 24, .88);
  border: 1px solid rgba(255,255,255,.12); border-radius: 22px; padding: 22px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.logo { font-size: 56px; line-height: 1; }
h1 { margin: 8px 0 6px; font-size: 28px; }
h2 { margin: 0 0 6px; }
h3 { margin: 18px 0 8px; }
p { margin: 6px 0; color: #d7e4d0; }
.hint { font-size: 14px; color: #9fb59a; }
.legend { list-style: none; padding: 0; margin: 12px 0; text-align: left; display: grid; gap: 6px; }
.legend li { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.06); padding: 6px 10px; border-radius: 10px; }
.legend b { margin-left: auto; }
.m { width: 22px; height: 14px; border-radius: 12px 12px 4px 4px; display: inline-block; position: relative; }
.m::after { content: ""; position: absolute; left: 8px; top: 12px; width: 6px; height: 8px; background: #f1ead8; border-radius: 2px; }
.m-brown { background: #7a4a24; } .m-orange { background: #f29a1f; } .m-beige { background: #d9b48a; }
.m-gold { background: #ffd84a; box-shadow: 0 0 10px #ffd84a; }
.m-red { background: radial-gradient(circle at 30% 40%, #fff 2px, transparent 3px), radial-gradient(circle at 70% 30%, #fff 2px, transparent 3px), #e0322b; }
.btn { margin-top: 12px; width: 100%; padding: 14px; font-size: 20px; font-weight: 800; color: #10240f; border: 0; border-radius: 14px;
  background: linear-gradient(180deg, #b8ff7a, #6cc94a); cursor: pointer; box-shadow: 0 6px 0 #3f8a2a; }
.btn:active { transform: translateY(3px); box-shadow: 0 3px 0 #3f8a2a; }
.big { font-size: 64px; font-weight: 900; color: #b8ff7a; line-height: 1.1; }
#best-line, #end-best, #end-stats { color: #c9d8c3; margin-top: 8px; font-size: 15px; }
.new-record { color: #ffd84a; font-weight: 800; }
#top { text-align: left; padding-left: 26px; margin: 0; }
#top li { padding: 3px 0; }
#top li.me { color: #ffd84a; font-weight: 700; }
.muted { color: #8aa087; list-style: none; margin-left: -26px; }
