:root {
  --ink: #171914;
  --paper: #f1eee5;
  --panel: #fffdf8;
  --soft: #e6e7df;
  --line: #cfd2c8;
  --muted: #68706b;
  --lime: #b6ff2f;
  --coral: #ff6f57;
  --blue: #6976f4;
  --butter: #ffd868;
  --green: #057a61;
  --shadow: 0 22px 58px rgb(23 25 20 / 9%);
  --poster-accent: var(--lime);
  --poster-ground: #fdf9ee;
  --poster-ink: var(--ink);
  --headline-width: 82%;
  --preview-panel-height: 840px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 4% 2%, rgb(105 118 244 / 12%), transparent 24%),
    radial-gradient(circle at 96% 0%, rgb(255 111 87 / 13%), transparent 27%),
    var(--paper);
  font-family: "Noto Sans JP", system-ui, sans-serif;
}

button,
textarea,
input { font: inherit; }

button { color: inherit; }

a { color: inherit; }

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
.resize-handle:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.page {
  width: min(100% - 36px, 1600px);
  margin: 0 auto;
  padding: 22px 0 34px;
}

.hero {
  position: relative;
  min-height: 200px;
  padding: 8px 12px 28px;
}

.eyebrow,
.section-heading p,
.control-intro p,
.sub-heading p,
.code-heading p,
.page-footer p {
  margin: 0;
  color: var(--green);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
}

.eyebrow { display: flex; align-items: center; gap: 10px; }
.eyebrow i { width: 18px; height: 18px; border: 2px solid var(--blue); border-radius: 5px; box-shadow: 5px 5px 0 var(--lime); }

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

.lead { margin: 22px 0 0; padding-right: 470px; color: var(--muted); font-size: clamp(15px, 1.3vw, 21px); font-weight: 700; }
.lead strong { color: var(--ink); }

.hero-actions { position: absolute; right: 12px; bottom: 28px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.support-chip,
.top-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 13px;
  font-size: 11px;
  font-weight: 800;
}
.support-chip { display: grid; place-items: center; padding: 0 15px; color: var(--green); background: #e7fff5; }
.support-chip.simulated { color: #745200; background: #fff5cf; }
.top-button { padding: 0 18px; background: var(--panel); cursor: pointer; transition: transform .18s ease, background .18s ease; }
.top-button:hover { transform: translateY(-2px); }
.top-button.dark { color: white; background: var(--ink); border-color: var(--ink); }

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

.lab-shell { overflow: hidden; }

.section-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 86px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}

.section-number {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  color: white;
  background: var(--coral);
  border-radius: 14px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 800;
}

.section-heading h2,
.sub-heading h2,
.code-panel h2 { margin: 3px 0 0; font-size: clamp(22px, 2vw, 31px); line-height: 1.05; }

.heading-metrics { display: flex; gap: 8px; margin-left: auto; }
.heading-metrics span { display: flex; align-items: baseline; gap: 5px; padding: 8px 11px; color: var(--muted); background: #f0f1eb; border-radius: 999px; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.heading-metrics i { color: var(--blue); font-size: 14px; font-style: normal; }

.studio { display: grid; grid-template-columns: 310px minmax(0, 1fr); align-items: start; }

.controls {
  align-self: start;
  width: 100%;
  padding: 22px 20px;
  background: #f7f4ec;
  border-right: 1px solid var(--line);
}

.control-intro h3 { margin: 5px 0 0; font-size: 20px; line-height: 1.25; }

.preset-list { display: grid; gap: 7px; margin-top: 16px; }
.preset-list button {
  display: grid;
  grid-template-columns: 29px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 43px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.preset-list button:hover { transform: translateX(2px); }
.preset-list button[aria-pressed="true"] { color: white; background: var(--ink); border-color: var(--ink); }
.preset-list button span { display: grid; place-items: center; width: 27px; height: 27px; color: var(--ink); background: var(--lime); border-radius: 8px; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 800; }
.preset-list button b { font-size: 11px; }
.preset-list button small { color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.preset-list button[aria-pressed="true"] small { color: #adb4ae; }

.control-block { padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.control-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.control-label label,
.control-label > span { font-size: 11px; font-weight: 800; }
.control-label output { color: var(--blue); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }

.text-control textarea {
  display: block;
  width: 100%;
  min-height: 78px;
  resize: vertical;
  padding: 10px 11px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}
.text-control p { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

.segmented { display: grid; grid-template-columns: repeat(2, 1fr); padding: 3px; background: #ebeae3; border: 1px solid var(--line); border-radius: 12px; }
.segmented.three { grid-template-columns: repeat(3, 1fr); }
.segmented.line-fit { grid-template-columns: 1.2fr .9fr .9fr; }
.segmented button { min-height: 35px; padding: 4px 6px; background: transparent; border: 0; border-radius: 8px; font-size: 10px; font-weight: 800; cursor: pointer; }
.segmented button[aria-pressed="true"] { color: var(--ink); background: var(--lime); box-shadow: 0 2px 8px rgb(23 25 20 / 12%); }
.distribution-control.is-disabled { opacity: .46; }
.distribution-control.is-disabled button { cursor: not-allowed; }

input[type="range"] {
  width: 100%;
  height: 18px;
  margin: 0;
  accent-color: var(--blue);
  cursor: pointer;
}
.range-hints { display: flex; justify-content: space-between; color: #8a918c; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 600; }

.preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  height: var(--preview-panel-height);
  padding: 18px;
  background: #e5e7e0;
}

.browser-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 48px;
  padding: 8px 16px;
  background: #d7dad3;
  border: 1px solid #bfc4bb;
  border-radius: 15px 15px 0 0;
}
.browser-address { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--muted); font-size: 10px; font-weight: 700; }
.browser-address i { flex: 0 0 auto; width: 8px; height: 8px; background: var(--coral); border-radius: 50%; }
.browser-address i:nth-child(2) { background: var(--butter); }
.browser-address i:nth-child(3) { background: #50c99a; }
.browser-address span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser-state { display: flex; align-items: center; gap: 8px; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 800; }
.browser-state b,
.browser-state span { padding: 7px 9px; border-radius: 999px; }
.browser-state b { color: var(--ink); background: var(--lime); }
.browser-state b.native { color: white; background: var(--green); }
.browser-state span { color: white; background: var(--blue); }

.preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 24px;
  overflow: hidden;
  background:
    linear-gradient(rgb(23 25 20 / 7%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(23 25 20 / 7%) 1px, transparent 1px),
    #eeece4;
  background-size: 24px 24px;
  border-inline: 1px solid #bfc4bb;
}

.poster {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 930px);
  height: min(100%, 650px);
  min-height: 480px;
  padding: 22px;
  color: var(--poster-ink);
  background: var(--poster-ground);
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: 13px 15px 0 rgb(23 25 20 / 13%);
  overflow: hidden;
  transition: color .28s ease, background .28s ease;
}

.poster-topline,
.poster-footer { position: relative; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 18px; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.poster-topline { padding-bottom: 14px; border-bottom: 2px solid currentColor; }
.poster-footer { align-items: flex-end; padding-top: 14px; border-top: 2px solid currentColor; }
.poster-footer p { margin: 0; max-width: 52ch; font-family: "Noto Sans JP", sans-serif; font-size: 11px; line-height: 1.45; letter-spacing: 0; }

.headline-frame {
  position: relative;
  z-index: 3;
  align-self: center;
  width: var(--headline-width);
  max-width: calc(100% - 20px);
  min-height: 170px;
  padding: 20px 26px 24px 0;
  border-right: 2px dashed var(--blue);
  transition: width .18s cubic-bezier(.2,.8,.2,1);
}
.headline-frame::before,
.headline-frame::after { content: ""; position: absolute; right: -5px; width: 8px; height: 8px; background: var(--blue); border-radius: 50%; }
.headline-frame::before { top: 0; }
.headline-frame::after { bottom: 0; }

.poster-headline {
  position: relative;
  z-index: 2;
  margin: 0;
  max-width: 100%;
  color: inherit;
  font-family: "Noto Sans JP", sans-serif;
  /* `grow` starts from this readable minimum and only scales upward. */
  font-size: clamp(48px, 3.6vw, 64px);
  font-weight: 900;
  line-height: .84;
  letter-spacing: 0;
  text-transform: uppercase;
  text-wrap: nowrap;
}
.poster-headline.font-serif { font-family: "DM Serif Display", serif; font-weight: 400; }
.poster-headline.font-mono { font-family: "IBM Plex Mono", monospace; font-weight: 700; }
.poster-headline.is-native { white-space: pre; }
.poster-headline.is-fallback { display: grid; justify-items: start; }
.fit-line { display: block; max-width: none; white-space: nowrap; transform-origin: left center; }

.resize-handle {
  position: absolute;
  top: 50%;
  right: -18px;
  z-index: 8;
  display: grid;
  place-items: center;
  width: 34px;
  height: 68px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--lime);
  box-shadow: 4px 5px 0 rgb(23 25 20 / 14%);
  translate: 0 -50%;
  cursor: ew-resize;
  touch-action: none;
}
.resize-handle i,
.resize-handle::before,
.resize-handle::after { width: 2px; height: 22px; background: var(--ink); border-radius: 99px; }
.resize-handle::before,
.resize-handle::after { content: ""; position: absolute; }
.resize-handle::before { translate: -6px 0; }
.resize-handle::after { translate: 6px 0; }

.poster-art { position: absolute; right: -70px; bottom: 65px; z-index: 1; width: 270px; height: 270px; border: 3px solid var(--ink); border-radius: 50%; background: var(--poster-accent); transition: background .28s ease; }
.poster-art i { position: absolute; border: 3px solid var(--ink); border-radius: 50%; }
.poster-art i:first-child { inset: 18%; background: var(--coral); }
.poster-art i:nth-child(2) { inset: 36%; background: var(--butter); }
.poster-art i:nth-child(3) { top: 49%; left: -35%; width: 170%; height: 3px; background: var(--ink); border: 0; border-radius: 0; rotate: -18deg; }
.poster-art b { position: absolute; top: 30px; left: -8px; padding: 7px 13px; color: white; background: var(--ink); border-radius: 999px; font: 800 10px "IBM Plex Mono", monospace; rotate: -10deg; }

body[data-preset="campaign"] { --poster-accent: var(--coral); --poster-ground: #191b17; --poster-ink: #fffdf8; }
body[data-preset="sale"] { --poster-accent: var(--blue); --poster-ground: var(--butter); --poster-ink: var(--ink); }
body[data-preset="japanese"] { --poster-accent: var(--butter); --poster-ground: #6976f4; --poster-ink: #fffdf8; }
body[data-preset="data"] { --poster-accent: var(--lime); --poster-ground: #171914; --poster-ink: #b6ff2f; }

.preview-footer {
  display: grid;
  grid-template-columns: repeat(4, auto) minmax(240px, 1fr);
  align-items: center;
  gap: 0;
  min-height: 68px;
  padding: 10px 14px;
  color: white;
  background: var(--ink);
  border-radius: 0 0 15px 15px;
}
.preview-footer div { min-width: 88px; padding: 0 13px; border-right: 1px solid #374039; }
.preview-footer div:first-child { padding-left: 0; }
.preview-footer small { display: block; color: #8f9892; font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; }
.preview-footer b { display: block; margin-top: 2px; color: var(--lime); font-family: "IBM Plex Mono", monospace; font-size: 12px; }
.preview-footer p { margin: 0 0 0 auto; color: #aeb5b0; font-size: 10px; line-height: 1.45; text-align: right; }

.lower-grid { display: grid; grid-template-columns: .92fr 1.08fr; gap: 18px; margin-top: 18px; }
.comparison-panel,
.code-panel { min-width: 0; padding: 22px; }
.sub-heading,
.code-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.sub-heading > span { flex: 0 0 auto; padding: 8px 10px; color: var(--blue); background: #eef0ff; border-radius: 999px; font: 700 10px "IBM Plex Mono", monospace; }

.comparison-list { display: grid; gap: 8px; margin-top: 20px; }
.comparison-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 12px; min-height: 76px; padding: 10px 14px; background: #f0eee7; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.comparison-row > span { color: var(--muted); font: 700 10px "IBM Plex Mono", monospace; }
.comparison-row p { margin: 0; white-space: nowrap; font-size: 42px; font-weight: 900; line-height: .9; transform-origin: left center; }
.comparison-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; padding: 11px 12px; background: #f5f2e9; border-radius: 11px; }
.comparison-note i { flex: 0 0 auto; width: 9px; height: 9px; margin-top: 3px; background: var(--butter); border-radius: 50%; box-shadow: 0 0 0 5px rgb(255 216 104 / 18%); }
.comparison-note p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }

.code-heading button { min-height: 37px; padding: 0 13px; color: white; background: var(--ink); border: 0; border-radius: 10px; font-size: 10px; font-weight: 800; cursor: pointer; }
.code-tabs { display: flex; align-items: flex-end; margin-top: 18px; }
.code-tabs button { min-width: 68px; min-height: 34px; padding: 0 12px; color: var(--muted); background: #ebece6; border: 1px solid var(--line); border-bottom: 0; border-radius: 9px 9px 0 0; font-size: 10px; font-weight: 800; cursor: pointer; }
.code-tabs button[aria-selected="true"] { color: var(--ink); background: var(--lime); border-color: var(--ink); }
.code-panel pre { min-height: 286px; margin: 0; padding: 17px; overflow: auto; color: #e7ece8; background: #151915; border: 1px solid var(--ink); border-radius: 0 13px 13px 13px; font: 600 11px/1.7 "IBM Plex Mono", monospace; tab-size: 2; }
.support-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 10px; padding: 10px 12px; background: #f3f1e9; border-radius: 10px; }
.support-note span { flex: 0 0 auto; width: 9px; height: 9px; margin-top: 3px; background: var(--butter); border-radius: 50%; box-shadow: 0 0 0 5px rgb(255 216 104 / 18%); }
.support-note span.supported { background: #37b98b; box-shadow: 0 0 0 5px rgb(55 185 139 / 16%); }
.support-note p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

.page-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 23px 6px 0; }
.page-footer div { display: flex; gap: 18px; }
.page-footer a { color: var(--muted); font-size: 10px; font-weight: 700; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; padding: 12px 16px; color: white; background: var(--ink); border-radius: 11px; box-shadow: 0 14px 34px rgb(0 0 0 / 22%); font-size: 11px; font-weight: 800; opacity: 0; translate: 0 12px; pointer-events: none; transition: opacity .2s ease, translate .2s ease; }
.toast.show { opacity: 1; translate: 0 0; }

@media (max-width: 1180px) {
  .hero { min-height: 0; }
  .lead { padding-right: 0; }
  .hero-actions { position: static; justify-content: flex-start; margin-top: 18px; }
  .studio { grid-template-columns: 270px minmax(0, 1fr); }
  .controls { padding-inline: 16px; }
  .heading-metrics { display: none; }
  .preview-footer { grid-template-columns: repeat(4, 1fr); }
  .preview-footer p { grid-column: 1 / -1; margin: 10px 0 0; text-align: left; }
}

@media (max-width: 900px) {
  .page { width: min(100% - 18px, 780px); padding-top: 16px; }
  .studio { grid-template-columns: 1fr; }
  .controls { border-right: 0; border-bottom: 1px solid var(--line); }
  .preview-panel { height: auto; }
  .preview-stage { min-height: 620px; }
  .preset-list { grid-template-columns: repeat(5, 1fr); }
  .preset-list button { grid-template-columns: 29px 1fr; }
  .preset-list button small { display: none; }
  .lower-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .page { width: min(100% - 12px, 520px); }
  .hero { padding: 6px 7px 22px; }
  h1 { font-size: clamp(28px, 9vw, 46px); white-space: normal; }
  .lead { margin-top: 17px; font-size: 14px; }
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .support-chip { grid-column: 1 / -1; }
  .top-button { padding-inline: 10px; }
  .lab-shell,
  .comparison-panel,
  .code-panel { border-radius: 18px; }
  .section-heading { padding-inline: 14px; }
  .section-number { width: 42px; height: 42px; border-radius: 12px; }
  .section-heading h2,
  .sub-heading h2,
  .code-panel h2 { font-size: 20px; }
  .controls { padding: 18px 14px; }
  .preset-list { grid-template-columns: 1fr; }
  .preset-list button small { display: block; }
  .preview-panel { padding: 9px; }
  .browser-bar { padding-inline: 10px; }
  .browser-state span { display: none; }
  .preview-stage { min-height: 520px; padding: 12px; }
  .poster { min-width: 650px; min-height: 470px; }
  .preview-stage { display: block; overflow-x: auto; }
  .preview-footer { grid-template-columns: 1fr 1fr; }
  .preview-footer div:nth-child(3),
  .preview-footer div:nth-child(4) { display: none; }
  .comparison-panel,
  .code-panel { padding: 17px 14px; }
  .sub-heading { display: grid; }
  .sub-heading > span { justify-self: start; }
  .comparison-row { grid-template-columns: 52px minmax(0, 1fr); }
  .code-panel pre { min-height: 260px; font-size: 10px; }
  .page-footer { display: grid; }
}

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