:root {
  --bg: #f4efe3;
  --ink: #111827;
  --muted: #4b5563;
  --card: #fffdfa;
  --line: #d8d1bf;
  --accent: #0f766e;
  --accent-2: #3b82f6;
  --shadow: 0 10px 25px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #fffbe9 0%, transparent 65%),
    radial-gradient(900px 420px at 100% 0%, #e6f4ff 0%, transparent 62%),
    var(--bg);
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.narrow {
  width: min(850px, 92vw);
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  background: rgba(250, 246, 237, 0.9);
}

.nav-inner {
  width: min(1100px, 92vw);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  gap: 14px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.nav-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.nav-links a {
  font-weight: 600;
  color: #374151;
}

.hero {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(160deg, #fff8e9 0%, #f5f8ff 60%, #f2f0e9 100%);
}

.hero .container {
  padding: 38px 0 34px;
}

.kicker {
  display: inline-block;
  margin: 0;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #99e4d4;
  background: #e7faf6;
  color: #0f766e;
  font-weight: 600;
  font-size: 0.85rem;
}

h1,
h2,
h3 {
  font-family: "Crimson Text", Georgia, serif;
}

h1 {
  margin: 14px 0 10px;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.12;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 900px;
  line-height: 1.6;
  font-size: 1.08rem;
}

.author-block {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  width: fit-content;
}

.author-block p {
  margin: 2px 0;
}

.hero-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #1f2937;
  padding: 9px 12px;
  font-weight: 600;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.section {
  padding: 38px 0;
}

.section.alt {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #faf7ef;
}

h2 {
  margin: 0 0 14px;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

p {
  margin: 0 0 11px;
  line-height: 1.65;
}

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

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 14px;
}

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

.quick-guide {
  margin: 10px 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(120deg, #fffefb 0%, #f5fbff 100%);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}

.quick-guide h3 {
  margin: 0 0 8px;
}

.quick-guide ol {
  margin: 0;
  padding-left: 20px;
}

.quick-guide li {
  margin: 4px 0;
}

.step-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 14px;
}

.step-card h3 {
  margin: 2px 0 6px;
  font-size: 1.28rem;
}

.step-card p {
  margin: 0;
}

.video-intro {
  color: #374151;
}

.video-showcase {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(280px, 1.45fr) minmax(240px, 1fr);
  gap: 14px;
}

.video-frame-wrap {
  border: 1px solid #b8c8e8;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(140deg, #eaf2ff 0%, #f5fffb 55%, #fffaf2 100%);
  box-shadow: var(--shadow);
  padding: 10px;
}

.video-frame-wrap iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 10px;
  background: #000;
}

.video-sidecard {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, #fffdf6 0%, #f3faff 100%);
  box-shadow: var(--shadow);
  padding: 14px;
}

.video-sidecard h3 {
  margin: 0 0 8px;
}

.video-sidecard ul {
  margin: 0 0 12px;
  padding-left: 18px;
}

.video-sidecard li {
  margin: 5px 0;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.card ul {
  margin: 0;
  padding-left: 20px;
}

.card li {
  margin: 4px 0;
}

.architecture {
  margin-top: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 12px;
}

.arch-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

#archSvg {
  width: 100%;
  height: auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

#archSvg .edge {
  stroke: #64748b;
  stroke-width: 2;
  marker-end: url(#arrow);
  opacity: 0.75;
}

#archSvg marker path {
  fill: #64748b;
}

.arch-node {
  cursor: pointer;
}

.arch-node rect {
  fill: #ffffff;
  stroke: #94a3b8;
  stroke-width: 1.5;
  transition: 160ms ease;
}

.arch-node text {
  text-anchor: middle;
  font-size: 13px;
  font-family: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  fill: #0f172a;
}

.arch-node.active rect {
  fill: #d1fae5;
  stroke: #0f766e;
  stroke-width: 2.2;
}

.arch-details {
  margin: 10px 0 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffbeb;
  padding: 10px 12px;
  color: #334155;
}

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

.playground-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fffdf8 100%);
  box-shadow: var(--shadow);
  padding: 14px;
}

.playground-card h3 {
  margin: 0 0 8px;
}

.playground-card label {
  display: block;
  font-weight: 600;
  margin: 9px 0 4px;
}

.playground-card input[type="url"],
.playground-card input[type="number"],
.playground-card select,
.playground-card textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
}

.playground-card textarea {
  resize: vertical;
}

.input-help {
  margin: 6px 0 2px;
  color: #475569;
  font-size: 0.9rem;
}

#checkEndpointBtn {
  margin: 6px 0 10px;
}

.support-endpoint {
  margin: 0 0 14px;
  border: 1px solid #b9d4ff;
  border-radius: 12px;
  background: linear-gradient(115deg, #eef7ff 0%, #f7fffd 60%, #fffdf7 100%);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.support-endpoint p {
  margin: 2px 0;
}

.support-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.agent-picker-actions {
  display: flex;
  gap: 8px;
  margin: 6px 0 8px;
  flex-wrap: wrap;
}

.agent-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 8px;
  margin: 6px 0 10px;
}

.agent-option {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  padding: 8px 10px;
}

.agent-option label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.agent-meta {
  margin-top: 4px;
  color: #475569;
  font-size: 0.84rem;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin: 10px 0 3px;
}

#playgroundOutput {
  margin: 0;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #0b1220;
  color: #e2e8f0;
  padding: 12px;
  font-size: 0.86rem;
  line-height: 1.4;
  min-height: 320px;
  overflow: auto;
}

.query-insights {
  margin-top: 12px;
  border: 1px solid #dbe2f0;
  border-radius: 12px;
  background: #f8fbff;
  padding: 10px;
}

.query-insights h3 {
  margin: 0 0 8px;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 8px;
}

.insight-card {
  border: 1px solid #d6deed;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}

.insight-card span {
  display: block;
  color: #64748b;
  font-size: 0.8rem;
}

.insight-card strong {
  display: block;
  margin-top: 3px;
  color: #0f172a;
  font-size: 1rem;
}

.agreement-track {
  margin-top: 10px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.agreement-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ef4444 0%, #f59e0b 45%, #22c55e 100%);
  transition: width 320ms ease;
}

.playground-visuals {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 14px;
}

.playground-visuals .chart-panel,
.playground-visuals .playground-card {
  margin-top: 0;
}

.playground-visuals canvas {
  max-height: 280px;
}

.table-wrap {
  overflow: auto;
}

.agent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.agent-table th,
.agent-table td {
  border: 1px solid #d1d5db;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.agent-table th {
  background: #f8fafc;
}

.muted {
  color: #64748b;
}

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

.quick-guide,
.support-endpoint,
.video-showcase,
.paper-access-grid,
.paper-preview-card,
.paper-protected-panel,
.playground-grid .playground-card,
.playground-visuals .chart-panel,
.playground-visuals .playground-card {
  animation: riseIn 420ms ease both;
}

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

.paper-gate-note {
  margin-top: 12px;
  border: 1px solid #d6deed;
  border-radius: 12px;
  background: linear-gradient(120deg, #fffaf0 0%, #f7fbff 100%);
  padding: 12px;
}

.paper-gate-note p {
  margin: 6px 0 0;
}

.paper-step-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.paper-checklist {
  margin: 6px 0 10px;
  border: 1px solid #d6deed;
  border-radius: 12px;
  background: #f8fbff;
  padding: 8px 10px;
}

#paperAccessPassword {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
}

.paper-access-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.paper-preview-card {
  margin-top: 14px;
  border: 1px solid #cbdcf6;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff 0%, #f5faff 100%);
  box-shadow: var(--shadow);
  padding: 14px;
  text-align: center;
}

.paper-preview-card h3 {
  margin: 0 0 8px;
}

.paper-preview-frame {
  margin-top: 10px;
  margin-left: auto;
  margin-right: auto;
  max-width: 760px;
  border: 1px solid #d6deed;
  border-radius: 12px;
  background: #f8fbff;
  padding: 12px;
  position: relative;
  overflow: hidden;
}

.paper-preview-frame img {
  display: block;
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.paper-preview-frame::after {
  content: none;
}

.paper-preview-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
  padding: 10px 24px;
  border: 2px solid rgba(185, 28, 28, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  color: rgba(127, 29, 29, 0.28);
  font-weight: 700;
  font-size: clamp(0.95rem, 2.5vw, 1.8rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
  backdrop-filter: blur(2px);
  white-space: nowrap;
  text-align: center;
  z-index: 2;
}

.paper-protected-panel {
  margin-top: 14px;
  border: 1px solid #b9d4ff;
  border-radius: 14px;
  background: linear-gradient(130deg, #eef7ff 0%, #fffef8 100%);
  box-shadow: var(--shadow);
  padding: 14px;
}

.paper-downloads {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.paper-downloads .btn {
  min-width: 140px;
  text-align: center;
}

.paper-frame-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.paper-frame-wrap iframe {
  width: 100%;
  height: min(88vh, 900px);
  border: 0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.kpi {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}

.kpi .value {
  font-size: 1.28rem;
  font-weight: 700;
}

.kpi .label {
  font-size: 0.88rem;
  color: var(--muted);
}

.chart-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 14px;
}

.chart-panel h3 {
  margin: 0 0 10px;
  font-size: 1.3rem;
}

.img-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 14px;
}

figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 10px;
}

figure.wide {
  grid-column: 1 / -1;
}

figure img {
  width: 100%;
  border-radius: 8px;
}

figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(250px, 1fr));
  gap: 10px;
}

.resource-grid a {
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  font-weight: 600;
  color: #1f2937;
}

footer {
  border-top: 1px solid var(--line);
  padding: 20px 0 26px;
  color: #475569;
  text-align: center;
  font-size: 0.95rem;
}

footer p {
  margin: 4px 0;
}

@media (max-width: 980px) {
  .three-col,
  .two-col,
  .kpi-grid,
  .img-grid,
  .resource-grid,
  .paper-access-grid,
  .playground-grid,
  .playground-visuals,
  .video-showcase,
  .agent-selector,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .support-endpoint {
    flex-direction: column;
    align-items: flex-start;
  }

  figure.wide {
    grid-column: auto;
  }
}
