:root {
    --bg: #0b0b0a;
    --surface: #161613;
    --surface-sunken: #101010;
    --border: #2b2b26;
    --border-strong: #403f38;
    --text: #f3f2ee;
    --text-secondary: #b0aea5;
    --text-muted: #7c7a72;
    --green: #4ade6f;
    --green-bg: #142418;
    --red: #ff6b6b;
    --red-bg: #2a1616;
    --accent: #f4c542;
    --accent-bg: #2a2311;
    --cyan: #5fd4d4;
    --mono: 'SF Mono', 'Menlo', 'Consolas', monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    --radius: 10px;
    --radius-sm: 6px;
    --space-1: 6px;
    --space-2: 10px;
    --space-3: 16px;
    --space-4: 24px;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    padding: 48px 20px 64px;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }
  .wrap { max-width: 720px; margin: 0 auto; }

  .eyebrow {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 8px;
  }
  h1 { font-size: 21px; font-weight: 650; letter-spacing: -0.01em; margin: 0 0 6px; }
  .sub { color: var(--text-secondary); font-size: 13.5px; margin: 0 0 28px; max-width: 52ch; }

  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: var(--space-3);
  }
  .card + .card { margin-top: 0; }

  label {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: block;
    margin-bottom: 7px;
  }

  input[type=text], input[type=password], select {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    transition: border-color .15s ease;
  }
  input[type=text]:focus, input[type=password]:focus, select:focus {
    outline: none;
    border-color: var(--accent);
  }
  input::placeholder { color: var(--text-muted); }

  .row { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: flex-end; }
  .row > div { flex: 1; min-width: 160px; }

  button {
    height: 36px;
    padding: 0 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #17140a;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s ease;
  }
  button:hover:not(:disabled) { opacity: .88; }
  button:disabled { opacity: 0.45; cursor: default; }
  button.secondary { background: transparent; color: var(--text); border-color: var(--border); }

  #status {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: var(--space-2);
    min-height: 16px;
  }
  #progressBar {
    height: 3px; background: var(--border); border-radius: 2px;
    overflow: hidden; margin-top: var(--space-2); display: none;
  }
  #progressFill { height: 100%; width: 0%; background: var(--accent); transition: width .2s ease; }

  .controls {
    display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap;
    padding-bottom: 16px; margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
  }
  .controls select {
    width: auto; min-width: 120px; height: 32px;
    font-weight: 600; font-size: 13px;
  }
  .slider-wrap {
    display: flex; align-items: center; gap: var(--space-2);
    font-family: var(--mono); font-size: 12px; color: var(--text-muted);
    flex: 1; min-width: 200px;
  }
  input[type=range] {
    flex: 1; -webkit-appearance: none; height: 3px;
    background: var(--border); border-radius: 2px; outline: none;
  }
  input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
    background: var(--accent); cursor: pointer; border: 2px solid var(--surface);
    box-shadow: 0 0 0 1px var(--accent);
  }
  input[type=range]::-moz-range-thumb {
    width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--surface);
    background: var(--accent); cursor: pointer; box-shadow: 0 0 0 1px var(--accent);
  }
  #thrOut {
    font-weight: 700; color: var(--text); min-width: 24px; text-align: right;
  }

  .list-item {
    display: flex; align-items: center; gap: var(--space-2);
    padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin-bottom: 6px; background: var(--surface-sunken);
  }
  .list-item:last-child { margin-bottom: 0; }
  .list-item .code {
    font-family: var(--mono); font-weight: 700; font-size: 12.5px;
    min-width: 76px; letter-spacing: .01em;
  }
  .bar-wrap { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
  .bar { height: 100%; border-radius: 3px; }
  .val {
    font-family: var(--mono); font-size: 12.5px; font-weight: 700;
    min-width: 42px; text-align: right;
  }

  .empty {
    color: var(--text-muted); font-size: 13px; padding: 14px 0; text-align: center;
  }
  .meta {
    font-family: var(--mono); font-size: 11.5px; color: var(--text-muted);
    margin-top: 14px; line-height: 1.6;
  }
  .badge {
    display: inline-block; font-family: var(--sans); font-size: 11px; padding: 2px 8px;
    border-radius: 10px; background: var(--green-bg); color: var(--green);
    font-weight: 600; margin-left: 8px;
  }
  a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; }
  a:hover { border-bottom-color: currentColor; }

  .legend {
    display: flex; gap: 16px; font-family: var(--mono); font-size: 11px;
    color: var(--text-muted); margin-top: 4px;
  }
  .legend span { display: inline-flex; align-items: center; gap: 5px; }
  .legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* --- shared: nav --- */
.nav { display: flex; gap: 4px; margin-bottom: 24px; }
.nav a {
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase; padding: 7px 12px; border-radius: 6px;
  color: var(--text-muted); border-bottom: none;
}
.nav a.active { background: var(--accent-bg); color: var(--accent); }
.nav a:hover:not(.active) { color: var(--text); }

/* --- plan page --- */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 14px;
}
.section-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 12px;
}
.section-num {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  color: var(--accent); background: var(--accent-bg);
  border-radius: 5px; padding: 2px 7px; min-width: 20px; text-align: center;
}
.section-head h2 { font-size: 14.5px; font-weight: 650; margin: 0; letter-spacing: -.005em; }
.section p { font-size: 13px; margin: 6px 0; color: var(--text-secondary); }
.section p strong { color: var(--text); }

.plan-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12.5px; }
.plan-table th, .plan-table td {
  border: 1px solid var(--border); padding: 7px 10px; text-align: left;
}
.plan-table th { background: var(--surface-sunken); font-weight: 600; color: var(--text-secondary); }

.check-group { margin: 12px 0; }
.check-label {
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px;
}
.check-item {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px;
}
.check-item:hover { background: var(--surface-sunken); }
.check-item input { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.check-note { font-size: 12px; color: var(--text-muted); font-style: italic; margin: 6px 0 0; }

.counter-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 18px; margin-bottom: 16px;
  font-family: var(--mono); font-size: 13px;
}
.counter-bar .count-wrap { display: flex; align-items: center; gap: 10px; }
.counter-bar .light {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--text-muted); flex-shrink: 0;
  transition: background .2s ease, box-shadow .2s ease;
}
.counter-bar .light.ok {
  background: var(--green);
  box-shadow: 0 0 8px 1px rgba(74, 222, 111, 0.55);
}
.counter-bar .count { font-weight: 700; font-size: 15px; }
.counter-bar .count.ok { color: var(--green); }
.counter-bar .count.low { color: var(--text-muted); }
.counter-bar button { height: 30px; padding: 0 12px; font-size: 12px; }

/* --- index page --- */
.tool-card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.tool-card:hover { border-color: var(--border-strong); }
.tool-card .tool-title { font-size: 15px; font-weight: 650; color: var(--text); margin: 0 0 4px; }
.tool-card .tool-desc { font-size: 13px; color: var(--text-secondary); margin: 0; }
