/* ===========================================================
   StanNG — Dashboard shell v4 "FLAT PRO" — based on Tabler UI
   Layout: fixed sidebar + topbar + content cards (Tabler style)
   Fully responsive, RTL-first (Vazirmatn). Legacy class names kept.
   =========================================================== */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------------- sidebar: icon rail, Tabler style ----------------
   72px collapsed / 232px expanded via .expanded class (persisted). */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 72px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-rail);
  border-inline-end: 1px solid var(--border-subtle);
  transition: width var(--dur-mid) var(--ease-out);
  overflow: hidden;
  z-index: 100;
}
.sidebar.expanded { width: 232px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 14px;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 68px;
}
.sidebar-brand img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--bg-0), 0 0 0 3px var(--gold-700), 0 0 14px var(--gold-glow);
}
.sidebar-brand > div { min-width: 0; opacity: 0; width: 0; overflow: hidden; }
.sidebar.expanded .sidebar-brand > div {
  opacity: 1; width: auto;
  animation: fade-in 200ms var(--ease-out) both;
}
.sidebar-brand .name {
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 12px var(--gold-glow);
}
.sidebar-brand .sub {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.rail-toggle {
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 6px;
  margin: 10px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.rail-toggle:hover { background: var(--surface); color: var(--text-0); }
.rail-toggle .ti { font-size: 18px; }
.sidebar.expanded .rail-toggle { margin: 10px 0 0 auto; }
[dir="rtl"] .sidebar.expanded .rail-toggle { margin: 10px auto 0 0; }

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 10px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  position: relative;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  user-select: none;
}
.nav-item > span:not(.badge) {
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity var(--dur-mid) var(--ease-out), width var(--dur-mid) var(--ease-out);
}
.sidebar.expanded .nav-item > span:not(.badge) { opacity: 1; width: auto; }

/* tooltip when collapsed */
.sidebar:not(.expanded) .nav-item::after {
  content: attr(data-tip);
  position: absolute;
  inset-inline-start: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-2);
  color: var(--text-0);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out);
  z-index: 120;
  box-shadow: var(--shadow-card);
}
[dir="rtl"] .sidebar:not(.expanded) .nav-item::after {
  inset-inline-start: auto;
  inset-inline-end: calc(100% + 10px);
}
.sidebar:not(.expanded) .nav-item:hover::after { opacity: 1; }

.nav-item:hover { background: var(--surface); color: var(--text-0); }
.nav-item {
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.nav-item:active { transform: scale(0.98); }
.nav-item.active {
  background: var(--accent-tint);
  color: var(--accent-text);
}
/* active indicator bar flush to start edge */
.nav-item.active::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--accent-solid);
  border-radius: 0 3px 3px 0;
}
[dir="rtl"] .nav-item.active::before {
  border-radius: 3px 0 0 3px;
}

.nav-item .ti { font-size: 19px; flex-shrink: 0; }

.nav-item .badge {
  margin-inline-start: auto;
  background: var(--accent-solid);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.4;
}
.sidebar:not(.expanded) .nav-item .badge { display: none; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-footer .support-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.sidebar-footer .support-link:hover { background: var(--surface); color: var(--text-0); }
.sidebar-footer .support-link span {
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity var(--dur-mid) var(--ease-out), width var(--dur-mid) var(--ease-out);
}
.sidebar.expanded .support-link span { opacity: 1; width: auto; }
.sidebar-footer .nav-item:hover { background: rgba(214, 57, 57, 0.12); color: var(--err); }

/* ---------------- topbar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 0 24px;
  background: var(--bg-0);
  border-bottom: 1px solid var(--border-subtle);
}
.topbar h1 { font-size: 18px; }

.topbar-actions { display: flex; align-items: center; gap: 6px; }

@media (max-width: 920px) {
  .topbar { padding: 0 16px; }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 18px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.icon-btn:hover {
  background: var(--surface);
  color: var(--text-0);
  border-color: var(--border-subtle);
}
.icon-btn:active { transform: scale(0.96); }

/* ---------------- main content ---------------- */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
@media (max-width: 700px) {
  .main-content { padding: 16px 12px; }
}

.view { display: none; }
.view.active {
  display: block;
  animation: view-in 260ms var(--ease-out) both;
}
@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- grid ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
@media (max-width: 560px) {
  .grid { gap: 12px; }
}
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }
@media (max-width: 1100px) {
  .col-3, .col-4 { grid-column: span 6; }
  .col-8 { grid-column: span 12; }
}
@media (max-width: 700px) {
  .col-3, .col-4, .col-6 { grid-column: span 12; }
}

/* ---------------- card (Tabler .card) ---------------- */
.win {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--dur-mid) var(--ease-out), border-color var(--dur-mid) var(--ease-out), transform var(--dur-mid) var(--ease-out);
}
.win:hover {
  box-shadow: 0 2px 16px rgba(4, 32, 69, 0.10);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
html[data-theme="dark"] .win:hover {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.30);
}
/* legacy neon edge — disabled */
.win::before { display: none; }

.win-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.win-head h3 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-0);
  display: flex;
  align-items: center;
  gap: 8px;
}
.win-head h3 .ti { color: var(--accent-text); font-size: 17px; }
.win-body { padding: 18px; }
.win-body.no-pad { padding: 0; }

.stat-card { padding: 18px; }
.stat-card .label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
}
.stat-card .label .ti { font-size: 17px; color: var(--accent-text); }
.stat-card .value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-0);
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.stat-card .value small { font-size: 13px; color: var(--text-2); font-weight: 600; }
.stat-card .bar { margin-top: 12px; }

.bar {
  height: 6px;
  background: var(--surface-strong);
  border-radius: 999px;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--accent-solid);
  border-radius: 999px;
  transition: width var(--dur-slow) var(--ease-out);
}

.progress-gold > span { background: var(--gold-500); }
.progress-amethyst > span { background: #ae3ec9; }
.progress-emerald > span { background: #2fb344; }
.progress-crimson > span { background: #d63939; }
.progress-azure > span { background: #4299e1; }

/* ---------------- table (Tabler .table) ---------------- */
.table-wrap { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data-table th {
  text-align: start;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  background: var(--surface-2);
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
table.data-table td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-1);
  vertical-align: middle;
}
table.data-table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
table.data-table tbody tr:hover { background: var(--surface); }
table.data-table tbody tr:last-child td { border-bottom: none; }

/* --- mobile stacked card layout --- */
@media (max-width: 700px) {
  table.data-table thead { display: none; }
  table.data-table tbody tr {
    display: block;
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 6px;
  }
  table.data-table tbody tr:last-child { border-bottom: none; }
  table.data-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border: none;
  }
  table.data-table tbody td::before {
    content: attr(data-label);
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-2);
  }
}

/* ---------------- status pills (Tabler badges) ---------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill-on {
  background: rgba(47, 179, 68, 0.12);
  color: var(--ok);
  border-color: rgba(47, 179, 68, 0.30);
}
html[data-theme="light"] .pill-on { color: #258b36; }
.pill-off {
  background: var(--surface-strong);
  color: var(--text-2);
  border-color: var(--border-subtle);
}
.pill-warn {
  background: rgba(245, 159, 0, 0.12);
  color: var(--warn);
  border-color: rgba(245, 159, 0, 0.30);
}
html[data-theme="light"] .pill-warn { color: #8f5f0a; }
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-on .pill-dot { animation: pill-pulse 2.2s var(--ease-out) infinite; }
@keyframes pill-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------------- row actions ---------------- */
.row-actions { display: flex; align-items: center; gap: 2px; }
.icon-btn.btn-sm { width: 30px; height: 30px; font-size: 15px; }
.row-actions .icon-btn:hover { background: var(--accent-tint); color: var(--accent-text); border-color: transparent; }
.row-actions .act-delete:hover { background: rgba(214, 57, 57, 0.14); color: var(--err); }
.row-actions .act-copysub:hover { background: rgba(47, 179, 68, 0.14); color: var(--ok); }

/* ---------------- modal (Tabler modal) ---------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 7, 18, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-mid) var(--ease-out);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  transform: translateY(14px) scale(0.98);
  transition: transform var(--dur-mid) var(--ease-out);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border-subtle);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
}

/* ---------------- QR / link display ---------------- */
.qr-box {
  display: inline-block;
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.qr-box img { display: block; border-radius: 4px; }

.link-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 4px 6px 4px 4px;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
html[data-theme="light"] .link-row { background: #ffffff; }
.link-row:focus-within,
.link-row:hover { border-color: var(--accent-solid); }
.link-row code {
  flex: 1;
  min-width: 0;
  direction: ltr;
  text-align: left;
  font-family: Monaco, Consolas, 'Courier New', monospace;
  font-size: 12px;
  color: var(--text-1);
  padding: 6px 8px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

/* ---------------- mobile sidebar ---------------- */
.menu-toggle { display: none; }

@media (max-width: 920px) {
  .sidebar {
    position: fixed;
    inset-inline-start: 0;
    top: 0;
    width: 264px !important;
    transform: translateX(100%);
    transition: transform var(--dur-mid) var(--ease-out);
    box-shadow: var(--shadow-pop);
  }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar .nav-item > span:not(.badge),
  .sidebar .support-link span { opacity: 1; width: auto; }
  .sidebar .nav-item .badge { display: inline-block; }
  .rail-toggle { display: none; }
  .menu-toggle { display: inline-flex; }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 95;
    background: rgba(3, 7, 18, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-mid) var(--ease-out);
  }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
  body.sidebar-locked { overflow: hidden; }
}

/* ---------------- empty state ---------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 20px;
  color: var(--text-2);
  font-size: 13.5px;
}
.empty-state .ti { font-size: 34px; color: var(--text-muted); }

/* ---------------- traffic chart ---------------- */
.chart-wrap { position: relative; }
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 0 18px 14px;
}
.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-2);
  font-weight: 600;
}
.chart-legend .dot { width: 10px; height: 10px; border-radius: 3px; }
.chart-legend .dot-gold { background: var(--gold-500); }
.chart-legend .dot-azure { background: #4299e1; }
.chart-legend .dot-line { background: var(--text-muted); height: 2px; width: 14px; border-radius: 2px; }

.chart-wrap canvas { width: 100%; }

.chart-tooltip {
  position: absolute;
  z-index: 50;
  opacity: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  padding: 10px 12px;
  font-size: 12px;
  pointer-events: none;
  min-width: 150px;
}
.chart-tooltip-time {
  font-weight: 700;
  color: var(--text-0);
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 5px;
}
.chart-tooltip-row {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-1);
  margin-top: 3px;
}
.chart-tooltip-row .dot { width: 8px; height: 8px; border-radius: 2px; }
.chart-tooltip-row .dot-gold { background: var(--gold-500); }
.chart-tooltip-row .dot-azure { background: #4299e1; }
.chart-tooltip-row .dot-line { background: var(--text-muted); height: 2px; width: 12px; border-radius: 2px; }

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

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

/* =========================== FREE PANEL BANNER (live) =========================== */
.free-banner {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--text-1, #e5e7eb);
  background: var(--glass, #1f2937);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-pop, 0 8px 32px rgba(0, 0, 0, 0.35));
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
  animation: freeBannerPulse 3.2s ease-in-out infinite;
}
/* free-banner dot recolored to arcane lavender via var (default fallback updated) */
.free-banner .fb-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-text, #a78bfa);
  box-shadow: 0 0 8px var(--accent-text, #a78bfa);
  animation: freeBannerBlink 1.6s ease-in-out infinite;
  flex: none;
}
.free-banner::after {
  content: "";
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, var(--accent-tint), transparent);
  animation: freeBannerSweep 4.5s linear infinite;
}
@keyframes freeBannerPulse {
  0%, 100% { border-color: var(--border-soft); }
  50%      { border-color: var(--border-strong); }
}
@keyframes freeBannerBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.8); }
}
@keyframes freeBannerSweep {
  0%   { left: -60%; }
  100% { left: 120%; }
}
[data-theme="light"] .free-banner {
  background: var(--glass, #ffffff);
  color: var(--text-1, #111827);
}
@media (prefers-reduced-motion: reduce) {
  .free-banner, .free-banner .fb-dot, .free-banner::after { animation: none; }
}

/* =========================== CYBER GRID BACKGROUND (myip.nl style) ===========================
   Near-black canvas with a fine 24px square grid + a soft green glow pool,
   fused with faint gold arcane pools in the corners (wizard sigil native
   to the terminal). Pure CSS, static (no motion cost), pointer-transparent. */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.aurora::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 24px 24px;
}
.aurora::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 42% at 50% 0%, rgba(139, 92, 246, 0.11), transparent 70%),
    radial-gradient(ellipse 45% 35% at 85% 100%, rgba(139, 92, 246, 0.06), transparent 70%),
    radial-gradient(ellipse 38% 30% at 8% 96%, rgba(245, 158, 11, 0.07), transparent 72%),
    radial-gradient(ellipse 30% 26% at 96% 4%, rgba(245, 158, 11, 0.06), transparent 72%);
}
html[data-theme="light"] .aurora::before {
  background-image:
    linear-gradient(to right, rgba(2, 44, 34, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(2, 44, 34, 0.06) 1px, transparent 1px);
}
html[data-theme="light"] .aurora::after {
  background:
    radial-gradient(ellipse 60% 42% at 50% 0%, rgba(124, 58, 237, 0.07), transparent 70%),
    radial-gradient(ellipse 38% 30% at 8% 96%, rgba(180, 83, 9, 0.05), transparent 72%);
}
@media (prefers-reduced-motion: reduce) {
  .aurora::before, .aurora::after, .aurora .a-blob { animation: none; }
}

/* =========================== GLASS SURFACES ===========================
   Translucent cards over the aurora: blur + subtle tint + luminous border. */
.win {
  background: color-mix(in srgb, var(--surface-1) 78%, transparent);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  border: 1px solid var(--border-soft);
}
.modal {
  background: color-mix(in srgb, var(--surface-1) 88%, transparent);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--border-soft);
}
.sidebar {
  background: color-mix(in srgb, var(--bg-rail) 62%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-inline-end: 1px solid var(--border-soft);
}
.topbar {
  background: color-mix(in srgb, var(--bg-1) 60%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}
.input, select.input, textarea.input {
  background: color-mix(in srgb, var(--bg-1) 55%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
html[data-theme="light"] .input,
html[data-theme="light"] select.input,
html[data-theme="light"] textarea.input {
  background: color-mix(in srgb, #ffffff 60%, transparent);
}
.auth-shell { position: relative; z-index: 1; }
.app-shell { position: relative; z-index: 1; }

/* =========================== TERMINAL CARDS (myip.nl × arcane) ===========================
   Cards framed like terminal windows: 2px green-tinted border, but the top
   edge carries the fusion signature — a green→gold gradient bar (phosphor
   flows into gold). Header strip darkened with a whisper of gold. */
.win {
  border: 2px solid rgba(139, 92, 246, 0.30);
  box-shadow: var(--shadow-card), inset 0 1px rgba(139, 92, 246, 0.12);
  border-radius: 6px;
}
.win::before {
  content: "";
  display: block; /* overrides the legacy .win::before{display:none} neutralizer above */
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #8b5cf6 0%, #7c3aed 38%, #d9a441 78%, #f59e0b 100%);
  opacity: 0.9;
  border-radius: 6px 6px 0 0;
  pointer-events: none;
}
.win { position: relative; overflow: hidden; }
.win-head {
  background: linear-gradient(180deg, rgba(20, 14, 3, 0.46), rgba(0, 0, 0, 0.40));
  position: relative;
}
.win-head h3 {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.3px;
}
/* arcane identity: card header icons turn gold — green stays for actions */
.win-head h3 .ti {
  color: var(--gold-300);
  filter: drop-shadow(0 0 5px var(--gold-glow));
}
.terminal-dots {
  display: inline-flex;
  gap: 6px;
  margin-inline-end: 10px;
  flex-shrink: 0;
}
.terminal-dots span {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.terminal-dots .td-r { background: #ff5f57; }
.terminal-dots .td-y { background: #febc2e; }
.terminal-dots .td-g { background: #28c840; }

/* code/link rows read like terminal output */
.link-row code,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.2px;
}
.link-row:hover { border-color: rgba(139, 92, 246, 0.55); }

/* monospace glow label — hero titles / topbar page title.
   Brand moments (login StanNG) now glow ARCANE GOLD, matching the sigil;
   add .glow-text--green for the classic phosphor look. */
.glow-text {
  color: var(--gold-300);
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.75), 0 0 22px rgba(245, 158, 11, 0.40), 0 0 36px rgba(245, 158, 11, 0.22);
}
.glow-text--green {
  color: var(--accent-text);
  text-shadow: 0 0 10px rgba(167, 139, 250, 0.8), 0 0 20px rgba(167, 139, 250, 0.4), 0 0 30px rgba(167, 139, 250, 0.2);
}
html[data-theme="light"] .glow-text { text-shadow: none; }
html[data-theme="light"] .glow-text--green { text-shadow: none; }
.mono-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-2);
}
/* arcane label variant — gold incantation text, e.g. "// spellbook.cfg" */
.mono-label--arcane {
  color: var(--gold-300);
  text-shadow: 0 0 8px var(--gold-glow);
}
html[data-theme="light"] .mono-label--arcane { text-shadow: none; }

/* arcane divider — hairline that flows green→gold, for use under brand rows */
.arcane-divider {
  height: 1px;
  border: none;
  margin: 14px auto;
  width: 62%;
  background: linear-gradient(90deg, transparent, var(--accent-solid) 30%, var(--gold-300) 70%, transparent);
  opacity: 0.55;
}
/* topbar title becomes terminal-styled */
.topbar h1 {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.4px;
}

/* ===========================================================
   HOGWARTS MAGIC LAYER (HP × terminal fusion)
   Rotating rune rings, floating incantations, wand-cast
   buttons, typewriter spell-casting. All decorative layers
   are pointer-transparent and respect prefers-reduced-motion.
   =========================================================== */

/* --- glyph helpers (Tabler codepoints, keeps HTML clean) --- */
.gl-wand::before { content: "\ebcb"; }
.gl-sparkles::before { content: "\f6d7"; }
.gl-star::before { content: "\eb2e"; }
.gl-stars::before { content: "\ed38"; }
.gl-moonstars::before { content: "\ece7"; }
.gl-bolt::before { content: "\ea38"; }

/* --- magic circle: spinning rune rings around a focal point ---
   Parent (.magic-circle / .splash-circle) sets --mc = diameter. */
.magic-circle {
  --mc: min(80vmin, 660px);
  position: fixed;
  left: 50%; top: 50%;
  width: var(--mc); height: var(--mc);
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
}
.mc-ring {
  position: absolute;
  border-radius: 50%;
  display: block;
}
.mc-ring.r1 {
  inset: 0;
  border: 1px dashed rgba(245, 158, 11, 0.32);
  animation: mc-spin 80s linear infinite;
}
.mc-ring.r2 {
  inset: 34px;
  border: 1px dotted rgba(139, 92, 246, 0.30);
  animation: mc-spin-rev 52s linear infinite;
}
.mc-glyph {
  position: absolute;
  left: 50%; top: 50%;
  font-size: 22px;
  font-style: normal;
  color: var(--gold-300);
  opacity: 0.30;
  text-shadow: 0 0 14px var(--gold-glow);
  transform: rotate(var(--a)) translateY(calc(var(--mc) / -2 + 18px));
}
@keyframes mc-spin { to { transform: rotate(360deg); } }
@keyframes mc-spin-rev { to { transform: rotate(-360deg); } }
html[data-theme="light"] .mc-glyph { opacity: 0.45; text-shadow: none; color: var(--gold-700); }
html[data-theme="light"] .mc-ring.r1 { border-color: rgba(180, 83, 9, 0.30); }
html[data-theme="light"] .mc-ring.r2 { border-color: rgba(124, 58, 237, 0.25); }

/* --- floating HP incantations (login) --- */
.hp-quote {
  position: fixed;
  z-index: 0;
  font-family: 'Cinzel', 'Times New Roman', serif;
  letter-spacing: 0.14em;
  color: var(--gold-300);
  opacity: 0.16;
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 0 12px var(--gold-glow);
}
.hp-quote.q1 { top: 15%; inset-inline-start: 5%; font-size: 15px; animation: hp-float-a 9s ease-in-out infinite; }
.hp-quote.q2 { bottom: 20%; inset-inline-end: 6%; font-size: 13px; animation: hp-float-b 11s ease-in-out infinite; }
.hp-quote.q3 { top: 8%; inset-inline-end: 10%; font-size: 12px; animation: hp-float-b 13s ease-in-out infinite reverse; }
@keyframes hp-float-a { 0%, 100% { transform: translateY(0); opacity: 0.14; } 50% { transform: translateY(-14px); opacity: 0.24; } }
@keyframes hp-float-b { 0%, 100% { transform: translateY(0); opacity: 0.16; } 50% { transform: translateY(10px); opacity: 0.22; } }
@media (max-width: 760px) { .hp-quote { display: none; } .magic-circle { --mc: 120vmax; opacity: 0.5; } }
html[data-theme="light"] .hp-quote { text-shadow: none; color: var(--gold-700); opacity: 0.28; }

/* --- wand-cast button: wand swings, sparks fly on the "cast" beat --- */
.btn-cast .wand {
  display: inline-block;
  font-style: normal;
  font-size: 17px;
  order: 2;
  transform-origin: 70% 80%;
  animation: wand-cast 2.6s ease-in-out infinite;
}
@keyframes wand-cast {
  0%, 100% { transform: rotate(0deg); }
  42% { transform: rotate(-26deg); }
  58% { transform: rotate(16deg); }
  72% { transform: rotate(-7deg); }
}
.btn-cast .spark {
  position: absolute;
  top: 50%; inset-inline-end: 22px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #fde68a;
  box-shadow: 0 0 8px var(--gold-glow), 0 0 14px var(--gold-glow);
  opacity: 0;
  pointer-events: none;
  animation: spark-pop 2.6s ease-out infinite;
}
.btn-cast .spark.s2 { animation-delay: 0.08s; inset-inline-end: 30px; }
.btn-cast .spark.s3 { animation-delay: 0.16s; inset-inline-end: 16px; }
@keyframes spark-pop {
  0%, 55% { opacity: 0; transform: translate(0, 0) scale(0.4); }
  62% { opacity: 1; transform: translate(-4px, -10px) scale(1); }
  100% { opacity: 0; transform: translate(-16px, -30px) scale(1.3); }
}
html[data-theme="light"] .btn-cast .spark { background: #d97706; }

/* --- brand sparkle: twinkle after the glowing wordmark --- */
.brand-spark {
  font-style: normal;
  font-size: 13px;
  color: var(--gold-300);
  vertical-align: super;
  margin-inline-start: 2px;
  display: inline-block;
  text-shadow: 0 0 8px var(--gold-glow);
  animation: brand-twinkle 2.4s ease-in-out infinite;
}
@keyframes brand-twinkle {
  0%, 100% { opacity: 0.35; transform: scale(0.8) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.15) rotate(20deg); }
}

/* --- login logo: gentle levitation (it's a magical artifact) --- */
.auth-logo { animation: logo-levitate 5.5s ease-in-out infinite; }
@keyframes logo-levitate {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* --- splash: summoning ritual --- */
.splash-circle {
  --mc: 170px;
  position: relative;
  width: var(--mc); height: var(--mc);
}
.splash-circle .mc-ring.r2 { inset: 20px; }
.splash-circle .mc-glyph { font-size: 14px; opacity: 0.5; }
.splash-center {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.splash-center .splash-logo { width: 74px; height: 74px; margin: 0; }
.splash-cast {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  direction: ltr;
  font-size: 13.5px;
  color: var(--gold-300);
  min-height: 21px;
  letter-spacing: 0.5px;
  text-shadow: 0 0 10px var(--gold-glow);
}
.splash-cast .cast-caret {
  display: inline-block;
  width: 7px; height: 13px;
  background: var(--accent-text);
  margin-left: 3px;
  vertical-align: -2px;
  animation: caret-blink 0.9s steps(1) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }
