:root {
  --bg: #ffffff;
  --surface: #f5f5f7;
  --surface-hover: #ebebee;
  --text-primary: #181818;
  --text-secondary: #6a6a6a;
  --hairline: rgba(24, 24, 24, 0.10);
  --accent: #0071e3;
  --accent-hover: #0062c4;
  --accent-text: #ffffff;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #18181b;
    --surface: #222226;
    --surface-hover: #2c2c31;
    --text-primary: #f4f4f5;
    --text-secondary: #94949c;
    --hairline: rgba(244, 244, 245, 0.12);
    --accent: #2997ff;
    --accent-hover: #1485ee;
    --accent-text: #ffffff;
  }
}

:root[data-theme="dark"] {
  --bg: #18181b;
  --surface: #222226;
  --surface-hover: #2c2c31;
  --text-primary: #f4f4f5;
  --text-secondary: #94949c;
  --hairline: rgba(244, 244, 245, 0.12);
  --accent: #2997ff;
  --accent-hover: #1485ee;
  --accent-text: #ffffff;
}

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

html {
  scroll-behavior: smooth;
  color-scheme: light dark;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px;
}

/* Reicon Wrapper: 18px glyph (1.5px stroke) inside 24px x 24px transparent box */
.reicon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  flex-shrink: 0;
}

.reicon-box svg {
  display: block;
  width: 18px;
  height: 18px;
}

/* Header (Alma spatial layout: brand + nav left, controls + CTA right) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 72px;
  background-color: var(--bg);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-icon {
  border-radius: 8px;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  line-height: 24px;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.control-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  cursor: pointer;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}

.control-btn:hover {
  background-color: var(--surface);
  color: var(--text-primary);
}

.icon-only-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}

.icon-only-btn:hover {
  background-color: var(--surface);
  color: var(--text-primary);
}

.header-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  margin-left: 4px;
  border-radius: 8px;
  background-color: var(--text-primary);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  transition: opacity 160ms var(--ease);
}

.header-cta:hover {
  opacity: 0.88;
}

.icon-sun {
  display: none;
}

.icon-moon {
  display: inline-flex;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun {
    display: inline-flex;
  }
  :root:not([data-theme="light"]) .icon-moon {
    display: none;
  }
}

:root[data-theme="dark"] .icon-sun {
  display: inline-flex;
}

:root[data-theme="dark"] .icon-moon {
  display: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease), opacity 160ms var(--ease), transform 140ms var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

.btn-accent {
  background-color: var(--accent);
  color: var(--accent-text);
}

.btn-accent:hover {
  background-color: var(--accent-hover);
}

.btn-solid {
  background-color: var(--text-primary);
  color: var(--bg);
}

.btn-solid:hover {
  opacity: 0.88;
}

.btn-neutral {
  background-color: var(--surface);
  color: var(--text-primary);
  border-color: var(--hairline);
}

.btn-neutral:hover {
  background-color: var(--surface-hover);
}

/* Centered Hero with Full-Width Animated Pixel-Matrix Banner */
.hero {
  padding: 0 0 120px;
}

.hero-banner {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 144px 0 136px;
}

.hero-banner-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.hero-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0 0 40px;
  font-size: 40px;
  font-weight: 600;
  line-height: 52px;
  letter-spacing: -0.03em;
}

.hero-title-primary {
  color: var(--text-primary);
}

.hero-title-secondary {
  color: var(--text-secondary);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.preview-section {
  padding-top: 64px;
}

/* Centered View Switcher + Direct Screenshot */
.preview-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
}

.tab-btn {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  cursor: pointer;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn[aria-selected="true"] {
  background-color: var(--surface);
  color: var(--text-primary);
}

.preview-frame {
  width: 100%;
}

.preview-image {
  width: 100%;
  border-radius: 28px;
  border: 1px solid var(--hairline);
  transition: opacity 160ms var(--ease);
}

.preview-image.is-switching {
  opacity: 0.45;
}

/* Sections (1.5x vertical whitespace, zero dividers) */
.section {
  padding: 96px 0;
}

.section-title {
  margin: 0 0 48px;
  font-size: 18px;
  font-weight: 700;
  line-height: 24px;
  color: var(--text-primary);
}

/* Modules Typographic Grid (flat, no cards, no nested boxes) */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 56px 64px;
}

.module-item {
  min-width: 0;
}

.module-icon {
  margin-bottom: 16px;
  color: var(--text-primary);
}

.module-item h3 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
  color: var(--text-primary);
}

.module-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.module-list li {
  font-size: 14px;
  font-weight: 400;
  line-height: 24px;
  color: var(--text-secondary);
}

/* Download Single-Layer Neutral Tiles */
.download-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
}

.download-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  padding: 48px;
  border-radius: 24px;
  background-color: var(--surface);
}

.tile-icon {
  margin-bottom: 24px;
  color: var(--text-primary);
}

.download-tile h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  line-height: 24px;
  color: var(--text-primary);
}

.tile-meta {
  margin: 0 0 32px;
  font-size: 14px;
  font-weight: 400;
  line-height: 24px;
  color: var(--text-secondary);
  word-break: break-all;
}

.tile-btn {
  min-width: 144px;
}

/* Commands Single Flat Surface */
.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.code-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-surface {
  margin: 0;
  padding: 32px;
  max-width: 100%;
  border-radius: 20px;
  background-color: var(--surface);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  line-height: 28px;
  color: var(--text-primary);
  overflow-x: auto;
}

/* Footer */
.site-footer {
  padding: 96px 0 64px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-brand {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: var(--text-primary);
}

.footer-domain {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: var(--text-secondary);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}

.footer-links a {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: var(--text-secondary);
  transition: color 160ms var(--ease);
}

.footer-links a:hover {
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 960px) {
  .modules-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 48px 40px;
  }

  .download-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
}

@media (max-width: 680px) {
  .container {
    padding: 0 20px;
  }

  .hero {
    padding: 0 0 72px;
  }

  .hero-banner {
    padding: 88px 0 80px;
  }

  .preview-section {
    padding-top: 40px;
  }

  .hero-title {
    font-size: 28px;
    line-height: 36px;
    margin-bottom: 32px;
  }

  .hero-cta {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .preview-image {
    border-radius: 16px;
  }

  .section {
    padding: 64px 0;
  }

  .section-title {
    margin-bottom: 32px;
  }

  .modules-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .download-tile {
    padding: 32px;
    border-radius: 20px;
  }

  .tile-btn {
    width: 100%;
  }

  .code-surface {
    padding: 24px;
    border-radius: 16px;
  }

  .site-footer {
    padding: 64px 0 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
