:root {
  --bg: #05050a;
  --bg2: #0b0b12;
  --surface: rgba(255, 255, 255, 0.06);
  --surface2: rgba(255, 255, 255, 0.10);
  --text: #f3f1ff;
  --muted: rgba(243, 241, 255, 0.70);

  --accent: #a78bfa;
  --accent2: #8b5cf6;
  --accent3: #c4b5fd;
  --mint: #34d399;
  --danger: #ff4d6d;

  --shadow: 0 18px 46px rgba(0, 0, 0, 0.45);
  --shadow2: 0 10px 22px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font-body: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  --font-head: "Montserrat", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 700px at 10% -10%, rgba(167, 139, 250, 0.18), transparent 62%),
    radial-gradient(900px 700px at 110% 10%, rgba(196, 181, 253, 0.14), transparent 66%),
    radial-gradient(900px 700px at 30% 120%, rgba(139, 92, 246, 0.10), transparent 68%),
    linear-gradient(180deg, var(--bg), var(--bg2));
  color: var(--text);
  font-family: var(--font-body);
}

.app {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.logoDot {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background:
    radial-gradient(18px 18px at 30% 30%, rgba(255,255,255,0.35), transparent 55%),
    linear-gradient(135deg, var(--accent2), var(--accent3));
  box-shadow: 0 12px 24px rgba(0,0,0,0.35);
}
.brandText { min-width: 0; }
.brandName { font-weight: 900; letter-spacing: 0.2px; line-height: 1.05; }
.brandName { font-family: var(--font-head); }
.brandSub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topStats {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  text-align: right;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 10px 16px rgba(0,0,0,0.25);
}
.chip.muted { color: var(--muted); font-weight: 700; }
.chip.good { background: rgba(52, 211, 153, 0.14); }
.chip.blue { background: rgba(167, 139, 250, 0.14); }

.main { display: grid; gap: 12px; }

.card {
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow2);
}
.card h1, .card h2 { margin: 0 0 10px 0; }
.muted { color: var(--muted); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.progress {
  height: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: 999px;
  overflow: hidden;
}
.progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent2), var(--accent3));
  width: 0%;
  transition: width 260ms ease;
}

.qTitle {
  font-family: var(--font-head);
  font-size: 22px;
  line-height: 1.2;
  margin: 0 0 10px 0;
  font-weight: 900;
  letter-spacing: 0.1px;
}
.qText { font-size: 16px; line-height: 1.35; margin: 0; }

.btnrow { display: grid; gap: 10px; margin-top: 12px; }
.btn {
  border: none;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 12px 12px;
  border-radius: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(0,0,0,0.25);
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, rgba(139,92,246,0.26), rgba(167,139,250,0.14));
}
.btn.danger { background: rgba(255,77,109,0.16); }

.option {
  text-align: left;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  border-radius: 18px;
  padding: 12px 12px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 12px 20px rgba(0,0,0,0.30);
}
.option:active { transform: translateY(1px); }
.optionKey {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: rgba(255,255,255,0.92);
  border: none;
  background: linear-gradient(180deg, rgba(139,92,246,0.26), rgba(167,139,250,0.14));
}
.optionText { font-size: 16px; font-weight: 850; line-height: 1.25; }

.input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 16px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  outline: none;
  box-shadow: 0 12px 20px rgba(0,0,0,0.30);
}
.input::placeholder { color: rgba(243,241,255,0.45); }
.input:focus { box-shadow: 0 14px 22px rgba(0,0,0,0.35), 0 0 0 2px rgba(167,139,250,0.22); }

.nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 8px;
  border-radius: 20px;
  background: rgba(255,255,255,0.05);
  box-shadow: var(--shadow2);
}
.navbtn {
  border-radius: 16px;
  padding: 10px 10px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 4px;
  box-shadow: 0 10px 18px rgba(0,0,0,0.22);
}
.navIcon { font-size: 18px; line-height: 1; }
.navLabel { font-size: 12px; letter-spacing: 0.2px; }
.navLabel { font-family: var(--font-head); }
.navbtn.active {
  color: var(--text);
  background: linear-gradient(180deg, rgba(167,139,250,0.18), rgba(255,255,255,0.06));
}

.overlay {
  position: fixed;
  inset: 0;
  padding: 16px;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(10px);
  z-index: 50;
}
.overlay.show { display: flex; }
.sheet {
  width: min(520px, 100%);
  background: rgba(15, 15, 24, 0.96);
  border: none;
  border-radius: 22px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.sheetTitle { font-weight: 950; font-size: 18px; margin: 0 0 8px 0; }
.sheetTitle { font-family: var(--font-head); }
.sheetText { margin: 0; color: var(--muted); line-height: 1.35; }
.sheet.good { box-shadow: var(--shadow), 0 0 0 2px rgba(52,211,153,0.20) inset; }
.sheet.bad { box-shadow: var(--shadow), 0 0 0 2px rgba(255,77,109,0.18) inset; }

.view {
  animation: viewIn 220ms ease both;
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); filter: blur(2px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.path {
  display: grid;
  gap: 12px;
}
.clusterCard {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow2);
}
.clusterTitle {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 18px;
  margin: 0 0 6px 0;
}
.clusterDesc { margin: 0 0 12px 0; color: var(--muted); }
.nodes {
  display: grid;
  gap: 12px;
}
.nodeRow {
  display: grid;
  grid-template-columns: 1fr 56px 1fr;
  align-items: center;
}
.nodeSpacer { height: 1px; }
.nodeBtn {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  border: none;
  background: rgba(167,139,250,0.18);
  box-shadow: 0 14px 26px rgba(26,21,48,0.14);
  cursor: pointer;
}
.nodeBtn:active { transform: translateY(1px); }
.nodeBtn.completed { background: rgba(52,211,153,0.18); }
.nodeBtn.current { background: rgba(139,92,246,0.22); }
.nodeBtn.locked { opacity: 0.45; cursor: not-allowed; }
.nodeIcon { font-size: 18px; font-weight: 900; }
.nodeMeta {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  box-shadow: 0 12px 20px rgba(0,0,0,0.30);
}
.nodeMetaTitle { font-weight: 900; margin: 0; }
.nodeMetaTitle { font-family: var(--font-head); }
.nodeMetaSub { margin: 4px 0 0 0; color: var(--muted); font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .progress > div { transition: none; }
}
