/* Astral VPN — Тапалка. Своя тёмная космическая тема: цвета из темы Telegram намеренно не берутся. */
:root {
  --bg: #05060f;
  --bg2: #0b0d24;
  --ink: #e8ecff;
  --muted: #8f95bd;
  --cyan: #5ee7ff;
  --violet: #8b5cf6;
  --amber: #ffb454;
  --card: rgba(19, 21, 50, 0.86);
  --line: rgba(140, 150, 255, 0.2);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  background:
    radial-gradient(120% 70% at 85% 0%, rgba(139, 92, 246, 0.30), transparent 60%),
    radial-gradient(90% 60% at 8% 100%, rgba(94, 231, 255, 0.16), transparent 62%),
    linear-gradient(180deg, var(--bg2), var(--bg));
}

#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

#app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: calc(var(--safe-t) + 10px) calc(var(--safe-r) + 16px) calc(var(--safe-b) + 12px) calc(var(--safe-l) + 16px);
}

/* ---- top: energy, day, streak ---- */
.hud { flex: none; }
.energy { display: flex; align-items: center; gap: 8px; }
.energy-ico { font-size: 18px; line-height: 1; }
.bar {
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  overflow: hidden;
}
.fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
}
.num { min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}
.row b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- centre: the Spark ---- */
.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.hint {
  min-height: 20px;
  padding: 0 8px;
  text-align: center;
  font-size: 14px;
  color: var(--amber);
}
.core {
  width: min(66vw, 40vh, 320px);
  aspect-ratio: 1;
  touch-action: none;
  cursor: pointer;
  will-change: transform;
  outline: none;
}
.core svg { width: 100%; height: 100%; display: block; pointer-events: none; animation: breathe 4.2s ease-in-out infinite; }
.core.spent svg { filter: grayscale(0.85) brightness(0.55); animation: none; }
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.025); }
}

/* "+3 сек" over the finger: a small reused pool of elements (see app.js) */
#floats { position: fixed; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.float {
  position: absolute;
  opacity: 0;
  font-weight: 700;
  font-size: 20px;
  color: #fff3c4;
  text-shadow: 0 0 10px rgba(255, 180, 84, 0.9), 0 1px 2px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  will-change: transform, opacity;
}

/* ---- bottom: what was earned and where it goes ---- */
.panel {
  flex: none;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.earned { font-size: 15px; color: var(--muted); }
.earned b { color: var(--cyan); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-size: 13px; }
#queueText { margin-top: 2px; }
.target {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.target-label { color: var(--muted); font-size: 13px; flex: none; }
.target-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.chev { color: var(--muted); }
.jar { margin-top: 10px; padding: 10px 12px; border-radius: 12px; border: 1px dashed rgba(255, 180, 84, 0.45); background: rgba(255, 180, 84, 0.06); }
.jar-title { margin-bottom: 4px; }
.jar-title b { color: var(--amber); font-variant-numeric: tabular-nums; }

/* ---- full-screen messages ---- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-t) + 16px) calc(var(--safe-r) + 16px) calc(var(--safe-b) + 16px) calc(var(--safe-l) + 16px);
  background: rgba(5, 6, 15, 0.9);
}
.card {
  width: 100%;
  max-width: 420px;
  padding: 20px 18px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.card.center { text-align: center; }
.card-title { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.card p { margin: 0 0 16px; line-height: 1.45; white-space: pre-line; }
.big { font-size: 56px; line-height: 1; margin-bottom: 10px; }
.btn {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--violet), #5b8cff 60%, var(--cyan));
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn:active { filter: brightness(1.15); }
.btn.ghost { margin-top: 10px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.btn[disabled] { opacity: 0.6; }

/* ---- device sheet ---- */
.sheet-wrap { position: fixed; inset: 0; z-index: 30; }
.shade { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 78%;
  overflow-y: auto;
  padding: 18px calc(var(--safe-r) + 16px) calc(var(--safe-b) + 16px) calc(var(--safe-l) + 16px);
  border-radius: 22px 22px 0 0;
  background: #10122b;
  border-top: 1px solid var(--line);
}
.sheet-list { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.opt[disabled] { opacity: 0.45; cursor: default; }
.opt.on { border-color: var(--cyan); background: rgba(94, 231, 255, 0.09); }
.opt .dot { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); }
.opt.on .dot { border-color: var(--cyan); background: radial-gradient(circle, var(--cyan) 45%, transparent 50%); }
.opt .t { flex: 1; min-width: 0; }
.opt .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt .t span { color: var(--muted); font-size: 13px; }

@media (max-height: 560px) {
  .core { width: min(56vw, 36vh, 320px); }
  .hint { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .core svg { animation: none; }
}
