:root {
  --bg: #ffffff;
  --surface: #f3f5f7;
  --line: #eceff3;
  --line-strong: #dde2e8;
  --ink: #0f1720;
  --ink-2: #3e4955;
  --muted: #5b6673;
  --accent: #15803d;
  --accent-ink: #ffffff;
  --accent-soft: #e8f5ec;
  --view-bg: #eef1f4;

  --font-body: system-ui, -apple-system, "Hiragino Sans", sans-serif;
  --font-num: "Manrope", system-ui, -apple-system, sans-serif;

  --gutter: 24px;
  --radius-card: 20px;
  --radius-control: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --surface: #18202a;
    --line: #222b35;
    --line-strong: #2c3846;
    --ink: #ecf1f6;
    --ink-2: #bfc8d2;
    --muted: #98a4b1;
    --accent: #6ee7a0;
    --accent-ink: #062a14;
    --accent-soft: #12301f;
    --view-bg: #131a22;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2 { margin: 0; }
h1 { font-family: var(--font-num); font-size: 20px; font-weight: 800; letter-spacing: .04em; }
h2 { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 700; }

.top { padding: 20px var(--gutter) 8px; max-width: 1180px; margin: 0 auto; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand p { margin: 0; font-size: 13px; }
.mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); position: relative; flex: none;
  -webkit-mask: none; }
.mark::after { content: ""; position: absolute; inset: 9px 7px 10px; background: var(--accent-ink);
  clip-path: polygon(0 100%, 30% 35%, 48% 62%, 70% 10%, 100% 100%); }

.layout { max-width: 1180px; margin: 0 auto; padding: 12px var(--gutter) 24px; display: grid; gap: 16px;
  grid-template-columns: 1fr; }
@media (min-width: 900px) { .layout { grid-template-columns: 360px 1fr; align-items: start; } .panel { position: sticky; top: 12px; } }
.panel, .stage { display: grid; gap: 16px; min-width: 0; }
.card { background: var(--surface); border-radius: var(--radius-card); padding: 20px; }

.btn-primary, .btn-outline { display: inline-flex; align-items: center; justify-content: center; height: 52px; padding: 0 20px;
  border-radius: var(--radius-control); font: inherit; font-weight: 700; cursor: pointer; width: 100%; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border: 0; }
.btn-outline { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); height: 52px; }
.btn-primary:disabled, .btn-outline:disabled { opacity: .5; cursor: default; }
.file { position: relative; overflow: hidden; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
#fileInfo { margin: 10px 0 0; }

.slider { margin-bottom: 14px; }
.slider-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
.slider p { margin: 2px 0 0; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; }
.card h3 { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 18px 0 8px; }
.hint { margin: 6px 0 0; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; background: var(--bg); border-radius: 12px; padding: 4px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: flex; align-items: center; justify-content: center; height: 38px; border-radius: 9px; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.seg input:disabled + span { opacity: .4; cursor: default; }
.check { display: flex; gap: 8px; align-items: center; margin: 14px 0 4px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.more summary { cursor: pointer; font-size: 13px; color: var(--muted); margin: 4px 0 12px; }

.viewer { padding: 0; overflow: hidden; position: relative; }
.view { width: 100%; aspect-ratio: 4 / 3; background: var(--view-bg); touch-action: none; }
@media (min-width: 900px) { .view { aspect-ratio: 16 / 10; } }
.view canvas { display: block; width: 100% !important; height: 100% !important; }
.status { position: absolute; left: 16px; bottom: 14px; right: 16px; font-size: 13px; color: var(--muted); pointer-events: none; }

.rows { margin-bottom: 16px; }
.row { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.row:last-child { border-bottom: 1px solid var(--line); }
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.how { margin: 16px 0 0; padding-left: 18px; }
.how li { margin: 2px 0; }

.foot { max-width: 1180px; margin: 0 auto; padding: 8px var(--gutter) 40px; }
.foot p { margin: 0 0 10px; }
.tools { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 13px; }

@media (max-width: 899px) {
  .panel, .stage { display: contents; }
  .o1 { order: 1; } .o2 { order: 2; } .o3 { order: 3; } .o4 { order: 4; }
}
