:root {
  --app-bg: #0a1628;
  --app-panel: #141c28;
  --app-line: rgba(255, 255, 255, 0.08);
  --app-text: #e2e8f0;
  --app-muted: #94a3b8;
  --app-violet: #7c3aed;
  --app-blue: #2563eb;
  --app-cyan: #06b6d4;
  --app-tab-h: 64px;
  --app-safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--app-bg);
  color: var(--app-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.app-shell {
  padding-bottom: calc(var(--app-tab-h) + var(--app-safe-b) + 12px);
}

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

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(10, 22, 40, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--app-line);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.app-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--app-violet), var(--app-blue));
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.3);
  position: relative;
}

.app-mark::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
}

.app-mark::after {
  content: "";
  position: absolute;
  inset: 15px;
  background: white;
  border-radius: 999px;
}

.app-brand-tag {
  font-size: 0.65rem;
  color: #c4b5fd;
  font-weight: 700;
}

.app-main {
  padding: 18px;
  max-width: 560px;
  margin: 0 auto;
}

.app-panel {
  display: none;
  animation: app-fade 0.35s ease;
}

.app-panel.active { display: block; }

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

.app-hero-bg {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  margin-bottom: 14px;
  min-height: 120px;
  background: linear-gradient(165deg, #1e1b4b, #0f2744);
}

.app-network-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
  pointer-events: none;
}

.app-hero {
  text-align: center;
  padding: 8px 0 20px;
}

.app-badge {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.12);
  color: #c4b5fd;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.app-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  display: block;
  border-radius: 18px;
}

.app-hero h1 {
  margin: 0 0 10px;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.app-hero .lead {
  margin: 0;
  color: var(--app-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.app-install-btn {
  margin-top: 18px;
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: 10px;
  background: var(--app-violet);
  color: white;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(124, 58, 237, 0.35);
}

.app-actions {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.app-action-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--app-line);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s, background 0.2s;
}

.app-action-card:hover,
.app-action-card:focus-visible {
  border-color: rgba(124, 58, 237, 0.4);
  background: rgba(124, 58, 237, 0.08);
}

.app-action-card strong { font-size: 0.95rem; }
.app-action-card span:last-child { color: var(--app-muted); font-size: 0.8rem; }

.app-section h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  color: #c4b5fd;
}

.install-steps { display: grid; gap: 10px; }

.install-step {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--app-line);
  background: rgba(0, 0, 0, 0.2);
}

.install-step h3 {
  margin: 0 0 6px;
  font-size: 0.82rem;
  color: #c4b5fd;
}

.install-step p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--app-muted);
  line-height: 1.5;
}

.app-muted {
  color: var(--app-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.app-site-link {
  text-align: center;
  margin-top: 20px;
  font-size: 0.82rem;
  color: var(--app-muted);
}

.app-site-link a {
  color: #c4b5fd;
  text-decoration: underline;
}

.app-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: var(--app-tab-h);
  padding-bottom: var(--app-safe-b);
  background: rgba(10, 22, 40, 0.96);
  border-top: 1px solid var(--app-line);
  backdrop-filter: blur(16px);
}

.app-tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--app-muted);
  padding: 8px 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.app-tabbar a svg {
  width: 20px;
  height: 20px;
}

.app-tabbar a.active {
  color: #c4b5fd;
}

.app-tabbar a.active svg { stroke: #a78bfa; }

#pwa-install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--app-tab-h) + var(--app-safe-b) + 10px);
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 39, 68, 0.96);
  border: 1px solid rgba(124, 58, 237, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  font-size: 0.78rem;
}

#pwa-install-banner button {
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  background: var(--app-violet);
  color: white;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 8px 12px;
  cursor: pointer;
}

#pwa-install-banner[hidden],
#pwa-install-btn[hidden],
#pwa-ios-hint[hidden] {
  display: none !important;
}

/* Cognitive panels in app */
.cog-panel {
  border: 1px solid var(--app-line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--app-panel);
}

.cog-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--app-line);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
}

.cog-live {
  color: #4ade80;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cog-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #4ade80;
}

.cog-grid {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.cog-item {
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--app-line);
  background: rgba(0, 0, 0, 0.15);
}

.cog-item h4 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}

.cog-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 8px;
}

.cog-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--app-violet), var(--app-cyan));
}

.cog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cog-tag {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.3);
  color: #c4b5fd;
}

.cog-tag.cyan {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.35);
  color: #67e8f9;
}

.pot-card {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--app-line);
  background: linear-gradient(165deg, rgba(124, 58, 237, 0.12), rgba(0, 0, 0, 0.2));
}

.pot-card h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.pot-card p {
  margin: 0 0 16px;
  color: var(--app-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.pot-layer {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--app-line);
  background: rgba(0, 0, 0, 0.15);
  margin-bottom: 8px;
  font-size: 0.82rem;
}

.pot-layer span:last-child {
  color: #c4b5fd;
  font-weight: 600;
  font-size: 0.78rem;
}

.contact-card {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--app-line);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}

.contact-card h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.contact-card p {
  margin: 0 0 16px;
  color: var(--app-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.contact-card .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  background: var(--app-violet);
  color: white;
  font-weight: 700;
  font-size: 0.88rem;
}

@media (min-width: 768px) {
  .app-main { padding: 24px; }
  .app-hero h1 { font-size: 1.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .app-panel { animation: none; }
}
