:root{
  --title-font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  --body-font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  --title-fx: float;
  --nebula-mode: violet;

  --title-c1: rgba(255,255,255,0.95);
  --title-c2: rgba(170,120,255,0.95);
  --title-c3: rgba(120,200,255,0.95);
  --title-size: clamp(28px, 4vw, 48px);
  --intro-size: 16px;

  --bg: #050610;
  --panel: rgba(10, 12, 25, 0.68);
  --panel2: rgba(10, 12, 25, 0.55);
  --border: rgba(255,255,255,0.10);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.65);
  --glow: rgba(142, 208, 255, 0.22);
  --accent: rgba(142, 208, 255, 0.9);
}

*{ box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin:0;
  font-family: var(--body-font);
  color: var(--text);
  background: radial-gradient(1200px 800px at 70% 20%, rgba(145, 80, 255, 0.18), rgba(0,0,0,0) 60%),
              radial-gradient(900px 700px at 20% 80%, rgba(60, 120, 255, 0.14), rgba(0,0,0,0) 55%),
              linear-gradient(180deg, #03010a 0%, #04021a 35%, #02010f 100%);
overflow-x: hidden;
}

#starCanvas{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

.topbar{
  position: relative;
  z-index: 2;
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  padding: 18px 22px;
}

.brand-title{
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-shadow: 0 0 24px var(--glow);
}
.brand-sub{
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.4px;
}

.nav{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-link{
  text-decoration: none;
  color: var(--text);
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.nav-link:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.10);
}
.nav-link.active{
  background: rgba(142, 208, 255, 0.12);
  border-color: rgba(142, 208, 255, 0.25);
  box-shadow: 0 0 30px rgba(142, 208, 255, 0.12);
}

.lang{
  color: var(--muted);
  font-size: 13px;
  padding: 10px 6px;
}
.lang-link{
  color: var(--muted);
  text-decoration: none;
}
.lang-link:hover{ color: var(--text); }

.main{
  position: relative;
  z-index: 2;
  min-height: calc(100vh - 140px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 28px 18px 18px;
}

.panel{
  width: min(980px, 96vw);
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  box-shadow: 0 10px 60px rgba(0,0,0,0.45);
  backdrop-filter: blur(10px);
  padding: 26px 22px;
}

.center{
  text-align:center;
}

.hero-title{
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 900;
  letter-spacing: 0.6px;
  text-shadow: 0 0 30px var(--glow);
}

.constellation{
  margin: 10px auto 8px;
  width: min(740px, 92vw);
  height: 120px;
  border-radius: 18px;
  border: 1px dashed rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.15);
  display:flex;
  align-items:center;
  justify-content:center;
  position: relative;
  overflow:hidden;
}
.constellation canvas{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
}

.intro{
  margin: 18px auto 6px;
  max-width: 780px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  min-height: 64px;
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  border-radius: 16px;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor:pointer;
  text-decoration:none;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover{
  transform: translateY(-1px);
  background: rgba(142, 208, 255, 0.10);
  border-color: rgba(142, 208, 255, 0.25);
  box-shadow: 0 0 30px rgba(142, 208, 255, 0.14);
}

.form{
  display:grid;
  gap: 12px;
  width: min(520px, 92vw);
  margin: 0 auto;
}
.field{
  display:grid;
  gap: 8px;
  text-align:left;
}
label{
  color: var(--muted);
  font-size: 13px;
}
input[type="text"], input[type="password"], input[type="email"]{
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  outline: none;
}
input:focus{
  border-color: rgba(142, 208, 255, 0.35);
  box-shadow: 0 0 0 3px rgba(142, 208, 255, 0.12);
}

.row{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.hint{
  color: var(--muted);
  font-size: 13px;
}
.error{
  border: 1px solid rgba(255, 115, 115, 0.35);
  background: rgba(255, 115, 115, 0.08);
  padding: 10px 12px;
  border-radius: 16px;
}
.ok{
  border: 1px solid rgba(142, 255, 182, 0.28);
  background: rgba(142, 255, 182, 0.08);
  padding: 10px 12px;
  border-radius: 16px;
}

.footer{
  position: relative;
  z-index: 2;
  padding: 14px 18px 22px;
  display:flex;
  gap: 10px;
  justify-content:center;
  align-items:center;
  color: var(--muted);
}
.footer-link{
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  padding: 6px 8px;
}
.footer-link:hover{ color: var(--text); }
.dot{ opacity: .6; }

.modal, .admin-panel{
  position: fixed;
  inset: 0;
  display:none;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,0.55);
  z-index: 50;
  padding: 18px;
}
.modal.show, .admin-panel.show{ display:flex; }

.modal-card, .admin-card{
  width: min(920px, 96vw);
  max-height: 80vh;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(10, 12, 25, 0.88);
  box-shadow: 0 12px 90px rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
}
.modal-head{
  position: sticky;
  top: 0;
  z-index: 2;

  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}
.modal-title{
  font-weight: 800;
  letter-spacing: .3px;
}
.icon-btn{
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-radius: 12px;
  padding: 6px 10px;
  cursor:pointer;
}
.modal-body{
  margin: 0;
  padding: 14px 16px;
  white-space: pre-wrap;
  color: var(--muted);
  overflow:auto;
  max-height: calc(80vh - 54px);
}
.admin-body{
  padding: 14px 16px 18px;
  color: var(--muted);
  max-height: calc(80vh - 56px);
  overflow-y: auto;
}
.admin-body::-webkit-scrollbar{ width: 10px; }
.admin-body::-webkit-scrollbar-thumb{ background: rgba(255,255,255,0.12); border-radius: 999px; }
.admin-body::-webkit-scrollbar-track{ background: rgba(0,0,0,0.18); }

.admin-body code{ color: var(--text); }

.toast{
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(10, 12, 25, 0.92);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  display:none;
}
.toast.show{ display:block; }


/* Welcome page: remove the central dark window */
.panel--clear{
  border: none;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
}

/* Gradient title */
/* Subtle text glow */
.hero-title, .brand-title{
  filter: drop-shadow(0 0 18px rgba(160,120,255,0.20)) drop-shadow(0 0 22px rgba(120,200,255,0.12));
}


.hero-title{
  font-size: var(--title-size);
  font-weight: 900;
  letter-spacing: 0.6px;
  text-shadow: 0 0 30px var(--glow);
  background: linear-gradient(90deg, var(--title-c1), var(--title-c2), var(--title-c3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.intro{
  font-size: var(--intro-size);
}


@keyframes amFloat{
  0% { transform: translate3d(0,0,0); }
  50% { transform: translate3d(0,-10px,0); }
  100% { transform: translate3d(0,0,0); }
}
@keyframes amDrift{
  0% { transform: translate3d(0,0,0); }
  50% { transform: translate3d(12px,-8px,0); }
  100% { transform: translate3d(0,0,0); }
}
@keyframes amShimmer{
  0% { filter: drop-shadow(0 0 18px rgba(160,120,255,0.22)) drop-shadow(0 0 22px rgba(120,200,255,0.12)); opacity: .96; }
  50% { filter: drop-shadow(0 0 28px rgba(160,120,255,0.32)) drop-shadow(0 0 34px rgba(120,200,255,0.18)); opacity: 1; }
  100% { filter: drop-shadow(0 0 18px rgba(160,120,255,0.22)) drop-shadow(0 0 22px rgba(120,200,255,0.12)); opacity: .96; }
}

.floaty{ animation: amFloat 6.5s ease-in-out infinite; }
.drifty{ animation: amDrift 9.5s ease-in-out infinite; }
.shimmer{ animation: amShimmer 5.2s ease-in-out infinite; }

/* Title flying effect variants (controlled by --title-fx) */
.hero-title{
  font-family: var(--title-font);
}
body[data-titlefx="float"] .hero-title{ animation: amFloat 6.5s ease-in-out infinite, amShimmer 5.2s ease-in-out infinite; }
body[data-titlefx="drift"] .hero-title{ animation: amDrift 10.0s ease-in-out infinite, amShimmer 5.2s ease-in-out infinite; }
body[data-titlefx="shimmer"] .hero-title{ animation: amShimmer 4.8s ease-in-out infinite; }

/* Make intro/button gently float too */
.intro{ animation: amDrift 12s ease-in-out infinite; }
.btn{ animation: amFloat 8.5s ease-in-out infinite; }

/* Nebula overlay modes (canvas does the heavy lifting, this adds subtle color wash) */
body[data-nebula="violet"] .main::before{
  content:"";
  position:absolute; inset:-40px;
  pointer-events:none;
  background: radial-gradient(900px 600px at 75% 25%, rgba(170,110,255,0.18), rgba(0,0,0,0) 60%),
              radial-gradient(800px 520px at 20% 75%, rgba(70,130,255,0.14), rgba(0,0,0,0) 58%);
  filter: blur(2px);
}
body[data-nebula="teal"] .main::before{
  content:"";
  position:absolute; inset:-40px;
  pointer-events:none;
  background: radial-gradient(860px 560px at 70% 30%, rgba(80,240,220,0.14), rgba(0,0,0,0) 60%),
              radial-gradient(760px 520px at 25% 75%, rgba(90,160,255,0.12), rgba(0,0,0,0) 58%);
  filter: blur(2px);
}
body[data-nebula="ember"] .main::before{
  content:"";
  position:absolute; inset:-40px;
  pointer-events:none;
  background: radial-gradient(860px 560px at 68% 32%, rgba(255,120,90,0.12), rgba(0,0,0,0) 60%),
              radial-gradient(760px 520px at 25% 75%, rgba(170,110,255,0.10), rgba(0,0,0,0) 58%);
  filter: blur(2px);
}
body[data-nebula="none"] .main::before{ content:none; }


.constellation-label{
  position: fixed;
  left: 50%;
  top: 36%;
  transform: translate(-50%, 0);
  z-index: 2;
  pointer-events: none;
  text-align: center;
  opacity: 0;
  transition: opacity 280ms ease;
  font-family: var(--body-font);
}

.constellation-label.show{ opacity: 1; }

.constellation-label .glyph{
  font-family: "Segoe UI Symbol", "Noto Sans Symbols", system-ui, Arial;
  font-size: 34px;
  line-height: 1;
  opacity: 0.85;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 14px rgba(170,120,255,0.25));
}

.constellation-label .name{
  font-weight: 900;
  letter-spacing: 0.22em;
  font-size: 14px;
  opacity: 0.68;
  text-transform: uppercase;
}



/* Hide center content (title/text/buttons) */
body[data-hidecenter="1"] .hero{ display:none !important; }
body[data-hidecenter="1"] .topbar{ opacity:0; pointer-events:none; }
body[data-hidecenter="1"] .footer{ opacity:0; pointer-events:none; }

body[data-page="login"] #constellationLabel{ display:none !important; }


.menu-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  max-width: 900px;
  margin: 18px auto 0;
}
.card{
  display:block;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.92);
  text-decoration:none;
  backdrop-filter: blur(10px);
  transition: transform 220ms ease, background 220ms ease;
}
.card:hover{ transform: translateY(-2px); background: rgba(0,0,0,0.28); }

.lang-box{display:inline-flex;align-items:center;gap:8px;margin-left:10px}
.lang-select{background:rgba(0,0,0,0.25);color:#fff;border:1px solid rgba(255,255,255,0.25);border-radius:10px;padding:8px 10px;outline:none}
.lang-select option{color:#000}


/* Hide UI (stars only) */
body.hide-ui header, body.hide-ui .hero, body.hide-ui footer{ opacity:0; pointer-events:none; }
body.hide-ui .main{ overflow:hidden; }


/* --- Forms v14 --- */
.form-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}
@media (max-width: 720px){
  .form-grid{ grid-template-columns: 1fr; }
}
.field select{
  width:100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  outline: none;
}
.field select:focus{
  border-color: rgba(142, 208, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(142, 208, 255, 0.10);
}


/* checkbox rows */
.chk{display:flex;gap:10px;align-items:flex-start;font-size:14px;opacity:.95}
.chk input{margin-top:3px}
.chk a{text-decoration:underline}


/* --- Dashboard layout (AM_1v16) --- */
.dashboard-wrap{
  display:grid;
  grid-template-columns: 280px 1fr;
  gap:16px;
  align-items:start;
}
@media (max-width: 900px){
  .dashboard-wrap{ grid-template-columns: 1fr; }
}
.dash-side{ position: sticky; top: 84px; }
@media (max-width: 900px){
  .dash-side{ position: static; }
}
.dash-card{
  background: rgba(0,0,0,0.34);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px;
  padding: 14px;
  backdrop-filter: blur(10px);
}

.profile-wrap{ display:flex; flex-direction:column; gap:12px; align-items:center; }
.profile-card{ display:flex; gap:14px; align-items:center; padding:14px; border:1px solid rgba(255,255,255,0.10); background: rgba(10,12,25,0.55); border-radius:18px; backdrop-filter: blur(10px); }
.profile-avatar{
  width: 96px;
  height: 96px;
  border-radius: 18px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.20);
  display:flex;
  align-items:center;
  justify-content:center;
}
.profile-avatar img{ width:100%; height:100%; object-fit:cover; display:block; }
.profile-avatar--placeholder{ font-weight:700; color: rgba(255,255,255,0.65); }

.img-thumb{
  width:200px;
  height:100px;
  object-fit:cover;
  display:block;
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.18);
}
.gallery-grid{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:10px;
}
.gallery-item{
  width:200px;
}
.gallery-badge{
  margin-top:6px;
  font-size:12px;
  color: rgba(255,255,255,0.70);
}

.dash-avatar{
  width: 88px;
  height: 88px;
  border-radius: 18px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.20);
  display:flex;
  align-items:center;
  justify-content:center;
}
.dash-avatar img{ width:100%; height:100%; object-fit:cover; display:block; }
.dash-avatar--placeholder{ font-size: 34px; opacity: .85; }
.dash-meta{ margin-top: 12px; }
.dash-username{ font-weight: 900; letter-spacing: .2px; font-size: 18px; }
.dash-email{ opacity:.85; font-size: 13px; word-break: break-word; margin-top: 2px; }
.dash-badges{ margin-top: 10px; display:flex; gap:8px; flex-wrap:wrap; }
.badge{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border:1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.22);
}
.badge--ok{ box-shadow: 0 0 0 1px rgba(60,255,180,0.15) inset; }
.badge--warn{ box-shadow: 0 0 0 1px rgba(255,190,60,0.15) inset; }
.dash-ids{ margin-top: 10px; font-size: 12px; opacity:.85; }
.dash-ids .muted{ opacity:.75; }
.dash-actions{ margin-top: 12px; display:flex; gap:10px; }
.btn--ghost{
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
}
.dash-nav{
  margin-top: 12px;
  display:grid;
  gap:8px;
}
.dash-link{
  width:100%;
  text-align:left;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.26);
  color: rgba(255,255,255,0.92);
  font-weight: 800;
  cursor:pointer;
}
.dash-link:hover{ background: rgba(255,255,255,0.06); }
.dash-link.is-active{
  background: rgba(255,255,255,0.10);
  box-shadow: 0 0 0 1px rgba(120,200,255,0.22) inset;
}
.dash-main{
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  padding: 16px;
  backdrop-filter: blur(10px);
}
.dash-head{ margin-bottom: 12px; }
.dash-title{ margin:0; font-size: 22px; font-weight: 900; }
.dash-sub{ margin: 6px 0 0; opacity:.88; }
.dash-view{ display:none; }
.dash-view.is-active{ display:block; }
.dash-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 1100px){
  .dash-grid{ grid-template-columns: 1fr; }
}
.dash-block{
  background: rgba(0,0,0,0.26);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 14px;
}
.dash-block__title{
  font-weight: 900;
  margin-bottom: 10px;
}
.dash-kv{
  display:grid;
  grid-template-columns: 160px 1fr;
  gap: 10px 12px;
  align-items:start;
}
@media (max-width: 560px){
  .dash-kv{ grid-template-columns: 1fr; }
}
.dash-kv .k{ opacity:.75; font-weight: 800; }
.dash-kv .v{ opacity:.95; }


/* Subtle cosmic glow drift (1v17) */
.cosmic-glow{
  position: fixed;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: screen;
  will-change: transform;
}
.cosmic-glow.glow--a{
  background: radial-gradient(900px 650px at 85% 18%, rgba(255,255,255,0.08), rgba(0,0,0,0) 60%);
  animation: glowDriftA 120s linear infinite;
}
.cosmic-glow.glow--b{
  background: radial-gradient(950px 720px at 15% 88%, rgba(255,255,255,0.07), rgba(0,0,0,0) 62%);
  animation: glowDriftB 120s linear infinite;
}
@keyframes glowDriftA{
  0%{ transform: translate3d(0,0,0) scale(1); }
  50%{ transform: translate3d(-2.5%, 1.5%, 0) scale(1.02); }
  100%{ transform: translate3d(1.8%, -1.2%, 0) scale(1.01); }
}
@keyframes glowDriftB{
  0%{ transform: translate3d(0,0,0) scale(1); }
  50%{ transform: translate3d(2.2%, -1.3%, 0) scale(1.02); }
  100%{ transform: translate3d(-1.6%, 1.1%, 0) scale(1.01); }
}

.brand--hidden{ visibility: hidden; }

/* Legal pages */
.legal{ max-width: 980px; margin: 0 auto; }
.legal-title{ margin: 0 0 14px; font-size: clamp(22px, 3vw, 34px); font-weight: 900; letter-spacing: .4px; text-shadow: 0 0 26px var(--glow); }
.legal-box{
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(0,0,0,0.18);
  padding: 16px 16px;
  color: var(--text);
  line-height: 1.65;
  white-space: normal;
}
.muted{ color: var(--muted); }

.badge--bad{ border-color: rgba(255,90,90,.35); background: rgba(255,60,60,.12); color: rgba(255,220,220,.95); }


/* Dashboard layout styles (selectable via Admin Panel / localStorage) */
body[data-page="dashboard"].dash-outline .panel,
body[data-page="dashboard"].dash-outline .card{
  background: transparent !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
}

body[data-page="dashboard"].dash-outline .panel{
  background: transparent !important;
}

body[data-page="dashboard"].dash-minimal .panel,
body[data-page="dashboard"].dash-minimal .card{
  background: transparent !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
  border: none !important;
}

body[data-page="dashboard"].dash-minimal .panel{
  padding-top: 10px !important;
}

body[data-page="dashboard"].dash-minimal .card{
  padding: 0 !important;
}

body[data-page="dashboard"].dash-minimal .dashboard-wrap{
  gap: 28px !important;
}

body[data-page="dashboard"].dash-minimal .side-card{
  border: 1px solid rgba(255,255,255,0.06) !important;
  background: rgba(255,255,255,0.02) !important;
}

body[data-page="dashboard"].dash-minimal .dash-main .card{
  border: 1px solid rgba(255,255,255,0.06) !important;
  background: rgba(255,255,255,0.02) !important;
  padding: 18px !important;
}

@keyframes amFloatSoft { 
  0%{ transform: translateY(0px);} 
  50%{ transform: translateY(-6px);} 
  100%{ transform: translateY(0px);} 
}
body[data-page="dashboard"].dash-minimal .dash-main{
  animation: amFloatSoft 8s ease-in-out infinite;
}
