:root {
  color-scheme: light;
  --bg: #dcecf9;
  --surface: #ffffff;
  --surface-soft: #f6f9ff;
  --ink: #121b31;
  --muted: #52637f;
  --line: #c7d8f0;
  --accent: #2f62ff;
  --accent-strong: #174be4;
  --accent-soft: #eaf0ff;
  --cyan: #1fc0c4;
  --shadow: 0 20px 54px rgba(45, 87, 138, 0.16);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #111d30;
  --surface-soft: #18263c;
  --ink: #edf4ff;
  --muted: #9fb0c7;
  --line: #2b3b54;
  --accent: #68a1ff;
  --accent-strong: #a9c9ff;
  --accent-soft: #172b4d;
  --cyan: #23c6c9;
  --shadow: 0 20px 54px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 0 0, rgba(132, 191, 255, 0.38), transparent 30rem),
    linear-gradient(90deg, #dbeafe 0%, #eaf4ff 45%, #d8f6f2 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at 0 0, rgba(62, 128, 255, 0.24), transparent 30rem),
    linear-gradient(90deg, #0b1220 0%, #101d30 52%, #0c282c 100%);
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.site-shell {
  min-height: 100vh;
}

.progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1440px, calc(100% - 56px));
  margin: 28px auto 20px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 18px;
  padding: 18px 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-wrap,
.brand,
.top-actions,
.theme-trigger,
.section-title-wrap,
.side-community-head,
.toolbox-item-head,
.admin-actions {
  display: flex;
  align-items: center;
}

.brand-wrap {
  gap: 14px;
}

.brand {
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3d82ff, #2f62ff);
  color: #ffffff;
  font-weight: 900;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-title {
  font-size: 17px;
  font-weight: 900;
}

.brand-subtitle,
.theme-trigger-label,
.side-label,
.toolbox-label,
.section-kicker,
.contact-kicker,
.side-community-eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.topbar-badge,
.pill {
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.pill.ok {
  border-color: color-mix(in srgb, var(--cyan) 46%, var(--line));
  color: var(--accent-strong);
}

.top-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-link,
.theme-trigger,
.button,
.hero-support-button,
.section-inline-btn,
.toolbox-inline-link,
.copy-chip,
.copy-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--ink);
  font-weight: 850;
}

.ghost-link {
  padding: 13px 18px;
  font-size: 14px;
}

.theme-trigger {
  gap: 12px;
  min-width: 150px;
  padding: 9px 14px;
}

.theme-trigger-copy {
  display: grid;
  gap: 1px;
  text-align: left;
}

.theme-trigger-value {
  font-size: 14px;
}

.theme-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset -5px -3px 0 color-mix(in srgb, var(--surface) 70%, transparent);
}

.hero,
.hero-support,
.doc-section,
.download-panel,
.toolbox-panel,
.side-community-card,
.admin-login,
.editor-section {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 330px);
  align-items: end;
  gap: 28px;
  width: min(1400px, calc(100% - 56px));
  min-height: 460px;
  margin: 0 auto 16px;
  border-radius: 22px;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, transparent 0 64%, rgba(47, 98, 255, 0.06)),
    repeating-linear-gradient(135deg, transparent 0 24px, rgba(112, 144, 190, 0.11) 24px 25px);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 22px;
  max-width: 1000px;
  padding: clamp(42px, 5vw, 72px) 0 clamp(40px, 5vw, 62px) clamp(36px, 6vw, 70px);
}

.hero h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(48px, 5.1vw, 72px);
  line-height: 1.08;
  letter-spacing: 0;
  word-break: keep-all;
}

.hero-lede {
  max-width: 870px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(17px, 1.7vw, 20px);
  line-height: 1.8;
}

.hero-note {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  border-radius: 14px;
  padding: 13px 17px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 900;
}

.hero-software-guide {
  display: grid;
  gap: 13px;
  max-width: 840px;
}

.hero-software-title,
.hero-software-tip {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.hero-software-title {
  color: var(--ink);
  font-weight: 850;
}

.hero-software-tip {
  font-size: 15px;
}

.hero-software-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-software-link {
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(47, 98, 255, 0.18);
  white-space: nowrap;
}

.codex-install-callout {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  width: min(100%, 280px);
  margin: 0 clamp(34px, 4vw, 64px) clamp(38px, 4vw, 44px) 0;
  border: 1px solid #9ab6ff;
  border-radius: 22px;
  padding: 22px 26px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  color: var(--ink);
  text-align: center;
  box-shadow: none;
}

.codex-install-callout strong {
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 900;
  line-height: 1.15;
}

.codex-install-callout span {
  color: var(--accent-strong);
  font-weight: 900;
}

.hero-support {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1400px, calc(100% - 56px));
  margin: 0 auto 20px;
  border-radius: 22px;
  padding: 24px 42px;
}

.hero-support p {
  margin: 0;
  line-height: 1.7;
}

.hero-support-copy {
  display: grid;
  gap: 8px;
}

.hero-support-detail,
.toolbox-note {
  color: var(--muted);
  font-size: 14px;
}

.hero-support-button,
.button.primary,
.section-inline-btn {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: var(--accent);
  color: #ffffff;
}

.hero-support-button,
.button,
.section-inline-btn,
.toolbox-inline-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 22px;
}

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 280px;
  gap: 22px;
  width: min(1400px, calc(100% - 56px));
  margin: 0 auto;
  align-items: start;
}

.side-nav,
.toolbox {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 16px;
}

.side-group {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
}

.side-label,
.toolbox-label {
  border-radius: 999px;
  padding: 9px 13px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.side-group a {
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--muted);
  font-weight: 800;
}

.side-group a.is-active,
.side-group a:hover {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--accent-strong);
}

.side-community-card {
  display: grid;
  gap: 12px;
  border-radius: 16px;
  padding: 16px;
}

.side-community-head {
  justify-content: space-between;
  gap: 10px;
}

.side-community-card h3,
.side-community-card p {
  margin: 0;
}

.side-community-card p {
  color: var(--muted);
  line-height: 1.6;
}

.side-community-button {
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
}

.side-community-qr {
  overflow: hidden;
  border-radius: 12px;
  background: #ffffff;
}

.content {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.doc-section,
.download-panel {
  border-radius: 18px;
  padding: clamp(24px, 3vw, 36px);
}

.section-head,
.download-panel {
  display: grid;
  gap: 13px;
}

.section-title-wrap {
  justify-content: space-between;
  gap: 16px;
}

.section-kicker {
  width: fit-content;
  border-radius: 999px;
  padding: 9px 16px;
  background: var(--cyan);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.download-panel .section-kicker {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.doc-section h2,
.download-panel h2 {
  margin: 0;
  font-size: clamp(28px, 3.4vw, 42px);
  line-height: 1.2;
}

.section-intro {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.steps {
  display: grid;
  gap: 18px;
}

.step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 16px;
}

.step-number {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 900;
}

.step-body {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.step-body h3 {
  margin: 5px 0 0;
  font-size: 21px;
}

.step-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.media-grid,
.step-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.media-grid.single {
  grid-template-columns: 1fr;
}

.shot {
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.shot button {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
}

.shot img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.shot figcaption {
  padding: 12px 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.download-panel {
  margin: 22px 0;
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface));
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.download-card,
.guide-card,
.toolbox-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
}

.download-card {
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.download-card:hover {
  border-color: #8eabff;
  transform: translateY(-2px);
}

.download-card strong,
.guide-card h3 {
  color: var(--ink);
}

.download-card small,
.guide-card p {
  color: var(--muted);
  line-height: 1.7;
}

.guide-card h3,
.guide-card p {
  margin: 0;
}

.tabs {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 7px;
  background: var(--surface-soft);
}

.tab-button {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.tab-button.is-active {
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: 0 8px 22px rgba(24, 91, 214, 0.14);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.copy-chip,
.endpoint-row {
  width: fit-content;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 10px 12px;
  color: var(--accent-strong);
}

.toolbox-panel {
  box-shadow: none;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.toolbox-copy-stack,
.toolbox-item,
.endpoint-block {
  display: grid;
  gap: 12px;
}

.toolbox-item-head {
  justify-content: space-between;
  gap: 10px;
}

.toolbox-item-label {
  color: var(--muted);
  line-height: 1.5;
}

.endpoint-name {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.endpoint-row {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  text-align: left;
}

.footer {
  width: min(1400px, calc(100% - 56px));
  margin: 36px auto 0;
  padding: 24px 0 38px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.footer-brand {
  color: var(--ink);
}

.lightbox,
.contact-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 8, 15, 0.72);
}

.lightbox[hidden],
.contact-modal[hidden],
[hidden] {
  display: none !important;
}

.lightbox img {
  max-height: 86vh;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.lightbox button,
.contact-close {
  position: absolute;
  top: 22px;
  right: 22px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 24px;
}

.contact-dialog {
  position: relative;
  display: grid;
  gap: 16px;
  width: min(760px, 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.contact-dialog h2,
.contact-dialog p {
  margin: 0;
}

.contact-intro {
  color: var(--muted);
  line-height: 1.75;
}

.contact-qr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.contact-qr-grid figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  text-align: center;
}

.contact-qr-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.contact-qr-grid figcaption {
  padding: 10px;
  color: #142033;
}

.contact-group-link {
  color: var(--accent-strong);
  font-weight: 850;
}

.admin-body {
  background: #eef3f8;
  color: #142033;
}

.admin-shell {
  width: min(1500px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0;
}

.admin-login {
  display: grid;
  gap: 18px;
  width: min(520px, 100%);
  margin: 10vh auto;
  border-radius: 18px;
  padding: 28px;
}

.admin-login h1,
.admin-topbar h1,
.editor-section h2 {
  margin: 0;
}

.admin-login p {
  margin: 8px 0 0;
  color: #667085;
  line-height: 1.7;
}

.admin-login label,
.editor-panel label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 14px;
  font-weight: 800;
}

.admin-login input,
.editor-panel select,
.editor-panel input,
.editor-panel textarea {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  padding: 11px 12px;
  background: #ffffff;
  color: #101828;
}

.editor-panel textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.55;
}

.editor-panel .json-area {
  min-height: 150px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 13px;
}

.editor-panel .json-area.tall {
  min-height: 360px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-actions {
  gap: 10px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(420px, 560px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.editor-panel {
  display: grid;
  gap: 14px;
}

.editor-section {
  display: grid;
  gap: 14px;
  border-radius: 16px;
  padding: 18px;
  box-shadow: none;
}

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

.editor-help {
  margin: 0;
  color: #667085;
  line-height: 1.6;
}

.preview-panel {
  position: sticky;
  top: 16px;
  overflow: hidden;
  border: 1px solid #d0d5dd;
  border-radius: 16px;
  background: #ffffff;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #d0d5dd;
  padding: 12px 14px;
}

.preview-head span {
  color: #667085;
  font-size: 13px;
}

.preview-panel iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 100px);
  border: 0;
}

.button.ghost {
  background: #ffffff;
  color: #142033;
}

.error-page {
  width: min(720px, calc(100% - 32px));
  margin: 18vh auto;
}

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

  .hero-copy {
    padding-right: clamp(36px, 6vw, 70px);
  }

  .codex-install-callout {
    justify-self: start;
    margin: 0 clamp(36px, 6vw, 70px) 36px;
  }

  .layout {
    grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
  }

  .toolbox {
    position: static;
    grid-column: 2;
  }
}

@media (max-width: 920px) {
  .topbar,
  .hero-support,
  .admin-topbar,
  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .side-nav,
  .toolbox,
  .preview-panel {
    position: static;
  }

  .toolbox {
    grid-column: auto;
  }

  .side-nav {
    order: -1;
  }

  .media-grid,
  .step-grid,
  .download-grid,
  .contact-qr-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar,
  .hero,
  .hero-support,
  .layout,
  .footer {
    width: min(100% - 20px, 1400px);
  }

  .hero {
    min-height: 0;
    border-radius: 20px;
  }

  .hero-copy {
    padding: 28px 18px;
  }

  .hero h1 {
    font-size: 38px;
  }

  .top-actions,
  .hero-software-links {
    width: 100%;
  }

  .ghost-link,
  .theme-trigger,
  .hero-software-link,
  .hero-support-button,
  .button {
    width: 100%;
  }

  .section-title-wrap {
    align-items: stretch;
    flex-direction: column;
  }

  .step {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
  }

  .step-number {
    width: 34px;
    height: 34px;
  }
}
