:root {
  --paper: #f2eee5;
  --surface: #fffdf7;
  --soft: #e8ebe5;
  --ink: #171914;
  --muted: #687069;
  --line: #c8ccc3;
  --lime: #a8ff24;
  --coral: #ff6855;
  --blue: #6f79f6;
  --green: #008b72;
  --yellow: #ffd667;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: radial-gradient(circle at 7% 3%, #e5e2e8 0, transparent 27%), var(--paper); }
button, input, a { font: inherit; }
button { border: 1px solid var(--line); color: inherit; background: var(--surface); cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
a { color: inherit; }
.page { width: min(1760px, calc(100% - 48px)); margin: 0 auto; padding: 38px 0 30px; }
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 28px; padding: 0 18px 32px; }
.eyebrow, .label, .section-heading p, .inspector header p, .why > p, .event-log > p, .fix-code > p { margin: 0 0 9px; color: var(--green); font: 900 11px/1.4 var(--mono); letter-spacing: .12em; }
.eyebrow i { display: inline-block; width: 18px; height: 18px; margin-right: 8px; translate: 0 4px; border: 2px solid var(--blue); border-radius: 5px; box-shadow: 8px 7px 0 -1px var(--lime); }
h1 { margin: 0; font-size: clamp(34px, 3.5vw, 58px); line-height: 1.08; letter-spacing: 0; white-space: nowrap; }
.lead { margin: 16px 0 0; color: var(--muted); font-size: clamp(17px, 1.65vw, 25px); font-weight: 850; }
.lead strong { color: var(--ink); }
.hero-actions { display: flex; gap: 10px; }
.hero-actions button { padding: 13px 18px; border-radius: 13px; font-size: 12px; font-weight: 850; white-space: nowrap; }
.hero-actions .dark { color: white; background: var(--ink); }

.lab, .requirements, .pattern, .exceptions { overflow: hidden; border: 1px solid var(--line); border-radius: 27px; background: var(--surface); box-shadow: 0 18px 45px #20221b0d; }
.section-heading { display: flex; align-items: center; gap: 17px; min-height: 94px; padding: 19px 26px; border-bottom: 1px solid var(--line); }
.section-heading > div { min-width: 0; }
.section-heading p { margin-bottom: 3px; }
.section-heading h2 { margin: 0; font-size: 28px; line-height: 1.15; }
.number { display: grid; flex: 0 0 auto; place-items: center; width: 50px; height: 50px; border-radius: 15px; color: white; background: var(--coral); font: 900 12px var(--mono); }
.number.blue { background: var(--blue); }
.number.green { background: var(--green); }
.number.yellow { color: var(--ink); background: var(--yellow); }
.heading-badges { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.heading-badges span, .heading-badges b { padding: 9px 12px; border-radius: 30px; white-space: nowrap; font: 900 10px var(--mono); }
.heading-badges span { color: var(--blue); background: #eef0ff; }
.heading-badges b { color: white; background: var(--coral); }
.heading-badges b.pass { color: var(--ink); background: var(--lime); }
.heading-badges b.fail { color: white; background: var(--coral); }

.lab-grid { display: grid; grid-template-columns: 280px minmax(520px, 1fr) 330px; min-height: 760px; }
.controls { container: control-panel / inline-size; background: #f8f5ed; border-right: 1px solid var(--line); }
.controls section { padding: 24px 20px; border-bottom: 1px solid var(--line); }
.controls h3 { margin: 0 0 15px; font-size: 17px; }
.scenario-list { display: grid; grid-template-columns: 1fr; gap: 8px; }
.scenario-list button { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 62px; padding: 10px; border-radius: 12px; text-align: left; }
.scenario-list button[aria-pressed="true"] { color: white; background: var(--ink); border-color: var(--ink); }
.scenario-list b { display: grid; flex: 0 0 auto; place-items: center; width: 30px; height: 32px; border-radius: 9px; color: var(--ink); background: var(--soft); font: 800 11px var(--mono); }
.scenario-list button[aria-pressed="true"] b { background: var(--lime); }
.scenario-list span { min-width: 0; font-size: 12px; font-weight: 850; }
.scenario-list small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.scenario-list button[aria-pressed="true"] small { color: #c9cec5; }
.mode-switch { position: relative; display: grid; grid-template-columns: 1fr 1fr; isolation: isolate; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: var(--soft); anchor-scope: --selected-mode; }
.mode-switch button { position: relative; z-index: 1; padding: 11px 8px; border: 0; border-radius: 9px; background: transparent; font-size: 12px; font-weight: 850; }
.mode-switch button[aria-pressed="true"] { color: white; background: var(--blue); }

@supports (anchor-name: --selected-mode) and (position-anchor: --selected-mode) {
  .mode-switch button[aria-pressed="true"] {
    anchor-name: --selected-mode;
    background: transparent;
  }

  .mode-switch::before {
    position: absolute;
    z-index: 0;
    position-anchor: --selected-mode;
    top: anchor(top);
    left: anchor(left);
    width: anchor-size(width);
    height: anchor-size(height);
    border-radius: 9px;
    background: var(--blue);
    content: "";
    transition: top 180ms ease, left 180ms ease, width 180ms ease, height 180ms ease;
  }
}
.action-panel { display: grid; gap: 8px; }
.action-panel .label, .action-panel h3 { margin-bottom: 2px; }
.action-panel button { padding: 11px 12px; border: 2px solid var(--ink); border-radius: 11px; font-size: 11px; font-weight: 850; }
.action-panel button:first-of-type { background: var(--lime); }
.action-panel p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.65; }

.workspace { min-width: 0; padding: 19px; background: #e6eae3; }
.instruction { display: flex; align-items: center; gap: 12px; min-height: 44px; margin-bottom: 13px; padding: 0 8px; }
.instruction > span { color: var(--blue); font-size: 28px; font-weight: 900; }
.instruction p { margin: 0; font-size: 12px; font-weight: 800; line-height: 1.5; }
.instruction b { margin-left: auto; padding: 7px 10px; border-radius: 7px; color: white; background: var(--blue); white-space: nowrap; font: 800 10px var(--mono); }
.browser { overflow: hidden; border: 1px solid #b8bfb5; border-radius: 18px; background: var(--surface); }
.browser-bar { display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 16px; border-bottom: 1px solid #b8bfb5; color: #58615b; background: #d6dcd2; font: 800 10px var(--mono); }
.browser-bar .dots { color: var(--coral); letter-spacing: 2px; }
.browser-bar b { margin-left: auto; padding: 6px 8px; border-radius: 8px; color: white; background: var(--green); font-size: 9px; }
.preview { position: relative; min-height: 605px; overflow: hidden; background-color: #fffdf7; background-image: linear-gradient(#e7e7df 1px, transparent 1px), linear-gradient(90deg, #e7e7df 1px, transparent 1px); background-size: 32px 32px; }
.demo-header { display: flex; align-items: center; gap: 24px; min-height: 76px; padding: 0 38px; border-bottom: 2px solid var(--ink); background: #fffdf7; }
.demo-header > b { font: 900 14px var(--mono); }
.demo-header nav { display: flex; gap: 20px; margin-left: auto; font-size: 11px; font-weight: 800; }
.demo-header a { text-decoration: none; }
.scene { display: grid; min-height: 465px; place-items: center; padding: 54px 28px 92px; }
.demo-card { position: relative; width: min(650px, 92%); padding: 38px; border: 2px solid var(--ink); border-radius: 22px; background: #fffdf7; box-shadow: 12px 14px 0 #20231e18; }
.demo-card .kicker { margin: 0 0 10px; color: var(--green); font: 900 10px var(--mono); letter-spacing: .1em; }
.demo-card h3 { max-width: 520px; margin: 0; font-size: clamp(28px, 4vw, 48px); line-height: 1.05; }
.demo-card > p:not(.kicker) { max-width: 500px; margin: 16px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.content-row { display: flex; align-items: center; gap: 14px; margin-top: 30px; padding: 20px; border-radius: 14px; background: var(--soft); }
.content-row > span { font-size: 13px; font-weight: 750; }
.popup-pair { position: relative; display: inline-flex; align-items: center; }
.popup-trigger { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 10px 14px; border: 2px solid var(--ink); border-radius: 12px; background: var(--lime); font-size: 12px; font-weight: 900; }
.popup-trigger[aria-expanded="true"] { box-shadow: 0 0 0 4px #6f79f650; }
.popup { position: absolute; z-index: 4; bottom: calc(100% + 16px); left: 50%; width: 260px; padding: 18px; translate: -50% 6px; border: 2px solid var(--ink); border-radius: 14px; background: var(--surface); box-shadow: 8px 10px 0 #17191425; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 160ms ease, translate 160ms ease, visibility 0s linear 160ms; }
.popup::before { position: absolute; top: 100%; inset-inline: 0; height: 18px; content: ""; }
.popup::after { position: absolute; top: 100%; left: 50%; width: 14px; height: 14px; translate: -50% -8px; rotate: 45deg; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); background: var(--surface); content: ""; }
.popup-pair[data-open="true"] .popup { translate: -50% 0; opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.popup h4 { margin: 0 30px 7px 0; font-size: 16px; }
.popup p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.popup a { display: inline-flex; margin-top: 12px; color: var(--green); font-size: 11px; font-weight: 900; }
.popup-close { position: absolute; top: 9px; right: 9px; display: grid; width: 28px; height: 28px; padding: 0; place-items: center; border: 0; border-radius: 50%; color: white; background: var(--ink); font-size: 0; }
.popup-close::before, .popup-close::after { position: absolute; width: 12px; height: 2px; rotate: 45deg; background: currentColor; content: ""; }
.popup-close::after { rotate: -45deg; }
.mode-broken .popup-close { display: none; }
.profile-avatar { display: grid; width: 42px; height: 42px; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: var(--coral); }
.profile-popup { width: 290px; }
.profile-popup .profile-head { display: flex; align-items: center; gap: 10px; }
.profile-popup .profile-head i { display: block; width: 44px; height: 44px; border: 2px solid var(--ink); border-radius: 50%; background: var(--yellow); }
.profile-popup .profile-head h4 { margin: 0; }
.menu-popup { display: grid; width: 220px; padding: 9px; gap: 5px; }
.menu-popup a { margin: 0; padding: 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.menu-popup a:hover, .menu-popup a:focus-visible { background: var(--soft); }
.help-popup { bottom: auto; top: calc(100% + 16px); }
.help-popup::before { top: auto; bottom: 100%; }
.help-popup::after { top: auto; bottom: 100%; translate: -50% 8px; rotate: 225deg; }
.preview-note { position: absolute; right: 18px; bottom: 14px; margin: 0; color: var(--muted); font-size: 10px; font-weight: 800; }
.event-strip { display: flex; align-items: center; gap: 16px; min-height: 54px; margin-top: 12px; padding: 11px 16px; border-radius: 13px; color: white; background: var(--ink); }
.event-strip span { color: var(--lime); font: 900 10px var(--mono); }
.event-strip p { margin: 0; font-size: 11px; font-weight: 750; }

.inspector { min-width: 0; color: white; background: #20231e; }
.inspector > header { display: flex; justify-content: space-between; gap: 12px; padding: 25px 19px; border-bottom: 1px solid #464b43; }
.inspector header p { color: #a8afa4; }
.inspector header code { font-size: 13px; font-weight: 900; overflow-wrap: anywhere; }
.inspector header > span { align-self: center; padding: 8px 10px; border-radius: 20px; color: var(--ink); background: #d9ddd5; font: 900 10px var(--mono); }
.inspector header > span.pass { color: var(--ink); background: var(--lime); }
.inspector header > span.fail { color: white; background: var(--coral); }
.requirement-list { display: grid; }
.requirement-list article { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid #464b43; }
.requirement-list article > div { display: flex; align-items: center; gap: 10px; }
.requirement-list b { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; color: var(--ink); background: #7d857a; font: 900 10px var(--mono); }
.requirement-list span { display: grid; gap: 2px; }
.requirement-list strong { font-size: 12px; }
.requirement-list small { color: #aeb4ab; font-size: 10px; }
.requirement-list em { padding: 6px 8px; border-radius: 12px; color: #d7dbd3; background: #ffffff12; font: normal 900 10px var(--mono); }
.requirement-list article.pass b, .requirement-list article.pass em { color: var(--ink); background: var(--lime); }
.requirement-list article.fail b { color: white; background: var(--coral); }
.requirement-list article.fail em { color: white; background: #ff685530; }
.why, .event-log, .fix-code { padding: 20px 18px; border-bottom: 1px solid #464b43; }
.why > p, .event-log > p, .fix-code > p { color: #a8afa4; }
.why strong, .fix-code strong { display: block; color: var(--lime); font-size: 15px; line-height: 1.45; }
.why span { display: block; margin-top: 9px; color: #c5c9c2; font-size: 10px; line-height: 1.75; }
.event-log ol { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.event-log li { display: grid; grid-template-columns: 48px 1fr; gap: 9px; padding: 8px; border: 1px solid #464b43; border-radius: 8px; color: #d7dbd3; font-size: 10px; }
.event-log time { color: var(--lime); font-family: var(--mono); }
.fix-code pre { max-height: 190px; margin: 13px 0 10px; padding: 13px; overflow: auto; border: 1px solid #4a5045; border-radius: 11px; color: #d5ff94; background: #11130f; white-space: pre-wrap; font-size: 10px; line-height: 1.65; }
.fix-code button { width: 100%; padding: 12px; border: 0; border-radius: 10px; background: var(--lime); font-size: 11px; font-weight: 900; }
.inspector-note { margin: 0; padding: 18px; color: #b6bbb2; font-size: 10px; line-height: 1.75; }

.requirements { margin-top: 24px; }
.requirements-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.requirements-grid article { padding: 29px; border-right: 1px solid var(--line); }
.requirements-grid article:last-child { border: 0; }
.requirements-grid span { display: inline-grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; color: white; background: var(--blue); font: 900 10px var(--mono); }
.requirements-grid h3 { margin: 18px 0 8px; font-size: 21px; }
.requirements-grid strong { display: block; font-size: 14px; line-height: 1.55; }
.requirements-grid p { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.8; }
.notes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 24px; }
.pattern-body, .exception-body { padding: 26px; }
.pattern-body pre { margin: 0; padding: 20px; overflow: auto; border-radius: 15px; color: #cfff82; background: #20231e; font-size: 11px; line-height: 1.65; }
.pattern-body p { margin: 16px 0 0; color: var(--muted); font-size: 11px; line-height: 1.8; }
.exception-body { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.exception-body article { padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: #f7f4ec; }
.exception-body b { color: var(--green); font: 900 10px var(--mono); }
.exception-body strong { display: block; margin-top: 12px; font-size: 15px; }
.exception-body p { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.75; }
.exception-body code { padding: 2px 5px; border-radius: 5px; background: var(--soft); }
.cautions { margin-top: 24px; padding: 30px; border-radius: 23px; background: #e8e4da; }
.cautions h2 { margin: 0 0 12px; font-size: 22px; }
.cautions p { max-width: 1300px; margin: 0; font-size: 13px; line-height: 1.9; }
.cautions a { display: inline-flex; margin-top: 14px; color: var(--green); font-size: 11px; font-weight: 900; }
.page-footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px 4px; color: var(--muted); font: 800 11px var(--mono); }
.page-footer div { display: flex; gap: 20px; }
.page-footer a { color: var(--green); }
.toast { position: fixed; bottom: 22px; left: 50%; z-index: 20; display: none; max-width: 90vw; padding: 14px 22px; translate: -50% 0; border-radius: 12px; color: white; background: var(--ink); box-shadow: 0 6px 30px #0003; font-size: 13px; }
.toast.visible { display: block; }

@container control-panel (min-width: 290px) {
  .scenario-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1350px) {
  .lab-grid { grid-template-columns: 250px minmax(460px, 1fr) 300px; }
  .demo-card { padding: 30px; }
}

@media (max-width: 1080px) {
  .page { width: min(100% - 28px, 920px); }
  .lab-grid { grid-template-columns: 250px minmax(0, 1fr); }
  .inspector { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .inspector > header, .requirement-list { grid-column: 1 / -1; }
  .why, .event-log { border-right: 1px solid #464b43; }
  .fix-code, .inspector-note { border-bottom: 1px solid #464b43; }
  .notes-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .page { width: min(100% - 20px, 620px); padding-top: 20px; }
  .hero { align-items: stretch; flex-direction: column; padding: 0 4px 22px; }
  h1 { white-space: normal; font-size: clamp(33px, 11vw, 50px); }
  .hero-actions { align-self: flex-end; }
  .section-heading { min-height: 82px; padding: 15px; }
  .section-heading h2 { font-size: 21px; }
  .number { width: 42px; height: 42px; border-radius: 12px; }
  .heading-badges { display: none; }
  .lab-grid { display: block; }
  .controls { border-right: 0; border-bottom: 1px solid var(--line); }
  .controls section { padding: 17px; }
  .action-panel { grid-template-columns: 1fr 1fr; }
  .action-panel .label, .action-panel h3, .action-panel p:last-child { grid-column: 1 / -1; }
  .workspace { padding: 12px; }
  .instruction { padding: 0; }
  .instruction p { font-size: 10px; }
  .demo-header { padding: 0 16px; }
  .demo-header nav { display: none; }
  .scene { padding: 36px 12px 80px; }
  .demo-card { width: 100%; padding: 24px 18px; }
  .demo-card h3 { font-size: 30px; }
  .content-row { align-items: flex-start; flex-direction: column; }
  .popup { left: 0; translate: 0 6px; }
  .popup-pair[data-open="true"] .popup { translate: 0 0; }
  .popup::after { left: 28px; }
  .inspector { display: block; }
  .why, .event-log { border-right: 0; }
  .requirements-grid { grid-template-columns: 1fr; }
  .requirements-grid article { border-right: 0; border-bottom: 1px solid var(--line); }
  .exception-body { grid-template-columns: 1fr; }
  .page-footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 390px) {
  .hero-actions button { padding-inline: 12px; }
  .browser-bar > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

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