:root {
  --paper: #f4f0e8;
  --surface: #fffdf7;
  --panel: #eceae3;
  --ink: #171814;
  --muted: #737872;
  --line: #c8cbc3;
  --purple: #6558ff;
  --coral: #ff624d;
  --green: #008b72;
  --lime: #a8ff1f;
  --yellow: #ffd86b;
  --shadow: 7px 8px 0 #171814;
  font-family: "DM Sans", "Noto Sans JP", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 88% 4%, #ffd9ce 0, transparent 25rem), var(--paper); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.page { width: min(1680px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0 28px; }

.hero { position: relative; min-height: 252px; padding: 30px 22px 24px; }
.eyebrow, .control-kicker, .section-heading p, .code-panel header p, .principles header p, .hover-control > p, .article-kicker { margin: 0; color: var(--green); font-family: "IBM Plex Mono", monospace; font-size: 12px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.eyebrow { display: flex; align-items: center; gap: 10px; }
.eyebrow i { width: 18px; height: 18px; border: 2px solid var(--purple); border-radius: 4px; box-shadow: 7px 7px 0 var(--lime); }
h1 { margin: 14px 0 0; font-size: min(6.15vw, 96px); line-height: .95; letter-spacing: 0; white-space: nowrap; }
.lead { margin: 22px 0 0; color: var(--muted); font-size: clamp(20px, 2vw, 31px); font-weight: 700; }
.lead strong { color: var(--ink); }
.hero-actions { position: absolute; right: 22px; bottom: 24px; display: flex; align-items: center; gap: 10px; }
.hero-actions button, .support-chip { min-height: 50px; padding: 0 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); font-size: 12px; font-weight: 800; white-space: nowrap; }
.support-chip { display: inline-flex; align-items: center; color: var(--green); background: #e9fff8; }
.hero-actions button { cursor: pointer; }
.hero-actions button:hover { transform: translateY(-2px); }
.hero-actions .dark { border-color: var(--ink); color: white; background: var(--ink); }

.designer-shell, .principles { overflow: hidden; border: 1px solid var(--line); border-radius: 28px; background: var(--surface); }
.section-heading { min-height: 92px; display: flex; align-items: center; gap: 18px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.section-number { width: 54px; height: 54px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 16px; color: white; background: var(--coral); font-family: "IBM Plex Mono", monospace; font-size: 13px; font-weight: 700; }
.section-heading h2, .code-panel h2, .principles h2 { margin: 3px 0 0; font-size: clamp(23px, 2.3vw, 34px); line-height: 1.1; }
.heading-readout { display: flex; gap: 10px; margin-left: auto; }
.heading-readout span { padding: 10px 13px; border-radius: 999px; background: #f0f1eb; color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 700; }
.heading-readout i { color: var(--purple); font-style: normal; }

.designer-grid { display: grid; grid-template-columns: 300px minmax(520px, 1fr) 338px; min-height: 720px; }
.controls { border-right: 1px solid var(--line); background: #f8f5ed; }
.control-section { padding: 24px 20px; border-bottom: 1px solid var(--line); }
.control-section h3 { margin: 5px 0 16px; font-size: 17px; }
.preset-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset-list button { min-height: 66px; display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; align-items: center; gap: 0 9px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; text-align: left; background: var(--surface); cursor: pointer; }
.preset-list button > span { width: 28px; height: 28px; grid-row: 1 / 3; display: grid; place-items: center; border-radius: 8px; background: #eef0eb; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.preset-list b { font-size: 12px; }
.preset-list small { color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; letter-spacing: .07em; }
.preset-list button[aria-pressed="true"] { border-color: var(--ink); color: white; background: var(--ink); }
.preset-list button[aria-pressed="true"] > span { color: var(--ink); background: var(--lime); }
.control-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.control-title p { margin: 0; color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.control-title h3 { margin-bottom: 13px; }
.control-title output { color: var(--purple); font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 700; }
input[type="range"] { width: 100%; height: 18px; margin: 0; accent-color: var(--purple); cursor: ew-resize; }
.range-labels { display: flex; justify-content: space-between; margin-top: 4px; color: #90948d; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.style-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.style-switch button, .segmented button, .hover-options button { min-height: 38px; border: 1px solid var(--line); background: var(--surface); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; cursor: pointer; }
.style-switch button { border-radius: 10px; }
.style-switch button[aria-pressed="true"], .segmented button[aria-pressed="true"] { border-color: var(--purple); color: white; background: var(--purple); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; }
.segmented button { border: 0; }
.control-help { margin: 11px 0 0; color: var(--muted); font-size: 10px; line-height: 1.65; }
.color-control { display: grid; grid-template-columns: 1fr auto; }
.color-field { height: 43px; display: flex; align-items: center; gap: 8px; padding: 5px 9px 5px 5px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.color-field input { width: 32px; height: 32px; padding: 0; overflow: hidden; border: 0; border-radius: 8px; background: none; cursor: pointer; }
.color-field span { font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.color-swatches { grid-column: 1 / -1; display: flex; gap: 9px; margin-top: 12px; }
.color-swatches button { width: 31px; height: 31px; padding: 0; border: 3px solid white; border-radius: 50%; background: var(--swatch); outline: 1px solid var(--line); cursor: pointer; }
.color-swatches button.active { outline: 3px solid var(--ink); }

.preview-column { min-width: 0; display: flex; flex-direction: column; background: #d9ddd5; }
.browser-bar { min-height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid #b7bcb3; background: #cfd4cc; }
.browser-bar > div { display: flex; align-items: center; gap: 6px; }
.browser-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }
.browser-bar i:nth-child(2) { background: var(--yellow); }
.browser-bar i:nth-child(3) { background: #55cda3; }
.browser-bar span { margin-left: 5px; color: #69706a; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.browser-bar strong { padding: 7px 10px; border-radius: 999px; color: white; background: var(--green); font-family: "IBM Plex Mono", monospace; font-size: 9px; }
.preview-stage { --demo-line-color: #6558ff; --demo-thickness: 2px; --demo-offset: 4px; --demo-style: solid; --demo-skip: auto; flex: 1; padding: clamp(24px, 4vw, 58px); background-color: #fffdf8; background-image: linear-gradient(#eaebe5 1px, transparent 1px), linear-gradient(90deg, #eaebe5 1px, transparent 1px); background-size: 28px 28px; }
.demo-link { color: inherit; text-decoration-line: underline; text-decoration-color: var(--demo-line-color); text-decoration-thickness: var(--demo-thickness); text-decoration-style: var(--demo-style); text-underline-offset: var(--demo-offset); text-decoration-skip-ink: var(--demo-skip); transition: color .2s ease, text-decoration-color .2s ease, text-decoration-thickness .2s ease; }
.preview-stage[data-hover="color"] .demo-link:hover, .preview-stage[data-hover="color"] .demo-link:focus-visible { color: var(--demo-line-color); text-decoration-color: var(--ink); }
.preview-stage[data-hover="thicken"] .demo-link:hover, .preview-stage[data-hover="thicken"] .demo-link:focus-visible { text-decoration-thickness: calc(var(--demo-thickness) + 2px); }
.demo-link:focus-visible { outline: 3px solid var(--lime); outline-offset: 5px; }
.article-preview { max-width: 760px; min-height: 390px; margin: 0 auto; padding: clamp(25px, 4vw, 52px); border: 2px solid var(--ink); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.article-preview nav { display: flex; justify-content: space-between; align-items: center; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.article-preview nav span, .small-link { font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.article-kicker { margin-top: 38px; }
.article-preview h3 { max-width: 650px; margin: 14px 0 24px; font-size: clamp(38px, 5.2vw, 76px); line-height: .93; letter-spacing: 0; }
.article-copy { max-width: 620px; margin: 0; font-size: clamp(14px, 1.3vw, 18px); font-weight: 600; line-height: 2; }
.article-meta { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 34px; padding-top: 19px; border-top: 1px solid var(--line); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.arrow-link b { display: inline-block; margin-left: 4px; }
.type-specimen { max-width: 760px; margin: 28px auto 0; padding: 24px 28px 31px; border: 1px solid var(--line); border-radius: 18px; background: #f3f0e7; }
.specimen-label { display: flex; justify-content: space-between; color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.specimen-label b { color: var(--purple); }
.specimen-link { display: inline-block; margin-top: 14px; font-size: clamp(30px, 4.2vw, 62px); font-weight: 800; line-height: 1.2; }
.measure-line { position: relative; display: flex; align-items: center; gap: 8px; margin-top: 22px; color: var(--coral); font-family: "IBM Plex Mono", monospace; font-size: 8px; font-weight: 700; }
.measure-line i { height: 1px; flex: 1; background: repeating-linear-gradient(90deg, var(--coral) 0 5px, transparent 5px 9px); }
.preview-footer { min-height: 67px; display: grid; grid-template-columns: repeat(3, auto) 1fr; align-items: center; gap: 0; border-top: 1px solid #adb2aa; color: white; background: var(--ink); }
.preview-footer > div { min-width: 110px; padding: 0 16px; border-right: 1px solid #3c3e38; }
.preview-footer span { display: block; color: #8e948b; font-family: "IBM Plex Mono", monospace; font-size: 8px; font-weight: 700; }
.preview-footer b { display: block; margin-top: 3px; color: var(--lime); font-family: "IBM Plex Mono", monospace; font-size: 11px; }
.preview-footer p { margin: 0; padding: 0 18px; color: #aeb3aa; font-size: 10px; text-align: right; }

.code-panel { min-width: 0; border-left: 1px solid var(--line); color: #f6f4ec; background: #20231e; }
.code-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 88px; padding: 18px; border-bottom: 1px solid #42463f; }
.code-panel header p { color: #82e2c2; font-size: 10px; }
.code-panel h2 { font-size: 21px; }
.code-panel header button { min-height: 39px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--lime); font-size: 10px; font-weight: 800; cursor: pointer; }
.code-tabs { display: flex; gap: 22px; height: 47px; padding: 0 18px; border-bottom: 1px solid #42463f; }
.code-tabs button { position: relative; border: 0; color: #90978d; background: transparent; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; cursor: pointer; }
.code-tabs button[aria-selected="true"] { color: white; }
.code-tabs button[aria-selected="true"]::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: var(--purple); }
.code-panel pre { min-height: 330px; margin: 0; padding: 23px 18px; overflow: auto; color: #d9dde0; font: 11px/1.8 "IBM Plex Mono", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.code-panel code .property { color: #82e2c2; }
.code-panel code .value { color: #ffd86b; }
.hover-control { padding: 20px 18px; border-top: 1px solid #42463f; border-bottom: 1px solid #42463f; }
.hover-control h3 { margin: 4px 0 13px; font-size: 16px; }
.hover-options { display: grid; grid-template-columns: 1fr; gap: 7px; }
.hover-options button { border-color: #4a4e47; border-radius: 9px; color: #d0d4cd; background: #292d27; }
.hover-options button[aria-pressed="true"] { border-color: var(--lime); color: var(--ink); background: var(--lime); }
.hover-control .hint { margin: 11px 0 0; color: #949a91; font-size: 10px; }
.accessibility-note { display: flex; align-items: flex-start; gap: 12px; margin: 18px; padding: 14px; border: 1px solid #4a4e47; border-radius: 13px; background: #292d27; }
.accessibility-note i { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--ink); background: var(--yellow); font-style: normal; font-weight: 800; }
.accessibility-note p { margin: 0; color: #aeb4aa; font-size: 10px; line-height: 1.55; }
.accessibility-note strong { display: block; margin-bottom: 3px; color: white; }

.principles { margin-top: 22px; }
.principles > header { min-height: 87px; display: flex; align-items: center; justify-content: space-between; padding: 18px 25px; border-bottom: 1px solid var(--line); }
.principles > header span { color: var(--purple); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.principle-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.principle-grid article { position: relative; min-height: 170px; padding: 30px; }
.principle-grid article + article { border-left: 1px solid var(--line); }
.principle-grid article > span { position: absolute; top: 22px; right: 22px; color: var(--coral); font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 700; }
.principle-grid h3 { margin: 0 0 12px; font-size: 22px; }
.principle-grid p { max-width: 380px; margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; line-height: 1.8; }
.page-footer { display: flex; justify-content: space-between; align-items: center; padding: 26px 5px 0; color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.page-footer p { margin: 0; }
.page-footer div { display: flex; gap: 24px; }
.page-footer a { color: inherit; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; padding: 13px 18px; border: 2px solid var(--ink); border-radius: 12px; color: var(--ink); background: var(--lime); box-shadow: 4px 4px 0 var(--ink); font-size: 12px; font-weight: 800; opacity: 0; transform: translateY(14px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1240px) {
  .hero { min-height: 220px; }
  .designer-grid { grid-template-columns: 280px minmax(480px, 1fr); }
  .code-panel { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; }
  .code-panel pre { min-height: 240px; }
  .hover-options { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
  .page { width: min(100% - 20px, 720px); padding-top: 18px; }
  .hero { min-height: auto; display: block; padding: 28px 10px; }
  h1 { font-size: clamp(48px, 12vw, 84px); white-space: normal; }
  .hero-actions { position: static; justify-content: flex-start; max-width: none; margin-top: 26px; }
  .support-chip { display: none; }
  .section-heading { align-items: flex-start; }
  .heading-readout { display: none; }
  .designer-grid { display: block; }
  .controls { border-right: 0; }
  .preset-list { grid-template-columns: repeat(2, 1fr); }
  .preview-stage { padding: 26px 18px 34px; }
  .article-preview { min-height: 0; padding: 28px 24px; }
  .article-preview h3 { font-size: clamp(38px, 9vw, 66px); }
  .type-specimen { padding: 20px; }
  .specimen-link { font-size: clamp(27px, 7vw, 50px); }
  .preview-footer { grid-template-columns: repeat(3, 1fr); }
  .preview-footer > div { min-width: 0; }
  .preview-footer p { grid-column: 1 / -1; padding: 14px 18px; border-top: 1px solid #3c3e38; text-align: left; }
  .principle-grid { grid-template-columns: 1fr; }
  .principle-grid article + article { border-top: 1px solid var(--line); border-left: 0; }
}

@media (max-width: 520px) {
  .page { width: calc(100% - 12px); }
  .hero { padding: 22px 8px; }
  h1 { font-size: 49px; line-height: .92; }
  .lead { font-size: 18px; }
  .hero-actions button { flex: 1; }
  .designer-shell, .principles { border-radius: 20px; }
  .section-heading { padding: 15px; }
  .section-number { width: 46px; height: 46px; border-radius: 13px; }
  .section-heading h2 { font-size: 22px; }
  .control-section { padding: 22px 17px; }
  .browser-bar { padding: 0 12px; }
  .browser-bar span { max-width: 155px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .article-preview nav span { display: none; }
  .article-preview h3 { font-size: 39px; }
  .article-copy { font-size: 14px; }
  .article-meta { align-items: flex-end; }
  .specimen-link { font-size: 29px; }
  .preview-footer > div { padding: 12px 9px; }
  .hover-options { grid-template-columns: 1fr; }
  .principles > header { align-items: flex-start; }
  .principles > header > span { display: none; }
  .page-footer { align-items: flex-start; gap: 18px; }
  .page-footer div { flex-direction: column; gap: 6px; text-align: right; }
}

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