  :root {
    --bg: #eef3ee;
    --panel: #ffffff;
    --ink: #17302b;
    --ink-soft: #4f6660;
    --line: #cbd7d1;
    --accent: #1d5fb0;
    --accent-ink: #ffffff;
    --contour: #9a7b4f;
    --ok: #1f7a4d;
    --warn: #a3620f;
    --err: #b3261e;
    --radius: 6px;
    font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  }
  * { box-sizing: border-box; }
  [hidden] { display: none !important; }
  html, body { margin: 0; height: 100%; }
  body {
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
  }
  .splash { position: fixed; inset: 0; z-index: 100; background: rgba(23, 48, 43, 0.55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 1.5rem; }
  .splash-card { background: var(--panel); color: var(--ink); border-radius: 10px; max-width: 42rem; width: 100%; max-height: calc(100vh - 3rem); overflow-y: auto; padding: 2rem 2.25rem 1.5rem; box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
  .splash-card h2 { margin: 0 0 0.25rem; font-size: 1.9rem; letter-spacing: -0.01em; }
  .splash-sub { margin: 0 0 1.25rem; color: var(--ink-soft); font-size: 1.05rem; }
  .splash-list { margin: 0; padding-left: 1.4rem; display: grid; gap: 0.7rem; }
  .splash-list li { line-height: 1.5; }
  .splash-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
  .splash-footer small { color: var(--ink-soft); }
  .load-warning { margin: 1rem 0 0; padding: 0.7rem 0.9rem; background: #fff1f0; border: 1px solid #f0b4ae; border-radius: var(--radius); color: #7a1f16; font-size: 0.9rem; }
  .splash-footer a { color: var(--accent); }
  .splash-footer .primary { width: auto; font-size: 1rem; padding: 0.6rem 1.5rem; }
  .linkbtn { font: inherit; font-size: 0.85rem; font-weight: 500; color: var(--accent); background: none; border: 0; padding: 0 0 0 0.4rem; cursor: pointer; text-decoration: underline; }
  .help-h { font-size: 1rem; margin: 1.25rem 0 0.5rem; }
  .help-p { margin: 0; line-height: 1.5; }
  .splash-card code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.9em; background: var(--bg); padding: 0.05rem 0.3rem; border-radius: 3px; }
  .topbar {
    display: flex; align-items: baseline; gap: 1rem;
    padding: 0.9rem 1.5rem;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
  }
  .topbar h1 { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; }
  .ver { font-size: 0.7em; font-weight: 500; color: var(--ink-soft); margin-left: 0.35rem; vertical-align: baseline; }
  .topbar p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
  .layout {
    display: grid;
    grid-template-columns: minmax(20rem, 26rem) 1fr;
    min-height: 0;
  }
  .side {
    padding: 1.5rem;
    border-right: 1px solid var(--line);
    overflow-y: auto;
    background: linear-gradient(180deg, #f6f9f6 0%, var(--bg) 100%);
  }
  .stage { padding: 1.5rem; display: grid; grid-template-rows: auto auto 1fr; gap: 1rem; min-height: 0; }
  label { display: block; font-weight: 600; margin: 0 0 0.35rem; font-size: 0.95rem; }
  input[type=text], input[type=url], input[type=password], textarea {
    width: 100%; padding: 0.6rem 0.7rem; font: inherit; color: var(--ink);
    border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  }
  input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
  }
  .swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
  .swatch { display: grid; grid-template-rows: 2rem auto; gap: 0.3rem; padding: 0.3rem; font-size: 0.78rem; font-weight: 500; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
  .swatch span { display: block; border-radius: 3px; background: var(--sw-bg); border: 1px solid rgba(0,0,0,0.12); position: relative; overflow: hidden; }
  .swatch span::before { content: "Aa"; position: absolute; left: 0.35rem; top: 0.15rem; font-size: 0.8rem; font-weight: 700; color: var(--sw-fg); }
  .swatch span::after { content: ""; position: absolute; right: 0.35rem; bottom: 0.35rem; width: 0.9rem; height: 0.25rem; border-radius: 2px; background: var(--sw-ac); }
  .swatch.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(29,95,176,0.25); }
  .notice { border: 1px solid #e3c98a; background: #fff8e6; color: #5a4300; border-radius: var(--radius); padding: 0.8rem 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
  .notice p { margin: 0; flex: 1 1 100%; }
  .notice button { padding: 0.4rem 0.8rem; font-size: 0.9rem; }
  select { width: 100%; padding: 0.6rem 0.7rem; font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
  .field.two { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.6rem; }
  textarea { min-height: 8rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85rem; }
  .field { margin-bottom: 1.1rem; }
  .hint { color: var(--ink-soft); font-size: 0.85rem; margin: 0.35rem 0 0; }
  .check { display: flex; align-items: flex-start; gap: 0.5rem; margin: 0.5rem 0; font-weight: 500; }
  .check input { margin-top: 0.3rem; }
  .check span small { display: block; color: var(--ink-soft); font-weight: 400; }
  details { border-top: 1px solid var(--line); padding-top: 0.8rem; margin-top: 1rem; }
  summary { cursor: pointer; font-weight: 600; margin-bottom: 0.6rem; }
  button {
    font: inherit; font-weight: 600; cursor: pointer;
    border-radius: var(--radius); border: 1px solid transparent;
    padding: 0.65rem 1.1rem;
  }
  .primary { background: var(--accent); color: var(--accent-ink); width: 100%; font-size: 1.05rem; }
  .primary:disabled { opacity: 0.6; cursor: wait; }
  .secondary { background: #fff; color: var(--ink); border-color: var(--line); }
  .secondary:hover { border-color: var(--ink-soft); }
  .toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
  .toolbar .grow { flex: 1; }
  .stats { color: var(--ink-soft); font-size: 0.9rem; }
  .log {
    margin-top: 1.1rem; max-height: 14rem; overflow-y: auto;
    font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.8rem;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.75rem;
  }
  .log:empty { display: none; }
  .log-line { padding: 0.1rem 0; white-space: pre-wrap; }
  .log-line.ok { color: var(--ok); }
  .log-line.warn { color: var(--warn); }
  .log-line.err { color: var(--err); }
  progress { width: 100%; height: 0.5rem; margin-top: 0.75rem; accent-color: var(--accent); }
  progress[hidden] { display: none; }
  .preview-frame {
    width: 100%; height: 100%; min-height: 70vh; border: 1px solid var(--line);
    border-radius: var(--radius); background: #fff;
  }
  .empty {
    border: 1px dashed var(--line); border-radius: var(--radius);
    display: grid; place-items: center; text-align: center; color: var(--ink-soft);
    padding: 3rem 1.5rem; min-height: 70vh;
    background:
      repeating-radial-gradient(circle at 30% 40%, transparent 0 34px, rgba(154,123,79,0.10) 34px 35px),
      repeating-radial-gradient(circle at 75% 70%, transparent 0 46px, rgba(29,95,176,0.08) 46px 47px);
  }
  .empty strong { color: var(--ink); display: block; font-size: 1.15rem; margin-bottom: 0.4rem; }
  @media (max-width: 860px) {
    .layout { grid-template-columns: 1fr; }
    .side { border-right: 0; border-bottom: 1px solid var(--line); }
  }
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
