/* ==========================================================================
   Pensira — shared stylesheet
   Light "chrome + blue" security aesthetic, built around the shield brand mark.
   ========================================================================== */

:root{
  /* Backgrounds/borders are hue+chroma custom properties, not literal oklch
     values, specifically so a public profile page can retheme the ACTUAL
     page background (not just the decorative glow layer) around a viewed
     Discord user's accent color -- see js/profile-theme.js. Defaults below
     reproduce the original near-white, faint-cool-blue look exactly (hue
     ~251, the low chroma values below) for every page that never overrides
     them, i.e. everywhere except a themed public profile. */
  --bg-hue: 251;
  --bg-chroma-0: 0.003;
  --bg-chroma-1: 0.006;
  --bg-chroma-2: 0.009;
  --bg-chroma-3: 0.012;
  --border-chroma: 0.02;
  --border-strong-chroma: 0.03;

  /* backgrounds — near-white, faint cool tint by default */
  --bg-0: oklch(98.5% var(--bg-chroma-0) var(--bg-hue));
  --bg-1: oklch(96.5% var(--bg-chroma-1) var(--bg-hue));
  --bg-2: oklch(93.5% var(--bg-chroma-2) var(--bg-hue));
  --bg-3: oklch(88% var(--bg-chroma-3) var(--bg-hue));

  /* borders */
  --border: oklch(55% var(--border-chroma) var(--bg-hue) / 0.16);
  --border-soft: oklch(55% var(--border-chroma) var(--bg-hue) / 0.09);
  --border-strong: oklch(45% var(--border-strong-chroma) var(--bg-hue) / 0.28);

  /* text */
  --text-0: oklch(24% 0.02 260);
  --text-1: oklch(40% 0.02 258);
  --text-2: oklch(56% 0.018 256);

  /* accents — chrome + blue */
  --blue-deep: oklch(40% 0.17 264);
  --blue: oklch(55% 0.19 256);
  --blue-mid: oklch(62% 0.15 244);
  --blue-light: oklch(74% 0.1 228);
  --silver: oklch(84% 0.006 255);
  --silver-dark: oklch(64% 0.012 255);

  --accent-grad: linear-gradient(135deg, var(--blue-deep), var(--blue) 55%, var(--blue-light));
  --btn-grad: linear-gradient(135deg, var(--blue), var(--blue-deep));

  /* Ambient background glow hues -- default blue theme. A public profile
     page (profile.html?u=<id>) overrides these 3 (via js/profile-theme.js)
     to the viewed Discord user's own profile accent color, when Discord
     reports one, so the whole page's ambient glow -- both the blurred
     .bg-glow blobs below and background.js's canvas circuit-traces --
     shifts to match that person's profile instead of the site default. */
  --glow-hue-1: 240;
  --glow-hue-2: 255;
  --glow-hue-3: 250;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --ease: cubic-bezier(.22,.9,.24,1);

  --font-ui: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

*, *::before, *::after{ box-sizing: border-box; }
html{
  color-scheme: light;
  /* body alone having overflow-x:hidden isn't reliably enough to stop
     mobile horizontal rubber-band/drag on some Android/iOS browsers --
     the document's scrollable width is the union of html+body, so both
     need it. */
  overflow-x: hidden;
  width: 100%;
  /* Restricts native touch handling to vertical panning only -- stops a
     one-finger scroll from also dragging the page sideways (reported live
     on mobile as the page "slipping" and cropping content at the edges). */
  touch-action: pan-y;
  /* Without this, tapping any link/button/<summary> (e.g. a FAQ question)
     on mobile Chrome/Safari flashes the browser's default translucent blue
     tap-highlight rectangle over the whole element -- no such override
     existed anywhere on the site before. */
  -webkit-tap-highlight-color: transparent;
}
body{
  margin: 0;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  background: var(--bg-0);
  color: var(--text-0);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  touch-action: pan-y;
  overflow-x: hidden;
  position: relative;
}
h1,h2,h3,h4{ font-family: var(--font-ui); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
p{ margin: 0; }
a{ color: inherit; text-decoration: none; }
ul{ margin: 0; padding: 0; list-style: none; }
button, select, textarea, input{ font-family: inherit; color: inherit; }
::selection{ background: oklch(75% 0.1 250 / 0.4); color: oklch(20% 0.03 260); }

.mono{ font-family: var(--font-mono); }
.muted{ color: var(--text-2); }
.container{ max-width: 1180px; margin: 0 auto; padding-inline: 28px; }

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- ambient background ---------- */
#bg-canvas{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  opacity: 0.85;
}
.bg-glow{
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.bg-glow::before, .bg-glow::after, .bg-glow i{
  content: "";
  position: absolute;
  border-radius: 50%;
  /* 110px was needlessly heavy for the compositor across 3 simultaneously
     animated full-screen blobs on every page -- 70px still reads as a soft
     glow at this element size but is meaningfully cheaper to render. */
  filter: blur(70px);
  opacity: 0.5;
  will-change: transform;
}
.bg-glow::before{
  width: 640px; height: 640px;
  top: -260px; left: -180px;
  background: radial-gradient(circle at 30% 30%, oklch(78% 0.08 var(--glow-hue-1) / 0.5), transparent 70%);
  animation: drift1 30s ease-in-out infinite;
}
.bg-glow::after{
  width: 580px; height: 580px;
  bottom: -260px; right: -160px;
  background: radial-gradient(circle at 60% 40%, oklch(80% 0.05 var(--glow-hue-2) / 0.45), transparent 70%);
  animation: drift2 34s ease-in-out infinite;
}
.bg-glow i{
  width: 480px; height: 480px;
  top: 32%; left: 50%;
  background: radial-gradient(circle, oklch(85% 0.04 var(--glow-hue-3) / 0.35), transparent 72%);
  animation: drift3 42s ease-in-out infinite;
}
@keyframes drift1{
  0%,100%{ transform: translate(0,0) scale(1); }
  50%{ transform: translate(60px, 40px) scale(1.1); }
}
@keyframes drift2{
  0%,100%{ transform: translate(0,0) scale(1); }
  50%{ transform: translate(-50px,-30px) scale(1.08); }
}
@keyframes drift3{
  0%,100%{ transform: translate(-50%,0) scale(1); }
  50%{ transform: translate(-45%,-40px) scale(1.15); }
}

/* ---------- profile page: dedicated clean background ---------- */
/* profile.html always uses this instead of the circuit-trace canvas + small
   circular blob glow every other page shares -- explicitly asked for
   something like me.pensira.org's own background (large soft layered
   radial glows over a plain base, no tech/circuit-board motif at all), on
   this one page specifically, always, not just for a themed/personalized
   view. Reuses --glow-hue-1/2/3 (set by js/profile-theme.js when a Discord
   accent color is found) so the same hue drives both this and the avatar
   ring -- one palette, just a different rendering technique here. */
body.profile-page #bg-canvas,
body.profile-page .bg-glow{ display: none; }
/* Most visitors WON'T have a Discord accent color set (achromatic/unset is
   the common case -- see js/profile-theme.js), so js/profile-theme.js's
   applyProfileGlow() never runs for most profile views, and the page falls
   through to whatever --glow-hue-1/2/3 already are. The :root defaults
   (240/255/250) are the REST OF THE SITE'S deliberately tight, subtle blue
   spread -- reused as-is here it would make the untethemed default look
   like a flat pale wash rather than the vivid, multi-toned style actually
   wanted. This class-scoped override (higher specificity than :root, still
   loses to profile-theme.js's inline document.documentElement.style writes
   when a real accent color IS found) gives profile.html its own richer
   ~90 deg spread as the DEFAULT too, anchored on the brand blue (250). */
body.profile-page{
  --glow-hue-1: 160;
  --glow-hue-2: 340;
  --glow-hue-3: 250;
  background-image:
    radial-gradient(ellipse 900px 560px at 12% -8%, oklch(83% 0.14 var(--glow-hue-1) / 0.4), transparent 60%),
    radial-gradient(ellipse 950px 620px at 105% 22%, oklch(80% 0.12 var(--glow-hue-2) / 0.35), transparent 58%),
    radial-gradient(ellipse 820px 560px at 45% 105%, oklch(84% 0.11 var(--glow-hue-3) / 0.3), transparent 58%);
  background-color: var(--bg-0);
  background-attachment: fixed;
}

/* ---------- nav ---------- */
.site-nav{
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(16px) saturate(140%);
  background: oklch(99% 0.002 250 / 0.72);
  border-bottom: 1px solid var(--border-soft);
}
.nav-inner{
  max-width: 1180px; margin: 0 auto; padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  position: relative;
}
/* Desktop only: with 3 unequal-width flex items (brand, nav-links,
   nav-auth), justify-content:space-between only equalizes the GAPS
   between them, not the visual center, so nav-links drifted toward
   whichever side was narrower. A 3-column grid (1fr auto 1fr) keeps it
   genuinely centered, with the outer columns shrinking gracefully if it
   needs more room. Scoped to min-width so it can't interact with the
   mobile hamburger-menu layout below, which reuses .nav-links as a
   full-width absolutely-positioned dropdown and .nav-toggle as a 4th
   visible item -- both would throw off a 3-column grid's auto-placement. */
@media (min-width: 701px){
  .nav-inner{ display: grid; grid-template-columns: 1fr auto 1fr; }
  .nav-inner > .brand{ justify-self: start; }
  .nav-inner > .nav-links{ justify-self: center; }
  .nav-inner > .nav-auth{ justify-self: end; }
}
.brand{ display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; }
.brand-mark{
  width: 32px; height: 32px; flex: none; object-fit: contain;
  border-radius: 8px;
  filter: drop-shadow(0 2px 6px oklch(50% 0.1 255 / 0.35));
}
.brand-name{
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav-links{ display: flex; align-items: center; gap: 4px; }
.nav-link{
  padding: 9px 14px; border-radius: 999px; font-size: 14.5px; font-weight: 500;
  color: var(--text-1); transition: color .2s var(--ease), background .2s var(--ease);
}
.nav-link:hover{ color: var(--text-0); background: var(--border-soft); }
.nav-link.is-active{ color: var(--blue-deep); background: oklch(90% 0.04 250 / 0.55); box-shadow: inset 0 0 0 1px var(--border-strong); }
.nav-status{
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .04em;
  color: var(--text-2); padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); white-space: nowrap;
}
.nav-status-dot{
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--blue); box-shadow: 0 0 8px 1px oklch(55% 0.19 256 / 0.7);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse{ 0%,100%{ opacity: 1; transform: scale(1); } 50%{ opacity: .55; transform: scale(.8); } }

.nav-toggle{
  display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: transparent; border: 1px solid var(--border); cursor: pointer;
  color: var(--text-1); transition: background .2s var(--ease), color .2s var(--ease);
}
.nav-toggle:hover{ background: var(--border-soft); color: var(--text-0); }
.nav-toggle svg{ width: 18px; height: 18px; }
.nav-toggle .icon-close{ display: none; }
.nav-toggle.is-open .icon-menu{ display: none; }
.nav-toggle.is-open .icon-close{ display: block; }

.nav-link-profile{ display: none; }

/* ---------- nav auth: login button / user menu ---------- */
.nav-auth{ display: flex; align-items: center; gap: 10px; }
.btn-discord-login{
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--btn-grad); color: oklch(99% 0.005 250);
  font-family: var(--font-ui); font-size: 13.5px; font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 10px 24px -12px oklch(50% 0.18 256 / 0.55);
  transition: transform .2s var(--ease), filter .2s var(--ease);
}
/* The [hidden] attribute alone doesn't win against this class's own
   `display` declaration (author styles beat the UA default [hidden] rule
   even at equal specificity) -- so auth.js's `loginBtn.hidden = true`
   toggle needs this explicit override to actually hide the button. */
.btn-discord-login[hidden]{ display: none; }
.btn-discord-login:hover{ transform: translateY(-1px); filter: brightness(1.06); }
.btn-discord-login svg{ width: 16px; height: 16px; flex: none; }

.nav-user{ position: relative; }
.nav-user-btn{
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-1); cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.nav-user-btn:hover{ background: var(--border-soft); }
.nav-avatar{ width: 26px; height: 26px; border-radius: 50%; object-fit: cover; display: block; background: var(--bg-2); flex: none; }
.nav-username{ font-size: 13.5px; font-weight: 600; color: var(--text-0); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user-chevron{ width: 14px; height: 14px; color: var(--text-2); transition: transform .2s var(--ease); flex: none; }
.nav-user.is-open .nav-user-chevron{ transform: rotate(180deg); }

.nav-user-menu{
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 172px;
  background: oklch(99.5% 0.002 250); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: 0 24px 44px -20px oklch(40% 0.06 255 / 0.35);
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
  z-index: 50;
}
.nav-user.is-open .nav-user-menu{ opacity: 1; visibility: visible; transform: translateY(0); }
.nav-user-menu-item{
  display: block; width: 100%; text-align: left; padding: 9px 12px;
  border-radius: var(--radius-sm); border: none; background: transparent;
  font-family: var(--font-ui); font-size: 13.5px; font-weight: 500; color: var(--text-1);
  cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-user-menu-item:hover{ background: var(--border-soft); color: var(--text-0); }
.nav-user-menu-item-danger:hover{ color: oklch(52% 0.19 25); background: oklch(93% 0.04 25 / 0.4); }

/* ---------- footer ---------- */
.site-footer{ border-top: 1px solid var(--border-soft); margin-top: 96px; }
.footer-inner{
  max-width: 1180px; margin: 0 auto; padding: 36px 28px 48px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px;
}
.footer-links{ display: flex; flex-wrap: wrap; gap: 22px; }
.footer-links a{ font-size: 13.5px; color: var(--text-2); transition: color .2s var(--ease); }
.footer-links a:hover{ color: var(--blue-deep); }
.footer-copy{ font-size: 13px; color: var(--text-2); }
.footer-badge{
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--blue-deep);
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: oklch(93% 0.03 250 / 0.5);
}
.footer-badge svg{ width: 14px; height: 14px; }

/* ---------- hero ---------- */
.hero{ padding: 72px 0 44px; text-align: center; }
.hero-badge{
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .03em;
  color: var(--blue-deep); padding: 7px 16px; border-radius: 999px;
  border: 1px solid oklch(55% 0.15 255 / 0.3); background: oklch(92% 0.04 250 / 0.55);
  margin-bottom: 26px;
  white-space: nowrap; width: fit-content;
}
.hero h1{
  font-size: clamp(38px, 6vw, 64px); line-height: 1.05;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub{
  max-width: 640px; margin: 18px auto 0; color: var(--text-1); font-size: 17px; line-height: 1.6;
}

/* ---------- tilt cards (shared mechanic) ---------- */
.tilt{
  position: relative;
  transform-style: preserve-3d;
  transition: transform .5s var(--ease), box-shadow .5s var(--ease), border-color .3s var(--ease);
  will-change: transform;
}
.tilt::before{
  content: "";
  position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(220px circle at var(--mx,50%) var(--my,50%), oklch(80% 0.08 240 / 0.32), transparent 60%);
  opacity: 0; transition: opacity .3s var(--ease);
  pointer-events: none;
}
.tilt:hover::before{ opacity: 1; }
.tilt.tilting{ transition: box-shadow .3s var(--ease), border-color .3s var(--ease); }

/* ---------- icon system (duotone: soft fill + crisp line, currentColor) ---------- */
.icon{ display: block; overflow: visible; }
.icon .ic-fill{ fill: currentColor; opacity: .28; stroke: none; }
.icon .ic-line{ fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon .ic-dash{ fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-dasharray: 2.5 2.5; opacity: .8; }
.ic-sweep{ transform-origin: 12px 12px; animation: radar-spin 3.4s linear infinite; transform-box: fill-box; }
@keyframes radar-spin{ to{ transform: rotate(360deg); } }

/* ---------- section label ---------- */
.section-label{
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-2); margin-bottom: 18px;
}
.section-label::after{ content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- stat grid ---------- */
.stat-hero{ margin-bottom: 18px; }
.stat-hero-card{
  display: flex; align-items: center; gap: 26px;
  padding: 30px 34px;
  background: linear-gradient(135deg, oklch(97% 0.025 250), var(--bg-1) 70%);
  border: 1px solid oklch(55% 0.15 255 / 0.4);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px oklch(60% 0.12 255 / 0.1), 0 30px 60px -32px oklch(45% 0.1 255 / 0.4), 0 0 44px -14px oklch(65% 0.16 250 / 0.3);
}
.stat-hero-card:hover{
  box-shadow: 0 0 0 1px oklch(58% 0.13 255 / 0.18), 0 34px 64px -28px oklch(45% 0.1 255 / 0.45), 0 0 54px -12px oklch(65% 0.17 250 / 0.4);
}
.stat-hero-icon-wrap{
  width: 62px; height: 62px; border-radius: 18px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: oklch(90% 0.045 250 / 0.8);
  border: 1px solid oklch(56% 0.13 250 / 0.5);
  color: oklch(38% 0.17 250);
}
.stat-hero-icon-wrap svg{ width: 32px; height: 32px; }
.stat-hero-tag{
  display: inline-block; margin-bottom: 10px;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--blue-deep); background: oklch(92% 0.05 250 / 0.65);
  border: 1px solid oklch(55% 0.15 255 / 0.35); padding: 4px 10px; border-radius: 999px;
  white-space: nowrap; width: fit-content;
}
.stat-hero-value{
  display: block; font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(34px, 5vw, 52px); letter-spacing: -0.01em; color: var(--text-0); line-height: 1;
}
.stat-hero-label{ margin-top: 8px; font-size: 15.5px; font-weight: 500; color: var(--text-1); }

.stat-grid{
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px;
  margin-bottom: 56px;
}
.stat-card{
  background: linear-gradient(180deg, oklch(99.5% 0.002 250), var(--bg-1));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; overflow: hidden;
}
.stat-card:hover{
  border-color: var(--border-strong);
  box-shadow: 0 24px 48px -24px oklch(45% 0.06 255 / 0.28);
}
.stat-icon-wrap{
  width: 46px; height: 46px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: oklch(90% 0.035 var(--h, 250) / 0.7);
  border: 1px solid oklch(60% 0.09 var(--h,250) / 0.4);
  color: oklch(42% 0.16 var(--h,250));
  margin-bottom: 18px;
}
.stat-icon-wrap svg{ width: 24px; height: 24px; }
.stat-value{
  display: block; font-family: var(--font-mono); font-weight: 700;
  font-size: 30px; letter-spacing: -0.01em; color: var(--text-0);
}
.stat-label{ margin-top: 6px; font-size: 14px; color: var(--text-2); }

/* ---------- threats panel ---------- */
.threats-panel{
  background: linear-gradient(180deg, oklch(99.5% 0.002 250), var(--bg-1));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 30px 30px 12px;
}
.threat-row{
  display: grid; grid-template-columns: 34px 130px 1fr auto; align-items: center;
  gap: 18px; padding: 15px 4px; border-bottom: 1px solid var(--border-soft);
}
.threat-row:last-child{ border-bottom: none; }
.threat-icon{
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: oklch(90% 0.035 var(--h,250) / 0.7);
  border: 1px solid oklch(60% 0.09 var(--h,250) / 0.4);
  color: oklch(42% 0.16 var(--h,250));
}
.threat-icon svg{ width: 18px; height: 18px; }
.threat-name{ font-size: 14.5px; font-weight: 500; color: var(--text-1); }
.threat-bar-track{
  position: relative; height: 8px; border-radius: 999px;
  background: var(--bg-2); overflow: hidden;
}
.threat-bar-fill{
  position: absolute; inset: 0 auto 0 0; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, oklch(48% 0.16 var(--h,250)), oklch(65% 0.15 var(--h,250)));
  box-shadow: 0 0 12px oklch(55% 0.17 var(--h,250) / 0.45);
  transition: width 1.1s var(--ease);
}
.threat-count{ font-family: var(--font-mono); font-size: 14.5px; font-weight: 600; color: var(--text-0); min-width: 64px; text-align: right; }

/* ---------- FAQ ---------- */
.faq-list{ display: flex; flex-direction: column; gap: 12px; }
.faq-item{
  background: linear-gradient(180deg, oklch(99.5% 0.002 250), var(--bg-1));
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 4px 6px;
}
.faq-item[open]{ border-color: var(--border-strong); }
.faq-q{
  list-style: none; cursor: pointer; padding: 18px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  font-size: 16.5px; font-weight: 500;
}
.faq-q::-webkit-details-marker{ display: none; }
.faq-q svg{ width: 20px; height: 20px; flex: none; transition: transform .3s var(--ease); color: var(--blue); }
.faq-item[open] .faq-q svg{ transform: rotate(180deg); }
.faq-a{ padding: 0 18px 20px 18px; color: var(--text-1); font-size: 15px; line-height: 1.7; max-width: 68ch; }
.faq-a p + p{ margin-top: 10px; }
.faq-steps{ margin-top: 10px; padding-left: 20px; list-style: decimal; display: flex; flex-direction: column; gap: 6px; }
.faq-steps li{ display: list-item; }

/* ---------- legal pages ---------- */
.legal-doc{ max-width: 760px; margin: 0 auto; padding: 56px 0 40px; }
.legal-doc h1{ font-size: 34px; margin-bottom: 8px; }
.legal-updated{ color: var(--text-2); font-size: 13.5px; font-family: var(--font-mono); margin-bottom: 40px; display: block; }
.legal-doc h2{ font-size: 20px; margin: 40px 0 12px; color: var(--text-0); }
.legal-doc h2 .num{ color: var(--blue); margin-right: 10px; font-family: var(--font-mono); font-size: 16px; }
.legal-doc p{ color: var(--text-1); font-size: 15px; line-height: 1.75; margin-bottom: 14px; }
.legal-doc ul{ margin: 0 0 14px; padding-left: 22px; list-style: disc; color: var(--text-1); font-size: 15px; line-height: 1.75; }
.legal-doc li{ display: list-item; margin-bottom: 6px; }
.legal-doc a{ color: var(--blue-deep); text-decoration: underline; text-underline-offset: 3px; }

.table-scroll{ overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 18px 0 28px; border-radius: var(--radius-md); }
.data-table{
  width: 100%; min-width: 560px; border-collapse: collapse; margin: 0;
  font-size: 13.5px; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden;
  background: oklch(99.5% 0.002 250);
}
.data-table th, .data-table td{ padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border-soft); }
.data-table thead th{
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-2); background: var(--bg-2);
}
.data-table tbody td{ color: var(--text-1); }
.data-table tbody tr:last-child td{ border-bottom: none; }
.data-table tbody tr:hover td{ background: var(--border-soft); }

/* ---------- feedback ---------- */
.feedback-wrap{ max-width: 620px; margin: 0 auto; padding: 60px 0 40px; }
.feedback-card{
  background: linear-gradient(180deg, oklch(99.5% 0.002 250), var(--bg-1));
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px;
}
.field{ margin-bottom: 22px; display: flex; flex-direction: column; gap: 8px; }
.field label{ font-size: 13.5px; font-weight: 500; color: var(--text-1); }
.field select, .field textarea, .field input{
  background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px 14px; font-size: 15px; color: var(--text-0);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field select:focus, .field textarea:focus, .field input:focus{
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px oklch(60% 0.15 250 / 0.2);
}
.field textarea{ resize: vertical; min-height: 140px; line-height: 1.6; font-family: var(--font-ui); }
.field-hint{ font-size: 12.5px; color: var(--text-2); }

.btn{
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; border-radius: 999px; border: none; cursor: pointer;
  font-family: var(--font-ui); font-size: 15px; font-weight: 600;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), filter .2s var(--ease);
}
.btn-primary{
  background: var(--btn-grad); color: oklch(99% 0.005 250);
  box-shadow: 0 12px 30px -12px oklch(50% 0.18 256 / 0.55);
}
.btn-primary:hover{ transform: translateY(-2px); filter: brightness(1.06); }
.btn-primary:active{ transform: translateY(0); }
.btn-primary:disabled{ opacity: .55; cursor: not-allowed; transform: none; }

.turnstile-slot{
  min-height: 66px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-2);
  background: var(--bg-1); margin-bottom: 22px;
}
.feedback-success{
  display: none; align-items: center; gap: 10px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: oklch(92% 0.05 250 / 0.6); border: 1px solid oklch(60% 0.15 250 / 0.35);
  color: var(--blue-deep); font-size: 14px; margin-top: 18px;
}
.feedback-success.is-visible{ display: flex; }
.feedback-success svg{ width: 18px; height: 18px; flex: none; }

/* ---------- responsive ---------- */
@media (max-width: 980px){
  .stat-grid{ grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px){
  .stat-hero-card{ flex-direction: column; align-items: flex-start; gap: 16px; }
  .threat-row{ grid-template-columns: 30px 1fr auto; grid-template-areas: "icon name count" "bar bar bar"; row-gap: 8px; }
  .threat-row .threat-bar-track{ grid-area: bar; }
  .threat-row .threat-icon{ grid-area: icon; }
  .threat-row .threat-name{ grid-area: name; }
  .threat-row .threat-count{ grid-area: count; }
}
@media (max-width: 700px){
  .nav-status{ display: none; }
  /* space-between across 3 independently-spaced flex items (brand,
     toggle, auth) left the hamburger toggle floating alone near the
     middle instead of at either edge. flex-start (below) naturally
     clusters brand+toggle together at the start in DOM order, and
     margin-inline-start:auto on .nav-auth absorbs all the remaining
     space, pushing it alone to the opposite end -- 2 corners, not 3
     independently-spaced items. Logical margin property, so it's
     correct under LTR or RTL without a separate override. */
  .nav-inner{ justify-content: flex-start; }
  .nav-auth{ margin-inline-start: auto; }
  .nav-toggle{ display: flex; }
  .nav-links{
    position: absolute; top: 100%; left: 0; right: 0; transform: none;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: oklch(99% 0.002 250 / 0.98); backdrop-filter: blur(16px) saturate(140%);
    border-bottom: 1px solid var(--border-soft);
    padding: 8px 20px 14px;
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height .3s var(--ease), opacity .25s var(--ease);
  }
  .site-nav.menu-open .nav-links{ max-height: 260px; opacity: 1; }
  .nav-link{ width: 100%; padding: 13px 14px; }
}
@media (max-width: 560px){
  .container{ padding-inline: 18px; }
  .stat-grid{ grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card{ padding: 18px; }
  .stat-value{ font-size: clamp(20px, 6.5vw, 30px); }
  .stat-hero-card{ padding: 18px; gap: 14px; }
  .stat-hero-icon-wrap{ width: 46px; height: 46px; border-radius: 14px; }
  .stat-hero-icon-wrap svg{ width: 24px; height: 24px; }
  .hero{ padding: 28px 0 20px; }
  .hero h1{ font-size: clamp(26px, 8vw, 36px); }
  .hero-badge{ margin-bottom: 14px; }
  .hero-sub{ font-size: 15px; margin-top: 10px; }
  .threats-panel{ padding: 20px 18px 6px; }
  .feedback-card{ padding: 22px; }
  .legal-doc{ padding: 40px 0 32px; }
  .profile-hero{ flex-direction: column; align-items: flex-start; text-align: left; }
}
@media (max-width: 460px){
  /* Keep a short "Login" label visible instead of hiding it entirely --
     an icon-only button isn't self-explanatory without a Discord-specific
     tooltip, and mobile users can't hover to find out anyway. */
  .btn-discord-login .btn-label{ font-size: 0; }
  .btn-discord-login .btn-label::after{ content: "Login"; font-size: 13.5px; }
  .btn-discord-login{ padding: 9px 14px; }
  .nav-username{ display: none; }
}

/* ---------- profile page ---------- */
.profile-hero{ display: flex; align-items: center; gap: 24px; padding: 44px 0 8px; flex-wrap: wrap; }
.profile-avatar{
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--bg-2); border: 3px solid oklch(94% 0.02 250);
  /* Third shadow layer is a themed glow ring sharing --glow-hue-3 with the
     ambient .bg-glow blob -- subtle on the default blue theme, strengthens
     into a real colored ring when js/profile-theme.js applies a viewed
     user's Discord accent color (see applyProfileGlow's --avatar-glow-alpha). */
  box-shadow: 0 0 0 1px var(--border), 0 20px 40px -20px oklch(45% 0.1 255 / 0.4),
    0 0 24px 3px oklch(72% 0.16 var(--glow-hue-3) / var(--avatar-glow-alpha, 0.22));
  transition: box-shadow .6s var(--ease);
}
.profile-name{ font-size: 26px; font-weight: 700; color: var(--text-0); }
.profile-level-row{ display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.profile-level-badge{
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  color: oklch(99% 0.005 250); background: var(--btn-grad);
  padding: 4px 11px; border-radius: 999px;
}
.profile-xp{ font-family: var(--font-mono); font-size: 14px; color: var(--text-2); }

.btn-share{
  margin-inline-start: auto; background: var(--bg-1); color: var(--text-1);
  border: 1px solid var(--border);
}
.btn-share:hover{ border-color: var(--border-strong); }
.btn-share[hidden]{ display: none; }

.profile-public-banner{
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 4px 0 8px; padding: 12px 16px; border-radius: var(--radius-md);
  background: var(--bg-1); border: 1px solid var(--border);
  font-size: 14px; color: var(--text-2);
}
.profile-public-banner svg{ width: 16px; height: 16px; color: var(--blue); flex: none; }
.profile-public-banner a{ color: var(--blue); font-weight: 500; }
.profile-public-banner[hidden]{ display: none; }

.profile-public-empty{
  margin: 24px 0; padding: 24px; border-radius: var(--radius-md);
  background: var(--bg-1); border: 1px solid var(--border);
  color: var(--text-2); text-align: center;
}
.profile-public-empty[hidden]{ display: none; }

.profile-section{ margin: 48px 0; }

.badges-row{ display: flex; flex-wrap: wrap; gap: 10px; }
.badges-row[hidden]{ display: none; }
.badge-chip{
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-1); font-size: 13.5px; font-weight: 500; color: var(--text-1);
}
.badge-chip svg{ width: 16px; height: 16px; color: var(--blue); flex: none; }
.badges-empty{
  font-size: 14px; color: var(--text-2); padding: 18px 20px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-md); text-align: center;
}

.scanner-status{
  display: inline-flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text-1);
  padding: 10px 16px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-1);
}
.scanner-status-dot{ width: 8px; height: 8px; border-radius: 50%; flex: none; }
.scanner-status-dot.is-ready{ background: oklch(62% 0.17 150); box-shadow: 0 0 8px 1px oklch(62% 0.17 150 / 0.55); animation: pulse 2.4s ease-in-out infinite; }
.scanner-status-dot.is-cooldown{ background: oklch(72% 0.15 70); box-shadow: 0 0 8px 1px oklch(72% 0.15 70 / 0.5); }

.settings-card{
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg-1); padding: 8px 20px;
}
.settings-row{
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 0; border-bottom: 1px solid var(--border);
}
.settings-row:last-child{ border-bottom: none; }
.settings-row-title{ font-size: 15px; font-weight: 600; color: var(--text-0); }
.settings-row-desc{ font-size: 13px; color: var(--text-2); margin-top: 3px; max-width: 420px; }

.switch{ position: relative; display: inline-block; width: 44px; height: 26px; flex: none; }
.switch input{ position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track{
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--border-strong); transition: background .2s var(--ease);
}
.switch-track::before{
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: oklch(99% 0.005 250);
  box-shadow: 0 2px 6px oklch(20% 0 0 / 0.25); transition: transform .2s var(--ease);
}
.switch input:checked + .switch-track{ background: var(--blue); }
.switch input:checked + .switch-track::before{ transform: translateX(18px); }

.settings-select{
  padding: 9px 14px; border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--bg-0); color: var(--text-0); font-family: var(--font-ui); font-size: 14px;
  cursor: pointer;
}

.settings-actions{ display: flex; align-items: center; gap: 14px; padding: 18px 0 14px; }
.settings-actions .btn{ padding: 10px 20px; font-size: 14px; }
.settings-saved-msg{ font-size: 13.5px; color: var(--text-2); }
.settings-saved-msg.is-error{ color: oklch(58% 0.2 25); }

.admin-block-form{ display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; padding: 18px 20px; }
.admin-block-form .field{ margin: 0; flex: 1; min-width: 220px; }
.admin-block-form input{ width: 100%; }
.admin-block-form .btn{ padding: 10px 20px; font-size: 14px; }

.pensira-login-error-banner{
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 1000; max-width: min(90vw, 480px);
  background: oklch(30% 0.05 25); color: oklch(96% 0.01 25);
  padding: 12px 20px; border-radius: 999px; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 30px -12px oklch(20% 0 0 / 0.5);
  animation: pensira-banner-in .25s var(--ease);
}
.pensira-login-error-banner.is-leaving{ opacity: 0; transform: translateX(-50%) translateY(-8px); transition: opacity .35s, transform .35s; }
@keyframes pensira-banner-in{ from{ opacity: 0; transform: translateX(-50%) translateY(-8px); } to{ opacity: 1; transform: translateX(-50%) translateY(0); } }

.profile-empty{ text-align: center; padding: 96px 0 64px; }
.profile-empty h1{ font-size: clamp(28px, 4.5vw, 40px); background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 14px; }
.profile-empty p{ max-width: 480px; margin: 0 auto 28px; color: var(--text-1); font-size: 16px; line-height: 1.6; }

/* ==========================================================================
   RTL support (Arabic dashboard, see public/js/i18n.js). Flexbox/Grid `row`
   layouts already auto-reverse under dir="rtl" per spec -- this section
   only needs to handle the few places with explicit left/right values that
   don't follow the writing direction automatically. */
[dir="rtl"]{ direction: rtl; }
[dir="rtl"] .profile-hero{ text-align: right; }
[dir="rtl"] .nav-select,
[dir="rtl"] select{ text-align: right; }
[dir="rtl"] .data-table th,
[dir="rtl"] .data-table td{ text-align: right; }
/* .nav-user-menu anchors itself with `right: 0` (a physical property that
   doesn't flip with direction) -- under RTL the trigger button ends up on
   the left of the mirrored nav, so the dropdown must anchor to the left
   edge instead, or it renders off-screen past the left edge entirely. */
[dir="rtl"] .nav-user-menu{ right: auto; left: 0; }
[dir="rtl"] .nav-user-menu-item{ text-align: right; }
