:root {
  color-scheme: dark;
  --bg: #05070a;
  --panel: #10161d;
  --panel-strong: #151e27;
  --text: #f5f7fa;
  --muted: #91a0ae;
  --accent: #10b981;
  --line: rgba(255, 255, 255, .13);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif; }
button, select { font: inherit; }
a { color: inherit; }

.site-nav {
  position: fixed; z-index: 100; inset: 0 0 auto; height: 54px;
  display: flex; align-items: center; gap: 4px; padding: 0 max(12px, calc((100vw - 1180px) / 2));
  overflow-x: auto; background: rgba(5, 7, 10, .88); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px); scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav .logo { color: var(--accent); font-weight: 900; letter-spacing: -.04em; margin-right: 10px; }
.site-nav a { padding: 9px 11px; border-radius: 8px; color: var(--muted); text-decoration: none; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.site-nav a:hover, .site-nav a.active { color: #fff; background: rgba(255,255,255,.08); }
.site-nav a.active { box-shadow: inset 0 -2px var(--accent); }

.modebar {
  position: fixed; z-index: 90; top: 64px; left: 50%; transform: translateX(-50%);
  width: min(calc(100% - 24px), 736px); display: flex; align-items: center; gap: 7px;
  padding: 7px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(5, 7, 10, .72); backdrop-filter: blur(14px);
}
.modebar button, .control-button {
  border: 1px solid transparent; border-radius: 8px; padding: 8px 11px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.modebar button:hover, .control-button:hover, .modebar button.active { color: #fff; background: rgba(255,255,255,.09); }
.modebar button.active { border-color: rgba(16,185,129,.55); color: var(--accent); }
.modebar .spacer { flex: 1; }
.modebar .count { color: var(--muted); font: 11px ui-monospace, Menlo, monospace; white-space: nowrap; }

.loading { min-height: 100dvh; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.14); border-top-color: var(--accent); animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.screen-message { max-width: 560px; margin: 110px auto 40px; padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); text-align: center; color: var(--muted); }
.screen-message h1 { color: #fff; }

body.has-app-footer { padding-bottom: max(92px, calc(78px + env(safe-area-inset-bottom))); }
.app-footer {
  position: fixed; z-index: 120; left: 50%; bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%); width: min(560px, calc(100% - 20px)); height: 68px;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: stretch;
  padding: 6px 8px; border: 1px solid rgba(255,255,255,.16); border-radius: 20px;
  background: rgba(7,10,14,.9); box-shadow: 0 18px 54px rgba(0,0,0,.48);
  backdrop-filter: blur(18px) saturate(145%);
}
.app-footer a { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font: 10px ui-monospace,Menlo,monospace; }
.app-footer a:hover, .app-footer a.active { color: #fff; }
.app-footer-icon { font: 700 19px/1 ui-sans-serif,system-ui,sans-serif; }
.app-footer a.primary .app-footer-icon {
  min-width: 48px; height: 35px; display: grid; place-items: center; margin-top: -17px;
  border-radius: 13px; color: #04110d; background: var(--accent); border: 3px solid #070a0e;
  box-shadow: -3px 0 #29e6dd, 3px 0 #ff3b76; font-size: 11px;
}
.app-footer a.active:not(.primary) .app-footer-icon { color: var(--accent); }

@media (max-width: 620px) {
  .site-nav { padding-inline: 8px; }
  .site-nav .logo { margin-right: 2px; }
  .site-nav a { padding-inline: 8px; }
  .modebar { overflow-x: auto; }
}
