/* cse-frog site — 「理科室の解剖プリント」(light) / 「黒板」(dark) */

:root {
  --paper: #f3efe2;
  --paper-2: #e9e3cf;
  --label: #fffdf6;
  --ink: #1b2a1f;
  --ink-soft: #4d5d50;
  --ink-faint: #7f8b7f;
  --rule: rgba(27, 42, 31, .16);
  --grid: rgba(31, 140, 118, .085);
  --grid-major: rgba(31, 140, 118, .14);
  --frog: #46a92a;
  --frog-deep: #2c7316;
  --frog-wash: rgba(70, 169, 42, .13);
  --cyan: #1a93b8;
  --cyan-wash: rgba(26, 147, 184, .12);
  --spike: #d9472f;
  --amber: #c98a12;
  --violet: #7a5ab8;
  --code-bg: #17231b;
  --code-ink: #e3eedc;
  --code-dim: #8fa38f;
  --shadow: 0 1px 0 rgba(27,42,31,.08), 0 10px 24px -14px rgba(27,42,31,.35);
  --radius: 6px;

  --f-display: "Dela Gothic One", "Zen Kaku Gothic New", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --f-body: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --f-pixel: "DotGothic16", "Zen Kaku Gothic New", monospace;
  --f-mono: "M PLUS 1 Code", ui-monospace, "SFMono-Regular", Menlo, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #13211a;
    --paper-2: #1a2c23;
    --label: #1b2e25;
    --ink: #e8efe1;
    --ink-soft: #aebfad;
    --ink-faint: #7d907e;
    --rule: rgba(232, 239, 225, .14);
    --grid: rgba(150, 220, 185, .05);
    --grid-major: rgba(150, 220, 185, .09);
    --frog: #7fd94f;
    --frog-deep: #a6ea7f;
    --frog-wash: rgba(127, 217, 79, .12);
    --cyan: #5fcdec;
    --cyan-wash: rgba(95, 205, 236, .12);
    --spike: #ff7a5c;
    --amber: #f0b440;
    --violet: #b79bf0;
    --code-bg: #0c1611;
    --code-ink: #e3eedc;
    --code-dim: #7f947f;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 12px 28px -14px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #13211a;
  --paper-2: #1a2c23;
  --label: #1b2e25;
  --ink: #e8efe1;
  --ink-soft: #aebfad;
  --ink-faint: #7d907e;
  --rule: rgba(232, 239, 225, .14);
  --grid: rgba(150, 220, 185, .05);
  --grid-major: rgba(150, 220, 185, .09);
  --frog: #7fd94f;
  --frog-deep: #a6ea7f;
  --frog-wash: rgba(127, 217, 79, .12);
  --cyan: #5fcdec;
  --cyan-wash: rgba(95, 205, 236, .12);
  --spike: #ff7a5c;
  --amber: #f0b440;
  --violet: #b79bf0;
  --code-bg: #0c1611;
  --code-ink: #e3eedc;
  --code-dim: #7f947f;
  --shadow: 0 1px 0 rgba(0,0,0,.3), 0 12px 28px -14px rgba(0,0,0,.7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.85;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--cyan); text-underline-offset: 3px; }
a:hover { color: var(--frog-deep); }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 3px; }
code, kbd, pre { font-family: var(--f-mono); }
::selection { background: var(--frog); color: #0d1a10; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px dashed var(--rule);
}
.site-head .wrap { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 34px; height: 34px; border-radius: 8px; image-rendering: pixelated; }
.brand b { font-family: var(--f-pixel); font-weight: 400; font-size: 19px; letter-spacing: .02em; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 14px; font-weight: 700;
  padding: 6px 10px; border-radius: 4px;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--frog-wash); }
.theme-btn {
  border: 1px solid var(--rule); background: var(--label); color: var(--ink);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 15px; line-height: 1;
}
.nav-toggle { display: none; }
@media (max-width: 760px) {
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; align-items: stretch;
         background: var(--paper); border-bottom: 1px dashed var(--rule); padding: 8px 16px 14px; gap: 2px; }
  .nav.open { display: flex; }
  .nav a { padding: 10px 8px; font-size: 15px; }
  .nav-toggle { display: inline-flex; margin-left: auto; border: 1px solid var(--rule); background: var(--label);
                color: var(--ink); border-radius: 4px; padding: 6px 10px; font: 700 13px var(--f-body); cursor: pointer; }
  .theme-btn { margin-left: 6px; }
}

/* ---------- common pieces ---------- */
.eyebrow {
  font-family: var(--f-pixel); font-size: 13px; letter-spacing: .12em; color: var(--frog-deep);
  display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: currentColor; }
h1, h2, h3 { line-height: 1.35; margin: 0; }
.h-display { font-family: var(--f-display); font-weight: 400; letter-spacing: .01em; }
.sec { padding: 92px 0 20px; }
.sec-head { display: grid; gap: 10px; margin-bottom: 36px; max-width: 760px; }
.sec-head h2 { font-family: var(--f-display); font-weight: 400; font-size: clamp(26px, 4vw, 38px); }
.sec-head p { margin: 0; color: var(--ink-soft); }
.lead { font-size: 17px; color: var(--ink-soft); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer;
  font: 700 15px var(--f-body); padding: 12px 20px; border-radius: 4px; border: 2px solid var(--ink);
  color: var(--ink); background: var(--label); box-shadow: 4px 4px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { color: var(--ink); transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { background: var(--frog); color: #0d1a10; }
.btn.small { padding: 7px 12px; font-size: 13px; box-shadow: 3px 3px 0 var(--ink); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

.label-card {
  background: var(--label); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow); position: relative;
}
.tape::before {
  content: ""; position: absolute; top: -11px; left: 50%; width: 84px; height: 22px; transform: translateX(-50%) rotate(-2deg);
  background: color-mix(in srgb, var(--amber) 32%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent);
}

.install {
  display: inline-flex; align-items: stretch; border: 2px solid var(--ink); border-radius: 4px; overflow: hidden;
  background: var(--code-bg); max-width: 100%;
}
.install code { color: var(--code-ink); padding: 11px 16px; font-size: 15px; white-space: nowrap; overflow-x: auto; }
.install code::before { content: "$ "; color: var(--frog); }
.install button {
  border: 0; border-left: 2px solid var(--ink); background: var(--frog); color: #0d1a10;
  font: 700 13px var(--f-body); padding: 0 14px; cursor: pointer; white-space: nowrap;
}

pre.code, .doc pre {
  background: var(--code-bg); color: var(--code-ink); border-radius: var(--radius); padding: 18px 20px;
  overflow-x: auto; font-size: 13.5px; line-height: 1.7; margin: 0; border: 1px solid rgba(0,0,0,.25);
}
pre.code .c { color: var(--code-dim); }
pre.code .k { color: #9fe07a; }
pre.code .s { color: #f2c66d; }

.stamp {
  display: inline-block; font-family: var(--f-display); color: var(--spike); border: 3px solid var(--spike);
  padding: 2px 12px; border-radius: 4px; transform: rotate(-6deg); letter-spacing: .1em; opacity: .9;
  font-size: 18px; mix-blend-mode: multiply;
}
:root[data-theme="dark"] .stamp { mix-blend-mode: normal; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stamp { mix-blend-mode: normal; } }

/* ---------- hero ---------- */
.hero { padding: 56px 0 30px; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center; }
.hero h1 { font-family: var(--f-display); font-weight: 400; font-size: clamp(32px, 5.4vw, 58px); line-height: 1.25; margin: 16px 0 18px; }
.hero h1 .hl { background: linear-gradient(transparent 62%, var(--frog-wash) 62%); padding: 0 .08em; }
.hero h1 .frog { color: var(--frog); }
.hero .lead { margin: 0 0 26px; max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 22px; }
.not-llm { margin-top: 22px; font-size: 14px; color: var(--ink-soft); display: flex; gap: 10px; align-items: baseline; }
.not-llm b { color: var(--spike); }

.specimen { position: relative; padding: 34px 34px 46px; }
.specimen .board { padding: 20px; transform: rotate(1.2deg); }
.specimen .board img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.specimen .logo-dark { display: none; }
:root[data-theme="dark"] .specimen .logo-light { display: none; }
:root[data-theme="dark"] .specimen .logo-dark { display: block; border-radius: 4px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .specimen .logo-light { display: none; }
  :root:not([data-theme="light"]) .specimen .logo-dark { display: block; border-radius: 4px; }
}
.specimen .tag-no {
  position: absolute; right: 8px; bottom: 6px; font-family: var(--f-mono); font-size: 12px; background: var(--label);
  border: 1px solid var(--rule); padding: 6px 12px 6px 22px; transform: rotate(-3deg); box-shadow: var(--shadow); line-height: 1.5;
}
.specimen .tag-no::before { content: ""; position: absolute; left: 8px; top: 50%; width: 7px; height: 7px; border-radius: 50%;
  border: 1.5px solid var(--ink-faint); transform: translateY(-50%); }
.callout {
  position: absolute; font-size: 12.5px; font-weight: 700; background: var(--label); border: 1px solid var(--rule);
  border-radius: 4px; padding: 4px 10px; line-height: 1.45; box-shadow: var(--shadow); white-space: nowrap;
  opacity: 0; animation: pop .5s ease forwards;
}
.callout small { display: block; font-weight: 400; color: var(--ink-soft); font-size: 11px; }
.callout::after { content: ""; position: absolute; height: 1.5px; background: var(--ink); width: 46px; top: 50%; }
.callout::before { content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--spike); top: calc(50% - 3px); z-index: 1; }
.callout.l::after { left: 100%; } .callout.l::before { left: calc(100% + 44px); }
.callout.r::after { right: 100%; } .callout.r::before { right: calc(100% + 44px); }
.callout.c1 { top: 13%; left: -6%; animation-delay: .5s; }
.callout.c2 { top: 41%; right: -4%; animation-delay: .7s; }
.callout.c3 { top: 64%; left: -8%; animation-delay: .9s; }
.callout.c4 { top: 6%; right: 2%; animation-delay: 1.1s; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.rise { opacity: 0; animation: rise .7s cubic-bezier(.2,.7,.2,1) forwards; }
.rise.d1 { animation-delay: .08s; } .rise.d2 { animation-delay: .18s; } .rise.d3 { animation-delay: .3s; } .rise.d4 { animation-delay: .42s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .specimen { max-width: 460px; margin: 0 auto; padding: 24px 12px 44px; }
  .callout { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rise, .callout, .reveal { animation: none !important; opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ---------- why ---------- */
.why { display: grid; grid-template-columns: 1.1fr 1fr; gap: 36px; align-items: start; }
.why blockquote {
  margin: 0; padding: 30px 30px 26px; font-size: 18px; line-height: 1.95;
}
.why blockquote p { margin: 0 0 12px; }
.why blockquote cite { font-style: normal; font-size: 13px; color: var(--ink-faint); }
.why-points { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; counter-reset: pt; }
.why-points li {
  counter-increment: pt; display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start;
  padding: 14px 0; border-bottom: 1px dashed var(--rule);
}
.why-points li::before {
  content: counter(pt); font-family: var(--f-display); font-size: 20px; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; border: 2px solid var(--ink); background: var(--frog-wash);
}
.why-points b { display: block; font-size: 16px; }
.why-points span { color: var(--ink-soft); font-size: 14.5px; }
@media (max-width: 860px) { .why { grid-template-columns: 1fr; } }

/* ---------- anatomy chart ---------- */
.anatomy { padding: 10px; overflow: hidden; }
.anatomy-row {
  display: grid; grid-template-columns: 210px 1fr 1fr; align-items: stretch; border-bottom: 1px solid var(--rule);
}
.anatomy-row:last-child { border-bottom: 0; }
.anatomy-row > div { padding: 16px 18px; }
.anatomy-row.head > div { font-family: var(--f-pixel); font-size: 13px; letter-spacing: .08em; color: var(--ink-faint); padding-block: 10px; }
.organ { display: flex; gap: 12px; align-items: center; font-weight: 700; }
.organ i {
  font-style: normal; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--spike); color: #fff;
  display: grid; place-items: center; font: 400 14px var(--f-display);
}
.anatomy-row .frogcol { background: var(--frog-wash); border-inline: 1px dashed var(--rule); }
.anatomy-row .frogcol code, .anatomy-row .llmcol code { font-size: 13px; background: var(--paper-2); padding: 1px 6px; border-radius: 3px; }
.anatomy-row .llmcol { color: var(--ink-soft); }
.anatomy-row.diy .frogcol { font-weight: 700; color: var(--frog-deep); }
.anatomy-foot { margin: 18px 4px 0; font-size: 14.5px; color: var(--ink-soft); }
@media (max-width: 760px) {
  .anatomy-row { grid-template-columns: 1fr 1fr; }
  .anatomy-row > .organcell { grid-column: 1 / -1; padding-bottom: 4px; }
  .anatomy-row.head > div:first-child { display: none; }
  .anatomy-row .frogcol { border-inline: 0; border-right: 1px dashed var(--rule); }
}

/* ---------- pipeline ---------- */
.pipeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-bottom: 34px; counter-reset: st; }
.pipeline li {
  list-style: none; position: relative; padding: 18px 20px 18px 18px; border: 2px solid var(--ink); margin-left: -2px;
  background: var(--label); counter-increment: st;
}
.pipeline li:first-child { margin-left: 0; border-radius: 6px 0 0 6px; }
.pipeline li:last-child { border-radius: 0 6px 6px 0; background: var(--frog-wash); }
.pipeline li::before { content: "STEP " counter(st); font-family: var(--f-pixel); font-size: 12px; color: var(--ink-faint); display: block; }
.pipeline b { font-family: var(--f-display); font-weight: 400; font-size: 22px; display: block; margin: 2px 0 4px; }
.pipeline span { font-size: 13.5px; color: var(--ink-soft); display: block; line-height: 1.7; }
.pipeline li:not(:last-child)::after {
  content: ""; position: absolute; right: -13px; top: 50%; width: 22px; height: 22px; background: var(--paper);
  border-top: 2px solid var(--ink); border-right: 2px solid var(--ink); transform: translateY(-50%) rotate(45deg); z-index: 2;
}
@media (max-width: 860px) {
  .pipeline { grid-template-columns: 1fr 1fr; gap: 12px; }
  .pipeline li, .pipeline li:first-child, .pipeline li:last-child { margin: 0; border-radius: 6px; }
  .pipeline li::after { display: none; }
}

.peek { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: stretch; }
.peek .explain-card { padding: 22px 22px 18px; }
.peek h3 { font-size: 16px; margin-bottom: 12px; }
@media (max-width: 860px) { .peek { grid-template-columns: 1fr; } }

/* score bars (shared with playground) */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 72px 1fr 64px; gap: 10px; align-items: center; font-size: 13.5px; }
.bar-row .tok { font-family: var(--f-mono); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .prob { font-family: var(--f-mono); text-align: right; }
.bar-track { height: 22px; background: var(--paper-2); border-radius: 3px; display: flex; overflow: hidden; position: relative; }
.bar-track span { display: block; height: 100%; transition: width .35s ease; }
.seg-direct { background: var(--frog); }
.seg-history { background: var(--amber); }
.seg-pair { background: var(--cyan); }
.seg-trace { background: var(--violet); }
.bar-row.blocked .bar-track { background: repeating-linear-gradient(-45deg, var(--paper-2) 0 6px, transparent 6px 12px); }
.bar-row.blocked .bar-track span { opacity: .35; }
.bar-row.blocked .tok { text-decoration: line-through; text-decoration-color: var(--spike); }
.blocked-note { font-size: 11.5px; color: var(--spike); font-weight: 700; grid-column: 2 / -1; margin-top: -6px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-soft); margin-top: 14px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* ---------- knobs ---------- */
.knobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.knob { padding: 20px 20px 18px; display: grid; gap: 8px; align-content: start; }
.knob .name { font-family: var(--f-mono); font-weight: 700; font-size: 15px; color: var(--frog-deep); word-break: break-all; }
.knob .llm { font-size: 13px; color: var(--ink-soft); }
.knob .llm::before { content: "LLM では → "; color: var(--ink-faint); }
.knob p { margin: 0; font-size: 14.5px; }
.dial { display: flex; gap: 3px; margin-top: 4px; }
.dial span { flex: 1; height: 6px; border-radius: 3px; background: var(--paper-2); }
.dial span.on { background: var(--frog); }

/* ---------- quickstart / limits / notebooks ---------- */
.qs { display: grid; grid-template-columns: 1fr 1.25fr; gap: 30px; align-items: start; }
.qs ul { padding-left: 1.2em; margin: 14px 0 0; color: var(--ink-soft); font-size: 14.5px; }
.qs li { margin-bottom: 6px; }
@media (max-width: 860px) { .qs { grid-template-columns: 1fr; } }

.limits { padding: 30px 30px 24px 34px; background: var(--label);
  background-image: repeating-linear-gradient(transparent 0 33px, var(--rule) 33px 34px); background-position: 0 14px; }
.limits .stamp { position: absolute; right: 24px; top: -16px; background: var(--label); }
.limits ol { margin: 0; padding-left: 1.3em; display: grid; gap: 10px; line-height: 2; }
.limits li::marker { font-family: var(--f-display); color: var(--spike); }

.notebooks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.nb { padding: 18px; text-decoration: none; color: var(--ink); display: grid; gap: 6px; transition: transform .15s ease; }
.nb:hover { transform: translateY(-3px) rotate(-.4deg); color: var(--ink); }
.nb .num { font-family: var(--f-pixel); color: var(--frog-deep); font-size: 13px; }
.nb b { font-family: var(--f-mono); font-size: 14px; word-break: break-all; }
.nb span { font-size: 13px; color: var(--ink-soft); line-height: 1.7; }
.nb em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--cyan); }

.cta-band { margin: 90px 0 0; padding: 46px 0; background: var(--code-bg); color: var(--code-ink); }
.cta-band .wrap { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.cta-band img { width: min(360px, 100%); image-rendering: auto; border-radius: 6px; }
.cta-band h2 { font-family: var(--f-pixel); font-weight: 400; font-size: clamp(22px, 3.2vw, 30px); }
.cta-band p { color: var(--code-dim); margin: 6px 0 18px; }
.cta-band .btn { border-color: var(--code-ink); box-shadow: 4px 4px 0 var(--frog); }

/* ---------- footer ---------- */
.site-foot { padding: 38px 0 46px; font-size: 13.5px; color: var(--ink-soft); border-top: 1px dashed var(--rule); margin-top: 70px; }
.cta-band + .site-foot { margin-top: 0; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 14px 30px; justify-content: space-between; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-foot a { color: var(--ink-soft); }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }
