:root {
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-2: #eef4f6;
  --text: #13232e;
  --muted: #60717c;
  --line: #d9e2e7;
  --brand: #0b4f6c;
  --brand-strong: #083d53;
  --accent: #1d778f;
  --soft-brand: #e4f1f5;
  --success: #22664b;
  --shadow: 0 16px 42px rgba(16, 45, 59, 0.09);
  --shadow-sm: 0 8px 20px rgba(16, 45, 59, 0.07);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --focus: 0 0 0 4px rgba(29, 119, 143, 0.18);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0e171d;
  --surface: #142129;
  --surface-2: #192a34;
  --text: #edf4f7;
  --muted: #a9bbc5;
  --line: #2a3c46;
  --brand: #67b8cc;
  --brand-strong: #8fd0df;
  --accent: #7bc6d8;
  --soft-brand: #183540;
  --success: #7bc59f;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 10px 24px rgba(0, 0, 0, 0.2);
  --focus: 0 0 0 4px rgba(123, 198, 216, 0.2);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
a { color: inherit; }

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 999;
  transform: translateY(-150%);
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--text);
  color: var(--surface);
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px);
}
.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
}
.brand-mark {
  width: 43px;
  height: 43px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--brand-strong);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .06em;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.brand-copy { display: grid; line-height: 1.15; }
.brand-copy strong { font-size: 15px; letter-spacing: -.01em; }
.brand-copy span { margin-top: 5px; color: var(--muted); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.tool-count {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
}
.icon-button {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.icon-button:hover { border-color: var(--accent); }
.icon-button:focus-visible { outline: none; box-shadow: var(--focus); }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.hero {
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 82% 20%, color-mix(in srgb, var(--soft-brand) 85%, transparent), transparent 34%),
    linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--bg) 62%, var(--surface)));
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 72px;
  align-items: end;
  padding: 68px 0 58px;
}
.eyebrow, .section-kicker {
  margin: 0 0 13px;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: .11em;
  font-size: 11px;
  font-weight: 800;
}
.hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(38px, 5.5vw, 66px);
  line-height: .99;
  letter-spacing: -.045em;
  font-weight: 760;
}
.hero-text {
  max-width: 740px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 18px;
}
.hero-panel {
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow-sm);
}
.search-label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 800; }
.search-box {
  height: 52px;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg);
}
.search-box:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.search-box svg { width: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}
.search-box input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
kbd {
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 2px 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
  font-family: inherit;
  font-weight: 700;
}
.search-status { min-height: 19px; margin: 9px 2px 0; color: var(--muted); font-size: 12px; }

.portal-section { padding: 52px 0 66px; }
.section-topline {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 28px;
}
.section-topline h2 { margin: 0; font-size: 30px; letter-spacing: -.03em; }
.filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.filter-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}
.filter-button:hover { border-color: var(--accent); color: var(--text); }
.filter-button.active { border-color: var(--brand); background: var(--soft-brand); color: var(--brand-strong); }
.filter-button:focus-visible { outline: none; box-shadow: var(--focus); }

.recent-section {
  margin: 0 0 28px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 82%, var(--soft-brand));
}
.section-subhead { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.section-subhead h3 { margin: 0; font-size: 13px; }
.text-button { border: 0; background: transparent; color: var(--brand); font-weight: 800; font-size: 12px; cursor: pointer; }
.recent-list { display: flex; flex-wrap: wrap; gap: 8px; }
.recent-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--surface);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}
.recent-item:hover { border-color: var(--accent); }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.tool-card {
  position: relative;
  min-height: 292px;
  display: flex;
  flex-direction: column;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255,255,255,.5);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tool-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: var(--shadow); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tool-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--soft-brand);
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: .04em;
}
.category-badge {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
}
.tool-card h3 { margin: 23px 0 7px; font-size: 21px; letter-spacing: -.025em; }
.tool-category { margin: 0 0 12px; color: var(--brand); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.tool-description { margin: 0; color: var(--muted); font-size: 14px; }
.card-actions { display: flex; align-items: center; gap: 9px; margin-top: auto; padding-top: 24px; }
.open-button, .secondary-button, .copy-button {
  border-radius: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.open-button {
  flex: 1;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--brand-strong);
  background: var(--brand-strong);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
}
.open-button:hover { background: var(--brand); }
.copy-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}
.copy-button:hover { border-color: var(--accent); color: var(--text); }
.open-button:focus-visible, .copy-button:focus-visible, .secondary-button:focus-visible { outline: none; box-shadow: var(--focus); }
.copy-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.external-arrow { font-size: 16px; line-height: 1; }

.empty-state {
  max-width: 460px;
  margin: 34px auto 0;
  padding: 38px;
  text-align: center;
}
.empty-icon { font-size: 38px; color: var(--muted); }
.empty-state h3 { margin: 8px 0 6px; }
.empty-state p { margin: 0 0 18px; color: var(--muted); }
.secondary-button { border: 1px solid var(--line); padding: 9px 13px; background: var(--surface); color: var(--text); }

.info-band { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.info-grid > div { padding: 29px 27px; border-right: 1px solid var(--line); }
.info-grid > div:first-child { padding-left: 0; }
.info-grid > div:last-child { border-right: 0; padding-right: 0; }
.info-label { display: block; margin-bottom: 5px; color: var(--brand); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .1em; }
.info-grid strong { display: block; font-size: 15px; }
.info-grid p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
code { border: 1px solid var(--line); border-radius: 5px; padding: 1px 4px; background: var(--bg); font-size: .95em; }

.site-footer { padding: 27px 0 38px; color: var(--muted); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 12px; }
.footer-inner > div:first-child { display: grid; gap: 3px; }
.footer-inner strong { color: var(--text); }
.footer-meta { display: flex; gap: 8px; align-items: center; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 750;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; gap: 34px; padding: 50px 0 46px; }
  .hero-panel { max-width: 620px; }
  .section-topline { align-items: flex-start; flex-direction: column; }
  .filters { justify-content: flex-start; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-grid { grid-template-columns: 1fr; }
  .info-grid > div, .info-grid > div:first-child, .info-grid > div:last-child { padding: 22px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .info-grid > div:last-child { border-bottom: 0; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 26px, 1180px); }
  .header-inner { min-height: 66px; }
  .brand-copy strong { font-size: 13px; }
  .brand-copy span { display: none; }
  .brand-mark { width: 39px; height: 39px; border-radius: 10px; }
  .tool-count { display: none; }
  .hero-grid { padding: 42px 0 36px; }
  .hero h1 { font-size: clamp(36px, 13vw, 50px); }
  .hero-text { font-size: 15px; }
  kbd { display: none; }
  .portal-section { padding: 38px 0 50px; }
  .section-topline h2 { font-size: 25px; }
  .filters { flex-wrap: nowrap; width: 100%; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
  .filter-button { white-space: nowrap; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: 265px; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
}

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