:root {
  color-scheme: light;
  --paper: #f3f0e8;
  --paper-deep: #e7e1d5;
  --ink: #191916;
  --muted: #77756c;
  --line: rgba(25, 25, 22, 0.14);
  --acid: #d5ff45;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 8%, rgba(255,255,255,.72), transparent 28rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "ss01" 1, "cv02" 1;
  -webkit-font-smoothing: antialiased;
}

button, textarea, select, input { font: inherit; }
button, a, select, input { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

a { color: inherit; text-decoration: none; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header,
main,
footer {
  width: min(1440px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 760;
  letter-spacing: -0.035em;
}

.brand-mark {
  width: 22px;
  height: 22px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  transform: rotate(12deg);
}

.brand-mark i { border-radius: 50%; background: currentColor; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { opacity: .28; }

nav { display: flex; align-items: center; gap: 28px; font-size: 13px; }
nav a { color: var(--muted); transition: color 160ms ease; }

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(255,255,255,.25);
}

.privacy-pill > span,
.canvas-badge > span:first-child {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #53a246;
  box-shadow: 0 0 0 3px rgba(83,162,70,.13);
}

.hero {
  padding: clamp(56px, 7vw, 88px) 0 clamp(44px, 6vw, 72px);
}

.eyebrow {
  margin: 0 0 22px;
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  max-width: 980px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(56px, 7vw, 104px);
  line-height: .88;
  letter-spacing: -.07em;
  font-weight: 400;
}

h1 em { color: var(--muted); font-weight: 400; }

.hero-copy {
  max-width: 430px;
  margin: 0 0 8px;
  color: #55534c;
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.55;
  letter-spacing: -.025em;
}

.studio {
  display: grid;
  grid-template-columns: minmax(300px, .72fr) minmax(0, 1.28fr);
  background: #fcfbf7;
  border: 1px solid rgba(25,25,22,.2);
  border-radius: 3px;
  box-shadow: 0 22px 70px rgba(48,41,28,.09), 0 2px 6px rgba(48,41,28,.05);
  overflow: hidden;
}

.composer, .preview-panel { padding: clamp(24px, 3.2vw, 48px); }
.composer { display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); }

.section-heading { display: flex; align-items: flex-start; gap: 16px; }
.section-heading h2 { margin-bottom: 4px; font-size: 18px; letter-spacing: -.025em; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.step { padding-top: 2px; color: #a4a096; font: 500 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }

.message-field {
  display: block;
  margin-top: 0;
  border-bottom: 1px solid rgba(25,25,22,.34);
}

textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 132px;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic", "PingFang SC", "Apple SD Gothic Neo", "Kohinoor Devanagari", "Noto Sans CJK JP", "Noto Sans Devanagari", sans-serif;
  font-size: clamp(26px, 2.7vw, 40px);
  line-height: 1.45;
  letter-spacing: -.025em;
}

textarea::placeholder { color: #aaa69d; }

#grapheme-count {
  display: block;
  padding: 9px 0 12px;
  color: var(--muted);
  font: 500 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.sample-row { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sample-row > span { margin-right: 3px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }

.sample-chip,
.icon-button {
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 140ms var(--ease-out);
}

.sample-chip { padding: 6px 9px; border-radius: 999px; color: #5c5a53; font-size: 11px; }
.sample-chip:active, .icon-button:active, .primary-button:active { transform: scale(.97); }

.control-block { margin-top: 38px; }
.control-label { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 9px; }
.control-label label { font-size: 12px; font-weight: 700; }
.control-label span { color: var(--muted); font-size: 10px; }

select {
  width: 100%;
  padding: 12px 36px 12px 13px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #f6f3ed;
  outline: none;
  color: var(--ink);
  font-size: 13px;
}

.field-note { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.sliders { margin-top: 34px; display: grid; gap: 24px; }
.sliders label > span { display: flex; justify-content: space-between; margin-bottom: 11px; font-size: 11px; font-weight: 650; }
.sliders output { color: var(--muted); font-weight: 500; }

input[type="range"] {
  width: 100%;
  height: 2px;
  margin: 0;
  appearance: none;
  background: linear-gradient(90deg, var(--ink) var(--range, 50%), #d7d2c8 var(--range, 50%));
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  width: 14px; height: 14px; appearance: none; border: 3px solid #fcfbf7; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 1px var(--ink);
}

.preview-panel { min-width: 0; }
.preview-head { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-bottom: 10px; }
.preview-actions { display: flex; gap: 6px; }
.icon-button { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 2px; color: var(--muted); font-size: 10px; }
.icon-button[aria-pressed="true"] { color: var(--ink); background: var(--paper-deep); border-color: rgba(25,25,22,.25); }
.pause-icon { width: 10px; font-weight: 800; letter-spacing: -3px; }

.canvas-shell {
  position: relative;
  margin-top: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 2px;
  background: #171815;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.09);
}

canvas { width: 100%; height: 100%; display: block; }

.canvas-badge {
  position: absolute;
  left: 14px;
  bottom: 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(16,17,15,.65);
  color: rgba(255,255,255,.72);
  backdrop-filter: blur(8px);
  font-size: 9px;
  letter-spacing: .04em;
}

.canvas-badge > span:first-child { background: var(--acid); box-shadow: 0 0 0 3px rgba(213,255,69,.13); }
.canvas-shell.is-paused .canvas-badge > span:first-child { background: #aaa; box-shadow: none; }

.export-row { margin-top: 18px; display: flex; align-items: center; justify-content: flex-end; }
.export-row > div { display: grid; gap: 4px; }
.export-row strong { font-size: 12px; }
.export-row span { color: var(--muted); font-size: 10px; }

.primary-button {
  min-width: 170px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), background-color 160ms ease;
}
.primary-button span { color: inherit; font-size: 11px; font-weight: 700; }
.primary-button svg { width: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5; }
.primary-button:disabled { opacity: .55; cursor: wait; }
.export-status { min-height: 16px; margin: 8px 0 -24px; color: var(--muted); font-size: 10px; text-align: right; }

.scripts { padding: clamp(100px, 13vw, 190px) 0; }
.scripts-intro { display: grid; grid-template-columns: 1fr 2fr; align-items: start; gap: 36px; }
.scripts h2 { margin: 0; max-width: 850px; font: 400 clamp(46px, 6vw, 86px)/.96 Georgia, serif; letter-spacing: -.055em; }

.script-grid { margin-top: 72px; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.script-grid article { min-height: 245px; padding: 22px; display: flex; flex-direction: column; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.script-grid article > span { color: var(--muted); font: 500 10px ui-monospace, monospace; }
.script-grid strong { margin: auto 0 28px; font-family: "Hiragino Sans", "PingFang SC", "Apple SD Gothic Neo", "Kohinoor Devanagari", sans-serif; font-size: clamp(27px, 2.4vw, 40px); font-weight: 500; letter-spacing: -.04em; }
.script-grid p { margin: 0; max-width: 210px; color: var(--muted); font-size: 11px; line-height: 1.5; }

.explain { padding: 72px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8vw; border-top: 1px solid var(--line); }
.explain h2 { max-width: 650px; font: 400 clamp(32px, 4vw, 58px)/1.05 Georgia, serif; letter-spacing: -.04em; }
.explain-copy { columns: 2; column-gap: 38px; color: #55534c; font-size: 13px; line-height: 1.7; }
.explain-copy p { break-inside: avoid; }

footer { min-height: 130px; margin-top: clamp(72px, 10vw, 140px); display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

@media (hover: hover) and (pointer: fine) {
  nav a:hover { color: var(--ink); }
  .sample-chip:hover, .icon-button:hover { background: var(--paper-deep); border-color: rgba(25,25,22,.26); }
  .primary-button:hover { background: #33332e; }
}

@media (max-width: 980px) {
  .studio { grid-template-columns: 1fr; }
  .composer { border-right: 0; border-bottom: 1px solid var(--line); }
  .script-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .site-header, main, footer { width: min(100% - 28px, 1440px); }
  .site-header { min-height: 64px; }
  nav a { display: none; }
  .hero { padding: 52px 0 46px; }
  h1 { font-size: clamp(52px, 17vw, 78px); }
  .hero-copy { font-size: 16px; }
  .composer, .preview-panel { padding: 22px 18px; }
  .preview-head { align-items: center; }
  .preview-head .section-heading p { display: none; }
  .icon-button span:last-child { display: none; }
  .canvas-shell { margin-top: 0; }
  .export-row { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .scripts-intro, .explain { grid-template-columns: 1fr; }
  .script-grid { grid-template-columns: 1fr; margin-top: 42px; }
  .script-grid article { min-height: 190px; }
  .explain-copy { columns: 1; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 14px; }
}

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