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

:root {
  --ink: #171814;
  --paper: #f1eee4;
  --surface: #fffdf7;
  --surface-2: #e8e7df;
  --line: #c8cbc1;
  --muted: #70776f;
  --violet: #7c5cff;
  --lime: #b6ff39;
  --coral: #ff6d4d;
  --blue: #4b78ff;
  --yellow: #ffd45a;
}

* { box-sizing: border-box; }

html {
  color: var(--ink);
  background: var(--paper);
}

body {
  min-width: 320px;
  margin: 0;
  font-family: Inter, "Noto Sans JP", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  background:
    radial-gradient(circle at 3% 0, rgba(124, 92, 255, 0.15), transparent 27rem),
    radial-gradient(circle at 100% 8%, rgba(182, 255, 57, 0.18), transparent 25rem),
    var(--paper);
}

button,
input { font: inherit; }

button { color: inherit; cursor: pointer; }

h1,
h2,
h3,
p,
pre { margin: 0; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.page {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 54px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 2px;
  margin-bottom: 18px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  color: #5d42e8;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.eyebrow i {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  color: var(--lime);
  background: var(--ink);
  font-size: 11px;
  font-style: normal;
  letter-spacing: -0.12em;
}

h1 {
  font-size: clamp(44px, 7vw, 82px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: 0;
}

h1 span {
  position: relative;
  color: var(--surface);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 6px 6px 0 var(--lime);
}

.lead {
  margin-top: 16px;
  color: var(--muted);
  font-size: clamp(14px, 1.7vw, 18px);
  font-weight: 800;
}

.lead strong { color: var(--ink); }

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.support-chip,
.action-button {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.9);
  font-size: 11px;
  font-weight: 900;
}

.support-chip[data-state="ok"] {
  border-color: #86bd24;
  color: #285f19;
  background: #e9facb;
}

.support-chip[data-state="fallback"] {
  border-color: var(--coral);
  color: #7c2f20;
  background: #ffe5dc;
}

.action-button { transition: transform 160ms ease, background 160ms ease; }
.action-button:hover { transform: translateY(-2px); }
.action-button:active { transform: translateY(0); }
.copy-url { border-color: var(--ink); color: #fff; background: var(--ink); }

.lab-shell,
.type-guide,
.recipe-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: 0 22px 50px rgba(23, 24, 20, 0.1);
}

.lab-heading,
.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lab-heading {
  min-height: 82px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}

.section-number {
  display: grid;
  flex: 0 0 46px;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  color: var(--ink);
  background: var(--lime);
  font-size: 12px;
  font-weight: 900;
}

.section-number.blue { color: #fff; background: var(--blue); }

.lab-heading p,
.section-heading p,
.recipe-heading p,
.control-kicker {
  margin-bottom: 3px;
  color: #5d42e8;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.lab-heading h2,
.section-heading h2,
.recipe-heading h2 {
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.1;
}

.native-badge {
  margin-left: auto;
  padding: 8px 12px;
  border-radius: 999px;
  color: #382989;
  background: #e9e3ff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.lab-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.55fr);
  min-height: 610px;
}

.controls {
  display: grid;
  align-content: start;
  border-right: 1px solid var(--line);
  background: #f9f7f0;
}

.control-intro,
.control-group { padding: 20px 22px; }

.control-intro {
  border-bottom: 1px solid var(--line);
}

.control-intro h3 {
  margin-bottom: 8px;
  font-size: 21px;
  line-height: 1.2;
}

.control-intro > p:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}

.control-intro code { color: var(--ink); }

.control-group {
  display: grid;
  gap: 13px;
  border-bottom: 1px solid var(--line);
}

.control-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.control-label b { font-size: 13px; }

.control-label code {
  color: #5d42e8;
  font-size: 10px;
  font-weight: 800;
}

.control-type {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.range-row {
  display: grid;
  grid-template-columns: 1fr 58px;
  align-items: center;
  gap: 12px;
}

input[type="range"] {
  width: 100%;
  height: 5px;
  margin: 0;
  border-radius: 999px;
  outline: none;
  background: linear-gradient(90deg, var(--violet) 0 var(--range-fill, 50%), #d8dbd3 var(--range-fill, 50%) 100%);
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 1px 7px rgba(23, 24, 20, 0.28);
  appearance: none;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 1px 7px rgba(23, 24, 20, 0.28);
}

.range-row output,
.color-row {
  display: grid;
  place-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 11px;
  font-weight: 900;
}

.color-row {
  grid-template-columns: 48px 1fr 28px;
  gap: 9px;
  padding: 7px 10px;
}

.color-row input[type="color"] {
  width: 38px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  overflow: hidden;
  background: transparent;
}

.color-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-row input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }

.color-row > span:not(.swatch) {
  justify-self: start;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.swatch {
  width: 22px;
  height: 22px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--current-accent, var(--violet));
}

.preview-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  background: var(--ink);
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 15px;
  border-bottom: 1px solid #363934;
  color: #abb0aa;
  font-size: 10px;
}

.preview-toolbar p { display: flex; align-items: center; gap: 8px; }

.preview-toolbar i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 13px 0 0 var(--yellow), 26px 0 0 #43c897;
  margin-right: 27px;
}

.preview-toolbar span {
  padding: 4px 8px;
  border: 1px solid #4f554d;
  border-radius: 999px;
  color: var(--lime);
}

.preview-stage {
  display: grid;
  place-items: center;
  min-height: 510px;
  padding: 42px 6%;
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px),
    #171814;
  background-size: 28px 28px;
}

.data-poster {
  --progress: 72;
  --tilt: -3deg;
  --accent: #7c5cff;
  --radius: 28px;

  display: grid;
  grid-template-rows: auto 1fr auto auto;
  width: min(620px, 94%);
  min-height: 382px;
  padding: clamp(22px, 4vw, 34px);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  color: var(--ink);
  background:
    radial-gradient(circle at 76% 27%, color-mix(in oklab, var(--accent) 82%, white) 0 13%, transparent 13.5%),
    linear-gradient(122deg, transparent 0 48%, var(--ink) 48.3% 49.4%, transparent 49.7%),
    color-mix(in oklab, var(--accent) 22%, #fffdf7);
  box-shadow:
    16px 18px 0 color-mix(in oklab, var(--accent) 88%, #171814),
    32px 38px 70px rgba(0, 0, 0, 0.3);
  transform: rotate(var(--tilt));
  transform-origin: center;
  transition:
    transform 280ms cubic-bezier(.2,.8,.2,1),
    border-radius 280ms cubic-bezier(.2,.8,.2,1),
    background 220ms ease,
    box-shadow 220ms ease;
}

@supports (x: attr(x type(*))) {
  .data-poster {
    --progress: attr(data-progress type(<number>), 0);
    --tilt: attr(data-tilt deg, 0deg);
    --accent: attr(data-accent type(<color>), #7c5cff);
    --radius: attr(data-radius px, 28px);
  }
}

.poster-topline,
.poster-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.poster-topline p,
.poster-topline span {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.poster-topline span {
  padding: 6px 9px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--lime);
}

.poster-main {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: 20px;
  padding: 18px 0 8px;
}

.score-copy > p {
  font-size: clamp(21px, 3.2vw, 40px);
  font-weight: 900;
  line-height: 0.9;
}

.score-copy strong {
  display: flex;
  align-items: flex-start;
  margin-top: 8px;
  font-size: clamp(72px, 10vw, 126px);
  line-height: 0.83;
  font-weight: 900;
}

.score-copy small {
  margin-top: 7px;
  font-size: 0.25em;
}

.orbit {
  position: relative;
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--progress) * 1%), rgba(255,255,255,.68) 0);
  box-shadow: inset 0 0 0 12px rgba(255,255,255,.5);
  transition: background 180ms linear;
}

.orbit-core {
  position: absolute;
  inset: 25%;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
}

.orbit i {
  position: absolute;
  width: 11px;
  height: 11px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--surface);
}

.orbit i:nth-child(2) { top: 11%; left: 17%; }
.orbit i:nth-child(3) { top: 46%; right: -7px; }
.orbit i:nth-child(4) { bottom: 8%; left: 25%; }

.meter {
  height: 20px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: rgba(255,255,255,.76);
}

.meter-fill {
  display: block;
  width: calc(var(--progress) * 1%);
  height: 100%;
  border-right: 3px solid var(--ink);
  background: var(--accent);
  transition: width 160ms linear, background 180ms ease;
}

.poster-bottom { margin-top: 18px; }

.poster-bottom > p {
  font-size: 10px;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: 0.09em;
}

.mini-bars {
  display: flex;
  align-items: end;
  gap: 5px;
  height: 34px;
}

.mini-bars i {
  width: 8px;
  height: calc((var(--progress) * 0.22px) + 5px);
  max-height: 32px;
  border-radius: 3px 3px 0 0;
  background: var(--ink);
  transition: height 160ms linear;
}

.mini-bars i:nth-child(2) { scale: 1 .72; transform-origin: bottom; }
.mini-bars i:nth-child(3) { scale: 1 .48; transform-origin: bottom; }
.mini-bars i:nth-child(4) { scale: 1 .88; transform-origin: bottom; }
.mini-bars i:nth-child(5) { scale: 1 .62; transform-origin: bottom; }

.live-html {
  display: flex;
  align-items: center;
  gap: 7px 10px;
  min-height: 62px;
  padding: 12px 16px;
  overflow-x: auto;
  border-top: 1px solid #363934;
  color: #aeb4ad;
  background: #111310;
  font: 700 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
}

.live-html b { color: var(--lime); }
.live-html b:nth-of-type(2) { color: #8facff; }
.live-html b:nth-of-type(3) { color: #ff9179; }
.live-html b:nth-of-type(4) { color: #ffd45a; }
.live-html i { font-style: normal; }

.value-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.value-strip > div {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  min-height: 74px;
  padding: 15px 18px;
  background: var(--surface);
}

.value-strip span,
.recipe-facts span {
  color: #5d42e8;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.value-strip b {
  font-size: clamp(18px, 2vw, 25px);
  line-height: 1;
}

.learn-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr);
  gap: 16px;
  margin-top: 16px;
}

.type-guide,
.recipe-panel { min-width: 0; padding: 22px; }

.type-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.type-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  min-height: 118px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.type-item > span {
  color: #5d42e8;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.type-item code {
  align-self: start;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--ink);
  background: #eceae3;
  font-size: 10px;
}

.type-item p {
  align-self: end;
  color: var(--muted);
  font-size: 11px;
}

.type-item > b {
  align-self: end;
  justify-self: end;
  font-size: 23px;
}

.color-item > b {
  width: 32px;
  height: 32px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--current-accent, var(--violet));
}

.fallback-note {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 13px 15px;
  border: 1px solid #e5bd48;
  border-radius: 14px;
  background: #fff0bd;
}

.fallback-note strong {
  font-size: 10px;
  letter-spacing: 0.08em;
}

.fallback-note p {
  color: #5f562e;
  font-size: 11px;
  line-height: 1.5;
}

.recipe-panel {
  color: #eef2ed;
  background: var(--ink);
  border-color: var(--ink);
}

.recipe-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.recipe-heading p { color: var(--lime); }

.recipe-heading button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid #4b514a;
  border-radius: 10px;
  color: var(--ink);
  background: var(--lime);
  font-size: 10px;
  font-weight: 900;
}

.code-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 18px;
  padding: 4px;
  border: 1px solid #3c403a;
  border-radius: 11px;
  background: #22251f;
}

.code-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  color: #9da39c;
  background: transparent;
  font-size: 10px;
  font-weight: 900;
}

.code-tabs button[aria-selected="true"] {
  color: var(--ink);
  background: #f6f5ef;
}

.code-view {
  height: 270px;
  padding: 18px;
  margin-top: 10px;
  overflow: auto;
  border: 1px solid #343832;
  border-radius: 14px;
  color: #dce4dc;
  background: #0f110e;
  font: 650 11px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre;
}

.recipe-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.recipe-facts > div {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid #343832;
  border-radius: 11px;
  background: #20231e;
}

.recipe-facts span { color: var(--lime); }
.recipe-facts b { font-size: 12px; }

.source-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 4px 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.source-footer div { display: flex; gap: 8px; }

.source-footer a {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255,255,255,.45);
  text-decoration: none;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100% - 36px));
  padding: 12px 15px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  color: var(--ink);
  background: var(--lime);
  box-shadow: 6px 7px 0 var(--ink);
  font-size: 11px;
  font-weight: 900;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-actions { justify-content: flex-start; }
  .lab-layout { grid-template-columns: 1fr; }
  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .control-intro { grid-column: 1 / -1; }
  .control-group:nth-child(2),
  .control-group:nth-child(4) { border-right: 1px solid var(--line); }
  .preview-stage { min-height: 480px; }
  .learn-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .page { width: min(100% - 20px, 1240px); padding-top: 18px; }
  h1 { font-size: clamp(42px, 15vw, 66px); }
  h1 span { -webkit-text-stroke-width: 1.5px; text-shadow: 4px 4px 0 var(--lime); }
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .support-chip { grid-column: 1 / -1; }
  .lab-heading { align-items: flex-start; flex-wrap: wrap; }
  .native-badge { margin-left: 58px; }
  .controls { grid-template-columns: 1fr; }
  .control-group:nth-child(2),
  .control-group:nth-child(4) { border-right: 0; }
  .preview-stage { min-height: 400px; padding: 34px 4%; }
  .data-poster { min-height: 315px; padding: 20px; box-shadow: 9px 11px 0 color-mix(in oklab, var(--accent) 88%, #171814), 22px 30px 55px rgba(0,0,0,.3); }
  .poster-main { grid-template-columns: 1.35fr .65fr; }
  .score-copy > p { font-size: 19px; }
  .score-copy strong { font-size: clamp(62px, 21vw, 92px); }
  .poster-topline p { max-width: 170px; }
  .live-html { align-items: flex-start; flex-direction: column; white-space: normal; }
  .value-strip { grid-template-columns: repeat(2, 1fr); }
  .type-guide, .recipe-panel { padding: 17px; }
  .type-list { grid-template-columns: 1fr; }
  .fallback-note { grid-template-columns: 1fr; }
  .recipe-heading { align-items: flex-start; }
  .recipe-facts { grid-template-columns: 1fr; }
  .source-footer { align-items: flex-start; flex-direction: column; }
}

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