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

:root {
  --paper: #f4f0e7;
  --panel: #fffdf8;
  --ink: #171914;
  --muted: #68706a;
  --line: #cfd2c8;
  --coral: #ff7255;
  --acid: #b8ff38;
  --blue: #6f79ff;
  --mint: #71dfc2;
  --shadow: 0 18px 50px rgb(28 31 24 / 10%);
  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 4% 2%, rgb(111 121 255 / 13%), transparent 25rem),
    radial-gradient(circle at 96% 5%, rgb(255 114 85 / 12%), transparent 26rem),
    var(--paper);
}

button, input { font: inherit; }
button { color: inherit; }

.page {
  width: min(1540px, calc(100% - 36px));
  margin: 0 auto;
  padding: 30px 0 24px;
}

.hero {
  position: relative;
  min-height: 184px;
  padding: 8px 12px 24px;
}

.eyebrow,
.section-heading p,
.control-intro p,
.recipe-heading p {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.eyebrow { display: flex; align-items: center; gap: 9px; color: #3d49da; }
.eyebrow i { width: 18px; height: 18px; border: 2px solid currentColor; border-radius: 5px; box-shadow: 6px 6px 0 var(--acid); }

h1 {
  margin: 12px 0 7px;
  font-size: clamp(48px, 5.5vw, 88px);
  line-height: .92;
  letter-spacing: 0;
  font-weight: 800;
  white-space: nowrap;
}

.lead { margin: 18px 0 0; padding-right: 470px; color: var(--muted); font-size: clamp(16px, 1.5vw, 23px); font-weight: 700; }
.lead strong { color: var(--ink); }

.hero-actions { position: absolute; right: 12px; bottom: 24px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; align-items: center; }
.support-chip, .action-button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgb(255 253 248 / 80%);
  font-size: 12px;
  font-weight: 800;
}
.support-chip { display: inline-grid; place-items: center; color: #15745d; background: #e5fff5; border-color: #9bddc9; }
.support-chip.unsupported { color: #9a3e2b; background: #fff0e8; border-color: #f4aa94; }
.action-button { cursor: pointer; }
.action-button.dark { color: white; background: var(--ink); border-color: var(--ink); }
.action-button:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.lab,
.anatomy-panel,
.recipe-panel {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  gap: 13px;
  align-items: center;
  min-height: 84px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}
.section-number {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  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-heading p { color: #c44d38; }
.section-heading h2, .recipe-heading h2 { margin: 2px 0 0; font-size: clamp(20px, 2vw, 29px); line-height: 1.15; }
.same-html { display: flex; align-items: center; gap: 7px; margin-left: auto; padding: 8px 11px; border-radius: 999px; color: #2f46c0; background: #e9edff; font-size: 11px; font-weight: 800; }
.same-html i { width: 18px; height: 10px; border: 2px solid currentColor; border-radius: 50%; }

.lab-body { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 650px; }
.controls { padding: 22px; border-right: 1px solid var(--line); background: #faf7ef; border-radius: 0 0 0 26px; }
.control-intro { margin-bottom: 18px; }
.control-intro p { color: #15745d; }
.control-intro h3 { margin: 4px 0 0; font-size: 20px; }

.segmented { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: #eeece5; }
.segmented button { position: relative; z-index: 1; height: 43px; border: 0; background: transparent; cursor: pointer; font-size: 12px; font-weight: 800; }
.segment-indicator { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 9px; background: white; box-shadow: 0 4px 12px rgb(20 24 18 / 9%); transition: translate .3s cubic-bezier(.2,.8,.2,1), background .3s; }
.segmented:has([data-layout="subgrid"][aria-pressed="true"]) .segment-indicator { translate: 100% 0; background: var(--acid); }

.control-block { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.control-title { display: flex; justify-content: space-between; gap: 12px; align-items: end; }
.control-title div { display: grid; gap: 3px; }
.control-title span { color: #347269; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.control-title b { font-size: 14px; }
.control-title output { color: #4754d5; font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 700; }
.choice-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin-top: 11px; }
.choice-row.widths { grid-template-columns: repeat(3, 1fr); }
.choice-row button { min-height: 38px; border: 1px solid var(--line); border-radius: 10px; background: white; cursor: pointer; font-size: 11px; font-weight: 800; }
.choice-row button[aria-pressed="true"] { color: white; border-color: var(--ink); background: var(--ink); }
.control-help { margin: 9px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
input[type="range"] { width: 100%; margin: 17px 0 0; accent-color: var(--blue); }

.switch-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); cursor: pointer; }
.switch-row span { display: grid; gap: 3px; }
.switch-row b { font-size: 13px; }
.switch-row small { color: var(--muted); font-size: 10px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row i { position: relative; width: 46px; height: 26px; border-radius: 999px; background: #d5d7d0; transition: background .2s; }
.switch-row i::after { content: ""; position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; border-radius: 50%; background: white; transition: translate .2s; }
.switch-row input:checked + i { background: var(--blue); }
.switch-row input:checked + i::after { translate: 20px 0; }

.control-note { margin-top: 22px; padding: 15px; border: 1px solid #e4c9b9; border-radius: 13px; background: #fff1e8; }
.control-note span { color: #bc4a34; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.control-note p { margin: 6px 0 0; color: #5c554e; font-size: 11px; line-height: 1.55; }
.control-note.is-subgrid { border-color: #aad7c8; background: #e8fff7; }
.control-note.is-subgrid span { color: #08775c; }

.preview-wrap { min-width: 0; padding: 20px; background: #ebece6; border-radius: 0 0 26px 0; }
.preview-toolbar { display: flex; justify-content: space-between; gap: 18px; align-items: center; height: 48px; padding: 0 16px; border: 1px solid #bdc2b9; border-bottom: 0; border-radius: 16px 16px 0 0; background: #daddd5; }
.preview-toolbar p { display: flex; align-items: center; gap: 6px; margin: 0; color: #6a716b; font-size: 11px; font-weight: 700; }
.preview-toolbar p i { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }
.preview-toolbar p i:nth-child(2) { background: #ffd45c; }
.preview-toolbar p i:nth-child(3) { background: var(--mint); }
.preview-toolbar div { display: flex; align-items: center; gap: 9px; }
.preview-toolbar span { font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.preview-toolbar b { padding: 6px 9px; border-radius: 7px; color: white; background: var(--ink); font-size: 10px; }

.preview-viewport { overflow: auto; min-height: 520px; border: 1px solid #bdc2b9; border-radius: 0 0 16px 16px; background: #dfe1da; }
.preview-canvas {
  position: relative;
  width: min(100%, 1080px);
  min-width: 460px;
  min-height: 520px;
  margin: 0 auto;
  padding: 48px 34px 36px;
  background-color: #f8f5ed;
  background-image:
    linear-gradient(rgb(23 25 20 / 5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(23 25 20 / 5%) 1px, transparent 1px);
  background-size: 24px 24px;
  transition: width .35s cubic-bezier(.2,.8,.2,1);
}

.plans { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 980px; margin: 0 auto; }
.plan-card { position: relative; min-width: 0; overflow: hidden; border: 2px solid var(--ink); border-radius: 19px; background: #fffef9; box-shadow: 7px 7px 0 rgb(23 25 20 / 14%); }
.plan-card > :not(.popular) { padding-inline: 18px; }
.plan-name { padding-top: 20px; padding-bottom: 16px; background: var(--card-accent); }
.plan-name p { margin: 0 0 15px; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 800; letter-spacing: .09em; }
.plan-name h3 { margin: 0; font-size: clamp(25px, 3vw, 43px); line-height: .95; }
.price { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; margin-top: 19px; }
.price b { font-size: 18px; }
.price span { font-size: 10px; font-weight: 700; }
.plan-description { padding-top: 16px; padding-bottom: 16px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.plan-description p { margin: 0; font-size: 12px; font-weight: 700; line-height: 1.55; }
.plan-features { display: grid; align-content: start; gap: 8px; margin: 0; padding-top: 16px; padding-bottom: 16px; list-style: none; }
.plan-features li { position: relative; padding-left: 17px; color: #454b46; font-size: 11px; font-weight: 700; }
.plan-features li::before { content: ""; position: absolute; top: .45em; left: 0; width: 7px; height: 7px; border-radius: 2px; background: var(--card-accent); border: 1px solid var(--ink); }
.plan-action { padding-top: 16px; padding-bottom: 16px; border-top: 1px solid var(--ink); }
.plan-action button { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 42px; padding: 0 13px; border: 2px solid var(--ink); border-radius: 10px; background: var(--ink); color: white; cursor: pointer; font-size: 11px; font-weight: 800; }
.plan-action span { font-size: 16px; }
.plan-action small { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }
.coral { --card-accent: var(--coral); }
.acid { --card-accent: var(--acid); }
.blue { --card-accent: var(--blue); }
.popular { position: absolute; z-index: 2; top: 10px; right: -27px; rotate: 35deg; width: 110px; padding: 5px; color: white; background: var(--ink); text-align: center; font-size: 8px; font-weight: 800; }

.preview-canvas[data-layout="subgrid"] .plans { grid-template-rows: repeat(4, auto); }
.preview-canvas[data-layout="subgrid"] .plan-card { display: grid; grid-row: span 4; grid-template-rows: subgrid; }
.preview-canvas[data-layout="subgrid"] .plan-card > :not(.popular) { min-height: 0; }
.preview-canvas[data-layout="subgrid"] .plan-features { height: 100%; }

.alignment-guides { position: absolute; z-index: 3; pointer-events: none; opacity: 1; transition: opacity .2s; }
.alignment-guides span { position: absolute; left: 0; right: 0; display: flex; align-items: center; height: 1px; background: rgb(23 25 20 / 24%); color: #616760; font-family: "IBM Plex Mono", monospace; font-size: 8px; font-weight: 700; }
.alignment-guides span::before { content: attr(data-guide); position: absolute; left: 5px; bottom: 4px; padding: 2px 4px; background: #f8f5ed; }
.preview-canvas:not(.show-guides) .alignment-guides { opacity: 0; }
.preview-canvas[data-layout="independent"] .alignment-guides span { background: repeating-linear-gradient(90deg, rgb(255 80 55 / 68%) 0 6px, transparent 6px 11px); }
.preview-canvas[data-layout="subgrid"] .alignment-guides span { background: rgb(66 85 230 / 42%); }

.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.metric-strip div { min-width: 0; padding: 11px 13px; border: 1px solid #c5c9c1; border-radius: 11px; background: #fff; }
.metric-strip span { display: block; color: #4657c6; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.metric-strip b { display: block; margin-top: 3px; overflow: hidden; font-size: 17px; text-overflow: ellipsis; }

.explain-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 18px; margin-top: 18px; }
.section-heading.compact { min-height: 78px; }
.row-diagram { margin: 22px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #f2f3ee; }
.parent-label { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.parent-label span { color: #3f4ed2; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.parent-label b { font-size: 11px; }
.diagram-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.diagram-cards > div { display: grid; grid-template-rows: 42px 30px 58px 36px; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; background: white; }
.diagram-cards i { border-bottom: 1px solid var(--ink); }
.diagram-cards i:first-child { background: var(--acid); }
.diagram-cards i:last-child { border: 0; background: var(--ink); }
.benefit-list { display: grid; gap: 9px; padding: 0 22px 22px; }
.benefit-list > div { display: grid; grid-template-columns: 35px 1fr; gap: 10px; align-items: start; padding: 11px; border: 1px solid var(--line); border-radius: 12px; }
.benefit-list span { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; color: white; background: var(--ink); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.benefit-list p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.benefit-list b { display: block; color: var(--ink); font-size: 12px; }

.recipe-panel { overflow: hidden; color: #f7f5ee; background: #121611; border-color: #121611; }
.recipe-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; min-height: 78px; padding: 18px 22px; border-bottom: 1px solid #343a34; }
.recipe-heading p { color: var(--acid); }
.recipe-heading button { min-height: 42px; padding: 0 15px; border: 0; border-radius: 11px; background: var(--coral); cursor: pointer; font-size: 11px; font-weight: 800; }
.code-tabs { display: flex; gap: 4px; margin: 17px 20px 0; padding: 4px; border: 1px solid #3c433c; border-radius: 11px; background: #1b201b; }
.code-tabs button { flex: 1; height: 34px; border: 0; border-radius: 7px; color: #9ca39b; background: transparent; cursor: pointer; font-size: 10px; font-weight: 800; }
.code-tabs button[aria-selected="true"] { color: var(--ink); background: var(--acid); }
pre { min-height: 270px; margin: 10px 20px 0; padding: 18px; overflow: auto; border: 1px solid #353b35; border-radius: 13px; color: #d9ded8; background: #080b08; font-family: "IBM Plex Mono", monospace; font-size: 11px; line-height: 1.65; }
.code-key { color: #ff8067; }
.code-value { color: #b8ff38; }
.code-comment { color: #788077; }
.code-explain { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 15px 20px 20px; }
.code-explain div { padding: 11px; border: 1px solid #343b34; border-radius: 11px; background: #1a201a; }
.code-explain span { color: var(--mint); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.code-explain p { margin: 5px 0 0; color: #aab1a9; font-size: 10px; line-height: 1.55; }
.code-explain code { color: var(--acid); }

.page-footer { display: flex; justify-content: space-between; gap: 20px; padding: 22px 8px 0; color: #687069; font-size: 11px; }
.page-footer span { font-family: "IBM Plex Mono", monospace; font-weight: 700; }
.page-footer p { margin: 0; }

@container (max-width: 740px) {
  .plans { grid-template-columns: 1fr; max-width: 380px; }
  .alignment-guides { display: none; }
}

@media (max-width: 1120px) {
  .hero { min-height: 0; }
  .lead { padding-right: 0; }
  .hero-actions { position: static; justify-content: flex-start; margin-top: 18px; }
  .lab-body { grid-template-columns: 235px minmax(0, 1fr); }
  .preview-canvas { padding-inline: 22px; }
  .plan-card > :not(.popular) { padding-inline: 13px; }
}

@media (max-width: 820px) {
  .page { width: min(100% - 20px, 720px); padding-top: 18px; }
  .hero { padding-inline: 4px; }
  .lab-body { grid-template-columns: 1fr; }
  .controls { border-right: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  .preview-wrap { border-radius: 0 0 26px 26px; }
  .explain-grid { grid-template-columns: 1fr; }
  .preview-viewport { min-height: 470px; }
  .preview-canvas { min-height: 470px; }
}

@media (max-width: 540px) {
  h1 { font-size: clamp(28px, 9vw, 46px); }
  .section-heading { padding-inline: 15px; }
  .section-number { width: 42px; height: 42px; border-radius: 13px; }
  .same-html { display: none; }
  .preview-wrap { padding: 10px; }
  .preview-toolbar p { max-width: 150px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .code-explain { grid-template-columns: 1fr; }
  .page-footer { display: grid; }
}

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