:root {
  color-scheme: light;
  --bg: #f4fbf9;
  --surface: #ffffff;
  --surface-soft: #e9f7f4;
  --text: #12312d;
  --muted: #526b67;
  --primary: #0f766e;
  --primary-strong: #0a5a54;
  --primary-soft: #d6efea;
  --accent: #c2410c;
  --success: #18794e;
  --warning: #9a5312;
  --danger: #b42318;
  --border: #cde4df;
  --focus: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(18, 49, 45, 0.08), 0 6px 18px rgba(18, 49, 45, 0.05);
  --shadow-md: 0 2px 5px rgba(18, 49, 45, 0.08), 0 18px 44px rgba(18, 49, 45, 0.1);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); scroll-behavior: smooth; }

body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 90% 0%, rgba(15, 118, 110, 0.1), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-tap-highlight-color: rgba(15, 118, 110, 0.16);
}

button, input { font: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.62; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.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;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: var(--surface);
  transform: translateY(-150%);
  transition: transform 160ms ease-out;
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  padding-top: var(--safe-top);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(18px);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 1180px);
  min-height: 68px;
  margin-inline: auto;
  padding: 10px 16px;
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.brand__mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 14px;
  background: var(--primary);
  box-shadow: var(--shadow-sm);
}
.brand__mark svg { width: 28px; fill: none; stroke: white; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.brand strong { display: block; font-size: 1rem; letter-spacing: -0.015em; }
.brand small { display: block; overflow: hidden; color: var(--muted); font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }

.privacy-chip {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  color: var(--primary-strong);
  font-size: 0.76rem;
  font-weight: 700;
}
.privacy-chip svg { width: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

.page { width: min(100%, 1180px); margin-inline: auto; padding: 20px 16px calc(40px + var(--safe-bottom)); }

.boot-panel {
  display: grid;
  min-height: min(70vh, 560px);
  place-content: center;
  justify-items: center;
  padding: 28px;
  text-align: center;
}
.boot-panel h1 { margin: 22px 0 6px; font-size: clamp(1.45rem, 6vw, 2rem); letter-spacing: -0.04em; }
.boot-panel p { max-width: 34ch; margin: 0; color: var(--muted); }
.boot-panel .button { margin-top: 20px; }

.loader {
  width: 44px;
  height: 44px;
  border: 4px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hero {
  position: relative;
  display: grid;
  min-height: 220px;
  align-items: end;
  overflow: hidden;
  padding: 28px 24px;
  border-radius: var(--radius-lg);
  background: var(--text);
  box-shadow: var(--shadow-md);
  color: #f7fffd;
  isolation: isolate;
}
.hero::before {
  position: absolute;
  z-index: -1;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(36, 184, 168, 0.22);
  content: "";
  inset: -170px -110px auto auto;
}
.hero__copy { max-width: 610px; }
.hero .eyebrow { color: #9de5dc; }
.hero h1 { max-width: 12ch; margin: 5px 0 10px; font-size: clamp(2rem, 9vw, 4.4rem); letter-spacing: -0.055em; line-height: 0.98; text-wrap: balance; }
.hero p:last-child { max-width: 52ch; margin: 0; color: #cde4df; font-size: 0.95rem; }
.hero__signal { position: absolute; right: 20px; bottom: 20px; display: flex; align-items: end; gap: 5px; opacity: 0.7; }
.hero__signal span { display: block; width: 5px; border-radius: 999px; background: #9de5dc; }
.hero__signal span:nth-child(1) { height: 14px; }
.hero__signal span:nth-child(2) { height: 26px; }
.hero__signal span:nth-child(3) { height: 40px; }

.eyebrow { margin: 0; color: var(--primary); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }

.notice {
  margin-top: 16px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.88rem;
}
.notice strong { color: var(--warning); }

.catalog { padding-top: 34px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.section-heading h2 { margin: 2px 0 0; font-size: clamp(1.7rem, 7vw, 2.5rem); letter-spacing: -0.045em; line-height: 1.1; }
.result-count { margin: 0 0 3px; color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }

.view-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 20px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}
.view-tab {
  min-height: 44px;
  padding: 9px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: clamp(0.76rem, 3.5vw, 0.9rem);
  font-weight: 700;
  transition: background-color 160ms ease-out, color 160ms ease-out, box-shadow 160ms ease-out;
}
.view-tab[aria-current="page"] { background: var(--surface); box-shadow: 0 1px 4px rgba(18, 49, 45, 0.12); color: var(--text); }

.search {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 14px;
}
.search > svg { position: absolute; left: 15px; width: 21px; fill: none; stroke: var(--muted); stroke-linecap: round; stroke-width: 1.8; pointer-events: none; }
.search input {
  width: 100%;
  min-height: 52px;
  padding: 12px 48px 12px 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  font-size: 16px;
}
.search input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.search button {
  position: absolute;
  right: 4px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
}
.search button:hover { background: var(--surface-soft); color: var(--text); }
.search button svg { width: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.7; }

.categories { margin-top: 20px; }
.categories > p { margin: 0 0 10px; color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.category-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.category-chip {
  min-height: 44px;
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color 160ms ease-out, background-color 160ms ease-out, color 160ms ease-out;
}
.category-chip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary); color: white; }

.catalog-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 20px; }

.toolkit-card {
  display: grid;
  min-width: 0;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 180ms ease-out, border-color 180ms ease-out, box-shadow 180ms ease-out;
}
.toolkit-card:hover { border-color: color-mix(in srgb, var(--primary) 48%, var(--border)); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.toolkit-card__mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 1rem;
  font-weight: 850;
  letter-spacing: -0.04em;
}
.toolkit-card__body { min-width: 0; }
.toolkit-card__top { display: flex; min-width: 0; align-items: start; justify-content: space-between; gap: 8px; }
.toolkit-card h3 { min-width: 0; margin: 1px 0 0; overflow: hidden; font-size: 1rem; letter-spacing: -0.02em; text-overflow: ellipsis; white-space: nowrap; }
.status {
  display: inline-flex;
  min-height: 24px;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
}
.status::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status--connected { background: #e2f5ea; color: var(--success); }
.status--pending { background: #fff3dc; color: var(--warning); }
.toolkit-card__description {
  display: -webkit-box;
  min-height: 2.5em;
  margin: 5px 0 12px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.toolkit-card__footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.toolkit-card__category { min-width: 0; overflow: hidden; color: var(--muted); font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.card-action {
  min-height: 44px;
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid var(--primary);
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font-size: 0.8rem;
  font-weight: 800;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, transform 160ms ease-out;
}
.card-action:hover:not(:disabled) { border-color: var(--primary-strong); background: var(--primary-strong); }
.card-action:active:not(:disabled) { transform: translateY(1px); }
.card-action--connected { border-color: var(--border); background: var(--surface); color: var(--text); }
.card-action--connected:hover:not(:disabled) { border-color: var(--danger); background: #fff4f2; color: var(--danger); }

.skeleton-card { min-height: 166px; overflow: hidden; position: relative; }
.skeleton-card::after {
  position: absolute;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.66), transparent);
  content: "";
  inset: 0;
  transform: translateX(-100%);
  animation: shimmer 1.3s ease-in-out infinite;
}
.skeleton-card span { display: block; border-radius: 8px; background: var(--surface-soft); }
.skeleton-card .s1 { width: 48px; height: 48px; }
.skeleton-card .s2 { width: 58%; height: 18px; margin-bottom: 12px; }
.skeleton-card .s3 { width: 92%; height: 12px; margin-bottom: 8px; }
.skeleton-card .s4 { width: 72%; height: 12px; }
@keyframes shimmer { to { transform: translateX(100%); } }

.empty-state { display: grid; justify-items: center; margin-top: 20px; padding: 42px 24px; border: 1px dashed var(--border); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--surface) 70%, transparent); text-align: center; }
.empty-state__icon { display: grid; width: 56px; height: 56px; place-items: center; border-radius: 18px; background: var(--surface-soft); color: var(--primary); }
.empty-state__icon svg { width: 28px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.6; }
.empty-state h3 { margin: 16px 0 5px; font-size: 1.1rem; }
.empty-state p { max-width: 36ch; margin: 0; color: var(--muted); font-size: 0.88rem; }
.empty-state .button { margin-top: 18px; }

.button {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 800;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out, transform 160ms ease-out;
}
.button:active:not(:disabled) { transform: translateY(1px); }
.button--primary { border: 1px solid var(--primary); background: var(--primary); color: white; }
.button--primary:hover { background: var(--primary-strong); }
.button--secondary { border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.button--secondary:hover { border-color: var(--primary); color: var(--primary); }
.button--danger { border: 1px solid var(--danger); background: var(--danger); color: white; }
.load-more-wrap { display: flex; justify-content: center; margin-top: 18px; }

.dialog {
  width: min(calc(100% - 32px), 420px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--text);
}
.dialog::backdrop { background: rgba(5, 24, 21, 0.58); backdrop-filter: blur(4px); }
.dialog form { position: relative; padding: 28px 22px 22px; text-align: center; }
.dialog__close { position: absolute; top: 8px; right: 8px; display: grid; width: 44px; height: 44px; place-items: center; border: 0; border-radius: 12px; background: transparent; color: var(--muted); }
.dialog__close:hover { background: var(--surface-soft); }
.dialog__close svg { width: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }
.dialog__icon { display: grid; width: 58px; height: 58px; margin-inline: auto; place-items: center; border-radius: 18px; background: #fff0ed; color: var(--danger); }
.dialog__icon svg { width: 30px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.dialog h2 { margin: 16px 0 8px; font-size: 1.3rem; letter-spacing: -0.03em; }
.dialog p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.dialog__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 22px; }

.toast {
  position: fixed;
  z-index: 50;
  right: 16px;
  bottom: calc(16px + var(--safe-bottom));
  left: 16px;
  max-width: 520px;
  margin-inline: auto;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--text);
  box-shadow: var(--shadow-md);
  color: white;
  font-size: 0.88rem;
  font-weight: 650;
}

@media (min-width: 680px) {
  .topbar__inner, .page { padding-inline: 24px; }
  .hero { min-height: 300px; padding: 42px; }
  .catalog { padding-top: 48px; }
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .view-tabs { width: 520px; }
  .search { width: min(100%, 700px); }
}

@media (min-width: 1040px) {
  .topbar__inner, .page { padding-inline: 32px; }
  .catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .toolkit-card { min-height: 174px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b1c19;
    --surface: #122824;
    --surface-soft: #19342f;
    --text: #effaf7;
    --muted: #a3bbb6;
    --primary: #43bdb0;
    --primary-strong: #74d8cd;
    --primary-soft: #183f39;
    --border: #2a4943;
    --focus: #fbbf24;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2), 0 6px 18px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.22), 0 20px 48px rgba(0, 0, 0, 0.2);
  }
  .hero { background: #06110f; }
  .status--connected { background: #183f2b; }
  .status--pending { background: #4a3216; }
  .card-action--connected:hover:not(:disabled) { background: #3b1a17; }
  .dialog__icon { background: #3b1a17; }
}

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