:root {
  color-scheme: dark;

  /* Shared tokens (mirrors modulonengine.com) */
  --bg: #030306;
  --bg-alt: #050712;

  --accent: #4af2c5;
  --accent-soft: rgba(74, 242, 197, 0.15);
  --accent-strong: rgba(74, 242, 197, 0.3);
  --accent-secondary: #8c7bff;
  --accent2: var(--accent-secondary);

  --text: #f7f9ff;
  --muted: rgba(247, 249, 255, 0.7);

  --danger: #ff5a7a;
  --warn: #ffaa3c;

  --border: rgba(255, 255, 255, 0.12);
  --border-highlight: rgba(74, 242, 197, 0.3);

  --panel: rgba(5, 7, 16, 0.85);
  --panel-strong: rgba(9, 13, 24, 0.45);

  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --gap: 1.5rem;

  --font-main: "Space Grotesk", sans-serif;
  --font-mono: "Chakra Petch", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 0% 0%, #051019, #020208 55%, #000000);
  color: var(--text);
  font-family: var(--font-main);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* Background (grid + subtle noise) */
.bg-grid {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Crect width='140' height='140' fill='black'/%3E%3Ccircle cx='5' cy='9' r='1' fill='%234af2c5'/%3E%3Ccircle cx='39' cy='92' r='1' fill='%238c7bff'/%3E%3Ccircle cx='104' cy='41' r='1' fill='%23ffffff'/%3E%3C/svg%3E");
}

.topbar {
  position: sticky;
  top: 1rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 1rem 1.5rem;
  background: rgba(5, 7, 16, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

.brand,
.logo {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-mark,
.logo-glyph {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid var(--accent);
  background: #050a10;
  box-shadow: 0 0 8px rgba(74, 242, 197, 0.5);
  flex-shrink: 0;
}

.brand-mark::after,
.logo-glyph::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 2px solid var(--accent-secondary);
  box-shadow: 0 0 10px rgba(140, 123, 255, 0.6);
}

.brand-text,
.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title,
.logo-title {
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  display: inline-block;
}

.brand-subtitle,
.logo-tagline {
  font-size: 0.7rem;
  color: var(--muted);
  font-family: var(--font-mono);
  display: inline-block;
}

@supports (-webkit-background-clip: text) {
  .brand-subtitle,
  .logo-tagline {
    background: linear-gradient(90deg, #4af2c5, #8c7bff, #4af2c5);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: gradient-shift 3s ease infinite;
  }
}

@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-actions .link[aria-current="page"] {
  color: var(--accent);
  text-decoration: none;
}

.container {
  width: 100%;
  margin: 0;
  padding: 0;
}

.app {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(5, 7, 16, 0.85);
  box-shadow: var(--shadow);
  overflow: visible;
  backdrop-filter: blur(5px);
}

.app--feed {
  border: none;
  background: transparent;
  box-shadow: none;
}

.feed-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--gap);
  align-items: start;
}

@media (max-width: 1100px) {
  .feed-layout {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
  }

  .feed-aside {
    order: -1;
  }
}

.feed-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feed-aside {
  position: relative;
}

.floating-panel {
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  overflow: auto;
}

.update-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.update-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-strong);
  padding: 1rem;
}

.update-item--owned {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(74, 242, 197, 0.2) inset;
}

.update-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.update-title {
  font-weight: 800;
  margin-top: 6px;
}

.update-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pill.tiny {
  font-size: 10px;
  padding: 1px 6px;
}

.update-highlights {
  margin: 10px 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.section {
  padding: 18px;
}

.section + .section {
  border-top: 1px solid var(--border);
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
}

.title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.subtle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(9, 13, 24, 0.45);
  padding: 1rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

@media (max-width: 860px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.col-6 {
  grid-column: span 6;
}

@media (max-width: 860px) {
  .col-6 {
    grid-column: span 12;
  }
}

.col-12 {
  grid-column: span 12;
}

.btn {
  appearance: none;
  border: 1px solid rgba(74, 242, 197, 0.55);
  background: rgba(74, 242, 197, 0.16);
  color: var(--text);
  padding: 0.8rem 1.3rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 0 0 1px rgba(74, 242, 197, 0.12) inset, 0 0 22px rgba(74, 242, 197, 0.14);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(74, 242, 197, 0.22);
  border-color: rgba(74, 242, 197, 0.8);
  box-shadow: 0 0 0 1px rgba(74, 242, 197, 0.18) inset, 0 0 28px rgba(74, 242, 197, 0.2);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

.btn:active {
  transform: translateY(0);
  opacity: 0.95;
}

.btn.secondary {
  border: 1px solid var(--border);
  background: rgba(9, 13, 24, 0.45);
  color: var(--text);
  box-shadow: none;
}

.btn.danger {
  border: 1px solid rgba(255, 90, 122, 0.35);
  background: rgba(255, 90, 122, 0.12);
  color: var(--text);
  box-shadow: none;
}

.btn.linkish {
  border: 1px solid transparent;
  background: transparent;
  padding: 8px 10px;
  font-weight: 600;
  color: var(--muted);
  font-family: var(--font-main);
  letter-spacing: 0;
  text-transform: none;
  box-shadow: none;
}

.btn.linkish:hover {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.06);
  transform: none;
  box-shadow: none;
  color: var(--accent);
}

.input {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(9, 13, 24, 0.45);
  color: var(--text);
  padding: 0.85rem 0.9rem;
  border-radius: 14px;
  outline: none;
}

.input:focus {
  border-color: var(--border-highlight);
  box-shadow: 0 0 0 3px rgba(74, 242, 197, 0.15);
}

.label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

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

.tab {
  border: 1px solid var(--border);
  background: rgba(9, 13, 24, 0.55);
  color: var(--muted);
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.tab[aria-selected="true"] {
  border-color: var(--border-highlight);
  background: rgba(74, 242, 197, 0.12);
  color: var(--accent);
}

.table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(9, 13, 24, 0.45);
}

.table th,
.table td {
  text-align: left;
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid rgba(120, 255, 200, 0.12);
  font-size: 0.92rem;
}

.table th {
  position: sticky;
  top: 0;
  background: rgba(9, 13, 24, 0.95);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(74, 242, 197, 0.1);
  border: 1px solid rgba(74, 242, 197, 0.35);
  color: var(--accent);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.pill.ok {
  border-color: rgba(74, 242, 197, 0.4);
  background: rgba(74, 242, 197, 0.12);
  color: var(--accent);
}

.pill.warn {
  border-color: rgba(255, 170, 60, 0.35);
  background: rgba(255, 170, 60, 0.12);
  color: var(--warn);
}

.pill.bad {
  border-color: rgba(255, 90, 122, 0.35);
  background: rgba(255, 90, 122, 0.12);
  color: var(--danger);
}

.pill-soon {
  border: 1px solid rgba(74, 242, 197, 0.4);
}

.pill-early {
  border: 1px solid rgba(74, 242, 197, 0.7);
  background: rgba(74, 242, 197, 0.16);
}

.link {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.link:hover {
  color: var(--accent);
  text-decoration: none;
}

.topbar-actions .link[href*="index.html"] {
  background: linear-gradient(90deg, #4af2c5, #8c7bff, #4af2c5);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: gradient-shift 3s ease infinite;
  display: inline-block;
}

.footer {
  padding: 18px;
}

.footer-inner {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}

.footer-links {
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px;
}

.notice {
  border: 1px solid var(--border);
  background: rgba(9, 13, 24, 0.45);
  border-radius: var(--radius);
  padding: 1rem;
}

.notice.error {
  border-color: rgba(255, 90, 122, 0.35);
  background: rgba(255, 90, 122, 0.08);
}

/* Store product panels (mirrors modulonengine.com product-grid) */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (max-width: 860px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
}

.product {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(9, 13, 24, 0.45);
  padding: 1rem 1rem 1.1rem;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.product-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-actions {
  margin-top: auto;
  padding-top: 1rem;
}

/* Color themes for each product */
.product--accent {
  border-color: rgba(74, 242, 197, 0.4);
  box-shadow: 0 0 24px rgba(74, 242, 197, 0.15);
}

.product--cyan {
  border-color: rgba(123, 255, 235, 0.35);
  background: linear-gradient(180deg, rgba(123, 255, 235, 0.08), rgba(9, 13, 24, 0.45));
}

.product--cyan:hover {
  border-color: rgba(123, 255, 235, 0.5);
  box-shadow: 0 0 20px rgba(123, 255, 235, 0.2);
}

.product--purple {
  border-color: rgba(168, 85, 247, 0.35);
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.08), rgba(9, 13, 24, 0.45));
}

.product--purple:hover {
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
}

.product--blue {
  border-color: rgba(59, 130, 246, 0.35);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(9, 13, 24, 0.45));
}

.product--blue:hover {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.product--orange {
  border-color: rgba(251, 146, 60, 0.35);
  background: linear-gradient(180deg, rgba(251, 146, 60, 0.08), rgba(9, 13, 24, 0.45));
}

.product--orange:hover {
  border-color: rgba(251, 146, 60, 0.5);
  box-shadow: 0 0 20px rgba(251, 146, 60, 0.2);
}

.product--pink {
  border-color: rgba(236, 72, 153, 0.35);
  background: linear-gradient(180deg, rgba(236, 72, 153, 0.08), rgba(9, 13, 24, 0.45));
}

.product--pink:hover {
  border-color: rgba(236, 72, 153, 0.5);
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.2);
}

.product--green {
  border-color: rgba(34, 197, 94, 0.35);
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.08), rgba(9, 13, 24, 0.45));
}

.product--green:hover {
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.2);
}

.product--engine {
  grid-column: span 3;
  background: linear-gradient(135deg, rgba(74, 242, 197, 0.12), rgba(140, 123, 255, 0.08), rgba(9, 13, 24, 0.5));
  border-color: rgba(74, 242, 197, 0.5);
  box-shadow: 0 0 32px rgba(74, 242, 197, 0.25), 0 0 16px rgba(140, 123, 255, 0.15);
  padding: 1.5rem;
  position: relative;
}

.product--engine::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary), var(--accent));
  background-size: 200% 100%;
  animation: gradient-shift 3s ease infinite;
}

/* Downloads */
.download-featured {
  border-color: rgba(74, 242, 197, 0.25);
  background: rgba(7, 10, 18, 0.75);
  box-shadow: 0 0 18px rgba(74, 242, 197, 0.12), 0 0 10px rgba(140, 123, 255, 0.08);
}

.download-version {
  background: rgba(7, 10, 18, 0.55);
  border-color: rgba(255, 255, 255, 0.08);
}

.download-version--latest {
  border-color: rgba(74, 242, 197, 0.35);
}

.download-file {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.16);
}

.download-file--primary {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.download-file--primary-zip {
  border-color: rgba(74, 242, 197, 0.32);
  background: rgba(74, 242, 197, 0.08);
}

.download-file--primary-tgz {
  border-color: rgba(140, 123, 255, 0.32);
  background: rgba(140, 123, 255, 0.08);
}

.download-file--primary-demos {
  border-color: rgba(255, 170, 60, 0.32);
  background: rgba(255, 170, 60, 0.08);
}

.download-file--primary-zip .download-file-title {
  color: rgba(74, 242, 197, 0.95);
}

.download-file--primary-tgz .download-file-title {
  color: rgba(140, 123, 255, 0.95);
}

.download-file--primary-demos .download-file-title {
  color: rgba(255, 170, 60, 0.95);
}

.download-file--primary-zip .btn {
  border-color: rgba(74, 242, 197, 0.65);
  background: rgba(74, 242, 197, 0.18);
  box-shadow: 0 0 0 1px rgba(74, 242, 197, 0.16) inset, 0 0 18px rgba(74, 242, 197, 0.18);
}

.download-file--primary-tgz .btn {
  border-color: rgba(140, 123, 255, 0.65);
  background: rgba(140, 123, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(140, 123, 255, 0.16) inset, 0 0 18px rgba(140, 123, 255, 0.18);
}

.download-file--primary-demos .btn {
  border-color: rgba(255, 170, 60, 0.65);
  background: rgba(255, 170, 60, 0.18);
  box-shadow: 0 0 0 1px rgba(255, 170, 60, 0.16) inset, 0 0 18px rgba(255, 170, 60, 0.18);
}

.download-file--legacy {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.08);
}

.download-file-title {
  font-weight: 700;
}

.download-file-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.download-hash {
  font-family: var(--font-mono);
  font-size: 12px;
}

.download-file-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .download-file {
    flex-direction: column;
    align-items: stretch;
  }

  .download-file-actions {
    margin-top: 10px;
  }

  .download-file-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-subtitle,
  .logo-tagline,
  .topbar-actions .link[href*="index.html"],
  .product--engine::before {
    animation-duration: 12s !important;
  }
  .noise-overlay {
    opacity: 0.08;
  }
}

.product--engine:hover {
  box-shadow: 0 0 40px rgba(74, 242, 197, 0.35), 0 0 20px rgba(140, 123, 255, 0.2);
  transform: translateY(-2px);
}

@media (max-width: 860px) {
  .product--engine {
    grid-column: span 1;
  }
}

.product--sdk {
  box-shadow: 0 0 24px rgba(74, 242, 197, 0.15);
}

.product--soon {
  opacity: 0.6;
  filter: saturate(0.65) brightness(0.88);
}

.product--soon:hover {
  opacity: 0.66;
}

.product-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.product h3 {
  margin: 0 0 0.4rem;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.product p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.product-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0;
}

.product-actions .btn,
.product-actions .btn.secondary {
  flex: 1;
  min-width: 160px;
}

/* On the full-width Engine panel, avoid comically wide buttons */
.product--engine .product-actions {
  justify-content: flex-start;
}

.product--engine .product-actions .btn,
.product--engine .product-actions .btn.secondary {
  flex: 0 0 auto;
}
