:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --text: #111111;
  --muted: #5f6368;
  --line: #e8eaed;
  --accent: #111111;
  --accent-soft: #f5f5f5;
  --warning: #faf7ef;
  --warning-line: #d9d0bc;
  --shadow: 0 4px 16px rgba(17, 17, 17, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

.page-shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 48px;
}

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

.hero-home h1 {
  max-width: 9ch;
}

.portal-card {
  display: block;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.portal-card:active {
  transform: scale(0.98);
}

.portal-card h2 {
  margin: 12px 0 8px;
  font-size: 22px;
  line-height: 1.2;
}

.portal-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.portal-link {
  display: inline-block;
  margin-top: 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.toplinks {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.toplinks a {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.hero,
.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 36px 32px;
  position: relative;
  overflow: hidden;
  margin-top: 18px;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -120px -120px auto;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.05), transparent 65%);
}

.eyebrow,
.kicker,
.hero-tag,
.step-index {
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  margin: 0 0 10px;
}

.hero h1,
.section h2 {
  margin: 0;
  line-height: 1.1;
}

.hero h1 {
  font-size: clamp(32px, 4vw, 56px);
  max-width: 10ch;
  letter-spacing: -0.03em;
  word-break: keep-all;
}

.hero-copy {
  font-size: 15px;
  line-height: 1.6;
  max-width: 640px;
  color: var(--muted);
  margin: 16px 0 0;
}

.hero-grid,
.compare-grid,
.script-grid {
  display: grid;
  gap: 14px;
}

.hero-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 20px;
}

.hero-card,
.compare-card,
.script-card,
.step-card,
.image-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.hero-card {
  padding: 18px;
}

.hero-tag {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f3f4f4;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.hero-tag.alt {
  background: #f6f6f6;
  color: var(--muted);
}

.hero-card h2,
.compare-card h3,
.step-card h3,
.script-card h3 {
  margin: 10px 0 8px;
  font-size: 18px;
  line-height: 1.3;
  word-break: keep-all;
}

.hero-card p,
.compare-card li,
.step-card li,
.script-card li,
.image-caption,
.notice {
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.section {
  margin-top: 14px;
  padding: 24px;
}

.section-heading {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.section-heading h2 {
  font-size: clamp(22px, 2.4vw, 30px);
  word-break: keep-all;
}

.kicker {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  flex-shrink: 0;
}

.compare-grid,
.script-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compare-card,
.script-card {
  padding: 18px;
}

.compare-card ul,
.steps ul,
.source-list {
  margin: 10px 0 0;
  padding-left: 18px;
}

.compare-card li,
.step-card li {
  margin-bottom: 4px;
}

.notice {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--warning-line);
  background: var(--warning);
  font-size: 13px;
}

.accent-section {
  background: var(--panel);
}

.image-card {
  overflow: hidden;
  margin-top: 16px;
}

.image-card img {
  display: block;
  width: 100%;
  height: auto;
  background: #fafafa;
}

.image-caption {
  padding: 10px 14px 14px;
  font-size: 12px;
}

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

.step-card {
  padding: 18px;
}

.step-index {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.mono {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9em;
  background: #f5f5f5;
  padding: 1px 4px;
  border-radius: 4px;
  word-break: break-all;
}

.script-card ol {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.matrix {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.matrix-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 1.2fr;
  gap: 0;
}

.matrix-row > div {
  padding: 14px 12px;
  border-right: 1px solid var(--line);
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.matrix-row > div:last-child {
  border-right: 0;
}

.matrix-head {
  background: #fafafa;
  font-weight: 700;
}

.matrix-head > div {
  border-top: 0;
}

.matrix-row p {
  margin: 0 0 6px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.matrix-row strong {
  color: var(--text);
}

.source-list {
  columns: 2;
  column-gap: 20px;
}

.source-list li {
  break-inside: avoid;
  margin-bottom: 8px;
  font-size: 13px;
}

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

a:hover {
  text-decoration: underline;
}

/* ======== Tablet ======== */
@media (max-width: 900px) {
  .hero,
  .section {
    padding: 20px;
    border-radius: 16px;
  }

  .hero-grid,
  .compare-grid,
  .script-grid,
  .steps,
  .home-grid {
    grid-template-columns: 1fr;
  }

  .matrix-row {
    grid-template-columns: 1fr;
  }

  .matrix-row > div {
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .matrix-head {
    display: none;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 14px;
  }

  .toplinks {
    gap: 14px;
  }

  .source-list {
    columns: 1;
  }
}

/* ======== Mobile (≤640px) ======== */
@media (max-width: 640px) {
  .page-shell {
    width: calc(100% - 24px);
    padding: 12px 0 36px;
  }

  .topbar {
    padding: 10px 2px 12px;
    gap: 8px;
  }

  .brand {
    font-size: 13px;
  }

  .toplinks {
    gap: 12px;
  }

  .toplinks a {
    font-size: 12px;
  }

  .hero {
    padding: 24px 18px;
    margin-top: 14px;
    border-radius: 14px;
  }

  .hero::after {
    width: 160px;
    height: 160px;
    opacity: 0.6;
  }

  .hero h1 {
    font-size: 28px;
    max-width: none;
    letter-spacing: -0.02em;
  }

  .hero-copy {
    font-size: 14px;
    line-height: 1.55;
    margin-top: 12px;
  }

  .eyebrow {
    font-size: 10px;
    margin-bottom: 8px;
  }

  .section {
    padding: 18px;
    margin-top: 12px;
    border-radius: 14px;
  }

  .section-heading {
    flex-direction: column;
    align-items: start;
    gap: 4px;
    margin-bottom: 12px;
  }

  .section-heading h2 {
    font-size: 20px;
  }

  .kicker {
    font-size: 10px;
  }

  .hero-card,
  .compare-card,
  .script-card,
  .step-card {
    padding: 14px;
    border-radius: 12px;
  }

  .hero-card h2,
  .compare-card h3,
  .step-card h3,
  .script-card h3 {
    font-size: 16px;
    margin: 8px 0 6px;
  }

  .hero-card p,
  .compare-card li,
  .step-card li,
  .script-card li,
  .notice,
  .image-caption {
    font-size: 12px;
    line-height: 1.55;
  }

  .hero-tag {
    font-size: 10px;
    padding: 3px 6px;
  }

  .portal-card {
    padding: 16px;
    border-radius: 12px;
  }

  .portal-card h2 {
    font-size: 18px;
    margin: 10px 0 6px;
  }

  .portal-card p {
    font-size: 12px;
    line-height: 1.5;
  }

  .portal-link {
    font-size: 11px;
    margin-top: 10px;
  }

  .steps {
    gap: 10px;
    margin-top: 12px;
  }

  .step-index {
    font-size: 10px;
  }

  .compare-card ul,
  .steps ul,
  .source-list {
    padding-left: 16px;
    margin-top: 8px;
  }

  .compare-card li,
  .step-card li {
    margin-bottom: 3px;
  }

  .mono {
    font-size: 0.85em;
    padding: 1px 3px;
  }

  .image-card {
    margin-top: 12px;
    border-radius: 12px;
  }

  .image-caption {
    padding: 8px 12px 12px;
  }

  .notice {
    padding: 12px 14px;
    margin-top: 12px;
    border-radius: 10px;
  }

  .matrix {
    border-radius: 12px;
    /* Allow horizontal scroll for tables */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .matrix-row {
    min-width: 600px;
    grid-template-columns: 1.2fr 1fr 1fr 1.3fr;
  }

  .matrix-row > div {
    padding: 10px 8px;
    font-size: 12px;
  }

  .matrix-row p {
    font-size: 11px;
    line-height: 1.5;
    margin-bottom: 4px;
  }

  .source-list {
    columns: 1;
    column-gap: 0;
  }

  .source-list li {
    margin-bottom: 6px;
    font-size: 12px;
  }

  .script-card ol {
    padding-left: 16px;
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.55;
  }
}

/* ======== Small Mobile (≤480px) ======== */
@media (max-width: 480px) {
  .page-shell {
    width: calc(100% - 16px);
  }

  .hero {
    padding: 20px 14px;
    margin-top: 10px;
  }

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

  .hero-copy {
    font-size: 13px;
  }

  .section {
    padding: 14px;
    margin-top: 10px;
  }

  .section-heading h2 {
    font-size: 18px;
  }

  .hero-card,
  .compare-card,
  .script-card,
  .step-card {
    padding: 12px;
  }

  .hero-card h2,
  .compare-card h3,
  .step-card h3,
  .script-card h3 {
    font-size: 15px;
  }

  .hero-card p,
  .compare-card li,
  .step-card li,
  .script-card li,
  .notice,
  .image-caption {
    font-size: 11.5px;
  }

  .portal-card {
    padding: 14px;
  }

  .portal-card h2 {
    font-size: 16px;
  }

  .topbar {
    padding: 8px 0 10px;
  }

  .brand {
    font-size: 12px;
  }

  .toplinks a {
    font-size: 11px;
  }
}
