/* public/aether.css */
@font-face {
  font-family: 'Quicksand';
  src: url('fonts/Quicksand-Variable.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}
:root {
  --bg: #f4f6fb;
  --bg-alt: #ffffff;
  --text: #1a2033;
  --muted: #6b7390;
  --accent: #4f46e5;
  --accent-2: #06b6d4;
  --accent-3: #a855f7;
  --border: #e2e6f0;
  --shadow: 0 2px 10px rgba(26, 32, 51, 0.08);
  --radius: 14px;
  --glow: 0 0 20px rgba(79, 70, 229, 0.25);
}
[data-theme="dark"] {
  --bg: #0d1020;
  --bg-alt: #171b30;
  --text: #e8ecf8;
  --muted: #8b93b5;
  --border: #2a3050;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  position: relative;
  padding-top: 62px; /* room for fixed top nav */
  color: var(--text);
  font-family: 'Quicksand', 'Segoe UI', sans-serif;
  font-size: 14.5px; line-height: 1.5;
  transition: background 0.3s, color 0.3s;
}
/* static animated gradient background - fixed layer so it never scrolls (mobile-safe) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background: linear-gradient(120deg, #7c3aed, #db2777, #f59e0b, #0ea5e9, #7c3aed);
  background-size: 300% 300%;
  animation: thorShift 14s ease infinite;
}
/* twinkle dots - fixed, shows on mobile */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 12% 22%, rgba(255,255,255,0.9), transparent),
    radial-gradient(1.5px 1.5px at 27% 61%, rgba(255,255,255,0.7), transparent),
    radial-gradient(2px 2px at 41% 15%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 58% 44%, rgba(255,255,255,0.6), transparent),
    radial-gradient(2px 2px at 73% 70%, rgba(255,255,255,0.85), transparent),
    radial-gradient(1.5px 1.5px at 86% 28%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 33% 84%, rgba(255,255,255,0.65), transparent),
    radial-gradient(2px 2px at 67% 90%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 92% 55%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 8% 78%, rgba(255,255,255,0.75), transparent);
  animation: twinkle 3.5s ease-in-out infinite alternate;
}
@keyframes twinkle {
  from { opacity: 0.35; }
  to { opacity: 1; }
}
@keyframes thorShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
/* headings sit directly on the gradient - keep them white and legible */
h1, h2, h3 {
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
.card h1, .card h2, .card h3,
.stat h3, .field-group h3 {
  color: var(--text);
  text-shadow: none;
}
.nav .brand { color: var(--text); text-shadow: none; }
.container { max-width: 1080px; margin: 0 auto; padding: 16px; }
/* keep content above the shared sparkle background layer */
.container, .lb-wrap { position: relative; z-index: 1; }
.card {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-alt); color: var(--text);
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  transition: transform 0.06s, box-shadow 0.15s;
}
.btn:active { transform: translateY(2px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border: none; box-shadow: var(--glow);
}
.btn-primary:hover { box-shadow: 0 0 28px rgba(79, 70, 229, 0.4); }
/* Twitch-branded sign-in button */
.btn-twitch {
  background: #9146ff;
  color: #fff;
  border: none;
  font-weight: 800;
  font-size: 15px;
  padding: 12px 22px;
  box-shadow: 0 4px 16px rgba(145, 70, 255, 0.45);
}
.btn-twitch:hover {
  background: #772ce8;
  box-shadow: 0 6px 22px rgba(145, 70, 255, 0.55);
}
.btn-twitch svg { width: 20px; height: 20px; flex-shrink: 0; }
.input {
  width: 100%; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font-family: inherit; font-size: 14px;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: rgba(79, 70, 229, 0.12); color: var(--accent);
  font-size: 13px; font-weight: 700;
}
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; gap: 14px; padding: 12px 20px;
  background: var(--bg-alt); border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}
.nav .brand { font-weight: 800; font-size: 16px; letter-spacing: 0.5px; display: inline-flex; align-items: center; }
.nav .brand-icon { width: 20px; height: 20px; margin-right: 7px; }
/* sign-in loading spinner (replaces the button text while redirecting) */
.login-spinner {
  width: 18px; height: 18px; border: 3px solid rgba(255,255,255,0.35);
  border-top-color: #fff; border-radius: 50%; display: inline-block;
  vertical-align: -4px; margin-right: 8px; animation: loginSpin 0.7s linear infinite;
}
@keyframes loginSpin { to { transform: rotate(360deg); } }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.nav a.active { color: var(--accent); }
.nav .spacer { flex: 1; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat .value { font-size: 24px; font-weight: 800; color: var(--accent); }
.stat .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.muted { color: var(--muted); }
.hero {
  text-align: center; padding: 72px 16px; position: relative; overflow: hidden;
  border-radius: 18px;
  background: rgba(18, 10, 45, 0.45);
  backdrop-filter: blur(3px);
  color: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
@keyframes thorShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.hero h1 {
  font-size: 52px; font-weight: 800; margin: 0 0 8px;
  color: #fff;
  text-shadow: 0 0 24px rgba(255,255,255,0.55), 0 2px 8px rgba(0,0,0,0.35);
  animation: heroPulse 3s ease-in-out infinite;
}
@keyframes heroPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}
.hero p { color: rgba(255,255,255,0.95); font-size: 18px; max-width: 560px; margin: 0 auto 24px; text-shadow: 0 1px 6px rgba(0,0,0,0.3); }
.hero .btn-primary {
  background: rgba(255,255,255,0.92); color: #7c3aed;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.hero .btn-primary:hover { box-shadow: 0 6px 28px rgba(0,0,0,0.35); }
/* settings field groups */
.field-group {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: 16px;
}
.field-group h3 { margin: 0 0 4px; font-size: 16px; }
.field-group .group-desc { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.field {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.field:last-child { border-bottom: none; }
.field label { font-weight: 700; font-size: 14px; }
.field .field-desc { color: var(--muted); font-size: 13px; }
.field .input { margin-top: 6px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggle {
  position: relative; width: 48px; height: 26px; flex-shrink: 0;
  appearance: none; background: var(--border); border-radius: 999px;
  cursor: pointer; transition: background 0.2s;
}
.toggle:checked { background: var(--accent); }
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  transition: transform 0.2s;
}
.toggle:checked::after { transform: translateX(22px); }
.slider {
  width: 100%; margin-top: 6px; accent-color: var(--accent);
  cursor: pointer; height: 6px;
}
.slider::-webkit-slider-thumb { cursor: pointer; }
.theme-swatches { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.theme-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px; border-radius: 12px; border: 2px solid var(--border);
  background: var(--bg); cursor: pointer; font-family: inherit; font-weight: 700; font-size: 13px;
}
.theme-swatch.active { border-color: var(--accent); }
.theme-swatch .dot {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c1), var(--c2));
}
@media (max-width: 640px) {
  .hero h1 { font-size: 28px; }
  .nav { flex-wrap: wrap; }
  .nav .spacer { display: none; }
  /* keep the save button pinned to the far right of the top nav on phones */
  #save-settings { margin-left: auto; }
  /* keep tables inside their cards: scroll horizontally instead of overflowing */
  .table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
}
/* hamburger for mobile nav */
.hamburger {
  display: none; background: none; border: none; cursor: pointer;
  padding: 6px; margin-right: 4px;
}
.hamburger span {
  display: block; width: 22px; height: 3px; margin: 4px 0;
  background: var(--text); border-radius: 2px; transition: transform 0.2s, opacity 0.2s;
}
@media (max-width: 860px) {
  .hamburger { display: block; }
  /* off-canvas drawer: slides in from the left */
  .side {
    display: flex; flex-direction: column;
    position: fixed; top: 62px; bottom: 0; left: 0; width: 260px;
    z-index: 99; border-radius: 0 14px 14px 0; border-left: none;
    background: var(--bg-alt); border-right: 1px solid var(--border);
    transform: translateX(-110%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
  }
  .side.open { transform: translateX(0); }
  /* backdrop behind the open drawer */
  .side-backdrop {
    display: none; position: fixed; inset: 62px 0 0 0; z-index: 98;
    background: rgba(0, 0, 0, 0.45);
  }
  .side-backdrop.show { display: block; }
  .layout { grid-template-columns: 1fr !important; }
}
/* mobile: collapsible cards (class added by dashboard/master JS) */
@media (max-width: 860px) {
  .collapsible > :first-child { cursor: pointer; }
  .collapsible > :first-child h3, .collapsible > h3 {
    padding-right: 26px; position: relative;
  }
  .collapsible > :first-child h3::after, .collapsible > h3::after {
    content: '▾'; position: absolute; right: 2px; top: 50%;
    transform: translateY(-50%); color: var(--muted); font-size: 12px;
    transition: transform 0.2s ease; pointer-events: none;
  }
  .collapsible.collapsed > *:not(:first-child) { display: none !important; }
  /* belt and braces: no button may remain visible inside a collapsed card */
  .collapsible.collapsed button, .collapsible.collapsed a.btn, .collapsible.collapsed .btn { display: none !important; }
  .collapsible.collapsed > :first-child h3::after, .collapsible.collapsed > h3::after {
    transform: translateY(-50%) rotate(-90deg);
  }
}
