@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@500;600;700;800&family=IBM+Plex+Mono:wght@500;600;700&family=Noto+Sans+JP:wght@500;600;700;800&display=swap");

:root {
  --paper: #f2eee5;
  --panel: #fffdf8;
  --ink: #171914;
  --muted: #68706a;
  --line: #cfd1c8;
  --acid: #b4ff2b;
  --coral: #ff6d58;
  --blue: #6d75f7;
  --yellow: #ffd86f;
  --mint: #66dec0;
  --purple: #8b5cf6;
  font-family: "DM Sans", "Noto Sans JP", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 2% 0%, rgb(109 117 247 / 15%), transparent 27rem), radial-gradient(circle at 98% 2%, rgb(255 109 88 / 14%), transparent 30rem), var(--paper); }
button, input { font: inherit; }
button { color: inherit; }
code, pre { font-family: "IBM Plex Mono", monospace; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.page { width: min(1640px, calc(100% - 34px)); margin: 0 auto; padding: 28px 0 22px; }
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 32px; min-height: 212px; padding: 8px 14px 26px; }
.hero > div:first-child { display: contents; }
.eyebrow, .section-heading p, .control-head p, .code-heading p { margin: 0; color: #08765e; font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow { grid-column: 1 / -1; align-self: end; display: flex; align-items: center; gap: 10px; }
.eyebrow i { width: 19px; height: 19px; border: 2px solid currentColor; border-radius: 5px; box-shadow: 6px 6px 0 var(--acid); }
h1 { grid-column: 1 / -1; margin: 13px 0 0; font-size: clamp(42px, 5.4vw, 86px); font-weight: 800; line-height: .92; letter-spacing: 0; white-space: nowrap; }
.lead { align-self: end; margin: 22px 0 0; color: var(--muted); font-size: clamp(16px, 1.45vw, 22px); font-weight: 700; }
.lead strong { color: var(--ink); }
.hero-actions { align-self: end; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; align-items: center; padding-bottom: 3px; }
.hero-actions button, .support-badge { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 13px; background: rgb(255 253 248 / 88%); font-size: 11px; font-weight: 800; }
.hero-actions button { cursor: pointer; }
.hero-actions .dark { color: white; border-color: var(--ink); background: var(--ink); }
.support-badge { display: grid; place-items: center; color: #08765e; border-color: #9edbc9; background: #e8fff7; font-family: "IBM Plex Mono", monospace; }

.lab, .order-panel, .code-panel, .use-cases { overflow: hidden; border: 1px solid var(--line); border-radius: 27px; background: var(--panel); box-shadow: 0 18px 50px rgb(28 31 24 / 9%); }
.section-heading { display: flex; align-items: center; gap: 14px; min-height: 86px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.section-heading.compact { min-height: 78px; }
.section-number { display: grid; place-items: center; flex: 0 0 auto; width: 49px; height: 49px; border-radius: 15px; color: white; background: var(--coral); font-family: "IBM Plex Mono", monospace; font-size: 13px; font-weight: 800; }
.section-number.blue { background: var(--blue); }
.section-number.yellow { color: var(--ink); background: var(--yellow); }
.section-heading h2, .code-heading h2 { margin: 3px 0 0; font-size: clamp(20px, 2vw, 30px); line-height: 1.1; }
.heading-status { display: flex; align-items: center; gap: 8px; margin-left: auto; color: #5a60c8; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.heading-status > span { color: var(--blue); font-size: 18px; }
.heading-status b { padding: 7px 10px; border-radius: 999px; color: white; background: var(--ink); }
.heading-status b.important { color: var(--ink); background: var(--yellow); }

.lab-grid { display: grid; grid-template-columns: 286px minmax(520px, 1fr) 310px; min-height: 820px; }
.controls { padding: 22px; border-right: 1px solid var(--line); background: #faf7ef; }
.control-head { margin-bottom: 15px; }
.control-head h3 { margin: 4px 0 0; font-size: 20px; }
.preset-list { display: grid; gap: 7px; }
.preset-list button { display: grid; grid-template-columns: 31px 1fr; grid-template-rows: auto auto; column-gap: 9px; min-height: 57px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; background: white; text-align: left; cursor: pointer; }
.preset-list button > span { grid-row: 1 / 3; display: grid; place-items: center; align-self: center; width: 31px; height: 31px; border-radius: 8px; color: #656d67; background: #edf0eb; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.preset-list b { align-self: end; font-size: 12px; }
.preset-list small { color: var(--muted); font-size: 10px; font-weight: 700; }
.preset-list button[aria-pressed="true"] { color: white; border-color: var(--ink); background: var(--ink); }
.preset-list button[aria-pressed="true"] > span { color: var(--ink); background: var(--acid); }
.preset-list button[aria-pressed="true"] small { color: #b9c0ba; }

.layer-control { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.control-title { display: flex; align-items: end; justify-content: space-between; gap: 10px; }
.control-title div { display: grid; gap: 3px; }
.control-title span { color: #08765e; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.control-title b { font-size: 13px; }
.control-title small { color: #858b86; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.layer-list { display: grid; gap: 5px; margin: 12px 0 0; padding: 0; list-style: none; }
.layer-item { display: grid; grid-template-columns: 20px 23px 1fr auto; align-items: center; gap: 7px; min-height: 42px; padding: 5px 6px; border: 1px solid #d5d7d0; border-radius: 10px; background: white; cursor: grab; }
.layer-item.dragging { opacity: .45; }
.layer-grip { color: #9ca29d; font-size: 14px; letter-spacing: -3px; }
.layer-index { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 6px; color: #4d55c7; background: #edf0ff; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.layer-name { overflow: hidden; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.layer-arrows { display: flex; gap: 3px; }
.layer-arrows button { display: grid; place-items: center; width: 25px; height: 25px; padding: 0; border: 1px solid #d2d5cd; border-radius: 6px; background: #f5f5f1; cursor: pointer; font-size: 11px; }
.layer-arrows button:disabled { opacity: .28; cursor: default; }
.layer-hint { margin: 9px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; font-weight: 700; }

.switches { display: grid; margin-top: 18px; border-top: 1px solid var(--line); }
.switches label { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 58px; border-bottom: 1px solid var(--line); cursor: pointer; }
.switches label > span { display: grid; gap: 2px; }
.switches b { font-size: 11px; }
.switches small { color: var(--muted); font-size: 10px; line-height: 1.25; font-weight: 600; }
.switches code { font-size: 10px; }
.switches input { position: absolute; opacity: 0; pointer-events: none; }
.switches i { position: relative; flex: 0 0 auto; width: 39px; height: 23px; border-radius: 999px; background: #d5d7d0; }
.switches i::after { content: ""; position: absolute; top: 4px; left: 4px; width: 15px; height: 15px; border-radius: 50%; background: white; transition: translate .18s; }
.switches input:checked + i { background: var(--blue); }
.switches input:checked + i::after { translate: 16px 0; }

.stage { min-width: 0; padding: 18px; background: #e8ebe5; }
.browser-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; height: 46px; padding: 0 14px; border: 1px solid #bec3ba; border-bottom: 0; border-radius: 15px 15px 0 0; background: #d7dcd4; }
.browser-bar p { display: flex; align-items: center; gap: 6px; margin: 0; color: #69716b; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.browser-bar p i { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }
.browser-bar p i:nth-child(2) { background: var(--yellow); }
.browser-bar p i:nth-child(3) { background: var(--mint); }
.browser-bar span { color: #08765e; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.preview-canvas { position: relative; min-height: 420px; padding: 48px 28px 24px; overflow: hidden; border: 1px solid #bec3ba; background-color: #f8f5ed; background-image: linear-gradient(rgb(23 25 20 / 4%) 1px, transparent 1px), linear-gradient(90deg, rgb(23 25 20 / 4%) 1px, transparent 1px); background-size: 28px 28px; }
.axis-label { display: flex; align-items: center; gap: 10px; color: #707772; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.axis-label i { position: relative; flex: 1; height: 2px; background: linear-gradient(90deg, #c9ccc5, var(--purple)); }
.axis-label i::after { content: ""; position: absolute; right: 0; top: 50%; width: 8px; height: 8px; border-top: 2px solid var(--purple); border-right: 2px solid var(--purple); transform: translateY(-50%) rotate(45deg); }
.axis-label b { color: var(--purple); }
.preview-host { display: grid; place-items: center; min-height: 278px; }
.computed-strip { display: grid; grid-template-columns: auto auto 17px 1fr; align-items: center; gap: 9px; min-height: 49px; padding: 0 14px; border: 2px solid var(--ink); border-radius: 12px; background: white; font-size: 10px; }
.computed-strip span { color: #08765e; font-family: "IBM Plex Mono", monospace; font-weight: 700; }
.computed-strip code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.computed-strip i { width: 17px; height: 17px; border: 2px solid var(--ink); border-radius: 5px; }
.computed-strip b { font-family: "IBM Plex Mono", monospace; font-size: 11px; }

.rule-stack { display: grid; gap: 7px; margin-top: 12px; }
.rule-card { position: relative; display: grid; grid-template-columns: 23px minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 3px 9px; min-height: 59px; padding: 9px 11px; overflow: hidden; border: 1px solid #c9cdc4; border-radius: 11px; background: #f9faf6; }
.rule-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--rule-color); }
.rule-rank { grid-row: 1 / 3; display: grid; place-items: center; align-self: center; width: 23px; height: 23px; border-radius: 6px; color: #59615b; background: #e9ece6; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.rule-card code { overflow: hidden; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.rule-card p { margin: 0; color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 10px; }
.rule-card p b { color: var(--ink); }
.rule-meta { grid-column: 3; grid-row: 1 / 3; display: grid; align-content: center; justify-items: end; gap: 4px; }
.rule-meta span { font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.rule-meta small { color: var(--muted); font-size: 10px; }
.rule-card.winner { color: white; border-color: var(--ink); background: var(--ink); box-shadow: 6px 6px 0 var(--rule-color); }
.rule-card.winner .rule-rank { color: var(--ink); background: var(--acid); }
.rule-card.winner p, .rule-card.winner p b, .rule-card.winner .rule-meta small { color: #dce1da; }
.rule-card.reverted { opacity: .55; }
.rule-card.reverted::after { content: "ROLLED BACK"; position: absolute; right: 9px; bottom: 5px; color: var(--coral); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }

.inspector { color: #f7f6ef; background: #1b1e19; }
.inspector > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 68px; padding: 0 18px; border-bottom: 1px solid #383c36; }
.inspector > header p, .decision-head p { margin: 0; color: #99a099; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.inspector > header span { padding: 6px 8px; border-radius: 999px; color: var(--ink); background: var(--acid); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.winner-card { margin: 18px; padding: 18px; border: 1px solid #484d45; border-radius: 16px; background: #242821; box-shadow: inset 4px 0 0 var(--winner-color, var(--acid)); }
.winner-card > span { color: var(--winner-color, var(--acid)); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.winner-card > code { display: block; margin: 15px 0 9px; overflow: hidden; color: white; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.winner-card p { margin: 0; font-family: "IBM Plex Mono", monospace; font-size: 11px; }
.winner-card p b { color: var(--winner-color, var(--acid)); }
.decision-head { display: flex; justify-content: space-between; gap: 10px; padding: 7px 18px 10px; }
.decision-head span { color: #8c938c; font-size: 10px; }
.decision-list { margin: 0; padding: 0; border-top: 1px solid #383c36; list-style: none; }
.decision-list li { display: grid; grid-template-columns: 31px 1fr auto; align-items: center; gap: 9px; min-height: 61px; padding: 8px 18px; border-bottom: 1px solid #383c36; }
.decision-list li > span { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #4d524a; border-radius: 8px; color: #aab0aa; font-family: "IBM Plex Mono", monospace; font-size: 10px; }
.decision-list li div { display: grid; gap: 3px; }
.decision-list li b { font-size: 11px; }
.decision-list li small { color: #9aa19a; font-size: 10px; line-height: 1.25; }
.decision-list li em { color: #9da49d; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-style: normal; font-weight: 700; }
.decision-list li.active { background: #262b23; }
.decision-list li.active > span { color: var(--ink); border-color: var(--acid); background: var(--acid); }
.decision-list li.active em { color: var(--acid); }
.why-box { margin: 18px; padding: 16px; border: 1px solid #464b43; border-radius: 14px; background: #11140f; }
.why-box span { color: var(--yellow); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.why-box p { margin: 8px 0 0; color: #d9ddd7; font-size: 11px; line-height: 1.6; font-weight: 700; }

.lower-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.order-steps { display: grid; grid-template-columns: repeat(7, 1fr); min-height: 290px; padding: 34px 24px; }
.order-steps > div { position: relative; padding: 74px 12px 14px; border-right: 1px solid var(--line); }
.order-steps > div:last-child { border-right: 0; }
.order-steps > div::before { content: ""; position: absolute; top: 37px; left: 0; right: 0; height: 2px; background: #d4d6cf; }
.order-steps > div:first-child::before { left: 50%; }
.order-steps > div:last-child::before { right: 50%; }
.order-steps span { position: absolute; z-index: 2; top: 24px; left: 50%; display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid var(--ink); border-radius: 50%; background: var(--panel); transform: translateX(-50%); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.order-steps .active { background: #f1eeff; }
.order-steps .active span { color: white; border-color: var(--purple); background: var(--purple); box-shadow: 0 0 0 6px rgb(139 92 246 / 13%); }
.order-steps b { display: block; font-size: 12px; text-align: center; }
.order-steps p { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.35; text-align: center; }

.code-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 78px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.code-heading button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 11px; color: white; background: var(--ink); cursor: pointer; font-size: 11px; font-weight: 800; }
.code-tabs { display: flex; gap: 5px; padding: 12px 20px 0; }
.code-tabs button { min-width: 62px; height: 35px; border: 1px solid var(--line); border-radius: 9px; background: white; cursor: pointer; font-size: 10px; font-weight: 800; }
.code-tabs button[aria-selected="true"] { color: white; border-color: var(--purple); background: var(--purple); }
.code-panel pre { height: 180px; margin: 12px 20px 0; padding: 17px; overflow: auto; border: 1px solid #363b34; border-radius: 14px; color: #ecf2e8; background: #171a16; font-size: 11px; line-height: 1.65; }
.code-note { margin: 13px 20px 20px; color: var(--muted); font-size: 10px; line-height: 1.5; font-weight: 700; }

.use-cases { margin-top: 18px; }
.use-case-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.use-case-grid article { min-height: 190px; padding: 28px; border-right: 1px solid var(--line); }
.use-case-grid article:last-child { border-right: 0; }
.use-case-grid span { color: #08765e; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.use-case-grid h3 { margin: 39px 0 13px; font-size: clamp(19px, 1.8vw, 27px); }
.use-case-grid code { display: block; padding: 11px; overflow: auto; border-radius: 9px; color: #eaf0e6; background: var(--ink); font-size: 10px; white-space: nowrap; }
.page-footer { display: flex; justify-content: space-between; gap: 20px; padding: 24px 14px 5px; color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.page-footer a { color: var(--ink); }

@media (max-width: 1250px) {
  .lab-grid { grid-template-columns: 270px minmax(470px, 1fr); }
  .inspector { grid-column: 1 / -1; display: grid; grid-template-columns: 240px 1fr 300px; align-items: start; }
  .inspector > header { grid-column: 1 / -1; }
  .decision-head { display: none; }
  .decision-list { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 0; }
  .decision-list li { border-top: 1px solid #383c36; }
}

@media (max-width: 900px) {
  .hero { display: block; }
  .hero > div:first-child { display: block; }
  .hero-actions { justify-content: flex-start; margin-top: 24px; }
  .lab-grid { grid-template-columns: 1fr; }
  .controls { border-right: 0; border-bottom: 1px solid var(--line); }
  .preset-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layer-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inspector { grid-column: auto; grid-template-columns: 1fr; }
  .decision-list { grid-template-columns: repeat(2, 1fr); }
  .lower-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .page { width: min(100% - 18px, 1640px); padding-top: 16px; }
  .hero { min-height: 0; padding: 10px 7px 22px; }
  h1 { font-size: clamp(21px, 7vw, 38px); }
  .lead { font-size: 14px; line-height: 1.5; }
  .support-badge { width: 100%; }
  .section-heading { padding: 15px; }
  .heading-status { display: none; }
  .preset-list, .layer-list { grid-template-columns: 1fr; }
  .stage { padding: 10px; }
  .browser-bar span { display: none; }
  .preview-canvas { min-height: 375px; padding: 35px 14px 14px; }
  .computed-strip { grid-template-columns: auto 1fr 17px; }
  .computed-strip b { grid-column: 2 / -1; }
  .rule-card { grid-template-columns: 23px minmax(0, 1fr); }
  .rule-meta { grid-column: 2; grid-row: 3; justify-items: start; grid-auto-flow: column; justify-content: start; }
  .decision-list { grid-template-columns: 1fr; }
  .order-steps { grid-template-columns: repeat(2, 1fr); padding: 18px 12px; }
  .order-steps > div { min-height: 126px; border-bottom: 1px solid var(--line); }
  .order-steps > div::before { display: none; }
  .use-case-grid { grid-template-columns: 1fr; }
  .use-case-grid article { border-right: 0; border-bottom: 1px solid var(--line); }
  .page-footer { display: grid; }
}

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