/* Drift — Aurora Noir cabinet (committed dark identity) */
:root {
  --bg: #0B0D14;
  --bg-2: #070810;
  --surface: #12151F;
  --surface-2: #171B28;
  --elevated: #1C2130;
  --border: rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.12);
  --text: #EEF0F8;
  --muted: #8A90A6;
  --faint: #5A6076;
  --accent-a: #7B6CFF;
  --accent-b: #B15CFF;
  --mint: #3BE8C0;
  --danger: #FF6B6B;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  --nav-h: 68px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  overflow-x: hidden;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; margin: 0; }

/* ambient particle canvas */
#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
/* aurora glow wash */
body::before {
  content: "";
  position: fixed;
  inset: -25% -25% auto -25%;
  height: 55vh;
  background:
    radial-gradient(55% 55% at 28% 18%, rgba(123, 108, 255, 0.30), transparent 70%),
    radial-gradient(45% 45% at 82% 8%, rgba(177, 92, 255, 0.24), transparent 72%);
  filter: blur(24px);
  pointer-events: none;
  z-index: 0;
}

/* ---- overlays ---- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 32px;
}
.overlay .glyph { font-size: 46px; }
.ov-title { font-size: 20px; font-weight: 700; }
.overlay .muted { max-width: 300px; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border-2);
  border-top-color: var(--accent-b);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- app shell ---- */
#app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 6px 18px calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px 4px;
}
.brand {
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.02em;
  background: linear-gradient(92deg, var(--accent-a), var(--accent-b) 58%, var(--mint));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  cursor: pointer;
}
.icon-btn:active { transform: scale(0.94); }

main { flex: 1; }
.tab { animation: fade 0.28s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.tab-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 8px 0 2px; }
.tab-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

/* ---- hero ---- */
.hero {
  position: relative;
  height: 260px;
  display: grid;
  place-items: center;
  margin-top: 8px;
}
.rings { position: absolute; inset: 0; display: grid; place-items: center; }
.rings span {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--border-2);
}
.rings span:nth-child(1) { width: 150px; height: 150px; animation: ring 3.4s ease-out infinite; }
.rings span:nth-child(2) { width: 210px; height: 210px; animation: ring 3.4s ease-out infinite 1.1s; }
.rings span:nth-child(3) { width: 270px; height: 270px; animation: ring 3.4s ease-out infinite 2.2s; }
@keyframes ring {
  0% { transform: scale(0.7); opacity: 0; }
  40% { opacity: 0.7; }
  100% { transform: scale(1.05); opacity: 0; }
}
.shield {
  position: relative;
  width: 118px; height: 118px;
  border-radius: 30px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(150deg, var(--accent-a), var(--accent-b));
  box-shadow: 0 20px 50px rgba(123, 108, 255, 0.45), inset 0 1px 0 rgba(255,255,255,0.25);
  animation: float 5s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.status-pill {
  display: flex; align-items: center; gap: 8px;
  margin: 6px auto 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(59, 232, 192, 0.12);
  border: 1px solid rgba(59, 232, 192, 0.3);
  color: var(--mint);
  font-size: 14px; font-weight: 600;
  width: max-content;
}
.status-pill::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--mint); box-shadow: 0 0 0 0 rgba(59,232,192,0.6);
  animation: pulse 2s infinite;
}
.status-pill.offline { background: rgba(138,144,166,0.12); border-color: var(--border-2); color: var(--muted); }
.status-pill.offline::before { background: var(--faint); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(59,232,192,0); } 100% { box-shadow: 0 0 0 0 rgba(59,232,192,0); } }

.hero-expiry { text-align: center; color: var(--muted); font-size: 14px; margin: 12px 0 22px; }
.hero-expiry b { color: var(--text); font-weight: 600; }

/* ---- buttons ---- */
.actions { display: flex; flex-direction: column; gap: 11px; }
.btn {
  border: none;
  border-radius: 15px;
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: linear-gradient(92deg, var(--accent-a), var(--accent-b)); box-shadow: 0 10px 26px rgba(123,108,255,0.35); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-sm { width: auto; padding: 12px 16px; font-size: 15px; }

/* ---- guide accordion ---- */
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 11px;
  overflow: hidden;
}
.step summary {
  display: flex; align-items: center; gap: 12px;
  padding: 15px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}
.step summary::-webkit-details-marker { display: none; }
.step .num {
  flex: 0 0 auto;
  width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
}
.step .s-title { flex: 1; }
.step .chev { color: var(--muted); font-size: 20px; transition: transform 0.2s ease; }
.step[open] .chev { transform: rotate(90deg); }
.s-body { padding: 0 16px 16px; color: var(--text); font-size: 14.5px; }
.s-body p { margin: 0 0 10px; }
.s-body ol { margin: 0 0 10px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.s-body b { font-weight: 650; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.links a {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--accent-b); text-decoration: none;
  padding: 8px 13px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
}
.note {
  background: rgba(123,108,255,0.09);
  border: 1px solid rgba(123,108,255,0.22);
  border-radius: 12px;
  padding: 12px 13px;
  font-size: 13.5px; color: var(--text);
}
.note.ok { background: rgba(59,232,192,0.08); border-color: rgba(59,232,192,0.22); }

/* ---- profile ---- */
.profile-head { display: flex; align-items: center; gap: 14px; margin: 12px 0 20px; }
.avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--mint), var(--accent-a) 55%, var(--accent-b));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}
.p-name { font-size: 20px; font-weight: 700; }
.p-id {
  background: none; border: none; color: var(--muted);
  font-size: 13px; display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; padding: 2px 0;
}
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-k { color: var(--muted); font-size: 12.5px; }
.stat-v { font-size: 16px; font-weight: 700; }
.stat-v.online { color: var(--mint); }
.sub-field { margin-top: 16px; }
.sub-label { color: var(--muted); font-size: 13px; margin-bottom: 7px; }
.sub-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 13px; padding: 12px 14px;
}
.sub-row code {
  flex: 1; font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.mini-copy { background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; }
.mini-copy:active { transform: scale(0.92); }

/* ---- guide mini illustration ---- */
.mini-ui {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; margin: 2px 0 12px;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.mui-row {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; font-size: 14px;
}
.mui-name { font-weight: 700; }
.mui-dots {
  color: var(--accent-b); font-weight: 800; letter-spacing: 1px;
  background: rgba(177, 92, 255, 0.15); border: 1px solid rgba(177, 92, 255, 0.45);
  border-radius: 8px; padding: 2px 9px;
}
.mui-arrow { color: var(--muted); font-size: 15px; }
.mui-toggle {
  width: 38px; height: 22px; border-radius: 999px; flex: 0 0 auto;
  background: linear-gradient(92deg, var(--accent-a), var(--accent-b)); position: relative;
}
.mui-toggle::after {
  content: ""; position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
}

/* ---- admin ---- */
.admin-head { display: flex; align-items: center; gap: 8px; margin: 8px 0 16px; }
.invite-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px; margin-bottom: 18px;
}
.invite-box .sub-row { background: var(--bg); margin-top: 4px; }
.link-btn {
  background: none; border: none; color: var(--accent-b);
  font-size: 13px; cursor: pointer; padding: 10px 2px 2px; margin-top: 4px;
}
.link-btn:active { opacity: 0.6; }
.btn-back { background: none; border: none; color: var(--text); font-size: 28px; line-height: 1; cursor: pointer; padding: 0 6px 0 0; }
.add-row { display: flex; gap: 8px; margin-bottom: 14px; }
.add-row input {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 13px; padding: 13px 14px; color: var(--text); font-size: 15px;
}
.add-row input:focus { outline: 2px solid var(--accent-a); }
.allowlist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.allowlist li {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 14px; font-size: 15px;
}
.allowlist .empty { justify-content: center; color: var(--muted); }
.allowlist .rm { background: none; border: none; color: var(--muted); font-size: 17px; cursor: pointer; padding: 4px 6px; }
.allowlist .rm:active { color: var(--danger); }

/* ---- bottom nav ---- */
.bottomnav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 4;
  max-width: 480px; margin: 0 auto;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: rgba(10, 12, 20, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
}
.nav-btn {
  flex: 1;
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); font-size: 11px; font-weight: 600;
  transition: color 0.15s ease;
}
.nav-btn span { letter-spacing: 0.01em; }
.nav-btn.active { color: var(--accent-b); }
.nav-btn:active { transform: scale(0.94); }

/* ---- toast ---- */
.toast {
  position: fixed;
  left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  transform: translateX(-50%);
  z-index: 20;
  background: var(--elevated);
  border: 1px solid var(--border-2);
  color: var(--text);
  padding: 11px 18px; border-radius: 12px; font-size: 14px;
  box-shadow: var(--shadow);
  animation: toastin 0.2s ease;
}
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
