:root {
  --bg: #f7f7f4;
  --card: #ffffff;
  --ink: #17191c;
  --muted: #5d636b;
  --line: #e3e3dd;
  --brand: #0b6e4f;
  --brand-ink: #ffffff;
  --brand-soft: #e6f2ed;
  --warn-bg: #fff6e0;
  --warn-ink: #6b4a00;
  --err: #b42318;
  --radius: 12px;
  --max: 980px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
a { color: var(--brand); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

header.site { background: var(--card); border-bottom: 1px solid var(--line); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; }
.logo { font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.logo span { color: var(--brand); }
.nav { display: flex; gap: 14px; font-size: 14px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover, .nav a[aria-current] { color: var(--brand); }

.hero { padding: 28px 0 8px; }
.hero h1 { font-size: clamp(26px, 5vw, 38px); line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.02em; }
.hero p { margin: 0; color: var(--muted); max-width: 640px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding: 0; list-style: none; }
.badges li { background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 18px 0; }
.notice { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 10px 14px; font-size: 14px; margin: 14px 0 0; }

/* tool */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: -4px 0 14px; scrollbar-width: none; }
.tab { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.req { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.req b { color: var(--ink); }
.drop { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; border: 2px dashed #c9cbc4; border-radius: var(--radius); padding: 34px 16px; cursor: pointer; background: #fbfbf9; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop-icon { font-size: 26px; color: var(--brand); }
.drop-title { font-weight: 700; font-size: 18px; }
.drop-sub { font-size: 13px; color: var(--muted); max-width: 420px; }
.err { color: var(--err); font-weight: 600; font-size: 14px; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stage-wrap { min-width: 0; }
.stage { display: flex; justify-content: center; background: repeating-conic-gradient(#eee 0 25%, #fafafa 0 50%) 0 0 / 16px 16px; border-radius: 10px; padding: 12px; }
.view { display: block; touch-action: none; cursor: grab; box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 6px 20px rgba(0,0,0,.12); background: #fff; }
.view:active { cursor: grabbing; }
.hint { font-size: 12px; color: var(--muted); text-align: center; margin: 6px 0 0; }
.controls { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.controls label { font-size: 13px; color: var(--muted); font-weight: 600; }
.row { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.grow { flex: 1 1 140px; display: flex; flex-direction: column; }
input[type=range] { width: 100%; accent-color: var(--brand); }
fieldset.grid { border: 0; padding: 0; margin: 0; }
legend { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid label { display: flex; flex-direction: column; gap: 3px; }
input[type=number], input[type=text] { font: inherit; font-size: 15px; color: var(--ink); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--ink) !important; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.clean-row { display: flex; flex-direction: column; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700; border-radius: 10px; padding: 10px 16px; cursor: pointer; border: 1px solid transparent; text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); font-size: 16px; padding: 13px 18px; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary:disabled { opacity: .6; cursor: wait; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); font-size: 14px; padding: 8px 12px; }

.result { grid-column: 1 / -1; display: flex; gap: 18px; align-items: center; background: var(--brand-soft); border-radius: var(--radius); padding: 14px; }
.result .out { max-width: 160px; max-height: 200px; width: auto; height: auto; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.result p { margin: 0 0 6px; }
.ok { font-weight: 800; color: var(--brand); font-size: 18px; }
.meta { font-size: 14px; color: var(--muted); }
.result .btn { margin-top: 6px; }

/* content */
h2 { font-size: 22px; letter-spacing: -0.01em; margin: 0 0 12px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 700; }
.table-scroll { overflow-x: auto; }
ol.steps { padding-left: 20px; margin: 0; }
ol.steps li { margin-bottom: 6px; }
details { border-bottom: 1px solid var(--line); padding: 10px 0; }
details:last-child { border-bottom: 0; }
summary { font-weight: 700; cursor: pointer; }
details p { margin: 8px 0 0; color: var(--muted); }
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; padding: 0; margin: 0; list-style: none; }
.links a { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px; background: #fff; }
.links a:hover { border-color: var(--brand); color: var(--brand); }
.links small { display: block; color: var(--muted); font-weight: 400; }
.ad { margin: 18px 0; min-height: 100px; }

footer.site { color: var(--muted); font-size: 13px; padding: 24px 0 40px; border-top: 1px solid var(--line); margin-top: 32px; }
footer.site p { margin: 0 0 6px; }

@media (max-width: 720px) {
  .editor { grid-template-columns: 1fr; }
  .result { flex-direction: column; text-align: center; }
  .card { padding: 14px; }
}
