/* Scopio — deep space theme */
:root {
  --bg: #04050d;
  --bg2: #0a0c1f;
  --ink: #eef0ff;
  --muted: #9aa0c3;
  --line: rgba(160, 170, 255, .14);
  --glass: rgba(18, 20, 48, .55);
  --glass-hi: rgba(30, 33, 78, .62);
  --a1: #8b5cf6;
  --a2: #22d3ee;
  --a3: #f472b6;
  --ok: #34d399;
  --err: #fb7185;
  --radius: 20px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 50% -10%, #141a44 0%, var(--bg2) 35%, var(--bg) 75%);
  background-color: var(--bg);
  color: var(--ink);
  font: 16px/1.5 "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  overflow-x: hidden;
}
#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.nebula {
  position: fixed; inset: -20%; z-index: 0; pointer-events: none; opacity: .55; filter: blur(60px);
  background:
    radial-gradient(40% 30% at 15% 20%, rgba(139, 92, 246, .35), transparent 70%),
    radial-gradient(35% 30% at 85% 30%, rgba(34, 211, 238, .22), transparent 70%),
    radial-gradient(45% 35% at 60% 90%, rgba(244, 114, 182, .18), transparent 70%);
  animation: drift 40s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(-2%, -1%, 0) rotate(0deg) scale(1); }
  to { transform: translate3d(2%, 2%, 0) rotate(6deg) scale(1.08); }
}
a { color: var(--a2); text-decoration: none; }
code, .mono { font-family: "Cascadia Code", "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: .88em; }
code { background: rgba(139, 92, 246, .14); padding: .1em .4em; border-radius: 6px; }
h1, h2, h3 { margin: 0 0 .3em; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 750; }
h2 { font-size: 1.15rem; font-weight: 650; display: flex; align-items: center; gap: .5em; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 .6em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }

.ic { width: 1.1em; height: 1.1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.18em; }
.ic.flip { transform: rotate(180deg); }

/* layout */
.wrap { position: relative; z-index: 1; max-width: 980px; margin: 0 auto; padding: 16px 16px calc(48px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(to bottom, rgba(4, 5, 13, .85), rgba(4, 5, 13, .4));
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6em; color: var(--ink); font-weight: 750; font-size: 1.15rem; letter-spacing: -.01em; }
.brand-orb {
  width: 26px; height: 26px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 32% 30%, #c4b5fd, var(--a1) 45%, #1e1b4b 80%);
  box-shadow: 0 0 18px rgba(139, 92, 246, .7);
}
.brand-orb::after {
  content: ""; position: absolute; inset: 9px -6px; border-radius: 50%; border: 1.5px solid rgba(34, 211, 238, .8); transform: rotate(-20deg);
}
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--muted); padding: 8px 12px; border-radius: 12px; display: flex; align-items: center; gap: .45em; font-weight: 550; transition: color .2s, background .2s; }
.nav a:hover { color: var(--ink); background: rgba(255, 255, 255, .05); }
.nav a.on { color: var(--ink); background: rgba(139, 92, 246, .18); }
.nav-btn { background: none; border: 0; padding: 4px; margin-left: 6px; cursor: pointer; border-radius: 50%; }
@media (max-width: 520px) { .nav a span { display: none; } .nav a { padding: 10px; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 18px 0 22px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.project-head { align-items: center; justify-content: flex-start; flex-wrap: nowrap; }
.back { display: inline-flex; align-items: center; gap: .3em; color: var(--muted); margin-top: 10px; font-weight: 550; }
.back:hover { color: var(--ink); }

/* glass */
.glass {
  background: linear-gradient(160deg, var(--glass-hi), var(--glass));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 10px 40px -12px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.panel { padding: 20px; margin-bottom: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }

/* buttons */
.btn {
  --b: rgba(255, 255, 255, .07);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: 10px 16px; min-height: 44px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--b); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .25s var(--spring), background .2s, box-shadow .3s, border-color .2s;
  -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, .12); border-color: rgba(160, 170, 255, .3); }
.btn:active { transform: scale(.96); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, .tab:focus-visible { outline: 2px solid var(--a2); outline-offset: 2px; }
.btn-primary {
  border: 0; color: #fff;
  background: linear-gradient(135deg, var(--a1), #6366f1 50%, var(--a2));
  background-size: 160% 160%; background-position: 0% 50%;
  box-shadow: 0 6px 24px -6px rgba(139, 92, 246, .7), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn-primary:hover { background-position: 100% 50%; box-shadow: 0 8px 32px -4px rgba(34, 211, 238, .55), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-ghost { background: transparent; }
.btn-danger { background: rgba(251, 113, 133, .14); border-color: rgba(251, 113, 133, .35); color: #fecdd3; }
.btn-danger:hover { background: rgba(251, 113, 133, .25); }
.btn-lg { min-height: 52px; font-size: 1.05rem; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .88rem; border-radius: 11px; }
.btn-icon { padding: 10px; width: 44px; }
.row-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.row-actions.split { justify-content: space-between; border-top: 1px solid var(--line); padding-top: 16px; }

/* forms */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 550; font-size: .92rem; }
input:not([type=checkbox]), textarea {
  width: 100%; padding: 12px 14px; border-radius: 13px; border: 1px solid var(--line);
  background: rgba(4, 5, 20, .55); color: var(--ink); font: inherit; font-weight: 400;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:not([type=checkbox]):focus, textarea:focus { outline: none; border-color: rgba(139, 92, 246, .7); box-shadow: 0 0 0 4px rgba(139, 92, 246, .18); background: rgba(4, 5, 20, .8); }
textarea { resize: vertical; }
.stack { display: flex; flex-direction: column; gap: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 14px; margin: 0; }
legend { padding: 0 6px; font-weight: 600; font-size: .92rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.check { flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid transparent; cursor: pointer; font-weight: 500; transition: background .2s, border-color .2s; }
.check:has(input:checked) { background: rgba(139, 92, 246, .16); border-color: rgba(139, 92, 246, .45); }
.check input, .switch { accent-color: var(--a1); width: 18px; height: 18px; margin: 0; }
.switch {
  appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 99px; position: relative; cursor: pointer;
  background: rgba(255, 255, 255, .12); border: 1px solid var(--line); transition: background .3s;
}
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #cbd0f5; transition: transform .35s var(--spring), background .3s; }
.switch:checked { background: linear-gradient(135deg, var(--a1), var(--a2)); }
.switch:checked::after { transform: translateX(18px); background: #fff; }
.switch-row { flex-direction: row; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-row:last-of-type { border-bottom: 0; }
.alert { background: rgba(251, 113, 133, .12); border: 1px solid rgba(251, 113, 133, .35); color: #fecdd3; padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: .92rem; }

/* login */
.hero-login { min-height: calc(100dvh - 64px); display: grid; place-items: center; position: relative; padding: 40px 0; }
.login-card { width: min(420px, 100%); padding: 32px 26px; position: relative; z-index: 2; animation: rise .9s var(--ease) both; }
.login-card h1 { background: linear-gradient(120deg, #fff 20%, #c4b5fd 50%, var(--a2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.planet {
  position: absolute; width: min(520px, 120vw); aspect-ratio: 1; border-radius: 50%; top: 50%; left: 50%;
  transform: translate(-50%, -62%); z-index: 1; opacity: .55;
  background: radial-gradient(circle at 30% 28%, rgba(196, 181, 253, .55), rgba(99, 102, 241, .35) 30%, rgba(30, 27, 75, .5) 60%, transparent 71%);
  filter: blur(1px);
  animation: float 14s ease-in-out infinite alternate;
}
.planet .ring { position: absolute; inset: 38% -14%; border-radius: 50%; border: 2px solid rgba(34, 211, 238, .35); transform: rotate(-18deg); box-shadow: 0 0 30px rgba(34, 211, 238, .25); }
@keyframes float { to { transform: translate(-50%, -58%) rotate(8deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.98); filter: blur(6px); } }

/* cards & grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { display: flex; align-items: center; gap: 16px; padding: 18px; color: var(--ink); transition: transform .4s var(--spring), border-color .3s, box-shadow .4s; animation: rise .7s var(--ease) both; }
.grid > :nth-child(2) { animation-delay: .06s; } .grid > :nth-child(3) { animation-delay: .12s; } .grid > :nth-child(4) { animation-delay: .18s; } .grid > :nth-child(n+5) { animation-delay: .24s; }
.card:hover { transform: translateY(-4px); border-color: rgba(139, 92, 246, .45); box-shadow: 0 18px 50px -14px rgba(139, 92, 246, .55), inset 0 1px 0 rgba(255, 255, 255, .08); }
.card-body { flex: 1; min-width: 0; }
.card .go { color: var(--muted); transition: transform .3s var(--spring); }
.card:hover .go { transform: translateX(4px); color: var(--ink); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .92rem; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .84rem; }
.meta span { display: inline-flex; align-items: center; gap: .35em; }

.world {
  --h: 260;
  width: 56px; height: 56px; flex: none; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 32% 28%, hsl(var(--h) 90% 82%), hsl(var(--h) 75% 55%) 38%, hsl(calc(var(--h) + 30) 70% 22%) 78%);
  box-shadow: 0 0 26px hsla(var(--h), 90%, 60%, .45), inset -6px -8px 16px rgba(0, 0, 0, .45);
}
.world::after { content: ""; position: absolute; inset: 40% -18%; border-radius: 50%; border: 1.5px solid hsla(calc(var(--h) + 140), 90%, 75%, .55); transform: rotate(-22deg); }
.world-lg { width: 72px; height: 72px; }
.avatar {
  --h: 260; width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: .9rem; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 75% 58%), hsl(calc(var(--h) + 50) 80% 45%));
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .1), 0 0 16px hsla(var(--h), 80%, 60%, .4);
}
.avatar-lg { width: 52px; height: 52px; font-size: 1.3rem; }
.account-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }

.empty { text-align: center; padding: 48px 20px; }
.empty-orb {
  width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(196, 181, 253, .9), rgba(99, 102, 241, .5) 40%, transparent 72%);
  box-shadow: 0 0 60px rgba(139, 92, 246, .5); animation: pulse 4s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.08); box-shadow: 0 0 90px rgba(34, 211, 238, .45); } }

/* files */
.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.file { display: flex; align-items: center; gap: 16px; padding: 16px; animation: rise .6s var(--ease) both; scroll-margin-top: 90px; }
.file-new { border-color: rgba(34, 211, 238, .35); box-shadow: 0 10px 40px -12px rgba(34, 211, 238, .35), inset 0 1px 0 rgba(255, 255, 255, .06); }
.file:target { border-color: var(--a2); }
.file-icon { width: 50px; height: 50px; flex: none; border-radius: 15px; display: grid; place-items: center; font-size: 1.5rem; color: #a7f3d0; background: linear-gradient(135deg, rgba(52, 211, 153, .2), rgba(34, 211, 238, .12)); border: 1px solid rgba(52, 211, 153, .25); }
.file-main { flex: 1; min-width: 0; }
.file-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.file-title strong { overflow-wrap: anywhere; }
.file-actions { display: flex; gap: 6px; align-items: center; }
.notes { margin: 8px 0 0; font-size: .9rem; color: #c7cbea; border-left: 2px solid rgba(139, 92, 246, .5); padding-left: 10px; }
@media (max-width: 600px) {
  .file { flex-wrap: wrap; }
  .file-actions { width: 100%; }
  .btn-dl { flex: 1; min-height: 50px; }
}
.pill { font-size: .72rem; font-weight: 650; padding: 2px 9px; border-radius: 99px; background: rgba(255, 255, 255, .08); border: 1px solid var(--line); color: #d6d9f5; letter-spacing: .02em; }
.pill-glow { background: linear-gradient(135deg, rgba(139, 92, 246, .35), rgba(34, 211, 238, .3)); border-color: rgba(34, 211, 238, .4); color: #fff; }
.pill-off { color: #fecdd3; border-color: rgba(251, 113, 133, .35); }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.is-revoked { opacity: .5; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-on { background: var(--ok); box-shadow: 0 0 12px var(--ok); animation: blink 2.4s ease-in-out infinite; }
.dot-off { background: #4b5072; }
@keyframes blink { 50% { opacity: .45; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.chip { --h: 260; font-size: .78rem; padding: 2px 10px; border-radius: 99px; background: hsla(var(--h), 70%, 55%, .18); border: 1px solid hsla(var(--h), 70%, 65%, .35); }

/* tabs */
.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: 16px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; position: relative; }
.tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: .45em; padding: 10px 12px; border: 0; border-radius: 12px; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: color .25s, background .35s var(--ease); }
.tab.on { color: #fff; background: linear-gradient(135deg, rgba(139, 92, 246, .45), rgba(34, 211, 238, .3)); box-shadow: 0 4px 18px -6px rgba(139, 92, 246, .7); }
.tabpanel { display: none; }
.tabpanel.on { display: block; animation: rise .5s var(--ease) both; }

.code { background: rgba(2, 3, 12, .7); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; overflow-x: auto; font-family: "Cascadia Code", ui-monospace, Consolas, monospace; font-size: .82rem; line-height: 1.6; color: #c4f1ff; margin: 10px 0 0; }
.danger-zone { border-color: rgba(251, 113, 133, .28); }

/* modals */
.modal {
  border: 0; padding: 16px; background: transparent; color: var(--ink);
  max-width: 100vw; max-height: 100dvh; width: 100%; height: 100%;
  display: grid; place-items: center; opacity: 0; pointer-events: none;
  transition: opacity .35s var(--ease);
}
.modal:not([open]) { display: none; }
.modal::backdrop { background: rgba(2, 3, 10, 0); backdrop-filter: blur(0); transition: background .35s, backdrop-filter .35s; }
.modal.is-open { opacity: 1; pointer-events: auto; }
.modal.is-open::backdrop { background: rgba(2, 3, 10, .6); backdrop-filter: blur(6px); }
.modal-card {
  position: relative; overflow: hidden; width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
  padding: 26px 22px 22px; border-radius: 24px;
  background: linear-gradient(165deg, rgba(34, 37, 88, .92), rgba(12, 13, 34, .95));
  border: 1px solid rgba(160, 170, 255, .22);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .03), inset 0 1px 0 rgba(255, 255, 255, .08);
  transform: translateY(30px) scale(.94); filter: blur(4px);
  transition: transform .5s var(--spring), filter .35s var(--ease);
}
.modal.is-open .modal-card { transform: none; filter: none; }
.modal-sm { width: min(420px, 100%); }
.modal-glow { position: absolute; width: 260px; height: 260px; border-radius: 50%; top: -150px; right: -90px; background: radial-gradient(circle, rgba(139, 92, 246, .45), transparent 70%); pointer-events: none; }
.modal h2 { position: relative; font-size: 1.3rem; margin-bottom: 10px; }
@media (max-width: 600px) {
  .modal { place-items: end center; padding: 0; }
  .modal-card { width: 100%; border-radius: 26px 26px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateY(100%); filter: none; }
}
.secret { background: rgba(2, 3, 12, .8); border: 1px dashed rgba(34, 211, 238, .5); border-radius: 14px; padding: 14px; margin: 14px 0 0; word-break: break-all; }
.secret code { background: none; padding: 0; color: #a5f3fc; font-size: .9rem; }

/* toasts */
.toasts { position: fixed; z-index: 50; left: 50%; top: calc(74px + env(safe-area-inset-top)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 14px; font-weight: 550; font-size: .93rem; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .7); animation: toast-in .6s var(--spring) both, toast-out .5s var(--ease) 4.5s forwards; }
.toast-ok { background: rgba(16, 80, 64, .8); border: 1px solid rgba(52, 211, 153, .5); }
.toast-err { background: rgba(90, 20, 40, .85); border: 1px solid rgba(251, 113, 133, .5); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-16px) scale(.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-12px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 520px) {
  .tab { flex: none; padding: 10px 13px; }
  .tab:not(.on) span { display: none; }
}
