:root {
  --bg: #f4f5f7;
  --ink: #1f2937;
  --muted: #6b7280;
  --accent: #1f3a8a;
  --accent-hover: #152a66;
  --accent-soft: #e6ebf8;
  --chip: #f9fafb;
  --chip-active: #1f3a8a;
  --chip-active-ink: #fff;
  --card: #ffffff;
  --line: #e5e7eb;
  --danger: #b91c1c;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  min-height: 100vh;
  padding: 0 16px 40px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.brand {
  text-align: center;
  padding: 24px 0 16px;
  border-bottom: 1px solid var(--line);
}
.brand h1 {
  margin: 0;
  font-size: 1.6em;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 700;
}
.brand .tag {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82em;
}
main {
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 0;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 14px;
}
.card h2 {
  margin: 0 0 10px;
  font-size: 1.05em;
  font-weight: 600;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9em; }
.notice {
  margin: 12px 0;
  padding: 10px 12px;
  background: var(--accent-soft);
  border-radius: 6px;
  font-size: 0.9em;
  color: var(--accent);
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.actions button { margin-top: 0; flex: 1 1 auto; }
button {
  cursor: pointer;
  font-family: inherit;
  padding: 10px 16px;
  border-radius: 6px;
  border: none;
  font-size: 0.95em;
  margin-top: 10px;
  transition: background 0.15s, color 0.15s;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button.secondary {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 0.85em;
  padding: 6px 12px;
}
input[type=text], input[type=url], textarea {
  width: 100%;
  padding: 10px;
  background: #f9fafb;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.92em;
  margin-top: 8px;
}
textarea { resize: vertical; min-height: 72px; }
.profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 12px 0;
}
.profile img {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  object-fit: cover;
}
.field {
  display: flex;
  gap: 8px;
  font-size: 0.88em;
  margin: 2px 0;
}
.field .label {
  color: var(--muted);
  min-width: 8em;
}
pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.8em;
}

/* ========== Wizard ========== */
.progress {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  margin: -4px 0 16px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s;
}
.wizard-question {
  font-size: 1.05em;
  font-weight: 600;
  margin: 0 0 4px;
}
.wizard-hint {
  color: var(--muted);
  font-size: 0.82em;
  margin: 0 0 14px;
}
.wizard-section {
  margin: 12px 0;
}
.wizard-section-label {
  font-size: 0.88em;
  font-weight: 600;
  color: var(--muted);
  margin: 10px 0 6px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.chip {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.85em;
  user-select: none;
  transition: all 0.15s;
}
.chip:active { transform: scale(0.95); }
.chip.active {
  background: var(--chip-active);
  color: var(--chip-active-ink);
  border-color: var(--chip-active);
}
.chip.extracted::before {
  content: "★ ";
  color: #f59e0b;
}
.chip.active.extracted::before { color: #fbbf24; }
.chip.added::before { content: "＋ "; }
.url-list { margin: 8px 0; }
.url-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.url-row input { margin-top: 0; }
.url-row button {
  margin-top: 0;
  padding: 6px 10px;
  font-size: 0.85em;
}
.ingest-result {
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.85em;
  color: var(--accent);
  margin: 8px 0;
}
.ingest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ingest-row button {
  margin-top: 0;
  padding: 4px 10px;
  font-size: 0.82em;
  flex: 0 0 auto;
}
.wizard-nav {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.wizard-nav button { flex: 1; }
.wizard-foot {
  text-align: center;
  margin-top: 10px;
}
.scale-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fafbfc;
}
.scale-group .skill-name {
  font-weight: 600;
  font-size: 0.92em;
  margin-bottom: 6px;
}
.loading-inline {
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.why-box {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 0.85em;
  color: #78350f;
  margin: 10px 0 16px;
  line-height: 1.55;
}
.form-label {
  display: block;
  font-size: 0.88em;
  font-weight: 600;
  margin-top: 14px;
  color: var(--ink);
}
.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}
.form-hint {
  font-size: 0.78em;
  color: var(--muted);
  margin: 2px 0 4px;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82em;
  color: var(--muted);
  margin-top: 4px;
  cursor: pointer;
}
.toggle-row input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}
.section-actions button,
.section-actions-only button {
  padding: 4px 10px;
  font-size: 0.78em;
  margin-left: 4px;
  margin-top: 0;
}
.section-actions-only {
  margin: 4px 0 6px;
  text-align: right;
}
.chip-remove {
  margin: 0 0 0 4px;
  padding: 0 4px;
  background: transparent;
  color: inherit;
  border: none;
  font-size: 1em;
  cursor: pointer;
  line-height: 1;
}
.chip.active .chip-remove { color: #fff; }

/* ========== Step Navigation ========== */
.step-nav {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  padding: 4px 2px 12px;
  margin-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.step-nav::-webkit-scrollbar { height: 4px; }
.step-nav::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
.step-nav-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px 6px;
  min-width: 56px;
  font-size: 0.72em;
  color: var(--muted);
  cursor: pointer;
  margin-top: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.step-nav-item:disabled:not(.is-current) { cursor: default; }
.step-nav-item.is-done {
  color: var(--accent);
  border-color: var(--accent-soft);
  background: var(--accent-soft);
}
.step-nav-item.is-done:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.step-nav-item.is-current {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.step-nav-item.is-future {
  opacity: 0.45;
}
.step-nav-badge {
  font-weight: 700;
  font-size: 0.95em;
  line-height: 1;
}
.step-nav-label {
  white-space: nowrap;
  font-size: 0.92em;
}
.step-nav-item.is-current .step-nav-badge,
.step-nav-item.is-done .step-nav-badge {
  display: inline-block;
  min-width: 1em;
  text-align: center;
}

.save-status {
  font-size: 0.78em;
  color: var(--muted);
  text-align: right;
  min-height: 1.2em;
  margin: -6px 0 8px;
  transition: color 0.2s;
}
.save-status.save-saving { color: var(--accent); }
.save-status.save-saved { color: #166534; }
.save-status.save-error { color: var(--danger); }
.save-status.save-pending { color: #a16207; }
