:root {
  --paper: #f3f0e7;
  --surface: #fffdf8;
  --ink: #17201d;
  --muted: #68716c;
  --line: rgb(23 32 29 / 12%);
  --blue: #3078ef;
  --blue-dark: #17468f;
  --blue-soft: #e5eeff;
  --yellow: #ffd84d;
  --yellow-soft: #fff3ae;
  --red: #e85d5d;
  --red-soft: #ffe8e3;
  --green: #14956d;
  --green-soft: #dff4ea;
  --code: #18231f;
  --shadow: 0 26px 74px rgb(40 51 46 / 13%);
  color-scheme: light;
  font-family: "Avenir Next", "Hiragino Sans", "Yu Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 3%, rgb(48 120 239 / 15%), transparent 31rem),
    radial-gradient(circle at 94% 4%, rgb(255 216 77 / 22%), transparent 30rem),
    linear-gradient(135deg, #eef3f4 0%, var(--paper) 54%, #f3ecdc 100%);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

h1,
h2,
h3,
p,
pre {
  margin: 0;
}

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

.page > *,
.demo-shell,
.comparison-grid,
.comparison-grid > *,
.code-panel {
  min-width: 0;
  max-width: 100%;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.eyebrow::before {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 4px rgb(48 120 239 / 15%);
  content: "";
}

h1 {
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.08;
}

.lead {
  margin-top: 10px;
  color: var(--muted);
  font-size: clamp(15px, 1.55vw, 18px);
  font-weight: 800;
  line-height: 1.65;
}

.lead code {
  color: var(--blue-dark);
  font-size: 0.9em;
}

.support-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid rgb(48 120 239 / 23%);
  border-radius: 999px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 900;
}

.support-chip.is-unsupported {
  border-color: rgb(232 93 93 / 32%);
  color: #8f3636;
  background: var(--red-soft);
}

.demo-shell {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgb(255 253 248 / 88%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.search-bar {
  display: grid;
  grid-template-columns: minmax(210px, 0.7fr) minmax(400px, 1.35fr) minmax(245px, 0.8fr);
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 66%);
}

.search-heading,
.search-heading > div,
.search-field,
.preset-buttons,
.section-heading,
.query-chip,
.card-heading,
.element-count,
.dom-strip,
.code-head,
.code-head > div:first-child,
.code-tabs {
  display: flex;
  align-items: center;
}

.search-heading {
  gap: 12px;
}

.search-heading > div,
.code-head > div:first-child {
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}

.step-number {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: white;
  background: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.search-heading p,
.section-heading p,
.code-head p {
  color: var(--blue);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.search-heading h2,
.section-heading h2,
.code-head h2 {
  font-size: 18px;
  letter-spacing: -0.025em;
}

.search-field {
  gap: 10px;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid rgb(48 120 239 / 24%);
  border-radius: 14px;
  background: white;
  box-shadow: 0 8px 24px rgb(48 120 239 / 8%);
}

.search-field:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgb(48 120 239 / 12%);
}

.search-field svg {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-width: 2;
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 15px;
  font-weight: 800;
}

.search-field output {
  flex: 0 0 auto;
  padding: 5px 7px;
  border-radius: 7px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 900;
}

.preset-buttons {
  gap: 7px;
}

.preset-buttons button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: white;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 900;
}

.preset-buttons button[aria-pressed="true"] {
  border-color: var(--blue);
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.comparison-section {
  padding: 22px;
  background:
    linear-gradient(rgb(23 32 29 / 3%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(23 32 29 / 3%) 1px, transparent 1px),
    #f5f4ef;
  background-size: 22px 22px;
}

.section-heading {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 15px;
}

.section-heading > div {
  display: grid;
  gap: 3px;
}

.query-chip {
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgb(48 120 239 / 20%);
  border-radius: 999px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.query-chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 3px rgb(255 216 77 / 25%);
}

.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.comparison-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgb(255 253 248 / 94%);
  box-shadow: 0 14px 34px rgb(37 45 41 / 8%);
}

.comparison-card--before {
  --card-accent: var(--red);
  --card-soft: var(--red-soft);
}

.comparison-card--after {
  --card-accent: var(--green);
  --card-soft: var(--green-soft);
}

.card-heading {
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
  margin-bottom: 12px;
}

.card-heading > div {
  display: grid;
  gap: 2px;
}

.card-heading > div > span {
  color: var(--card-accent);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.card-heading h3 {
  font-size: 18px;
  letter-spacing: -0.025em;
}

.element-count {
  gap: 8px;
  min-width: 132px;
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, var(--card-accent) 22%, transparent);
  border-radius: 11px;
  color: var(--card-accent);
  background: var(--card-soft);
}

.element-count b {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 19px;
  line-height: 1;
}

.element-count span {
  font-size: 9px;
  font-weight: 900;
  line-height: 1.2;
}

.article-frame {
  border: 1px solid rgb(23 32 29 / 10%);
  border-radius: 14px;
  background: white;
  overflow: hidden;
}

.browser-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: #f2f3f1;
}

.browser-bar i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d0d4d1;
}

.browser-bar i:first-child {
  background: #ef7b6e;
}

.browser-bar i:nth-child(2) {
  background: #f0bf56;
}

.browser-bar i:nth-child(3) {
  background: #66be8f;
}

.browser-bar span {
  margin-left: 5px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  font-weight: 800;
}

.article-content {
  display: grid;
  gap: 12px;
  min-height: 178px;
  padding: 18px;
  color: #35403b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.9;
}

.article-content mark {
  padding: 2px 1px;
  color: var(--ink);
  background: var(--yellow);
  border-radius: 3px;
  box-shadow: 0 0 0 2px rgb(255 216 77 / 28%);
}

::highlight(search-results) {
  color: var(--ink);
  background-color: var(--yellow);
  text-decoration: underline 2px var(--blue);
  text-underline-offset: 2px;
}

.dom-strip {
  gap: 9px;
  min-height: 42px;
  margin-top: 10px;
  padding: 0 10px;
  border-radius: 11px;
  background: #edf0ed;
}

.dom-strip > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.dom-strip code {
  min-width: 0;
  overflow: hidden;
  color: #47514c;
  font-size: 9px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dom-strip code b {
  color: var(--red);
}

.dom-strip strong {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 5px;
  margin-left: auto;
  color: var(--card-accent);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.dom-strip strong i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.fallback-notice {
  margin-top: 10px;
  color: #8f3636;
  font-size: 11px;
  font-weight: 800;
}

.code-panel {
  position: relative;
  border-top: 1px solid var(--line);
  color: white;
  background: var(--code);
}

.code-head {
  gap: 16px;
  min-height: 66px;
  padding: 11px 18px;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
}

.code-head h2 {
  color: white;
}

.code-tabs {
  gap: 5px;
  margin-left: auto;
  padding: 4px;
  border-radius: 10px;
  background: rgb(255 255 255 / 7%);
}

.code-tabs button,
.copy-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #aebbb5;
  background: transparent;
  font-size: 10px;
  font-weight: 900;
}

.code-tabs button[aria-selected="true"] {
  border-color: rgb(255 216 77 / 26%);
  color: var(--yellow);
  background: rgb(255 216 77 / 10%);
}

.copy-button {
  border-color: rgb(255 255 255 / 12%);
  color: white;
  background: rgb(255 255 255 / 7%);
}

.code-panel pre {
  max-width: 100%;
  min-height: 118px;
  padding: 17px 20px 19px;
  overflow-x: auto;
  color: #f2f6f3;
  font-size: 12px;
  line-height: 1.7;
}

.code-panel code {
  white-space: pre;
}

.copy-status {
  position: absolute;
  right: 18px;
  bottom: 7px;
  color: #9ee0c6;
  font-size: 9px;
  font-weight: 800;
}

@media (max-width: 940px) {
  .page {
    width: min(100% - 28px, 760px);
    padding-top: 22px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .search-bar {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .comparison-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .page {
    width: calc(100% - 20px);
    padding: 16px 0 26px;
  }

  h1 {
    font-size: 31px;
    line-height: 1.14;
  }

  .lead {
    font-size: 13px;
    line-height: 1.6;
  }

  .demo-shell {
    border-radius: 18px;
  }

  .search-bar,
  .comparison-section {
    padding: 16px;
  }

  .search-field output {
    display: none;
  }

  .section-heading {
    align-items: flex-start;
  }

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

  .query-chip {
    min-height: 30px;
  }

  .comparison-card {
    padding: 12px;
  }

  .card-heading h3 {
    font-size: 16px;
  }

  .element-count {
    min-width: 116px;
  }

  .article-content {
    min-height: 0;
    padding: 15px;
    font-size: 12px;
  }

  .code-head {
    align-items: stretch;
    flex-wrap: wrap;
    padding: 13px 14px;
  }

  .code-head > div:first-child {
    width: 100%;
  }

  .code-tabs {
    margin-left: 0;
  }

  .copy-button {
    margin-left: auto;
  }

  .code-panel pre {
    min-height: 135px;
    padding: 15px 16px 18px;
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

