﻿/* Bacteria Blaster — full-screen canvas game (petri dish under a microscope), with lab-glass DOM overlays */
:root { --ink: #0f2a33; --muted: #557680; --teal: #14b8a6; --teal-d: #0b6f66; --lime: #8ee05a; --glass: #f2fbfb; --red: #ff4d5e; --yellow: #ffe066;
  font-family: 'Rubik', 'Trebuchet MS', system-ui, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #02060a; color: var(--ink); overscroll-behavior: none; }
h1, h2 { margin: 0; font-weight: 700; }
a { color: var(--teal-d); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }

.game { position: fixed; inset: 0; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }

/* ---------- HUD ---------- */
.hud { position: absolute; left: 0; right: 0; top: 0; height: 54px; display: flex; align-items: center; justify-content: center; gap: clamp(8px, 3vw, 30px);
  padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); pointer-events: none;
  background: linear-gradient(rgba(8, 40, 48, .92), rgba(5, 26, 32, .92)); border-bottom: 2px solid rgba(126, 240, 201, .35); color: #e9fffb; }
.h-box { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.h-box span { font-size: 11px; opacity: .7; text-transform: uppercase; letter-spacing: .1em; font-weight: 500; }
.h-box b { font-size: 23px; min-width: 2ch; text-align: center; }
.streak b { color: var(--yellow); transition: transform .12s; }
.streak b.bump { transform: scale(1.4); }
.shields b { font-size: 15px; letter-spacing: 1px; line-height: 23px; }
.btns { display: flex; gap: 6px; pointer-events: auto; }
.hb { width: 38px; height: 38px; border-radius: 50%; border: 2px solid rgba(126, 240, 201, .5); background: rgba(255, 255, 255, .08); color: #e9fffb; font-size: 15px; display: grid; place-items: center; }
.hb:active { transform: scale(.92); }
#btn-auto { opacity: .55; }
#btn-auto.on { opacity: 1; background: rgba(20, 184, 166, .45); border-color: #7ef0c9; }
@media (pointer: coarse) { #btn-auto { display: none; } }

.colony { position: absolute; top: calc(54px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(460px, calc(100% - 20px)); margin-top: 6px;
  display: flex; align-items: center; gap: 8px; pointer-events: none; color: #e9fffb; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.colony span { opacity: .75; }
.colony b { font-size: 13px; min-width: 7ch; text-align: right; letter-spacing: 0; }
.c-bar { flex: 1; height: 9px; border-radius: 9px; background: rgba(255, 255, 255, .12); overflow: hidden; border: 1px solid rgba(255, 255, 255, .2); }
.c-bar i { display: block; height: 100%; width: 0; background: var(--lime); border-radius: 9px; transition: width .2s, background .3s; }
.colony.warn .c-bar i { background: var(--yellow); }
.colony.danger .c-bar i { background: var(--red); animation: throb .6s infinite alternate; }
.colony.danger b { color: #ff9aa4; }
@keyframes throb { to { opacity: .55; } }
@media (max-width: 440px) { .h-box b { font-size: 18px; } .h-box span { font-size: 9px; } .shields b { font-size: 11px; } .hb { width: 32px; height: 32px; font-size: 12px; } .hud { gap: 8px; } }

/* ---------- panels ---------- */
.panel { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; overflow-y: auto; background: rgba(2, 12, 16, .45); }
.card { position: relative; width: min(560px, 100%); background: var(--glass); border: 3px solid var(--teal); border-radius: 26px;
  padding: 24px 22px 16px; text-align: center; box-shadow: 0 0 0 6px rgba(20, 184, 166, .18), 0 16px 40px rgba(0, 0, 0, .5); margin: auto; }
.card::before, .card::after { content: '🦠'; position: absolute; top: -20px; font-size: 32px; }
.card::before { left: 16px; transform: rotate(-20deg); }
.card::after { right: 16px; transform: rotate(25deg); filter: hue-rotate(150deg); }
.card.small { width: min(340px, 100%); }
.kicker { margin: 0; font-size: 13px; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; font-weight: 500; }
h1 { font-size: clamp(40px, 10.5vw, 64px); line-height: 1; color: var(--teal-d); letter-spacing: -.01em;
  background: linear-gradient(90deg, #12a36b, #0ea5b7 55%, #7c4dff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; padding-bottom: 4px; }
h2 { font-size: 36px; color: var(--teal-d); margin-bottom: 4px; }
.tagline { margin: 6px 0 8px; font-size: 18px; font-weight: 500; }
.why { margin: 0 0 8px; color: var(--muted); font-size: 16px; font-weight: 500; }
.rules { text-align: left; margin: 10px auto; padding-left: 22px; font-size: 15.5px; line-height: 1.38; max-width: 470px; font-weight: 500; }
.rules li { margin: 4px 0; }
.rules b { color: var(--teal-d); }
.controls { font-size: 14.5px; color: var(--muted); margin: 6px 0 12px; font-weight: 500; line-height: 1.6; }
kbd { display: inline-block; min-width: 22px; padding: 0 5px; border: 1.5px solid var(--muted); border-bottom-width: 3px; border-radius: 6px; background: #fff; font: inherit; font-size: 13px; line-height: 19px; color: var(--ink); margin: 0 1px; }
.touch-only { display: none; }
@media (pointer: coarse) { .touch-only { display: block; } .key-only { display: none; } }

.btn { display: block; width: 100%; margin: 8px 0; padding: 10px 14px; font-size: 20px; font-weight: 700; background: #fff; border: 3px solid var(--teal);
  border-radius: 16px; box-shadow: 0 5px 0 var(--teal-d); transition: transform .08s; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--teal-d); }
.btn.primary { background: linear-gradient(#a6f37a, #7fdc4f); border-color: #3f9a1f; box-shadow: 0 5px 0 #2f7a14; }
.btn.primary:active { box-shadow: 0 1px 0 #2f7a14; }
.btn.big { font-size: 25px; padding: 12px 14px; }
.best-line { min-height: 1em; margin: 8px 0 0; font-size: 16px; color: var(--teal-d); font-weight: 500; }
.links { font-size: 14.5px; margin: 12px 0 0; color: var(--muted); }

.o-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 10px; }
.o-stats div { background: #fff; border: 2px solid #cdeceb; border-radius: 12px; padding: 6px 4px; }
.o-stats span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 500; }
.o-stats b { font-size: 25px; color: var(--ink); }
.new-best { font-size: 21px; color: #d6283a; margin: 4px 0; font-weight: 700; }

.ad-wrap { width: 100%; text-align: center; margin-top: 10px; font-family: system-ui, sans-serif; }
.ad-wrap.ad-on { min-height: 100px; }
.ad-wrap:has(ins[data-ad-status="unfilled"]) { display: none; }
.ad-label { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
