@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #0a0713;
  --bg-2: #120b1f;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-solid: #171025;
  --border: rgba(178, 148, 230, 0.16);
  --border-hover: rgba(192, 132, 252, 0.4);
  --text: #f1ecfb;
  --text-dim: #a99cc9;
  --text-dimmer: #6e628f;
  --violet: #a63fe0;
  --violet-2: #7c3aed;
  --cyan: #5ad1e6;
  --pink: #e05fc4;
  --gradient: linear-gradient(100deg, var(--violet) 0%, var(--violet-2) 55%, var(--cyan) 120%);
  --gradient-text: linear-gradient(100deg, #d9b3ff 0%, #c9a3ff 40%, #7fe3f0 100%);
  --good: #5ad1e6;
  --bad: #ff7a90;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-glow: 0 0 0 1px var(--border), 0 8px 30px -8px rgba(124, 58, 237, 0.35);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Fixed atmospheric background: soft glow orbs + faint grid, sits behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(760px circle at 12% -8%, rgba(166, 63, 224, 0.28), transparent 60%),
    radial-gradient(620px circle at 108% 18%, rgba(90, 209, 230, 0.16), transparent 55%),
    radial-gradient(900px circle at 50% 115%, rgba(124, 58, 237, 0.18), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.5;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 100% 60% at 50% 0%, #000 20%, transparent 75%);
}

a { color: var(--cyan); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: #8fe3f0; }

h1, h2, h3 { font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif; letter-spacing: -0.01em; color: var(--text); }

::selection { background: rgba(166, 63, 224, 0.35); color: #fff; }

/* --- nav --------------------------------------------------------------- */
.nav-wrap {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  background: rgba(10, 7, 19, 0.6);
  border-bottom: 1px solid rgba(178, 148, 230, 0.1);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1080px; margin: 0 auto; padding: 14px 24px;
}
.nav-brand { display: flex; align-items: center; }
.nav-brand img { height: 30px; display: block; transition: transform 0.2s var(--ease), filter 0.2s var(--ease); }
.nav-brand:hover img { transform: translateY(-1px); filter: drop-shadow(0 0 14px rgba(166, 63, 224, 0.5)); }
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links > a:not(.btn):not(.btn-ghost) {
  color: var(--text-dim); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 8px 12px; border-radius: 8px; transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.nav-links > a:not(.btn):not(.btn-ghost):hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.nav-links form { margin: 0 0 0 4px; }

/* --- buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--gradient); background-size: 160% 160%; background-position: 0% 50%;
  border: none; color: #100c1a; font-weight: 700; padding: 10px 20px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; text-decoration: none;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 6px 20px -6px rgba(166, 63, 224, 0.55);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background-position 0.4s var(--ease);
}
.btn:hover { transform: translateY(-1px); background-position: 100% 50%; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 10px 26px -6px rgba(166, 63, 224, 0.7); color: #100c1a; }
.btn:active { transform: translateY(0); }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border);
  color: var(--text); padding: 9px 19px; border-radius: var(--radius-sm); text-decoration: none; font-size: 14px;
  font-weight: 500; font-family: 'Inter', sans-serif; cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.2s var(--ease);
}
.btn-ghost:hover { border-color: var(--border-hover); background: rgba(255, 255, 255, 0.06); color: var(--text); transform: translateY(-1px); }
.btn-ghost.active { border-color: var(--border-hover); background: rgba(166, 63, 224, 0.16); }
.btn:disabled, .btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* --- layout -------------------------------------------------------------- */
main { max-width: 660px; margin: 0 auto; padding: 48px 24px 100px; animation: rise 0.5s var(--ease); }
.wide { max-width: 960px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

h1 { font-size: 32px; font-weight: 700; margin: 8px 0 6px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); font-weight: 600; margin: 40px 0 10px; display: flex; align-items: center; gap: 10px; }
h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }
p.lead { color: var(--text-dim); font-size: 15.5px; margin-top: 0; }

/* --- surfaces / cards ----------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; margin: 16px 0;
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-glow);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
form.card { padding: 26px; }

label { display: block; font-weight: 600; font-size: 13.5px; margin: 20px 0 7px; color: var(--text); }
label:first-child { margin-top: 0; }
.hint { color: var(--text-dim); font-size: 13px; margin-top: 6px; line-height: 1.5; }

input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 13px; font-size: 14px; font-family: inherit;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}
input[type=text]:hover, input[type=email]:hover, input[type=password]:hover, input[type=number]:hover, select:hover, textarea:hover { border-color: rgba(178, 148, 230, 0.3); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--violet); background: rgba(166, 63, 224, 0.06);
  box-shadow: 0 0 0 3px rgba(166, 63, 224, 0.18);
}
input::placeholder, textarea::placeholder { color: var(--text-dimmer); }
select { appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' stroke='%23a99cc9' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px;
}
textarea { font-family: ui-monospace, 'JetBrains Mono', Consolas, monospace; font-size: 12.5px; min-height: 100px; resize: vertical; }

/* custom checkbox -> toggle switch */
input[type=checkbox] {
  appearance: none; -webkit-appearance: none; position: relative;
  width: 38px; height: 22px; min-width: 38px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--border);
  cursor: pointer; transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
  vertical-align: middle;
}
input[type=checkbox]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #cfc3ea; transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
input[type=checkbox]:checked { background: var(--gradient); border-color: transparent; }
input[type=checkbox]:checked::after { transform: translateX(16px); background: #fff; }
input[type=checkbox]:focus-visible { box-shadow: 0 0 0 3px rgba(166, 63, 224, 0.25); outline: none; }
input[type=checkbox]:not(.statfield-check) { flex-shrink: 0; }

.row { display: flex; align-items: center; gap: 12px; margin: 14px 0; flex-wrap: wrap; }
.row label { margin: 0; font-weight: 500; cursor: pointer; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

.saved, .error {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; font-weight: 500;
  border: 1px solid; animation: rise 0.3s var(--ease);
}
.saved { color: #8ff0e0; background: rgba(90, 209, 230, 0.08); border-color: rgba(90, 209, 230, 0.3); }
.error { color: #ffb3bf; background: rgba(255, 122, 144, 0.08); border-color: rgba(255, 122, 144, 0.3); }

/* --- feature / stat cards ------------------------------------------------- */
.features { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 28px 0; }
@media (max-width: 640px) { .features { grid-template-columns: 1fr; } }
.feature {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), background 0.25s var(--ease);
}
.feature:hover { border-color: var(--border-hover); transform: translateY(-2px); background: rgba(255, 255, 255, 0.06); }
.feature h3 { margin: 0 0 6px; font-size: 15.5px; color: var(--text); font-weight: 600; }
.feature p { margin: 0; color: var(--text-dim); font-size: 13.5px; }

/* --- hero ------------------------------------------------------------------ */
.hero { text-align: center; padding: 56px 0 32px; position: relative; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600;
  letter-spacing: 0.04em; color: var(--text-dim); background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border); padding: 6px 14px; border-radius: 999px; margin-bottom: 22px;
}
.hero .eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.hero img.banner { max-width: 100%; border-radius: var(--radius); margin-bottom: 24px; box-shadow: var(--shadow-glow); }
.hero h1 {
  font-size: clamp(32px, 5.5vw, 52px); line-height: 1.1; max-width: 720px; margin: 0 auto 18px;
  background: var(--gradient-text); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { max-width: 560px; margin: 8px auto 30px; font-size: 16.5px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* --- footer ------------------------------------------------------------------ */
footer { text-align: center; color: var(--text-dimmer); font-size: 12.5px; padding: 56px 24px 40px; border-top: 1px solid rgba(178, 148, 230, 0.08); margin-top: 48px; }
footer div:first-child { max-width: 560px; margin: 0 auto; }
footer a { color: var(--text-dim); }
footer a:hover { color: var(--cyan); }

code { background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; font-size: 0.9em; font-family: ui-monospace, 'JetBrains Mono', Consolas, monospace; }
pre { background: rgba(0, 0, 0, 0.35) !important; border: 1px solid var(--border); }
pre code { border: none; padding: 0; background: none; }

/* --- reorderable field list (dashboard tab-list fields) ------------------ */
.field-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.field-list li {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  background: rgba(255, 255, 255, 0.025); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.field-list li:hover { border-color: var(--border-hover); background: rgba(255, 255, 255, 0.05); }
.field-label { flex: 1; font-size: 14px; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--violet-2); background: rgba(166, 63, 224, 0.14); border: 1px solid rgba(166, 63, 224, 0.3); padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.field-move {
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 7px; cursor: pointer; font-size: 13px; line-height: 1; padding: 0;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
}
.field-move:hover { border-color: var(--border-hover); color: var(--text); background: rgba(255, 255, 255, 0.08); }

/* --- auth pages (login/signup) ------------------------------------------- */
.auth { max-width: 400px; margin: 64px auto; text-align: center; animation: rise 0.5s var(--ease); }
.auth img.mark { width: 52px; height: 52px; border-radius: 13px; margin-bottom: 18px; box-shadow: var(--shadow-glow); }
.auth h1 { font-size: 24px; }
.auth p.lead { font-size: 14px; margin-bottom: 22px; }
.auth .card { text-align: left; }
.auth p.hint { text-align: center; margin-top: 20px; }
.auth .error, .auth .saved { text-align: left; }

strong { color: var(--text); }
ul { padding-left: 20px; }
li { margin: 4px 0; }
