:root {
  color-scheme: light;
  --bg: #eef2f1;
  --surface: #ffffff;
  --surface-strong: #f6f8f7;
  --ink: #161b1f;
  --muted: #58646b;
  --soft: #dce2e1;
  --line: #c7d0cf;
  --accent: #0b7a68;
  --accent-strong: #07584e;
  --accent-soft: #dff2ed;
  --novel: #8a3ffc;
  --novel-soft: #f0e8ff;
  --rtl: #006d77;
  --rtl-soft: #dff6f5;
  --blue: #2458d3;
  --blue-soft: #e7edff;
  --amber: #9a5a05;
  --amber-soft: #fff0d7;
  --shadow: 0 22px 60px rgba(28, 41, 47, 0.14);
  --radius: 8px;
  font-family:
    Inter, "Noto Sans SC", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(0, 109, 119, 0.11) 0, transparent 35%),
    linear-gradient(180deg, #f6f0ff 0, var(--bg) 38%, #edf3f2 100%);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(138, 63, 252, 0.38);
  outline-offset: 2px;
}

.shell {
  width: min(1480px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
}

.workspace {
  display: grid;
  grid-template-columns: 324px minmax(0, 1fr);
  min-height: calc(100vh - 32px);
  overflow: hidden;
  border: 1px solid rgba(131, 153, 166, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(248, 251, 252, 0.94);
}

.brand {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, #15191d 0 49%, var(--rtl) 50%),
    #172027;
  color: #ffffff;
  font-weight: 760;
}

.brand strong {
  display: block;
  font-size: 1.08rem;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.filter-block {
  display: grid;
  gap: 12px;
}

.filter-heading,
.search-label,
.select-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #2b3942;
  font-size: 0.82rem;
  font-weight: 720;
}

.text-button {
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 720;
}

.text-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.text-button:hover {
  background: var(--accent-soft);
}

.search-box {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.search-box span {
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  max-width: 100%;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #30414b;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 660;
  line-height: 1.1;
  white-space: nowrap;
}

.chip.is-active {
  border-color: rgba(14, 124, 102, 0.55);
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(14, 124, 102, 0.16);
}

.tag {
  min-height: 24px;
  padding: 0 8px;
  cursor: default;
  font-size: 0.72rem;
  font-weight: 650;
}

.tag.kind-official {
  border-color: rgba(37, 99, 235, 0.24);
  background: var(--blue-soft);
  color: #1d4ed8;
}

.tag.kind-install {
  border-color: rgba(161, 92, 8, 0.24);
  background: var(--amber-soft);
  color: var(--amber);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #30414b;
  font-size: 0.88rem;
  font-weight: 650;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.content {
  min-width: 0;
  padding: 26px;
  overflow: auto;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--rtl);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 900px;
  margin-bottom: 10px;
  font-size: clamp(2rem, 4vw, 4.5rem);
  font-weight: 820;
  line-height: 1;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 820px;
  margin-bottom: 0;
  color: #46545c;
  font-size: 1rem;
  line-height: 1.65;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.24rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  letter-spacing: 0;
}

.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  flex: 0 0 auto;
  padding: 0 14px;
  border: 1px solid rgba(0, 109, 119, 0.32);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--rtl);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 760;
}

.source-link:hover {
  background: var(--accent-soft);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 12px;
  min-height: 84px;
  padding: 14px;
  border: 1px solid rgba(120, 137, 140, 0.35);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-card img {
  grid-row: span 2;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--surface-strong);
}

.stat-value {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.6rem;
  font-weight: 780;
  line-height: 1;
}

.stat-label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.collection-tools,
.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.active-filter-row {
  display: flex;
  min-height: 32px;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tool-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

select {
  min-height: 36px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
}

.source-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.source-strip article {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.source-strip img {
  width: 38px;
  height: 38px;
  border-radius: 7px;
}

.source-strip strong,
.source-strip span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-strip strong {
  font-size: 0.88rem;
}

.source-strip span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
}

.sync-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1px solid rgba(14, 124, 102, 0.28);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(138, 63, 252, 0.08), rgba(0, 109, 119, 0.09)),
    rgba(225, 243, 238, 0.72);
}

.sync-panel strong,
.sync-panel span {
  display: block;
}

.sync-panel strong {
  font-size: 0.9rem;
}

.sync-panel span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.results-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.skill-card {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 12px;
  min-height: 274px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.skill-card:hover {
  border-color: rgba(0, 109, 119, 0.34);
  box-shadow: 0 14px 34px rgba(35, 51, 57, 0.1);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.source-pill img {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 6px;
}

.score {
  display: inline-flex;
  min-width: 42px;
  justify-content: center;
  padding: 5px 7px;
  border-radius: 6px;
  background: #edf8f4;
  color: var(--accent-strong);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.76rem;
  font-weight: 790;
}

.skill-card p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.open-link,
.install-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 11px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 760;
}

.open-link {
  border: 1px solid #172027;
  background: #172027;
  color: #ffffff;
}

.install-button {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: #30414b;
}

.install-button:hover,
.open-link:hover {
  transform: translateY(-1px);
}

.empty-state {
  padding: 36px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 292px minmax(0, 1fr);
  }

  .stats-grid,
  .source-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .shell {
    width: 100%;
    margin: 0;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content {
    padding: 20px;
  }

  .topbar,
  .collection-tools,
  .sync-panel,
  .results-head {
    align-items: stretch;
    flex-direction: column;
  }

  .source-link,
  .tool-actions {
    align-self: flex-start;
  }

  h1 {
    font-size: clamp(2rem, 10vw, 3.2rem);
    line-height: 1;
  }

  .hero-copy {
    font-size: 0.94rem;
  }

  .stats-grid,
  .source-strip,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .skill-card {
    min-height: 0;
  }
}

@media (max-width: 460px) {
  .content,
  .sidebar {
    padding: 16px;
  }

  .card-top,
  .card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .open-link,
  .install-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .skill-card:hover,
  .install-button:hover,
  .open-link:hover {
    transform: none;
  }
}
