/* =====================================================================
   AetherVision AI — "Aether HUD" cosmic gaming console
   ===================================================================== */

:root {
  --bg-0: #04060e;
  --bg-1: #080c1a;
  --bg-2: #0d1430;
  --surface: rgba(13, 22, 48, 0.62);
  --surface-2: rgba(20, 30, 60, 0.45);
  --surface-3: rgba(28, 40, 78, 0.55);
  --line: rgba(120, 200, 255, 0.14);
  --line-strong: rgba(120, 200, 255, 0.32);

  --fg: #e7ecff;
  --fg-dim: #98a3c9;
  --fg-dimmer: #5d6a96;

  --cyan: #00f0ff;
  --cyan-soft: #5cf2ff;
  --violet: #b76dff;
  --magenta: #ff5dac;
  --gold: #ffcc4d;
  --green: #34ffb1;
  --red: #ff4f6c;

  --bracket: var(--cyan);
  --shadow-glow: 0 0 0 1px rgba(0, 240, 255, 0.18), 0 6px 30px -8px rgba(0, 240, 255, 0.18);
  --shadow-deep: 0 22px 60px -22px rgba(0,0,0,0.85), inset 0 0 0 1px var(--line);

  --display: 'Orbitron', system-ui, sans-serif;
  --body: 'Sora', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: radial-gradient(ellipse 100% 80% at 50% -10%, #1d244e 0%, var(--bg-0) 60%) fixed;
  color: var(--fg);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

html, body { overflow-x: hidden; max-width: 100%; }

a { color: inherit; text-decoration: none; }

::selection { background: rgba(0,240,255,0.35); color: #fff; }

/* ================ ATMOSPHERE LAYERS ================ */

.bg-aurora {
  position: fixed; inset: 0; z-index: -3; pointer-events: none;
  overflow: hidden;
}
.bg-aurora .blob {
  position: absolute;
  filter: blur(110px);
  opacity: 0.55;
  border-radius: 50%;
  animation: drift 28s ease-in-out infinite alternate;
}
.bg-aurora .blob-cyan {
  width: 720px; height: 720px; left: -10%; top: -20%;
  background: radial-gradient(circle, #00f0ff 0%, transparent 70%);
}
.bg-aurora .blob-violet {
  width: 640px; height: 640px; right: -15%; top: 20%;
  background: radial-gradient(circle, #b76dff 0%, transparent 70%);
  animation-delay: -8s;
}
.bg-aurora .blob-magenta {
  width: 520px; height: 520px; left: 30%; bottom: -25%;
  background: radial-gradient(circle, #ff5dac 0%, transparent 70%);
  animation-delay: -14s;
  opacity: 0.35;
}

@keyframes drift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(60px,40px,0) scale(1.08); }
  100% { transform: translate3d(-40px,80px,0) scale(0.95); }
}

.bg-grid {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(120,200,255,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(120,200,255,0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 30%, transparent 95%);
}

.bg-scanlines {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: repeating-linear-gradient(to bottom,
    rgba(255,255,255,0.013) 0 1px,
    transparent 1px 3px);
  mix-blend-mode: overlay;
}

.bg-noise {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.85'/></svg>");
}

/* ================ TYPOGRAPHY ================ */

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 .4em;
  text-transform: uppercase;
}
h1 { font-size: clamp(1.6rem, 2.4vw, 2.4rem); letter-spacing: 0.08em; }
h2 { font-size: 1.3rem; letter-spacing: 0.07em; }
h3 { font-size: 1rem; letter-spacing: 0.06em; }

.mono { font-family: var(--mono); font-size: 0.82em; letter-spacing: 0.02em; }
.dim  { color: var(--fg-dim); }
.dimmer { color: var(--fg-dimmer); }
.accent { color: var(--cyan); }
.tagline { color: var(--fg-dim); font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase; }

p { margin: 0 0 1em; color: var(--fg-dim); }

/* ================ NAV ================ */

.nav-bar {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  background: linear-gradient(to bottom, rgba(8,12,26,0.85), rgba(8,12,26,0.55));
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 14px 24px;
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 32px; align-items: center;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 0 20px -4px rgba(0,240,255,0.4), inset 0 0 0 1px rgba(0,240,255,0.05);
  background: #0a1024;
  object-fit: cover;
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-family: var(--display); font-weight: 900; font-size: 0.95rem; letter-spacing: 0.18em; }
.brand-tag { font-family: var(--mono); color: var(--fg-dimmer); font-size: 0.65rem; letter-spacing: 0.12em; margin-top: 2px; }

.nav-links { display: flex; gap: 4px; justify-content: center; }
.nav-link {
  position: relative;
  padding: 8px 14px;
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.12em;
  color: var(--fg-dim);
  text-transform: uppercase;
  border-radius: 6px;
  display: flex; align-items: center; gap: 8px;
  transition: color .2s, background .2s;
}
.nav-link:hover { color: var(--cyan); background: rgba(0,240,255,0.05); }
.nav-link .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.45; flex: 0 0 6px;
}
.nav-link.active {
  color: var(--cyan);
  background: rgba(0,240,255,0.08);
  box-shadow: inset 0 0 0 1px rgba(0,240,255,0.25);
}
.nav-link.active .dot { opacity: 1; box-shadow: 0 0 10px var(--cyan); }

.nav-meta { display: flex; align-items: center; gap: 14px; }

/* Lang switcher shown inside nav-links drawer on mobile only */
.nav-links-lang { display: none; }

/* Hamburger button (mobile only) */
.nav-burger {
  display: none;
  width: 38px; height: 38px;
  padding: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  transition: border-color .15s, background .15s;
}
.nav-burger:hover { border-color: var(--cyan); }
.nav-burger span {
  position: absolute;
  left: 9px; right: 9px;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: transform .25s, opacity .2s, top .25s;
}
.nav-burger span:nth-child(1) { top: 12px; }
.nav-burger span:nth-child(2) { top: 18px; }
.nav-burger span:nth-child(3) { top: 24px; }
.nav-burger[aria-expanded="true"] { border-color: var(--cyan); }
.nav-burger[aria-expanded="true"] span:nth-child(1) { top: 18px; transform: rotate(45deg); }
.nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-burger[aria-expanded="true"] span:nth-child(3) { top: 18px; transform: rotate(-45deg); }

/* Language switcher (in nav AND floating on auth pages) */
.lang-switcher {
  display: inline-flex;
  background: var(--surface-2);
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  gap: 2px;
}
.lang-switcher form { margin: 0; padding: 0; }
.lang-pill {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.lang-pill:hover { color: var(--cyan); }
.lang-pill.active {
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #06091a;
  box-shadow: 0 0 14px -4px rgba(0,240,255,0.5);
}

/* When the switcher floats on auth pages (no nav). */
body > .lang-switcher {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 40;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.coin-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,204,77,0.16), rgba(255,93,172,0.05));
  border: 1px solid rgba(255,204,77,0.35);
  color: var(--gold);
  font-family: var(--mono); font-size: 0.78rem;
  text-shadow: 0 0 10px rgba(255,204,77,0.4);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.coin-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(255,204,77,0.7);
  box-shadow: 0 6px 24px -10px rgba(255,204,77,0.5);
}
.coin-pill:active { transform: translateY(0); }
.coin-amt { font-weight: 700; }
.coin-label { color: var(--fg-dim); }
.coin-plus {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: #1a1300;
  font-weight: 900;
  font-family: var(--display);
  font-size: 0.85rem;
  margin-left: 4px;
  box-shadow: 0 0 10px rgba(255,204,77,0.55);
}

/* Modal */
.modal {
  position: fixed; inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in .2s ease;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(4,6,14,0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 32px;
  animation: rise .35s cubic-bezier(.2,.8,.2,1);
}
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--fg);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}
.modal-close:hover { color: var(--cyan); border-color: var(--cyan); }
.modal-head { margin-bottom: 22px; padding-right: 40px; }
.modal-head h2 { margin: 4px 0 8px; font-size: 1.4rem; }
.modal-head p { margin: 0; }
.modal-empty {
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  margin-top: 12px;
}
.modal-empty strong {
  display: block;
  font-family: var(--display);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.modal-foot { margin-top: 16px; text-align: center; font-size: 0.74rem; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Topup info / grid */
.topup-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}
@media (max-width: 600px) { .topup-info { grid-template-columns: 1fr; } }
.topup-info .info-row {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.topup-info .info-free {
  background: linear-gradient(135deg, rgba(52,255,177,0.08), rgba(0,240,255,0.04));
  border-color: rgba(52,255,177,0.3);
}
.topup-info .info-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.topup-info .info-value {
  font-family: var(--body);
  font-size: 0.92rem;
  color: var(--fg);
}
.topup-info .info-value.gold { color: var(--gold); font-weight: 700; }

.topup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.topup-product { margin: 0; }
.topup-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--body);
  color: var(--fg);
  text-align: center;
  transition: transform .15s, border-color .15s, background .15s, box-shadow .15s;
  position: relative;
}
.topup-btn:hover {
  transform: translateY(-2px);
  border-color: var(--cyan);
  background: linear-gradient(135deg, rgba(0,240,255,0.1), rgba(183,109,255,0.04));
  box-shadow: 0 12px 30px -14px rgba(0,240,255,0.5);
}
.topup-btn:active { transform: translateY(0); }
.topup-coins {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gold);
  font-family: var(--mono);
  align-self: center;
}
.topup-coin-amt {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  color: var(--gold);
}
.topup-coin-label {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.topup-name {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.topup-price {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--cyan);
}
.topup-cta {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-dim);
  border-top: 1px dashed var(--line);
  padding-top: 8px;
  margin-top: 4px;
}
.topup-btn:hover .topup-cta { color: var(--cyan); }

/* Topup return icons */
.topup-return-icon {
  width: 72px; height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display);
  font-weight: 900;
  font-size: 2rem;
}
.topup-return-icon.ok {
  background: rgba(52,255,177,0.1);
  border: 2px solid var(--green);
  color: var(--green);
  box-shadow: 0 0 30px -8px var(--green);
}
.topup-return-icon.pending {
  background: rgba(0,240,255,0.08);
  border: 2px solid var(--cyan);
  color: var(--cyan);
}
.topup-return-icon.pending .spinner-mini {
  width: 32px; height: 32px;
  border-width: 2px;
}
.topup-return-icon.failed {
  background: rgba(255,79,108,0.1);
  border: 2px solid var(--red);
  color: var(--red);
}

/* Notice banner (small inline info messages) */
.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--fg-dim);
  margin-bottom: 18px;
}
.notice-warn {
  border-color: rgba(255,154,68,0.35);
  background: linear-gradient(135deg, rgba(255,154,68,0.10), rgba(255,204,77,0.04));
  color: #ffd2a8;
}
.notice-icon {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255,154,68,0.18);
  border: 1px solid rgba(255,154,68,0.5);
  color: #ff9a44;
  font-size: 0.84rem;
  flex: 0 0 22px;
}

/* Homepage */
.home-hero {
  text-align: center;
  padding: 80px 20px 60px;
  max-width: 920px;
  margin: 0 auto;
}
.home-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 28px;
}
.home-title {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0 0 22px;
}
.home-title-grad {
  background: linear-gradient(120deg, var(--cyan) 0%, var(--violet) 50%, var(--magenta) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.home-lede {
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  max-width: 620px;
  margin: 0 auto 32px;
  color: var(--fg-dim);
}
.home-cta {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.home-cta-primary {
  font-size: 0.88rem;
  padding: 14px 28px;
}
.home-trust {
  margin-top: 36px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
}

.home-section-head {
  text-align: center;
  margin-bottom: 36px;
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}
.home-section-head h2 {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  margin-bottom: 12px;
}

.home-features { padding: 60px 0; }
.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.feature-card {
  padding: 26px;
  text-align: left;
}
.feature-card h3 {
  font-size: 0.95rem;
  margin-bottom: 10px;
  margin-top: 16px;
}
.feature-card p { margin: 0; font-size: 0.92rem; }
.feature-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-family: var(--display);
  font-weight: 900;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  border: 1px solid currentColor;
}
.feature-icon.cyan   { color: var(--cyan);   background: rgba(0,240,255,0.08);   box-shadow: 0 0 24px -6px rgba(0,240,255,0.45); }
.feature-icon.violet { color: var(--violet); background: rgba(183,109,255,0.1);  box-shadow: 0 0 24px -6px rgba(183,109,255,0.45); }
.feature-icon.green  { color: var(--green);  background: rgba(52,255,177,0.08);  box-shadow: 0 0 24px -6px rgba(52,255,177,0.45); }
.feature-icon.gold   { color: var(--gold);   background: rgba(255,204,77,0.08);  box-shadow: 0 0 24px -6px rgba(255,204,77,0.45); }

.home-how { padding: 60px 0; }
.home-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  counter-reset: step;
}
.home-steps li {
  position: relative;
  padding: 28px 22px 22px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.home-steps .step-num {
  display: inline-block;
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  color: var(--cyan);
  margin-bottom: 10px;
}
.home-steps h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.home-steps p { margin: 0; font-size: 0.9rem; }

.home-pricing { padding: 60px 0; }
.home-final {
  padding: 60px 0;
  display: flex;
  justify-content: center;
}
.home-final-card {
  text-align: center;
  padding: 46px;
  max-width: 720px;
  background: linear-gradient(135deg, rgba(0,240,255,0.08), rgba(183,109,255,0.05));
}
.home-final-card h2 {
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  background: linear-gradient(120deg, #fff, var(--cyan), var(--violet));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.home-final-card p { max-width: 480px; margin: 0 auto 22px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.product-card {
  padding: 22px;
}
.product-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.chip.status-paid     { color: var(--green); border-color: rgba(52,255,177,0.4); }
.chip.status-pending  { color: var(--cyan);  border-color: rgba(0,240,255,0.4); }
.chip.status-expired  { color: var(--gold);  border-color: rgba(255,204,77,0.4); }
.chip.status-failed   { color: var(--red);   border-color: rgba(255,79,108,0.45); }
.chip.status-cancelled{ color: var(--fg-dim); }

.user-menu { position: relative; }
.user-menu summary {
  list-style: none;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.user-menu summary:hover,
.user-menu[open] summary {
  border-color: var(--line-strong);
  background: var(--surface-3);
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 0.95rem;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #06091a;
  letter-spacing: 0;
  flex: 0 0 32px;
}
.user-menu .who {
  font-family: var(--mono); font-size: 0.74rem; color: var(--fg-dim);
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-pop {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 8px;
  min-width: 240px;
  max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-deep);
  display: flex; flex-direction: column; gap: 4px;
  backdrop-filter: blur(20px);
  z-index: 50;
}
.user-pop-email {
  font-size: 0.72rem;
  color: var(--fg-dim);
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-pop-link {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--fg);
  text-decoration: none;
  transition: background 0.12s ease;
}
.user-pop-link:hover { background: var(--surface-3); }
.user-pop-link.active { color: var(--cyan); }
.user-pop form { margin-top: 4px; }
.user-pop-row { font-size: 0.74rem; }

/* My Account page */
.account-card { padding: 24px; }
.account-grid { display: flex; flex-direction: column; gap: 12px; }
.account-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.account-row:last-child { border-bottom: none; }
.account-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dimmer);
}
.account-value {
  font-size: 0.9rem;
  color: var(--fg);
  word-break: break-all;
}
@media (max-width: 540px) {
  .account-row { grid-template-columns: 1fr; gap: 4px; padding: 8px 0; }
}

/* ================ PAGE FRAME ================ */

.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 36px 24px 80px;
  position: relative;
}

.page-footer {
  max-width: 1400px; margin: 0 auto;
  padding: 24px;
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 0.72rem;
  color: var(--fg-dimmer);
  border-top: 1px solid var(--line);
}

/* ================ HUD CARD ================ */

.hud {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  box-shadow: var(--shadow-deep);
}
.hud::before, .hud::after,
.hud > .corners::before, .hud > .corners::after {
  content: ""; position: absolute;
  width: 14px; height: 14px;
  border-color: var(--bracket);
  border-style: solid;
  border-width: 0;
  pointer-events: none;
}
.hud::before { top: -1px; left: -1px;  border-top-width: 2px; border-left-width: 2px;  border-top-left-radius: 6px; }
.hud::after  { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; border-top-right-radius: 6px; }
.hud > .corners::before { bottom: -1px; left: -1px;  border-bottom-width: 2px; border-left-width: 2px;  border-bottom-left-radius: 6px; }
.hud > .corners::after  { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: 6px; }

.hud-title {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}
.hud-title h2, .hud-title h1 { margin: 0; }
.hud-title .meta { color: var(--fg-dimmer); font-family: var(--mono); font-size: 0.74rem; }

/* ================ FORMS ================ */

label {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 0 0 8px;
}
label .req { color: var(--magenta); }

input[type=text], input[type=email], input[type=password], input[type=number],
textarea, select {
  width: 100%;
  padding: 12px 14px;
  background: rgba(4,8,18,0.6);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--body); font-size: 0.95rem;
  transition: border .2s, box-shadow .2s, background .2s;
}
textarea { font-family: var(--mono); font-size: 0.86rem; resize: vertical; min-height: 110px; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--cyan);
  background: rgba(0,240,255,0.05);
  box-shadow: 0 0 0 3px rgba(0,240,255,0.1), 0 0 28px -10px rgba(0,240,255,0.55);
}
input::placeholder, textarea::placeholder { color: var(--fg-dimmer); }

input[type=file] {
  width: 100%;
  font-family: var(--mono); font-size: 0.82rem;
  color: var(--fg-dim);
  padding: 10px;
  background: rgba(4,8,18,0.6);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
}
input[type=file]::file-selector-button {
  border: 1px solid var(--cyan);
  background: rgba(0,240,255,0.08);
  color: var(--cyan);
  padding: 6px 12px;
  border-radius: 6px;
  font-family: var(--mono); font-size: 0.74rem;
  text-transform: uppercase; letter-spacing: 0.12em;
  margin-right: 12px;
  cursor: pointer;
}

input[type=checkbox] {
  appearance: none;
  width: 18px; height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: rgba(4,8,18,0.6);
  cursor: pointer;
  position: relative;
  vertical-align: middle;
}
input[type=checkbox]:checked {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0,240,255,0.5);
}
input[type=checkbox]:checked::after {
  content: "✓"; position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #06091a; font-size: 12px; font-weight: 700;
}

.field { margin-bottom: 18px; }
.field-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

.help { font-size: 0.78rem; color: var(--fg-dimmer); margin-top: 6px; font-family: var(--mono); }

/* ================ BUTTONS ================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  font-family: var(--display); font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 1px solid var(--cyan);
  background: linear-gradient(135deg, rgba(0,240,255,0.18), rgba(0,240,255,0.04));
  color: var(--cyan);
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  transition: transform .12s, box-shadow .2s, color .2s, background .2s;
}
.btn::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  border-radius: 8px;
  background: linear-gradient(135deg, transparent 60%, rgba(255,255,255,0.12));
  opacity: 0; transition: opacity .2s;
}
.btn:hover {
  color: #06091a;
  background: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 8px 30px -10px rgba(0,240,255,0.7);
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  border-color: var(--cyan);
}
.btn-violet {
  border-color: var(--violet);
  background: linear-gradient(135deg, rgba(183,109,255,0.2), rgba(183,109,255,0.04));
  color: var(--violet);
}
.btn-violet:hover { background: var(--violet); color: #1b0a30; box-shadow: 0 0 0 1px var(--violet), 0 8px 30px -10px rgba(183,109,255,0.7); }

.btn-ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--fg);
}
.btn-ghost:hover { color: var(--cyan); background: rgba(0,240,255,0.06); border-color: var(--cyan); box-shadow: none; }

.btn-danger {
  border-color: var(--red);
  background: linear-gradient(135deg, rgba(255,79,108,0.18), rgba(255,79,108,0.04));
  color: var(--red);
}
.btn-danger:hover { background: var(--red); color: #240207; box-shadow: 0 0 0 1px var(--red), 0 8px 30px -10px rgba(255,79,108,0.7); }

.btn-sm { padding: 7px 12px; font-size: 0.68rem; letter-spacing: 0.14em; }

.btn-icon {
  width: 36px; height: 36px; padding: 0;
  border-radius: 8px;
}

/* ================ FLASH ================ */

.flash {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 24px;
  font-family: var(--mono); font-size: 0.84rem;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  backdrop-filter: blur(10px);
  animation: slide-in .4s ease;
}
.flash-tag {
  font-weight: 700; letter-spacing: 0.18em;
  font-size: 0.66rem;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid currentColor;
}
.flash-success { color: var(--green); border-color: rgba(52,255,177,0.4); }
.flash-error   { color: var(--red);   border-color: rgba(255,79,108,0.45); }
.flash-info    { color: var(--cyan);  border-color: rgba(0,240,255,0.4); }

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================ AUTH (login/register/setup) ================ */

.auth-shell {
  min-height: calc(100vh - 60px);
  display: grid;
  place-items: center;
  padding: 60px 24px;
}
.auth-card {
  width: 100%;
  max-width: 460px;
  padding: 40px;
}
.auth-brand {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 28px;
  text-align: center;
}
.auth-brand img {
  width: 96px; height: 96px;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 24px rgba(0,240,255,0.45));
}
.auth-brand h1 {
  font-size: 1.6rem; letter-spacing: 0.18em; margin: 0;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  /* Wrap the wordmark instead of overflowing on narrow viewports. */
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-align: center;
}
.auth-brand .tagline { margin-top: 6px; }
.auth-forgot {
  margin-top: 14px;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.78rem;
}
.auth-meta {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 0.74rem;
  color: var(--fg-dimmer);
  margin-top: 22px; padding-top: 18px;
  border-top: 1px dashed var(--line);
}
.auth-meta a { color: var(--cyan); }
.auth-meta a:hover { text-decoration: underline; }

/* ================ DASHBOARD ================ */

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}
@media (max-width: 920px) { .hero { grid-template-columns: 1fr; } }

.hero-card {
  position: relative;
  padding: 36px;
  background: linear-gradient(135deg, rgba(0,240,255,0.1), rgba(183,109,255,0.06) 60%, rgba(255,93,172,0.04));
  overflow: hidden;
}
.hero-card .eyebrow {
  font-family: var(--mono); font-size: 0.74rem;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--cyan);
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.hero-card .eyebrow::before {
  content: ""; width: 30px; height: 1px;
  background: linear-gradient(to right, var(--cyan), transparent);
}
.hero-title {
  font-family: var(--display);
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-transform: uppercase;
  background: linear-gradient(120deg, #fff 0%, var(--cyan) 50%, var(--violet) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin: 0 0 14px;
}
.hero-card p { font-size: 1rem; max-width: 38rem; }
.hero-actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.stat {
  position: relative;
  padding: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.stat .label {
  font-family: var(--mono); font-size: 0.66rem;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 6px;
}
.stat .value {
  font-family: var(--display); font-weight: 900;
  font-size: 1.6rem;
  letter-spacing: 0.04em;
}
.stat .sub { font-family: var(--mono); font-size: 0.74rem; color: var(--fg-dimmer); }
.stat.cyan .value   { color: var(--cyan); }
.stat.violet .value { color: var(--violet); }
.stat.gold .value   { color: var(--gold); }
.stat.green .value  { color: var(--green); }

/* ================ GRID OF IMAGES ================ */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-2);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s ease;
}
.thumb:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 16px 50px -20px rgba(0,240,255,0.6);
  transform: translateY(-2px);
}
.thumb:hover img { transform: scale(1.04); }
.thumb .overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent 55%);
  opacity: 0; transition: opacity .2s;
}
.thumb:hover .overlay { opacity: 1; }
.thumb .overlay .prompt {
  font-family: var(--mono); font-size: 0.74rem;
  color: var(--fg);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.thumb .badge {
  position: absolute; top: 10px; left: 10px;
  font-family: var(--mono); font-size: 0.62rem;
  padding: 3px 8px; border-radius: 4px;
  background: rgba(4,8,18,0.85); border: 1px solid var(--line-strong);
  color: var(--cyan); letter-spacing: 0.14em; text-transform: uppercase;
}
.thumb.txt2img .badge { color: var(--cyan); border-color: rgba(0,240,255,0.4); }
.thumb.img2img .badge { color: var(--violet); border-color: rgba(183,109,255,0.4); }

/* Pending / processing job cards */
.thumb.pending {
  cursor: default;
  background: linear-gradient(135deg, rgba(0,240,255,0.06), rgba(183,109,255,0.04));
  border-style: dashed;
  border-color: rgba(0,240,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.thumb.pending.status-queued {
  border-color: rgba(120,200,255,0.35);
  animation: pulse-border 2s ease-in-out infinite;
}
.thumb.pending.status-processing {
  border-color: rgba(0,240,255,0.55);
  animation: pulse-border 1.4s ease-in-out infinite;
  box-shadow: 0 0 22px -8px rgba(0,240,255,0.5);
}
.thumb.pending.status-failed {
  border-color: rgba(255,79,108,0.55);
  background: linear-gradient(135deg, rgba(255,79,108,0.08), rgba(0,0,0,0.2));
  animation: none;
}
.thumb.pending:hover {
  transform: none;
  box-shadow: none;
}
.thumb.pending .pending-body {
  padding: 18px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  text-align: center;
  width: 100%;
}
.thumb.pending .spinner-mini {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(0,240,255,0.18);
  border-top-color: var(--cyan);
  border-right-color: var(--violet);
  animation: spin 1.2s linear infinite;
  filter: drop-shadow(0 0 10px rgba(0,240,255,0.5));
}
.thumb.pending .status-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.4rem;
}
.thumb.pending .failed-icon {
  background: rgba(255,79,108,0.16);
  border: 1px solid var(--red);
  color: var(--red);
  box-shadow: 0 0 16px -4px rgba(255,79,108,0.4);
}
.thumb.pending .status-text {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}
.thumb.pending.status-failed .status-text { color: var(--red); }
.thumb.pending .prompt {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--fg-dim);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  width: 100%;
}
.thumb.pending .error-msg {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--red);
  background: rgba(255,79,108,0.08);
  border: 1px solid rgba(255,79,108,0.25);
  padding: 4px 8px;
  border-radius: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  max-width: 100%;
}
.thumb.pending .dismiss-form { margin-top: 4px; }

@keyframes pulse-border {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

.empty {
  text-align: center; padding: 60px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--fg-dim);
  font-family: var(--mono);
}
.empty h3 { color: var(--fg); margin-bottom: 8px; }

/* ================ GENERATE ================ */

.generate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 980px) { .generate-grid { grid-template-columns: 1fr; } }

.mode-tabs {
  display: inline-flex;
  background: var(--surface-2);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  margin-bottom: 24px;
}
.mode-tabs a {
  padding: 8px 18px;
  font-family: var(--mono); font-size: 0.74rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--fg-dim);
  border-radius: 999px;
  display: flex; align-items: center; gap: 8px;
}
.mode-tabs a.active {
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #06091a;
  font-weight: 700;
  box-shadow: 0 0 18px -4px rgba(0,240,255,0.5);
}
.mode-tabs a:hover:not(.active) { color: var(--cyan); }

.cost-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 16px;
  font-family: var(--mono); font-size: 0.84rem;
}
.cost-bar .cost { color: var(--gold); font-weight: 700; }

/* ================ TABLE ================ */

.tbl {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  font-size: 0.92rem;
}
.tbl thead th {
  text-align: left;
  font-family: var(--mono); font-size: 0.7rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--fg-dim);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-strong);
  background: rgba(0,0,0,0.2);
}
.tbl tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: rgba(0,240,255,0.04); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .col-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--mono); font-size: 0.7rem;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.chip.role-admin { color: var(--gold); border-color: rgba(255,204,77,0.45); }
.chip.role-user  { color: var(--fg-dim); }
.chip.banned     { color: var(--red);  border-color: rgba(255,79,108,0.45); }
.chip.active     { color: var(--green); border-color: rgba(52,255,177,0.4); }
.chip.kind-txt2img { color: var(--cyan); }
.chip.kind-img2img { color: var(--violet); }

/* ================ PAGINATION ================ */

.pager { display: flex; align-items: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.pager a, .pager span {
  padding: 6px 12px;
  border-radius: 6px;
  font-family: var(--mono); font-size: 0.78rem;
  border: 1px solid var(--line);
  color: var(--fg-dim);
}
.pager a:hover { color: var(--cyan); border-color: var(--cyan); }
.pager .here { color: var(--cyan); border-color: var(--cyan); background: rgba(0,240,255,0.08); }

/* ================ SEARCH ================ */

.search-row {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 18px;
}
.search-row form { flex: 1; display: flex; gap: 8px; }

/* ================ IMAGE VIEW ================ */

.view-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 980px) { .view-grid { grid-template-columns: 1fr; } }
.view-frame {
  position: relative;
  background: #04060e;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  overflow: hidden;
}
.view-frame img {
  width: 100%; height: auto; border-radius: 6px;
  display: block;
}
.view-meta dt {
  font-family: var(--mono); font-size: 0.72rem;
  color: var(--fg-dim); letter-spacing: 0.14em; text-transform: uppercase;
  margin-bottom: 6px;
}
.view-meta dd {
  margin: 0 0 18px;
  padding: 12px 14px;
  background: rgba(4,8,18,0.5);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--mono); font-size: 0.86rem;
  white-space: pre-wrap; word-break: break-word;
}

/* ================ MISC ================ */

.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.kbd {
  font-family: var(--mono); font-size: 0.74rem;
  padding: 2px 6px; border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: rgba(4,8,18,0.6);
  color: var(--fg-dim);
}

.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
  animation: pulse 1.6s ease-in-out infinite;
  display: inline-block;
}
@keyframes pulse {
  0%, 100% { opacity: 0.5; transform: scale(0.85); }
  50%      { opacity: 1;   transform: scale(1.15); }
}

.spinner-overlay {
  position: fixed; inset: 0;
  background: rgba(4,6,14,0.85);
  backdrop-filter: blur(16px);
  display: none;
  place-items: center;
  z-index: 100;
  flex-direction: column;
}
.spinner-overlay.active { display: flex; }
.spinner-overlay .ring {
  width: 88px; height: 88px;
  border-radius: 50%;
  border: 2px solid rgba(0,240,255,0.15);
  border-top-color: var(--cyan);
  border-right-color: var(--violet);
  animation: spin 1.4s linear infinite;
  filter: drop-shadow(0 0 20px rgba(0,240,255,0.6));
}
.spinner-overlay .label {
  margin-top: 22px;
  font-family: var(--display);
  font-size: 0.95rem;
  letter-spacing: 0.32em;
  color: var(--cyan);
  text-transform: uppercase;
}
.spinner-overlay .sub {
  margin-top: 6px;
  font-family: var(--mono); font-size: 0.78rem;
  color: var(--fg-dim);
  letter-spacing: 0.12em;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================ ANIMATIONS / ENTRY ================ */

.hud, .stat, .thumb, .flash {
  animation: rise .55s cubic-bezier(.2,.8,.2,1) backwards;
}
.thumb:nth-child(1) { animation-delay: 0s; }
.thumb:nth-child(2) { animation-delay: 0.04s; }
.thumb:nth-child(3) { animation-delay: 0.08s; }
.thumb:nth-child(4) { animation-delay: 0.12s; }
.thumb:nth-child(5) { animation-delay: 0.16s; }
.thumb:nth-child(6) { animation-delay: 0.20s; }
.thumb:nth-child(7) { animation-delay: 0.24s; }
.thumb:nth-child(8) { animation-delay: 0.28s; }
.thumb:nth-child(n+9) { animation-delay: 0.32s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* image preview area */
.preview-drop {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(4,8,18,0.4);
  overflow: hidden;
}
.preview-drop img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.preview-drop .placeholder {
  text-align: center;
  color: var(--fg-dimmer);
  font-family: var(--mono);
  font-size: 0.84rem;
  padding: 24px;
}
.preview-drop .placeholder strong { color: var(--cyan); }

@media (max-width: 760px) {
  /* Topbar stays single row on mobile: brand | (coin + avatar + burger).
     Use minmax(0,...) so the auto column can shrink instead of forcing the
     row wider than the viewport. */
  .nav-inner {
    grid-template-columns: minmax(0, auto) 1fr;
    gap: 10px;
    padding: 12px 12px;
    min-width: 0;
  }
  .nav-meta { gap: 8px; justify-content: flex-end; min-width: 0; flex-wrap: nowrap; }
  /* The full email is repeated inside the dropdown so the user can still
     see which account is active. */
  .user-menu .who { display: none; }
  .user-menu summary { padding: 3px; }
  .user-menu .avatar { width: 34px; height: 34px; font-size: 0.95rem; flex: 0 0 34px; }

  /* Lang switcher in the topbar is hidden — moved into the drawer. */
  .nav-meta-desktop { display: none; }

  /* Hamburger replaces the inline nav links. */
  .nav-burger { display: block; flex: 0 0 36px; width: 36px; height: 36px; }
  .nav-burger span { left: 8px; right: 8px; }

  /* Brand: drop the wordmark + tagline on mobile — they take too much room
     next to the coin pill and would push the avatar/burger off the right
     edge of the viewport. Strip the frame around the logo and bump its
     size so the brand mark itself stays recognizable. */
  .brand { gap: 0; }
  .brand-text { display: none; }
  .brand-logo {
    width: 44px; height: 44px;
    border: none;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(0,240,255,0.45));
  }

  /* Coin pill: drop the "koin" word so the pill stays compact next to the
     avatar/burger. The "+" badge stays — it's the affordance that signals
     the pill opens the topup modal. */
  .coin-pill { padding: 5px 8px; gap: 5px; font-size: 0.74rem; flex: 0 0 auto; }
  .coin-label { display: none; }
  .coin-plus { width: 16px; height: 16px; font-size: 0.78rem; margin-left: 2px; }

  /* Nav links collapse into a drawer that drops down below the topbar. */
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px 16px;
    background: linear-gradient(to bottom, rgba(8,12,26,0.97), rgba(6,9,20,0.97));
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 30px -10px rgba(0,0,0,0.5);
  }
  .nav-links.open { display: flex; }
  .nav-link {
    padding: 12px 14px;
    font-size: 0.84rem;
    border-radius: 8px;
  }
  .nav-links-lang {
    display: flex;
    justify-content: flex-start;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
  }
  /* Make sure the topbar is the positioning context for the drawer. */
  .nav-bar { position: sticky; }

  /* Tighten page padding so wide cards (.hud, .hero-card) have room. */
  .page { padding: 24px 14px 60px; }
  .hero-card { padding: 24px 18px; }

  /* Auth pages (login/register/forgot/reset/setup): the wordmark + heavy
     paddings overflow narrow viewports. Trim everything to fit. */
  .auth-shell { padding: 32px 12px; min-height: calc(100vh - 40px); }
  .auth-card { padding: 24px 18px; max-width: 100%; }
  .auth-brand { margin-bottom: 18px; }
  .auth-brand img { width: 72px; height: 72px; margin-bottom: 10px; }
  .auth-brand h1 { font-size: 1.25rem; letter-spacing: 0.12em; }
}

/* ================ IMAGE LIGHTBOX ================ */

/* In the image detail view, hint that the image is clickable. The frame is
   rendered as a <button> for keyboard/screen-reader support, so we reset the
   browser's default button chrome. */
button.view-frame.zoomable {
  appearance: none;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  display: block;
}
.view-frame.zoomable { cursor: zoom-in; }
.view-frame.zoomable:hover img {
  transform: scale(1.01);
}
.view-frame.zoomable img {
  transition: transform .25s ease;
}
.view-frame.zoomable:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.lightbox {
  position: fixed; inset: 0;
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2,4,10,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: zoom-out;
  animation: fade-in .2s ease;
  padding: 24px;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 30px 80px -20px rgba(0,240,255,0.25);
  animation: rise .35s cubic-bezier(.2,.8,.2,1);
}
.lightbox-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 42px; height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(8,12,26,0.85);
  color: var(--fg);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
  transition: color .15s, border-color .15s, transform .15s;
}
.lightbox-close:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  transform: scale(1.05);
}
@media (max-width: 600px) {
  .lightbox { padding: 12px; }
  .lightbox-close { top: 10px; right: 10px; width: 38px; height: 38px; }
}
