:root{
  --bg0:#060a16;
  --bg1:#0a1022;
  --stroke: rgba(255,255,255,.12);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.68);
  --accentA: rgba(59,130,246,.95);
  --accentB: rgba(168,85,247,.85);

  /* iOS safe-area */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: system-ui, Segoe UI, Arial;
  background:
    radial-gradient(900px 520px at 20% 10%, rgba(124,58,237,.22), transparent 55%),
    radial-gradient(900px 520px at 85% 20%, rgba(14,165,233,.18), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  color: var(--text);
  overflow: hidden;
  touch-action: none; /* we handle touch input */
}

/* HUD */
.hud{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(10px + var(--sat)) calc(12px + var(--sar)) 10px calc(12px + var(--sal));
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  border-bottom: 1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  backdrop-filter: blur(10px);
  z-index: 20;
}

.brand{ font-weight: 1000; letter-spacing: .2px; }
.sub{ color: var(--muted); font-weight:700; font-size:12px; margin-top:6px; max-width: 52ch; }

.hudRight{
  display:flex;
  gap:10px;
  align-items:center;
}

.stat{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  border-radius: 14px;
  padding: 8px 10px;
  min-width: 84px;
}
.label{ color: var(--muted); font-size:11px; font-weight:800; }
.value{ font-size:16px; font-weight:1000; margin-top:2px; }

/* Stage (fills screen under HUD and above actions) */
.stage{
  position: fixed;
  inset: 0;
  padding-top: calc(62px + var(--sat));
  padding-bottom: calc(68px + var(--sab));
  padding-left: var(--sal);
  padding-right: var(--sar);
  z-index: 1;
}

/* Canvas fills available area */
#c{
  width: 100%;
  height: 100%;
  display:block;
  background: rgba(255,255,255,.03);
  border-top: 1px solid rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

/* Center panel */
.panel{
  position:absolute;
  inset: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 18px;
  pointer-events: none; /* only inner gets clicks */
}

.panelInner{
  pointer-events: auto;
  width: min(560px, calc(100vw - 36px));
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.38);
  backdrop-filter: blur(12px);
  box-shadow: 0 22px 60px rgba(0,0,0,.45);
  padding: 14px;
}

.panelTitle{ font-size: 20px; font-weight: 1000; }
.panelText{ margin-top: 8px; color: var(--muted); font-weight: 700; line-height: 1.35; }

.panelButtons{
  display:flex;
  gap:10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.btn{
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 12px 14px;
  cursor:pointer;
  font-weight: 1000;
}

.btn.primary{
  background: linear-gradient(135deg, var(--accentA), var(--accentB));
  border-color: rgba(255,255,255,.20);
}

.btn:active{ transform: translateY(1px); }

.panelHint{
  display:flex;
  gap:8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.pill{
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  padding: 6px 10px;
  border-radius: 999px;
  color: rgba(255,255,255,.78);
  font-weight: 900;
  font-size: 12px;
}

/* Bottom thumb bar */
.actions{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px calc(12px + var(--sar)) calc(10px + var(--sab)) calc(12px + var(--sal));
  display:flex;
  gap:10px;
  justify-content: space-between;
  border-top: 1px solid var(--stroke);
  background: rgba(255,255,255,.03);
  backdrop-filter: blur(10px);
  z-index: 25;
}

.chip{
  flex: 1;
  min-height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-weight: 1000;
  cursor: pointer;
}

.chip:active{ transform: translateY(1px); }

/* Wider screens: make HUD + actions less tall */
@media (min-width: 900px){
  .hud{ padding: 12px 14px; }
  .stage{ padding-top: 70px; padding-bottom: 76px; }
  .actions{ max-width: 980px; left: 50%; transform: translateX(-50%); border-radius: 18px 18px 0 0; }
}
