:root {
  --page: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --ink: #17202b;
  --muted: #687584;
  --faint: #8b96a3;
  --line: #dce3ea;
  --line-strong: #c6d1dd;
  --accent: #2f67db;
  --accent-soft: #edf3ff;
  --accent-wash: rgba(47, 103, 219, .08);
  --danger: #b04444;
  --success: #26764f;
  --shadow-soft: 0 12px 28px rgba(31, 47, 66, .06);
  --shadow-dialog: 0 28px 80px rgba(20, 35, 52, .18);
  --sans: Geist, "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { background: var(--page); color: var(--ink); }
body { margin: 0; min-width: 320px; font: 15px/1.5 var(--sans); }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(980px, calc(100% - 40px));
  height: 76px;
  margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 15px; font-weight: 720; letter-spacing: -.025em; text-decoration: none; }
.brand svg { width: 19px; height: 19px; color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: 7px; }
.tool-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, .75);
  color: var(--muted);
  transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}
.tool-button svg { width: 17px; height: 17px; }
.tool-button:hover { border-color: #aac0ef; background: var(--accent-soft); color: var(--accent); transform: translateY(-1px); }
.tool-button-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.tool-button-primary:hover { border-color: #2459c7; background: #2459c7; color: #fff; }

.hub-shell { width: min(980px, calc(100% - 40px)); margin: 0 auto; padding: 52px 0 88px; }
.hub-workspace { display: grid; gap: 14px; }
.control-bubble {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px solid rgba(220, 227, 234, .9);
  border-radius: 18px;
  background: rgba(255, 255, 255, .78);
  box-shadow: var(--shadow-soft);
}
.search-wrap { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 0 10px; border-radius: 12px; color: var(--faint); }
.search-wrap:focus-within { background: var(--surface); box-shadow: inset 0 0 0 1px #a9c0f0, 0 0 0 3px var(--accent-wash); }
.search-wrap svg { width: 17px; height: 17px; }
.search-wrap input { width: 100%; height: 42px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 14px; }
.search-wrap input::placeholder { color: var(--faint); }
.category-nav { display: flex; align-items: center; gap: 4px; }
.category-button { min-height: 34px; padding: 6px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 13px; white-space: nowrap; transition: background .18s ease, color .18s ease; }
.category-button:hover { background: var(--surface-soft); color: var(--ink); }
.category-button.active { background: var(--accent-soft); color: var(--accent); font-weight: 680; }
.category-count { margin-left: 5px; font: 11px var(--mono); opacity: .72; }

.skill-surface { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-soft); }
.skill-list { display: grid; }
.skill-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 76px;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition: background .18s ease, color .18s ease;
}
.skill-row:last-child { border-bottom: 0; }
.skill-row:hover, .skill-row.active { background: var(--surface-soft); }
.skill-row:focus-visible { position: relative; z-index: 1; outline: 3px solid #c8d8ff; outline-offset: -3px; }
.skill-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.skill-mark svg { width: 16px; height: 16px; }
.skill-name { overflow: hidden; font-size: 14px; font-weight: 680; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.skill-meta { display: flex; align-items: center; gap: 11px; color: var(--faint); font-size: 12px; white-space: nowrap; }
.skill-category { color: var(--muted); }
.skill-chevron { width: 17px; height: 17px; color: #a2adba; transition: color .18s ease, transform .18s ease; }
.skill-row:hover .skill-chevron, .skill-row.active .skill-chevron { color: var(--accent); transform: translateX(2px); }
.empty { padding: 44px 18px; color: var(--muted); font-size: 14px; text-align: center; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 0; }
.pagination:not(:empty) { min-height: 62px; border-top: 1px solid var(--line); }
.page-button { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--muted); }
.page-button:hover:not(:disabled) { border-color: #aac0ef; background: var(--accent-soft); color: var(--accent); }
.page-button:disabled { cursor: default; opacity: .35; }
.page-button svg { width: 16px; height: 16px; }
.page-index { min-width: 34px; color: var(--muted); font: 12px var(--mono); text-align: center; }

.detail-dialog, .upload-dialog { width: min(520px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-dialog); }
.detail-dialog::backdrop, .upload-dialog::backdrop { background: rgba(24, 35, 48, .18); backdrop-filter: blur(3px); }
.detail-panel { padding: 22px; }
.detail-top, .dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.detail-title { margin: 13px 0 0; font-size: 25px; line-height: 1.22; letter-spacing: -.05em; overflow-wrap: anywhere; }
.detail-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.detail-mark svg { width: 19px; height: 19px; }
.detail-facts { display: grid; margin-top: 24px; border-top: 1px solid var(--line); }
.detail-fact { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.detail-fact span { color: var(--muted); }
.detail-fact b { font-weight: 680; text-align: right; }
.detail-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 19px; }
.detail-action { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 650; }
.detail-action:hover { border-color: #aac0ef; background: var(--accent-soft); color: var(--accent); }
.detail-action svg { width: 16px; height: 16px; }
.detail-feedback { display: flex; align-items: center; gap: 7px; min-height: 22px; margin-top: 9px; color: var(--success); font-size: 12px; font-weight: 650; }
.detail-feedback::before { content: '✓'; display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: #e5f4ea; font-size: 10px; }
.detail-feedback.error { color: var(--danger); }
.detail-feedback.error::before { content: '!'; background: #fdeaea; }
.detail-url { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.detail-url code { display: block; overflow: hidden; color: var(--muted); font: 11px/1.5 var(--mono); text-overflow: ellipsis; white-space: nowrap; }

.toast { position: fixed; inset: auto 20px 20px auto; margin: 0; z-index: 20; max-width: 300px; padding: 10px 13px; border: 1px solid #cfe0d5; border-radius: 11px; background: #f3fbf5; color: var(--success); font-size: 13px; box-shadow: var(--shadow-soft); opacity: 0; pointer-events: none; transform: translateY(7px); transition: opacity .18s ease, transform .18s ease; }
.toast:not(:popover-open) { display: none; }
.toast.error { border-color: #edcaca; background: #fff5f5; color: var(--danger); }
.toast.show { opacity: 1; transform: translateY(0); }

.upload-dialog form { padding: 22px; }
.dialog-head { align-items: center; margin-bottom: 20px; }
.dialog-head h2 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.dropzone { display: flex; align-items: center; gap: 10px; min-height: 56px; margin-bottom: 17px; padding: 11px 13px; border: 1px dashed #abb8c6; border-radius: 13px; background: var(--surface-soft); color: var(--muted); cursor: pointer; }
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.upload-dialog .dropzone input { position: absolute; width: 1px; min-width: 0; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; }
.dropzone svg { width: 18px; height: 18px; color: var(--accent); }
.dropzone span { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.upload-dialog label:not(.dropzone) { display: grid; gap: 6px; margin-bottom: 15px; color: var(--muted); font-size: 12px; font-weight: 650; }
.upload-dialog label input, .upload-dialog label select { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 400; }
.upload-dialog label input:focus, .upload-dialog label select:focus { border-color: #9db7ef; box-shadow: 0 0 0 3px var(--accent-wash); }
.dialog-actions { display: flex; align-items: center; gap: 8px; margin-top: 7px; padding-top: 16px; border-top: 1px solid var(--line); }
.form-state { margin-right: auto; color: var(--muted); font-size: 12px; }
.form-state.error { color: var(--danger); }
.button { min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 650; }
.button:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.button-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.button-primary:hover { border-color: #2459c7; background: #2459c7; }
.button:disabled { cursor: wait; opacity: .55; }

:focus-visible { outline: 3px solid #c8d8ff; outline-offset: 2px; }
@media (max-width: 680px) {
  .topbar, .hub-shell { width: calc(100% - 30px); }
  .topbar { height: 66px; }
  .hub-shell { padding: 28px 0 54px; }
  .control-bubble { grid-template-columns: 1fr; gap: 4px; padding: 7px; border-radius: 16px; }
  .category-nav { overflow-x: auto; padding: 1px; scrollbar-width: none; }
  .category-nav::-webkit-scrollbar { display: none; }
  .category-button { flex: 0 0 auto; }
  .skill-surface { border-radius: 17px; }
  .skill-row { grid-template-columns: 32px minmax(0, 1fr) 16px; min-height: 72px; padding: 12px 14px; }
  .skill-meta { grid-column: 2; grid-row: 2; gap: 8px; margin-top: -9px; }
  .skill-chevron { grid-column: 3; grid-row: 1 / span 2; }
  .detail-dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .detail-panel { padding: 21px 18px calc(20px + env(safe-area-inset-bottom)); }
  .detail-dialog::backdrop { background: rgba(24, 35, 48, .2); }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .dialog-actions { flex-wrap: wrap; }
  .form-state { width: 100%; margin-right: 0; }
  .dialog-actions .button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
