:root {
  color-scheme: light;
  --paper: #f8f5ef;
  --panel: #fffdf8;
  --ink: #242638;
  --muted: #5c5a64;
  --accent: #a8381d;
  --orange: #ef8351;
  --line: #e5ddd2;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--sans); }
h1, h2, h3, p, figure { margin: 0; }
a { color: inherit; }
button { font: inherit; }
code { font: .93em/1.45 var(--mono); }
pre { margin: 0; font: .83rem/1.7 var(--mono); }
button:focus-visible, a:focus-visible, summary:focus-visible, pre:focus-visible {
  outline: 3px solid #cb552c;
  outline-offset: 4px;
}
.container { width: min(1120px, calc(100% - 80px)); margin-inline: auto; }
.skip-link { position: absolute; top: 10px; left: 10px; z-index: 2; transform: translateY(-150%); background: var(--panel); padding: 10px 15px; border: 1px solid; }
.skip-link:focus { transform: translateY(0); }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 76px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; line-height: 1.22; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .045em; }
.brand small { color: var(--muted); margin-top: 5px; font-size: .73rem; }
.brand-symbol { width: 38px; height: 38px; display: grid; place-items: center; background: var(--ink); color: #ffc39f; border-radius: 10px; }
.brand-symbol svg { width: 26px; height: 26px; }
.site-header nav { display: flex; align-items: center; gap: clamp(18px, 3.2vw, 42px); }
.site-header nav a { text-decoration: none; color: var(--muted); font-size: .88rem; font-weight: 600; }
.site-header nav a:hover, .text-link:hover { color: var(--accent); }
.lesson-tag { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #dcc7b7; border-radius: 99px; padding: 6px 12px; color: #7c3b2b; font: 600 .76rem/1.4 var(--mono); white-space: nowrap; }
.lesson-tag span, .console-live span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.hero { display: grid; grid-template-columns: 1.06fr .94fr; gap: clamp(26px, 5vw, 68px); align-items: center; padding-block: clamp(48px, 7vw, 91px); }
.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--accent); font: 700 .75rem/1.5 var(--mono); letter-spacing: .12em; }
.hero .eyebrow > span:first-child { font-size: 1.06rem; line-height: 1; }
.eyebrow-divider { width: 13px; height: 1px; background: #c2856d; }
.hero h1 { margin: 11px 0 16px; font-size: clamp(2.7rem, 6.15vw, 5.55rem); line-height: 1.12; letter-spacing: -.07em; font-weight: 820; }
.hero h1 span { color: var(--accent); font-size: .74em; letter-spacing: -.035em; white-space: nowrap; }
.hero-intro { max-width: 31em; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.14rem); line-height: 1.8; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 22px; margin-top: 26px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 12px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; text-decoration: none; font-size: .89rem; font-weight: 700; line-height: 1.4; padding: 10px 15px; }
.button:disabled { cursor: wait; opacity: .6; }
.button-primary { background: var(--ink); color: #fffaf2; padding: 12px 17px; }
.button-primary span { color: #ffc095; }
.button-primary:hover { background: #383c56; }
.text-link { text-decoration: none; font-size: .89rem; font-weight: 700; text-underline-offset: 4px; }
.text-link:hover { text-decoration: underline; }
.text-link span { color: var(--accent); margin-left: 4px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 23px; color: var(--muted); font-size: .75rem; }
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta span::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: #aa5a40; }
.hero-figure { margin: 0; border: 1px solid #e4d2bc; border-radius: 26px; overflow: hidden; }
.hero-figure svg { width: 100%; height: auto; display: block; }

.practice-section { background: #f1ede5; border-block: 1px solid var(--line); padding: clamp(45px, 6vw, 70px) 0; }
#practice, #python, #exercise-2, #http-observer { scroll-margin-top: 20px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 23px; }
.section-index { background: #f4ddcc; border-radius: 4px; padding: 1px 6px; letter-spacing: .05em; }
.section-heading h2 { font-size: clamp(1.9rem, 4vw, 2.75rem); font-weight: 800; letter-spacing: -.05em; line-height: 1.25; margin-block: 7px 4px; }
.section-heading p:not(.eyebrow) { color: var(--muted); }
.button-quiet { border-color: #d4c8bb; background: transparent; white-space: nowrap; }
.button-quiet:hover { background: var(--panel); }
.button-quiet span { color: var(--accent); font-size: 1.1rem; line-height: .95; }
.noscript { padding: 10px 14px; margin-bottom: 12px; border: 1px solid var(--line); background: var(--panel); }
.lab-layout { display: grid; grid-template-columns: 1.12fr 1fr; gap: 20px; align-items: start; }
.steps { display: grid; gap: 12px; list-style: none; margin: 0; padding: 0; }
.step { position: relative; display: flex; gap: 14px; min-width: 0; padding: 20px; background: var(--panel); border: 1px solid #e3dcd0; border-radius: 14px; }
.step-number { display: grid; place-items: center; flex: 0 0 36px; height: 36px; color: var(--accent); background: #f6e2d2; border-radius: 9px; font: 700 .9rem/1 var(--mono); }
.step-content { min-width: 0; width: 100%; }
.endpoint { display: flex; align-items: center; gap: 6px; padding-right: 107px; min-height: 24px; }
.endpoint span { display: inline-block; padding: 2px 5px; background: #e8efea; color: #2a5845; border-radius: 4px; font: 700 .68rem/1.2 var(--mono); letter-spacing: .025em; }
.endpoint .method-post { background: #f5e2d5; color: #843724; }
.endpoint code { color: var(--muted); font-size: .81rem; white-space: nowrap; }
.step h3 { margin: 5px 0 3px; font-size: 1.17rem; line-height: 1.45; }
.step-content > p:not(.endpoint) { color: var(--muted); font-size: .88rem; }
.step-status { position: absolute; top: 20px; right: 20px; border: 1px solid #e6ded4; background: #f6f3ed; color: #605962; border-radius: 99px; padding: 2px 8px; font-size: .69rem; white-space: nowrap; }
.step-status[data-state="pass"] { background: #e7f2e8; color: #305739; border-color: #d4e2d3; }
.step-status[data-state="retry"] { background: #fae9df; color: #903921; border-color: #f1cdb8; }
.step-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 11px; }
.button-action { border-color: #d8cabc; color: #282938; background: #fbf7ef; padding: 7px 11px; font-size: .82rem; }
.button-action span { color: var(--accent); }
.button-action:hover { border-color: #c48f74; background: #faecdf; }
.response-link { display: none; color: var(--accent); text-underline-offset: 3px; font-size: .76rem; font-weight: 700; }
.credentials { display: flex; flex-wrap: wrap; gap: 4px 13px; margin-top: 7px; color: var(--muted); font-size: .77rem; }
.credentials code { padding: 2px 5px; border-radius: 4px; color: #813c29; background: #f7eadf; }
.inspect-column { display: grid; gap: 14px; min-width: 0; }
.console { color: #fff7ec; background: #252637; border-radius: 14px; overflow: hidden; box-shadow: 0 6px 16px #302b2620; }
.console-bar { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #454658; background: #2e3044; padding: 12px 17px; }
.console-lights { display: flex; gap: 5px; }
.console-lights span { width: 7px; height: 7px; border-radius: 50%; background: #ee896a; }
.console-lights span:nth-child(2) { background: #e9bc7b; }
.console-lights span:nth-child(3) { background: #9abcac; }
.console-bar h3 { flex: 1; font-size: .86rem; }
.console-live { display: inline-flex; align-items: center; gap: 6px; color: #f5b68d; font-size: .7rem; white-space: nowrap; }
.console-body { display: grid; gap: 13px; padding: 18px; }
.console-field { display: grid; align-items: baseline; grid-template-columns: 5em 1fr; gap: 12px; padding-bottom: 11px; border-bottom: 1px solid #454658; }
.console-field > span, .console-output > span { color: #c5c3d2; font-size: .74rem; }
.console-field strong { color: #f8b889; font-size: .87rem; overflow-wrap: anywhere; }
#result-status[data-state="pass"] { color: #bde2c5; }
#result-status[data-state="retry"] { color: #ffae9e; }
.console-field code { color: #fff7ec; font-size: .82rem; overflow-wrap: anywhere; }
.console-output > span { display: block; margin-bottom: 6px; }
.console-output pre { min-height: 105px; max-height: 225px; overflow: auto; padding: 10px; border-radius: 6px; background: #1d1e2c; color: #ebe7dc; white-space: pre-wrap; overflow-wrap: anywhere; }
.trace-tip { display: flex; gap: 12px; padding: 15px; background: #f9f2e6; border: 1px solid #e8d8c5; border-radius: 12px; }
.trace-icon { flex: 0 0 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; color: var(--accent); background: #f3ddc9; font-size: 1.15rem; font-weight: 700; }
.trace-tip h3 { font-size: .93rem; margin-bottom: 4px; }
.trace-tip p { color: #595563; font-size: .83rem; }
.trace-tip .trace-note { font-size: .76rem; margin-top: 6px; }
.takeaway { display: grid; grid-template-columns: 1fr 1fr; margin-top: 18px; border: 1px solid var(--line); border-radius: 13px; background: #f8f5ed; }
.takeaway > div { padding: 13px 17px; }
.takeaway > div + div { border-left: 1px solid var(--line); }
.direction { display: block; color: var(--accent); font-size: .74rem; font-weight: 700; }
.takeaway strong { font-size: 1rem; }
.takeaway p { color: var(--muted); font-size: .82rem; }

.python-section { padding-block: clamp(45px, 6vw, 70px); }
.python-grid { display: grid; grid-template-columns: 1.12fr 1fr; align-items: start; gap: 20px; }
.python-task, .reference { min-width: 0; border: 1px solid var(--line); background: var(--panel); border-radius: 14px; }
.python-task { padding: 20px; }
.python-task h3 { font-size: 1.13rem; }
.python-task ol { padding-left: 1.55rem; margin: 8px 0 12px; }
.python-task li { padding-left: 4px; margin: 4px 0; color: var(--muted); font-size: .88rem; }
.python-task li::marker { color: var(--accent); font-family: var(--mono); font-weight: 700; }
.python-task code, .reference-body > p code, .trace-tip code { color: #863b27; overflow-wrap: anywhere; }
.install-hint { color: var(--muted); border-top: 1px solid var(--line); padding-top: 9px; font-size: .77rem; }
.reference summary { display: flex; align-items: center; justify-content: space-between; padding: 17px; cursor: pointer; list-style: none; }
.reference summary::-webkit-details-marker { display: none; }
.reference summary:hover { color: var(--accent); }
.reference summary strong, .reference summary small { display: block; }
.reference summary small { color: var(--muted); margin-top: 2px; font: .73rem/1.4 var(--mono); }
.detail-icon { position: relative; width: 25px; height: 25px; color: var(--accent); background: #f7e6d8; border-radius: 6px; }
.detail-icon::before, .detail-icon::after { content: ""; position: absolute; left: 7px; top: 12px; height: 1px; width: 11px; background: currentColor; }
.detail-icon::after { transform: rotate(90deg); }
.reference[open] .detail-icon::after { transform: rotate(0); }
.reference-body { padding: 0 15px 15px; }
.reference-body > p { margin-bottom: 9px; color: var(--muted); font-size: .8rem; }
.code-box { overflow: hidden; border-radius: 8px; background: #252637; color: #fff5e9; }
.code-bar { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 11px; background: #2e3044; border-bottom: 1px solid #454658; font: .77rem/1.4 var(--mono); }
.code-bar button { padding: 4px 8px; background: transparent; border: 1px solid #646575; color: #fff7ed; border-radius: 4px; cursor: pointer; font: .74rem/1.4 var(--sans); }
.code-bar button:hover { border-color: #ffc59d; color: #ffc59d; }
.code-box pre { max-width: 100%; overflow: auto; padding: 11px; }
.code-box pre code { font-size: .96em; }
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 80px; }
.footer-inner strong { margin-right: 8px; }
.footer-inner div span { color: var(--muted); font-size: .79rem; }
.footer-inner .text-link { font-size: .8rem; }

.downloads-page {
  width: min(660px, calc(100% - 36px));
  margin: clamp(36px, 10vh, 100px) auto;
  padding: clamp(20px, 5vw, 42px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid var(--orange);
  border-radius: 14px;
}
.downloads-page h1 { margin-bottom: 8px; line-height: 1.3; font-size: clamp(1.65rem, 5vw, 2.5rem); }
.downloads-page p { color: var(--muted); }
.downloads-page p:first-child { color: var(--accent); font-weight: 700; font-size: .85rem; margin-bottom: 5px; }
.downloads-page p:last-child { margin-top: 16px; }
.downloads-page a { color: var(--accent); font-weight: 700; text-underline-offset: 4px; }
#download-records { display: grid; gap: 8px; list-style: none; margin: 18px 0; padding: 0; }
.download-record { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.download-record .format { color: var(--accent); font: 700 .82rem/1.4 var(--mono); }

@media (max-width: 900px) {
  .container { width: calc(100% - 56px); }
  .hero { gap: 25px; }
  .step { padding: 15px; }
  .step-status { top: 15px; right: 15px; }
}
@media (max-width: 715px) {
  .container { width: calc(100% - 36px); }
  .header-inner { min-height: 65px; }
  .site-header nav { display: none; }
  .hero { grid-template-columns: 1fr; padding-block: 36px; gap: 25px; }
  .hero h1 { font-size: clamp(2.72rem, 10vw, 4.35rem); }
  .hero-figure { max-width: 500px; }
  .lab-layout, .python-grid { grid-template-columns: 1fr; gap: 14px; }
  .section-heading { align-items: start; }
  .button-quiet { padding: 6px 9px; font-size: .75rem; gap: 5px; margin-top: 4px; }
  .section-heading p:not(.eyebrow) { font-size: .9rem; }
  .console-output pre { min-height: 88px; }
  .response-link { display: inline-block; padding: 7px 0; }
}
@media (max-width: 405px) {
  .footer-inner { flex-direction: column; align-items: start; justify-content: center; gap: 4px; padding-block: 13px; }
  .step { padding: 13px; gap: 9px; }
  .step-number { flex-basis: 28px; height: 28px; font-size: .76rem; }
  .step-status { top: 13px; right: 13px; }
  .endpoint code { font-size: .76rem; }
  .takeaway { grid-template-columns: 1fr; }
  .takeaway > div + div { border-left: 0; border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
