:root {
  color-scheme: dark;
  --page: #111822;
  --paper: #1b2431;
  --ink: #edf2fa;
  --muted: #b4c1d3;
  --accent: #9bb7ff;
  --line: #3b4a60;
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--page);
}
* { box-sizing: border-box; }
body { margin: 0; -webkit-user-select: none; user-select: none; }
/* Keep editable values and generated output available for manual copying. */
input:not([type="range"]):not([type="checkbox"]):not([type="file"]), textarea, .encoding code { -webkit-user-select: text; user-select: text; }
button, input, select, textarea { font: inherit; }
a { color: var(--accent); }
button, select, input[type="range"], input[type="checkbox"] { cursor: pointer; }
button, .download { transition: background-color .12s; }
:focus-visible { outline: 3px solid #8bb1ff; outline-offset: 3px; }
.site-header, main, footer { max-width: 1120px; margin: auto; }
.site-header { display: flex; justify-content: space-between; align-items: center; padding: 28px 32px; }
.brand { display: flex; align-items: center; gap: 12px; font-family: "Trebuchet MS", sans-serif; font-size: 22px; font-weight: 700; text-decoration: none; color: var(--ink); }
.brand-icon { display: grid; place-items: center; width: 36px; height: 36px; background: var(--accent); color: white; border-radius: 8px; font-size: 27px; }
.version { font-size: 13px; color: var(--muted); }
main { padding: 24px 32px 32px; }
.page-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-links { display: flex; align-items: center; gap: 12px; }
.github-link { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; color: var(--muted); border-radius: 6px; }
.github-link:hover { color: var(--ink); background: #29364a; }
.page-tools .download { padding: 10px 16px; font-size: 13px; }
.intro { display: flex; justify-content: space-between; align-items: center; gap: 28px; padding: 6px 0 32px; }
h1 { font-size: clamp(28px, 3.5vw, 40px); line-height: 1.45; letter-spacing: -.04em; margin: 0 0 16px; }
.intro p { color: var(--muted); line-height: 1.9; margin: 0; font-size: 15px; }
.download { flex-shrink: 0; padding: 16px 22px; border: 1px solid var(--accent); color: var(--accent); background: var(--paper); border-radius: 8px; font-weight: 700; text-decoration: none; }
.download:hover { background: #2b3b55; }
.download span { display: block; font-size: 12px; font-weight: 400; margin-top: 6px; }
.workspace { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: stretch; }
.controls, .preview-panel, .command-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.controls { padding: 24px; }
h2 { font-size: 18px; margin: 0; }
.controls h2 { margin-bottom: 22px; }
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
input:not([type="range"]):not([type="checkbox"]):not([type="file"]), select { padding: 10px 12px; border: 1px solid var(--line); background: #141c28; border-radius: 6px; color: var(--ink); width: 100%; min-width: 0; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row > input { flex: 1; }
.primary, .secondary { display: inline-block; padding: 10px 14px; border-radius: 6px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.primary { border: 1px solid #4169c3; background: #4169c3; color: white; }
.primary:hover { background: #527ddd; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.secondary:disabled { opacity: .45; cursor: not-allowed; }
.secondary { border: 1px solid var(--line); background: #29364a; color: var(--ink); }
.secondary:hover { background: #354763; }
.field-note { font-size: 12px; line-height: 1.7; color: var(--muted); margin: 8px 0 18px; }
.number-label { display: flex; justify-content: space-between; align-items: baseline; margin-top: 18px; }
.number-label span { color: var(--muted); font-size: 12px; }
.measure input { max-width: 94px; font-size: 20px !important; font-variant-numeric: tabular-nums; }
.measure span { color: var(--muted); font-size: 13px; }
input[type="range"] { width: 100%; margin: 14px 0 0; accent-color: var(--accent); }
/* Keep size native; match its thin outlined rail for Y, without a progress fill. */
#offset-range { appearance: none; -webkit-appearance: none; height: 16px; background: transparent; }
#offset-range::-webkit-slider-runnable-track { box-sizing: border-box; height: 8px; border: 1px solid #929292; background: #3b3b3b; border-radius: 4px; }
#offset-range::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5px; border: 0; border-radius: 50%; background: var(--accent); }
#offset-range::-moz-range-track, #offset-range::-moz-range-progress { box-sizing: border-box; height: 8px; border: 1px solid #929292; background: #3b3b3b; border-radius: 4px; }
#offset-range::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--accent); }
.toggles { display: flex; gap: 16px; margin: 22px 0; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 0; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.select-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.text-button { padding: 6px 0; border: 0; background: none; color: var(--accent); font-size: 12px; text-decoration: underline; text-underline-offset: 4px; }
#reset { margin-top: 16px; }
.preview-panel { padding: 24px; display: flex; flex-direction: column; min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.panel-heading > span { color: var(--muted); font-size: 12px; }
.preview-stage { position: relative; width: 100%; min-height: 340px; flex: 1; border: 1px solid var(--line); border-radius: 8px; background-color: #2a3544; background-image: linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px); background-size: 16px 16px; overflow: hidden; }
canvas { display: block; width: 100%; height: 100%; position: absolute; inset: 0; }
.zoom-badge { position: absolute; right: 12px; top: 12px; font-size: 11px; color: var(--muted); background: #141c28e6; padding: 5px 8px; border-radius: 4px; }
.preview-footer { display: flex; gap: 12px; justify-content: space-between; font-size: 11px; color: var(--muted); margin: 14px 0 22px; flex-wrap: wrap; }
.legend-square { display: inline-block; width: 10px; height: 10px; border: 1px dashed var(--muted); margin-right: 6px; }
.skin-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.upload { cursor: pointer; margin: 0; }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload:focus-within { outline: 3px solid #8bb1ff; outline-offset: 3px; }
.preview-panel > .field-note { margin-bottom: 0; }
.command-panel { margin-top: 24px; padding: 24px; }
.command-panel .panel-heading { margin-bottom: 14px; }
.command-panel .panel-heading { flex-wrap: wrap; }
.copy-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
textarea[hidden] { display: none; }
#json-copy-fallback { margin-top: 12px; }
textarea { display: block; width: 100%; resize: vertical; background: #141c28; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 16px; font: 14px/1.8 Consolas, "Courier New", monospace; overflow-wrap: anywhere; }
.encoding { display: flex; gap: 24px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 14px; }
.encoding code { color: var(--ink); margin-left: 6px; }
#copy-status { color: var(--accent); margin-left: auto; }
.error { color: #ffa1b0; font-size: 13px; }
.guide { padding: 30px 0 0; max-width: 850px; font-size: 13px; line-height: 1.9; color: var(--muted); }
.guide h2 { color: var(--ink); margin-bottom: 12px; }
.guide ol { padding-left: 22px; }
.guide li { padding-left: 5px; margin: 6px 0; }
details { border-top: 1px solid #c8d8ef; padding-top: 16px; margin-top: 22px; }
summary { cursor: pointer; color: var(--ink); }
footer { padding: 20px 32px 32px; font-size: 13px; color: var(--muted); }
footer span { display: block; margin-top: 8px; font-size: 11px; }
@media (max-width: 760px) {
  .site-header { padding: 20px; }
  main { padding: 16px 20px 28px; }
  .version { font-size: 10px; }
  .brand { font-size: 19px; gap: 8px; }
  .intro { flex-direction: column; align-items: flex-start; gap: 22px; }
  .intro p br { display: none; }
  .page-tools .download { width: auto; font-size: 12px; padding: 10px 12px; }
  .workspace { grid-template-columns: 1fr; gap: 16px; }
  .controls, .preview-panel, .command-panel { padding: 20px; }
  .preview-stage { min-height: 330px; }
  .panel-heading > span { font-size: 10px; }
  .encoding { gap: 12px; }
  footer { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  button, .download { transition: none; }
}
