@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('cairo-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('cairo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

:root {
  --bg: #060a14;
  --panel: #0d1424;
  --text: #e8eefb;
  --muted: #8fa1c2;
  --cyan: #5ce1ff;
  --cyan-deep: #2aa9ff;
  --orange: #ff9a4d;
  --violet: #b08cff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Cairo', 'Segoe UI', Tahoma, system-ui, -apple-system, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

body { overflow: hidden; }

#app { position: fixed; inset: 0; overflow: hidden; }

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

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 18px;
  pointer-events: none;
  z-index: 5;
}
.hud-top { top: calc(env(safe-area-inset-top, 0px) + 12px); }
.hud-bottom { bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); }

.stat { text-align: center; min-width: 62px; }
.stat-val {
  font-size: 27px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(92, 225, 255, 0.35);
}
.stat-lbl { font-size: 11px; color: #7f92b3; margin-top: 3px; font-weight: 600; }
.stat-left .stat-val { color: var(--orange); text-shadow: 0 0 18px rgba(255, 154, 77, 0.35); }

.hud-mid { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.lives { display: flex; gap: 6px; height: 10px; }
.life {
  width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe3e0, #ff6b6b 45%, #c22d3d 100%);
  box-shadow: 0 0 10px rgba(255, 100, 100, 0.6);
  transition: background .25s, box-shadow .25s, transform .25s;
}
.life.dead { background: #2b3346; box-shadow: none; transform: scale(0.78); }

.icon-btn {
  pointer-events: auto;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(120, 170, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #cfe0ff;
  cursor: pointer;
  transition: transform .12s, background .2s;
}
.icon-btn:active { transform: scale(0.94); background: rgba(255, 255, 255, 0.12); }
.icon-btn.off { color: #5f6f8d; }

.foot-hint {
  font-size: 12.5px;
  color: #6f82a4;
  font-weight: 600;
  transition: opacity .4s;
}

/* ---------- Screens ---------- */
.screens { position: absolute; inset: 0; z-index: 10; pointer-events: none; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  pointer-events: auto;
  background: radial-gradient(130% 90% at 50% 0%, rgba(10, 19, 37, 0.58), rgba(3, 6, 12, 0.86));
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.card {
  width: 100%;
  max-width: 356px;
  padding: 22px 20px 20px;
  border-radius: 26px;
  text-align: center;
  background: linear-gradient(180deg, rgba(20, 31, 54, 0.96), rgba(9, 15, 28, 0.98));
  border: 1px solid rgba(110, 170, 255, 0.15);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: cardIn .28s ease-out both;
}
.card.small { max-width: 320px; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.logo { display: flex; justify-content: center; margin-bottom: 6px; }
.logo svg { filter: drop-shadow(0 8px 22px rgba(255, 140, 60, 0.28)); }

h1 {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.15;
  background: linear-gradient(180deg, #ffffff, #9ec9ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h2 { font-size: 26px; font-weight: 800; margin-bottom: 6px; }

.tagline {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--muted);
  margin: 8px 0 0;
  font-weight: 500;
}

.best-row { font-size: 13px; color: #8fa1c2; margin: 14px 0 14px; font-weight: 600; }
.best-row b { color: var(--cyan); font-weight: 800; }

.btn {
  display: block;
  width: 100%;
  min-height: 54px;
  margin-top: 10px;
  border: 0;
  border-radius: 16px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  color: #04121c;
  background: linear-gradient(180deg, #6ce6ff, #2aa9ff);
  box-shadow: 0 10px 26px rgba(42, 169, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform .12s ease, filter .2s;
}
.btn:active { transform: translateY(1px) scale(0.99); filter: brightness(1.05); }
.btn.ghost {
  background: rgba(255, 255, 255, 0.05);
  color: #cfe0ff;
  border: 1px solid rgba(120, 170, 255, 0.2);
  box-shadow: none;
  font-weight: 700;
}

.score-big {
  font-size: 54px;
  font-weight: 900;
  line-height: 1;
  margin: 12px 0 2px;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 0 30px rgba(92, 225, 255, 0.4);
}

.hints {
  list-style: none;
  text-align: right;
  margin-top: 16px;
  display: grid;
  gap: 7px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #94a7c7;
  font-weight: 500;
}
.hints li { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.dot-cyan { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.dot-orange { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.dot-violet { background: var(--violet); box-shadow: 0 0 8px var(--violet); }
.dot-red { background: #ff6b6b; box-shadow: 0 0 8px #ff6b6b; }

/* capture progress */
.progress {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 68px);
  left: 18px;
  right: 18px;
  height: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
  pointer-events: none;
  transition: opacity .2s;
}
.progress-track {
  flex: 1;
  height: 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 5px;
  background: linear-gradient(90deg, #ffd08a, #ff9a4d);
  box-shadow: 0 0 12px rgba(255, 160, 80, 0.55);
  transition: width .25s ease-out;
}
.progress-label {
  font-size: 11px;
  font-weight: 800;
  color: #ffc98a;
  min-width: 30px;
  font-variant-numeric: tabular-nums;
}

.hidden { display: none !important; }
