:root {
  font-family: "STIX Two Text", Georgia, serif;
  color: #000;
  background: #fff;
  font-size: 18px;
  line-height: 1.6;
  --accent: #00529b;
  --accent-dark: #003b70;
  --muted: #5b5b5b;
  --border: #ccc;
  --soft: #f6f6f6;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; padding: 0 1rem; background: #fff; color: #000; }
button, input, select { font: inherit; }
button { color: inherit; }
.noise { display: none; }

.topbar {
  width: 100%; max-width: 760px; min-height: 64px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  border-bottom: 1px solid var(--border); font-size: .75rem;
}
.brand { display: flex; align-items: center; gap: .55rem; color: #000; text-decoration: none; font-weight: 700; letter-spacing: .04em; }
.brand-mark { height: 17px; display: flex; align-items: center; gap: 2px; }
.brand-mark i { display: block; width: 2px; background: var(--accent); }
.brand-mark i:nth-child(1), .brand-mark i:nth-child(5) { height: 6px; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(4) { height: 12px; }
.brand-mark i:nth-child(3) { height: 17px; }
.top-meta { display: flex; gap: .45rem; color: var(--muted); }
.top-meta b { color: var(--accent); font-weight: 400; }
.about-button { justify-self: end; padding: .35rem 0; border: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: .75rem; }
.about-button:hover { text-decoration: underline; }

main { width: 100%; max-width: 760px; margin: 0 auto; }
.hero { padding: 4.5rem 0 3.5rem; text-align: center; }
.eyebrow { display: none; }
h1 { margin: 0; font-size: clamp(2.25rem, 7vw, 3.25rem); line-height: 1.1; letter-spacing: -.035em; }
h1 em, .manifesto h2 em { color: var(--accent); font-style: italic; font-weight: 400; }
.hero > p { max-width: 620px; margin: 1rem auto 1.8rem; color: var(--muted); font-size: 1.03rem; }
.mutate-button {
  min-width: 220px; min-height: 48px; padding: .6rem 1rem; display: flex; align-items: center; justify-content: center; gap: 1rem;
  border: 1px solid var(--accent); border-radius: 3px; background: var(--accent); color: #fff; cursor: pointer; font-weight: 600;
}
.mutate-button:hover { border-color: var(--accent-dark); background: var(--accent-dark); }
.mutate-button b { font-size: 1rem; font-weight: 400; }
.file-note { color: #888; font-size: .68rem; }

.workspace { padding: 0 0 4rem; color: #000; background: #fff; }
.drop-zone {
  min-height: 390px; padding: 2rem; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px dashed #aaa; border-radius: 3px; background: var(--soft); text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.dragging { border-color: var(--accent); background: #f0f6fb; }
.drop-corners { display: none; }
.drop-icon { width: 54px; height: 54px; margin-bottom: 1rem; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 1.4rem; }
.drop-zone h2 { margin: 0; font-size: 1.25rem; line-height: 1.3; }
.drop-zone > p { margin: .2rem 0 0; color: var(--muted); font-style: italic; font-size: .9rem; }
.demo-divider { width: 230px; margin: 2rem 0 .6rem; display: flex; align-items: center; gap: .7rem; color: #888; font-size: .67rem; }
.demo-divider span { flex: 1; height: 1px; background: var(--border); }
.demo-button { border: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: .8rem; font-weight: 600; }
.demo-button:hover { text-decoration: underline; }

.editor { width: 100%; }
.editor-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: .7rem; }
.section-index { display: block; margin-bottom: .2rem; color: var(--accent); font-size: .68rem; font-weight: 600; text-transform: uppercase; }
.editor-head h2 { max-width: 430px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.2rem; line-height: 1.3; }
.signal-stats { display: flex; align-items: center; flex-wrap: wrap; justify-content: end; gap: .45rem; color: #777; font-size: .67rem; }
.signal-stats i { width: 3px; height: 3px; border-radius: 50%; background: var(--accent); }
.signal-stats button { margin-left: .35rem; padding: 0; border: 0; border-bottom: 1px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer; font-size: inherit; }

.canvas-shell { position: relative; width: 100%; height: min(72vw, 560px); overflow: hidden; border: 1px solid var(--border); background: var(--soft); cursor: ew-resize; user-select: none; }
.canvas-shell canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#originalCanvas { clip-path: inset(0 50% 0 0); }
.compare-line { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: rgba(255,255,255,.9); pointer-events: none; }
.compare-line span { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; transform: translate(-50%,-50%); display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; background: #fff; color: var(--accent); font-size: .75rem; }
.canvas-label { position: absolute; top: .6rem; padding: .2rem .45rem; background: rgba(255,255,255,.9); color: #333; font-size: .62rem; }
.label-before { left: .6rem; }
.label-after { right: .6rem; color: var(--accent); }
.processing-overlay { position: absolute; inset: 0; display: none; place-items: center; align-content: center; gap: 1rem; background: rgba(246,246,246,.92); color: var(--accent); font-size: .75rem; }
.processing-overlay.active { display: grid; }
.processing-wave { height: 38px; display: flex; align-items: center; gap: 4px; }
.processing-wave i { width: 3px; height: 8px; background: var(--accent); animation: wave .7s ease-in-out infinite alternate; }
.processing-wave i:nth-child(2n) { animation-delay: -.3s; }
.processing-wave i:nth-child(3n) { animation-delay: -.5s; }
@keyframes wave { to { height: 38px; } }
.compare-hint { margin: .35rem 0 2rem; color: #888; text-align: center; font-size: .65rem; font-style: italic; }
.compare-hint span { color: var(--accent); }

.variants-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: .55rem; }
.variants-head .section-index { margin: 0; }
.variants-head h3 { margin: 0; font-size: 1.2rem; line-height: 1.3; }
.variants-head > span { color: #888; text-align: right; font-size: .62rem; }
.variant-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; margin-bottom: 2.25rem; }
.variant { position: relative; aspect-ratio: 4 / 3; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 2px; background: var(--soft); cursor: pointer; }
.variant:hover { border-color: var(--accent); }
.variant.selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.variant canvas { width: 100%; height: 100%; display: block; object-fit: cover; }
.variant-index { position: absolute; left: .3rem; top: .3rem; min-width: 24px; padding: .08rem .25rem; background: rgba(255,255,255,.9); color: #333; text-align: center; font-size: .6rem; }
.variant.selected .variant-index { background: var(--accent); color: #fff; }
.variant-download { position: absolute; right: .3rem; bottom: .3rem; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 2px; background: var(--accent); color: #fff; opacity: 0; font-size: .75rem; }
.variant:hover .variant-download, .variant:focus-visible .variant-download { opacity: 1; }

.controls-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.control-panel { padding: 1.25rem; border: 1px solid var(--border); border-radius: 2px; background: var(--soft); }
.panel-title { display: flex; justify-content: space-between; margin-bottom: .8rem; color: #555; font-size: .7rem; font-weight: 600; text-transform: uppercase; }
.panel-title output { color: var(--accent); }
.control-panel > label { display: block; margin-bottom: .35rem; color: #333; font-size: .82rem; font-weight: 600; }
input[type="range"] { width: 100%; height: 4px; margin: .8rem 0 0; appearance: none; background: #ddd !important; }
input[type="range"]::-webkit-slider-thumb { width: 17px; height: 17px; appearance: none; border: 2px solid #fff; outline: 1px solid var(--accent); border-radius: 50%; background: var(--accent); cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border: 2px solid #fff; outline: 1px solid var(--accent); border-radius: 50%; background: var(--accent); cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; color: #888; font-size: .62rem; }
.effect-chain { display: grid; gap: .4rem; }
.effect-chain > span { color: #777; font-size: .75rem; font-style: italic; }
.effect-row { min-height: 45px; padding: .35rem .45rem; display: grid; grid-template-columns: 22px minmax(125px,1fr) minmax(100px,1.4fr) 38px 25px; gap: .45rem; align-items: center; border: 1px solid #ddd; border-radius: 2px; background: #fff; transition: opacity .15s; }
.effect-row.disabled { opacity: .45; }
.effect-toggle { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.effect-select { min-width: 0; padding: .25rem; border: 1px solid #ddd; border-radius: 2px; background: #fff; color: #222; font-size: .75rem; }
.effect-range[type="range"] { min-width: 65px; height: 3px; margin: 0; }
.effect-range[type="range"]::-webkit-slider-thumb { width: 12px; height: 12px; }
.effect-value { color: var(--accent); text-align: right; font-size: .68rem; }
.effect-remove { width: 23px; height: 23px; padding: 0; border: 0; background: transparent; color: #888; cursor: pointer; font-size: 1rem; }
.effect-remove:hover { color: #a00000; }
.add-effect { width: 100%; height: 38px; margin-top: .6rem; border: 1px dashed #aaa; border-radius: 2px; background: #fff; color: var(--accent); cursor: pointer; font-size: .72rem; font-weight: 600; }
.add-effect:hover { border-color: var(--accent); background: #f0f6fb; }
.add-effect:disabled { opacity: .4; cursor: default; }

.action-row { margin-top: 1rem; display: flex; gap: .55rem; }
.mutate-button { min-width: 230px; border: 1px solid var(--accent); }
.icon-button, .download-button { min-height: 48px; border: 1px solid var(--border); border-radius: 3px; background: #fff; color: var(--accent); cursor: pointer; }
.icon-button { width: 48px; font-size: 1.2rem; }
.icon-button:disabled { color: #aaa; background: var(--soft); cursor: default; }
.download-button { margin-left: auto; min-width: 160px; padding: .55rem .8rem; display: flex; align-items: center; justify-content: center; gap: .8rem; font-weight: 600; }
.download-button:hover, .icon-button:not(:disabled):hover { border-color: var(--accent); background: #f0f6fb; }
.download-button b { font-size: 1rem; }

.manifesto { padding: 3.5rem 0 3rem; border-top: 1px solid var(--border); }
.manifesto-grid { display: grid; grid-template-columns: 1fr; }
.manifesto h2 { margin: .25rem 0 1rem; font-size: 2rem; line-height: 1.2; }
.manifesto-copy { color: #333; }
.manifesto-copy p { margin: 0 0 1rem; }
.method-list { margin-top: 2rem; border-top: 1px solid var(--border); }
.method-list div { padding: .85rem 0; display: grid; grid-template-columns: 40px 130px 1fr; align-items: center; border-bottom: 1px solid var(--border); }
.method-list b { color: var(--accent); font-size: .75rem; }
.method-list span { font-size: .85rem; font-weight: 600; }
.method-list i { color: var(--muted); font-size: .8rem; font-style: italic; }

footer { width: 100%; max-width: 760px; margin: 0 auto; padding: 1.5rem 0; display: flex; justify-content: space-between; border-top: 1px solid var(--border); color: #888; font-size: .7rem; }

dialog { width: min(600px,calc(100% - 2rem)); padding: 2rem; border: 1px solid var(--border); border-radius: 3px; background: #fff; box-shadow: 0 8px 30px rgba(0,0,0,.18); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h2 { margin: .25rem 0 1rem; font-size: 2rem; line-height: 1.15; }
dialog p { color: #333; }
.dialog-close { position: absolute; right: .75rem; top: .55rem; border: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: 1.4rem; }

@media (max-width: 600px) {
  body { padding: 0 .75rem; }
  .topbar { grid-template-columns: 1fr 1fr; }
  .top-meta { display: none; }
  .hero { padding: 3rem 0; }
  .hero br { display: none; }
  .drop-zone { min-height: 330px; }
  .editor-head { align-items: start; }
  .editor-head h2 { max-width: 48vw; }
  .canvas-shell { height: 78vw; }
  .variants-head { align-items: start; }
  .variants-head > span { max-width: 145px; }
  .variant-grid { grid-template-columns: repeat(2,1fr); }
  .effect-row { grid-template-columns: 20px minmax(85px,1fr) minmax(60px,1fr) 32px 20px; gap: .25rem; padding: .3rem; }
  .effect-select { padding: .2rem 0; font-size: .67rem; }
  .action-row { flex-wrap: wrap; }
  .mutate-button { flex: 1; min-width: 0; }
  .download-button { width: 100%; margin-left: 0; }
  .method-list div { grid-template-columns: 35px 1fr; }
  .method-list i { grid-column: 2; }
  footer span:nth-child(2) { display: none; }
}
