/* TinySandy – main stylesheet (tokens, base, layout, components, tool UI) */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-wght-normal.woff2")
    format("woff2-variations");
}

:root {
  --font:
    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --mono:
    ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --bg: #ffffff;
  --bg-soft: #f5f8fd;
  --bg-hero: linear-gradient(180deg, #eaf2ff 0%, #f4f8ff 100%);
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --border: #dfe6f1;
  --border-strong: #c3cfe2;
  --text: #0f1b3d;
  --text-2: #46526b;
  --text-3: #5a6680;
  --primary: #0a5fe0;
  --primary-h: #074fc0;
  --primary-soft: #e6f0ff;
  --on-primary: #ffffff;
  --link: #0a5fe0;
  --danger: #b42318;
  --danger-bg: #fdeceb;
  --ok: #05713f;
  --ok-bg: #e6f6ee;
  --warn: #8a4b00;
  --warn-bg: #fff4e0;
  --focus: #0a5fe0;
  --focus-ring: 0 0 0 3px #fff, 0 0 0 6px #0a5fe0;
  --shadow-sm: 0 1px 2px rgba(15, 27, 61, 0.06);
  --shadow: 0 4px 18px rgba(15, 27, 61, 0.07);
  --shadow-lg: 0 12px 36px rgba(15, 27, 61, 0.12);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --footer-bg: #0b1437;
  --footer-text: #c8d0e6;
  --footer-head: #ffffff;
  --header-h: 64px;
  /* category colour system: solid (icon bg), tint (card bg) */
  --c-green: #15803d;
  --t-green: #eaf7ef;
  --c-purple: #7c3aed;
  --t-purple: #f1ebfe;
  --c-red: #d92d20;
  --t-red: #fdeeed;
  --c-blue: #1d62e0;
  --t-blue: #e8f0fe;
  --c-orange: #c2570a;
  --t-orange: #fff1e3;
  --c-indigo: #4f46e5;
  --t-indigo: #ecebfd;
  --c-teal: #0f766e;
  --t-teal: #e3f5f2;
  --c-violet: #7e22ce;
  --t-violet: #f3e8fd;
  --c-pink: #c0267a;
  --t-pink: #fdebf4;
  --c-cyan: #0e7490;
  --t-cyan: #e1f4f9;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c1224;
  --bg-soft: #0f1730;
  --bg-hero: linear-gradient(180deg, #10204a 0%, #0c1630 100%);
  --surface: #131c36;
  --surface-2: #18233f;
  --border: #27355a;
  --border-strong: #3a4b78;
  --text: #eef2fc;
  --text-2: #c2cce3;
  --text-3: #9fadcc;
  --primary: #5b9bff;
  --primary-h: #7cb0ff;
  --primary-soft: #172a55;
  --on-primary: #06122b;
  --link: #8ab8ff;
  --danger: #ff9a90;
  --danger-bg: #3a1a1c;
  --ok: #6fe0a6;
  --ok-bg: #12301f;
  --warn: #ffc46b;
  --warn-bg: #35270d;
  --focus: #8ab8ff;
  --focus-ring: 0 0 0 3px #0c1224, 0 0 0 6px #8ab8ff;
  --shadow-sm: none;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.5);
  --footer-bg: #070c1c;
  --c-green: #2fa862;
  --t-green: #12281e;
  --c-purple: #9d71f5;
  --t-purple: #241a3d;
  --c-red: #ef5a4e;
  --t-red: #35191b;
  --c-blue: #4c86f0;
  --t-blue: #152445;
  --c-orange: #e07a1f;
  --t-orange: #33220f;
  --c-indigo: #7b74f2;
  --t-indigo: #1d1c45;
  --c-teal: #27a79b;
  --t-teal: #10292a;
  --c-violet: #b06af0;
  --t-violet: #2a1a40;
  --c-pink: #e0529c;
  --t-pink: #3a1829;
  --c-cyan: #33b3d3;
  --t-cyan: #0f2a35;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1224;
    --bg-soft: #0f1730;
    --bg-hero: linear-gradient(180deg, #10204a 0%, #0c1630 100%);
    --surface: #131c36;
    --surface-2: #18233f;
    --border: #27355a;
    --border-strong: #3a4b78;
    --text: #eef2fc;
    --text-2: #c2cce3;
    --text-3: #9fadcc;
    --primary: #5b9bff;
    --primary-h: #7cb0ff;
    --primary-soft: #172a55;
    --on-primary: #06122b;
    --link: #8ab8ff;
    --danger: #ff9a90;
    --danger-bg: #3a1a1c;
    --ok: #6fe0a6;
    --ok-bg: #12301f;
    --warn: #ffc46b;
    --warn-bg: #35270d;
    --focus: #8ab8ff;
    --focus-ring: 0 0 0 3px #0c1224, 0 0 0 6px #8ab8ff;
    --shadow-sm: none;
    --shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.5);
    --footer-bg: #070c1c;
    --c-green: #2fa862;
    --t-green: #12281e;
    --c-purple: #9d71f5;
    --t-purple: #241a3d;
    --c-red: #ef5a4e;
    --t-red: #35191b;
    --c-blue: #4c86f0;
    --t-blue: #152445;
    --c-orange: #e07a1f;
    --t-orange: #33220f;
    --c-indigo: #7b74f2;
    --t-indigo: #1d1c45;
    --c-teal: #27a79b;
    --t-teal: #10292a;
    --c-violet: #b06af0;
    --t-violet: #2a1a40;
    --c-pink: #e0529c;
    --t-pink: #3a1829;
    --c-cyan: #33b3d3;
    --t-cyan: #0f2a35;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img,
svg,
canvas,
video {
  max-width: 100%;
  height: auto;
}
h1,
h2,
h3,
h4 {
  line-height: 1.2;
  margin: 0 0 0.5em;
  color: var(--text);
  font-weight: 750;
  letter-spacing: -0.015em;
}
h1 {
  font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.6rem);
}
h2 {
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem);
}
h3 {
  font-size: 1.125rem;
}
p {
  margin: 0 0 1em;
}
a {
  color: var(--link);
  text-underline-offset: 0.18em;
}
a:hover {
  text-decoration-thickness: 2px;
}
ul,
ol {
  padding-left: 1.3em;
  margin: 0 0 1em;
}
li {
  margin: 0.25em 0;
}
code,
kbd,
samp,
pre {
  font-family: var(--mono);
  font-size: 0.92em;
}
code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.05em 0.35em;
}
pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px;
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
}
th,
td {
  padding: 0.5em 0.75em;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  font-weight: 650;
  background: var(--surface-2);
}
hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.5em 0;
}
.ico {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
}
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 20px;
}
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.muted {
  color: var(--text-3);
}
[hidden] {
  display: none !important;
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex: none;
}
.brand img,
.brand svg {
  width: 40px;
  height: 40px;
  flex: none;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-name {
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.brand-name b {
  color: var(--primary);
  font-weight: 800;
}
.brand-tag {
  font-size: 0.78rem;
  color: var(--text-2);
  font-weight: 500;
  margin-top: 2px;
}
.nav-desktop {
  display: none;
  margin-left: 16px;
}
.nav-desktop > ul {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}
.nav-desktop li {
  margin: 0;
  position: relative;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 550;
  font-size: 0.92rem;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  position: relative;
}
.nav-link:hover {
  background: var(--surface-2);
}
.nav-link[aria-current="page"] {
  color: var(--primary);
}
.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}
.nav-link .ico {
  width: 1em;
  height: 1em;
}
.dd-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 290px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 60;
}
.dd-panel a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 550;
}
.dd-panel a:hover {
  background: var(--surface-2);
}
.header-spacer {
  flex: 1;
}
.header-search {
  display: none;
  position: relative;
  width: 260px;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0 10px;
  min-height: 40px;
}
.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  padding: 8px 0;
}
.search-box input::placeholder {
  color: var(--text-3);
}
.search-box .ico {
  color: var(--text-3);
}
.clear-btn {
  border: 0;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: inline-flex;
}
.clear-btn:hover {
  color: var(--text);
}
.suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  z-index: 70;
  max-height: min(70vh, 420px);
  overflow: auto;
  padding: 6px;
  list-style: none;
  margin: 0;
}
.suggest li {
  margin: 0;
}
.suggest a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.92rem;
}
.suggest a:hover,
.suggest a.is-active,
.suggest [aria-selected="true"] {
  background: var(--primary-soft);
}
.suggest small {
  display: block;
  color: var(--text-3);
  font-size: 0.78rem;
}
.suggest .empty {
  padding: 10px;
  color: var(--text-2);
  font-size: 0.9rem;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:hover {
  background: var(--surface-2);
}
.icon-btn .ico {
  width: 24px;
  height: 24px;
}
.theme-switch {
  position: relative;
  width: 64px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  padding: 0;
  flex: none;
}
.theme-switch .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e59600;
  transition: transform 0.2s;
}
:root[data-theme="dark"] .theme-switch .knob {
  transform: translateX(26px);
  background: #26335c;
  color: #ffd666;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-switch .knob {
    transform: translateX(26px);
    background: #26335c;
    color: #ffd666;
  }
}
.theme-switch .sun,
.theme-switch .moon {
  display: none;
}
.theme-switch .sun {
  display: inline-flex;
}
:root[data-theme="dark"] .theme-switch .sun {
  display: none;
}
:root[data-theme="dark"] .theme-switch .moon {
  display: inline-flex;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-switch .sun {
    display: none;
  }
  :root:not([data-theme="light"]) .theme-switch .moon {
    display: inline-flex;
  }
}
.saved-btn {
  background: #12204a;
  color: #fff;
  border-radius: 50%;
  width: 38px;
  height: 38px;
}
.saved-btn:hover {
  background: #1c2f66;
}
:root[data-theme="dark"] .saved-btn {
  background: #27355a;
}
.menu-btn {
  display: inline-flex;
}
.mobile-search-btn {
  display: inline-flex;
}

/* drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 12, 28, 0.55);
  z-index: 90;
}
.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(88vw, 340px);
  background: var(--surface);
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: auto;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.drawer nav ul {
  list-style: none;
  margin: 0;
  padding: 8px;
}
.drawer nav a,
.drawer nav summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.drawer nav summary::-webkit-details-marker {
  display: none;
}
.drawer nav a:hover,
.drawer nav summary:hover {
  background: var(--surface-2);
}
.drawer nav a[aria-current="page"] {
  color: var(--primary);
  background: var(--primary-soft);
}
.drawer .sub a {
  padding: 9px 12px 9px 22px;
  font-weight: 500;
  font-size: 0.95rem;
}
.drawer details[open] summary .chev {
  transform: rotate(180deg);
}
.mobile-search-panel {
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.mobile-search-panel .container {
  padding-block: 10px;
}

/* bottom nav (mobile) */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 16px rgba(15, 27, 61, 0.06);
}
.bottom-nav a,
.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 2px 7px;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 550;
  color: var(--text-2);
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
  min-height: 56px;
  position: relative;
}
.bottom-nav .ico {
  width: 24px;
  height: 24px;
}
.bottom-nav [aria-current="page"] {
  color: var(--primary);
}
.bottom-nav [aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
}
body.has-bottom-nav {
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 650;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}
.btn-primary:hover {
  background: var(--primary-h);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--surface-2);
}
.btn-ghost {
  background: transparent;
  color: var(--primary);
  padding-inline: 10px;
}
.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.86rem;
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-block {
  width: 100%;
}

/* ---------- hero ---------- */
.hero {
  background: var(--bg-hero);
  padding: 40px 0 34px;
  position: relative;
  overflow: hidden;
}
.hero .container {
  display: grid;
  gap: 20px;
  align-items: center;
  grid-template-columns: minmax(0, 1fr);
}
.hero-badges {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 650;
  font-size: 0.82rem;
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 16px;
}
.hero-badges i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}
.hero h1 {
  font-size: clamp(2rem, 1.2rem + 3.4vw, 3.1rem);
  margin-bottom: 0.4em;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.hero h1 .grad {
  color: var(--primary);
}
.hero h1 .plat {
  color: var(--primary);
}
.hero p.lead {
  color: var(--text-2);
  font-size: 1.02rem;
  max-width: 620px;
}
.hero-art {
  display: block;
  width: 100%;
  max-width: 460px;
  margin-inline: auto;
}
.hero-search {
  margin-top: 22px;
  max-width: 640px;
  position: relative;
}
.hero-search .search-box {
  padding: 5px 5px 5px 14px;
  min-height: 56px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  background: var(--surface);
}
.hero-search .search-box input {
  font-size: 1rem;
}
.hero-search .btn {
  min-height: 44px;
  border-radius: 9px;
}
.popular-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  font-size: 0.88rem;
  color: var(--text-2);
}
.popular-chips a {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.84rem;
}
.popular-chips a:hover {
  border-color: var(--primary);
  color: var(--primary);
}
:root[data-theme="dark"] .popular-chips a {
  background: var(--surface-2);
}
.hero-art-wrap {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: none;
}

/* ---------- sections ---------- */
.section {
  padding: 38px 0;
}
.section.soft {
  background: var(--bg-soft);
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.section-head h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-head p {
  margin: 0.2em 0 0;
  color: var(--text-2);
}
.view-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 650;
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap;
}
.view-all:hover {
  text-decoration: underline;
}
.flame {
  color: #ef5a2a;
}
.section-head .sec-ico {
  color: var(--primary);
}

/* category cards */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.cat-grid > li {
  margin: 0;
}
.cat-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  padding: 14px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  position: relative;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.cat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.cat-card .chev {
  position: absolute;
  right: 12px;
  top: 50%;
  margin-top: -10px;
  color: var(--text-3);
  width: 18px;
  height: 18px;
}
.cat-card .name {
  font-weight: 650;
  font-size: 0.98rem;
  line-height: 1.25;
}
.cat-card .count {
  color: var(--text-3);
  font-size: 0.86rem;
}
.cat-card .ibox {
  width: 48px;
  height: 48px;
}
.ibox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  color: #fff;
  flex: none;
}
.ibox .ico {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}
.sq-green {
  background: var(--c-green);
}
.sq-purple {
  background: var(--c-purple);
}
.sq-red {
  background: var(--c-red);
}
.sq-blue {
  background: var(--c-blue);
}
.sq-orange {
  background: var(--c-orange);
}
.sq-indigo {
  background: var(--c-indigo);
}
.sq-teal {
  background: var(--c-teal);
}
.sq-violet {
  background: var(--c-violet);
}
.sq-pink {
  background: var(--c-pink);
}
.sq-cyan {
  background: var(--c-cyan);
}
.tint-green {
  background: var(--t-green);
}
.tint-purple {
  background: var(--t-purple);
}
.tint-red {
  background: var(--t-red);
}
.tint-blue {
  background: var(--t-blue);
}
.tint-orange {
  background: var(--t-orange);
}
.tint-indigo {
  background: var(--t-indigo);
}
.tint-teal {
  background: var(--t-teal);
}
.tint-violet {
  background: var(--t-violet);
}
.tint-pink {
  background: var(--t-pink);
}
.tint-cyan {
  background: var(--t-cyan);
}
:root[data-theme="dark"] .ibox {
  color: #08102a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ibox {
    color: #08102a;
  }
}

/* tool cards */
.tool-grid {
  display: grid;
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 0;
  grid-template-columns: minmax(0, 1fr);
}
.tool-grid > li {
  margin: 0;
}
.tool-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  text-decoration: none;
  color: var(--text);
  height: 100%;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    border-color 0.15s;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.tool-card .tc-body {
  flex: 1;
  min-width: 0;
}
.tool-card .tc-name {
  display: block;
  font-weight: 650;
  font-size: 1rem;
  line-height: 1.25;
}
.tool-card .tc-desc {
  display: block;
  color: var(--text-2);
  font-size: 0.88rem;
  margin-top: 2px;
}
.tool-card .tc-open {
  display: none;
  color: var(--primary);
  font-weight: 650;
  font-size: 0.8rem;
  margin-top: 8px;
  align-items: center;
  gap: 4px;
}
.tool-card .tc-chev {
  color: var(--text-3);
  width: 20px;
  height: 20px;
}
.tool-card.compact {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 14px;
}
.tool-card.compact .tc-chev {
  display: none;
}
.tool-card.compact .ibox {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}
.tool-card.compact .ibox .ico {
  width: 20px;
  height: 20px;
}
.tool-card .tc-arrow {
  display: none;
  color: var(--primary);
}
.tool-card.compact .tc-arrow {
  display: block;
  margin-top: auto;
}
.tool-card.compact .tc-name {
  font-size: 0.92rem;
}
.tool-card.compact .tc-desc {
  font-size: 0.8rem;
}
.tool-card .tc-cat {
  display: block;
  color: var(--text-3);
  font-size: 0.78rem;
  margin-top: 2px;
}

.home-split {
  display: grid;
  gap: 26px;
}
.recent-panel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
}
.recent-panel h2 {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.recent-panel .rp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.recent-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}
.recent-list li {
  margin: 0;
}
.recent-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 6px;
  text-decoration: none;
  color: var(--text);
  border-radius: 10px;
}
.recent-list a:hover {
  background: var(--surface);
}
.recent-list .ibox {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}
.recent-list .ibox .ico {
  width: 18px;
  height: 18px;
}
.recent-list .rl-name {
  font-weight: 620;
  font-size: 0.9rem;
  display: block;
  line-height: 1.2;
}
.recent-list .rl-cat {
  font-size: 0.78rem;
  color: var(--text-3);
  display: block;
}
.recent-list time {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--text-3);
  white-space: nowrap;
}
.empty-note {
  color: var(--text-2);
  font-size: 0.92rem;
  padding: 8px 2px;
}

.feat-row {
  display: grid;
  gap: 12px;
  grid-auto-flow: column;
  grid-auto-columns: minmax(190px, 70%);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: 8px;
  list-style: none;
  margin: 0;
  padding-left: 0;
}
.feat-row > li {
  margin: 0;
  scroll-snap-align: start;
}

.cta-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--primary-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
}
.cta-banner .cta-ico {
  color: var(--primary);
  width: 42px;
  height: 42px;
}
.cta-banner h2 {
  font-size: 1.15rem;
  margin: 0 0 2px;
}
.cta-banner p {
  margin: 0;
  color: var(--text-2);
  font-size: 0.92rem;
  flex: 1;
  min-width: 220px;
}

/* FAQ */
.faq {
  max-width: 860px;
}
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin: 0 0 10px;
}
.faq summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 650;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: "+";
  font-size: 1.4rem;
  line-height: 1;
  color: var(--primary);
  font-weight: 500;
}
.faq details[open] summary::after {
  content: "\2212";
}
.faq details > div {
  padding: 0 18px 14px;
  color: var(--text-2);
}
.faq details > div p:last-child {
  margin-bottom: 0;
}

/* ---------- footer ---------- */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  margin-top: 20px;
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  padding: 40px 0 28px;
}
.footer-grid > * {
  min-width: 0;
}
.site-footer a {
  color: var(--footer-text);
  text-decoration: none;
}
.site-footer a:hover {
  color: #fff;
  text-decoration: underline;
}
.site-footer h2,
.site-footer h3 {
  color: var(--footer-head);
  font-size: 0.95rem;
  margin: 0 0 12px;
  letter-spacing: 0;
}
.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.site-footer li {
  margin: 7px 0;
  font-size: 0.9rem;
}
.site-footer .brand {
  color: #fff;
}
.site-footer .brand-tag {
  color: #aab6d6;
}
.site-footer .brand-name b {
  color: #6ea8ff;
}
.socials {
  display: flex;
  gap: 16px;
  margin-top: 18px;
}
.socials a {
  display: inline-flex;
  padding: 6px;
  border-radius: 8px;
}
.socials .ico {
  width: 20px;
  height: 20px;
}
.suggest-form {
  display: flex;
  gap: 0;
  margin-top: 8px;
}
.suggest-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid #2a3866;
  border-right: 0;
  background: #fff;
  color: #0f1b3d;
  padding: 10px 12px;
  border-radius: 8px 0 0 8px;
  font: inherit;
  font-size: 0.9rem;
}
.suggest-form button {
  background: var(--primary);
  color: #fff;
  border: 0;
  padding: 0 16px;
  font: inherit;
  font-weight: 650;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  min-height: 42px;
}
:root[data-theme="dark"] .suggest-form button {
  color: #06122b;
}
.footer-bottom {
  border-top: 1px solid #1f2c57;
  padding: 16px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  font-size: 0.84rem;
}
.footer-bottom ul {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.footer-bottom li {
  margin: 0;
}
.to-top {
  position: fixed;
  right: 16px;
  bottom: 84px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--primary);
  color: var(--on-primary);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 54;
}
.to-top.show {
  display: flex;
}

/* ---------- breadcrumbs / pages ---------- */
.crumbs {
  padding: 14px 0 4px;
  font-size: 0.88rem;
  color: var(--text-2);
}
.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}
.crumbs li {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.crumbs li + li::before {
  content: "/";
  color: var(--text-3);
}
.crumbs a {
  color: var(--text-2);
}
.crumbs [aria-current] {
  color: var(--text);
  font-weight: 600;
}
.page-head {
  padding: 16px 0 10px;
}
.page-head .lead {
  color: var(--text-2);
  font-size: 1.05rem;
  max-width: 760px;
}
.prose {
  max-width: 780px;
}
.prose h2 {
  margin-top: 1.6em;
}
.prose h3 {
  margin-top: 1.2em;
}
.legal-meta {
  color: var(--text-3);
  font-size: 0.9rem;
}
.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  padding: 10px 14px;
  font-size: 0.92rem;
  margin: 0 0 14px;
  color: var(--text-2);
}
.notice .ico {
  margin-top: 0.2em;
  color: var(--primary);
}
.notice.warn {
  background: var(--warn-bg);
  border-color: #e2b04d;
  color: var(--warn);
}
.notice.warn .ico {
  color: var(--warn);
}
.notice.ok {
  background: var(--ok-bg);
  border-color: #4cb283;
  color: var(--ok);
}
.notice.ok .ico {
  color: var(--ok);
}
.notice.err {
  background: var(--danger-bg);
  border-color: #e08a83;
  color: var(--danger);
}
.notice.err .ico {
  color: var(--danger);
}
.notice p {
  margin: 0;
}

/* category / all-tools */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 6px;
}
.chip {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
}
.chip:hover {
  border-color: var(--primary);
}
.chip[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.result-count {
  color: var(--text-2);
  font-size: 0.92rem;
  margin: 8px 0 14px;
}
.cat-section {
  margin-bottom: 30px;
}
.cat-section > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- tool page layout ---------- */
.tool-layout {
  display: grid;
  gap: 24px;
  padding-bottom: 20px;
}
.tool-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 6px;
}
.tool-head .ibox {
  width: 52px;
  height: 52px;
  border-radius: 13px;
}
.tool-head .ibox .ico {
  width: 28px;
  height: 28px;
}
.tool-head h1 {
  margin: 0 0 6px;
}
.tool-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 14px;
  align-items: center;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  padding: 3px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.pill.local {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: transparent;
}
.pill.srv {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: transparent;
}
.fav-btn[aria-pressed="true"] .ico {
  fill: currentColor;
}
.article-section {
  margin-top: 30px;
}
.article-section ol,
.article-section ul {
  max-width: 760px;
}
.sidebar {
  display: block;
}
.side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 14px 8px;
  margin-bottom: 16px;
}
.side-card h2 {
  font-size: 0.98rem;
  margin-bottom: 6px;
}
.side-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.side-card li {
  margin: 0;
}
.side-card a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
}
.side-card a:hover {
  background: var(--surface-2);
}
.side-card a[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 650;
}
.related-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr);
  list-style: none;
  padding: 0;
  margin: 0;
}
.related-grid li {
  margin: 0;
}
.side-toggle {
  display: flex;
}

/* the interactive tool panel */
.tool {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 18px;
}
.tool-note {
  margin-bottom: 14px;
}
.fields {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px 14px;
  margin-bottom: 14px;
}
.field {
  grid-column: span 6;
  min-width: 0;
}
.field.w-half {
  grid-column: span 6;
}
.field.w-third {
  grid-column: span 6;
}
.field > label,
.field > .lbl,
.field legend {
  display: block;
  font-weight: 650;
  font-size: 0.92rem;
  margin-bottom: 5px;
  color: var(--text);
  padding: 0;
}
.field fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.field .hint {
  display: block;
  color: var(--text-3);
  font-size: 0.82rem;
  margin-top: 4px;
}
.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field input[type="date"],
.field input[type="time"],
.field input[type="datetime-local"],
.field input[type="url"],
.field input[type="email"],
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  min-height: 44px;
}
.field textarea {
  resize: vertical;
  line-height: 1.5;
  min-height: 120px;
}
.field textarea.mono,
.out-text.mono {
  font-family: var(--mono);
  font-size: 0.88rem;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.field [aria-invalid="true"] {
  border-color: var(--danger);
  border-width: 2px;
}
.field input[type="color"] {
  width: 64px;
  height: 44px;
  padding: 3px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  cursor: pointer;
}
.field input[type="range"] {
  width: 100%;
  min-height: 32px;
  accent-color: var(--primary);
}
.field .with-unit {
  display: flex;
  align-items: center;
  gap: 8px;
}
.field .with-unit span {
  color: var(--text-2);
  font-size: 0.9rem;
  white-space: nowrap;
}
.check-row,
.radio-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  min-height: 32px;
}
.check-row input,
.radio-row input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
  flex: none;
}
.check-row label,
.radio-row label {
  font-weight: 550;
  margin: 0;
}
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}
.range-val {
  font-weight: 650;
  color: var(--primary);
  margin-left: 6px;
}

.dropzone {
  display: block;
  border: 2px dashed var(--border-strong);
  border-radius: var(--r);
  background: var(--surface-2);
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.dropzone:hover,
.dropzone.is-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.dropzone:focus-within {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
.dropzone .dz-ico {
  width: 38px;
  height: 38px;
  color: var(--primary);
  margin: 0 auto 6px;
  display: block;
}
.dropzone .dz-title {
  font-weight: 700;
  display: block;
}
.dropzone .dz-sub {
  color: var(--text-2);
  font-size: 0.88rem;
  display: block;
  margin-top: 2px;
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}
.dz-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.dz-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 6px 6px 12px;
  margin: 0;
  font-size: 0.9rem;
}
.dz-list .fn {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dz-list .fs {
  color: var(--text-3);
  font-size: 0.8rem;
  white-space: nowrap;
}
.dz-list button {
  min-width: 36px;
  min-height: 36px;
  border: 0;
  background: none;
  color: var(--text-2);
  cursor: pointer;
  border-radius: 8px;
}
.dz-list button:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 6px;
}
.tool-error {
  margin: 10px 0 0;
}
.tool-status {
  min-height: 1.4em;
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 0.92rem;
}
.progress {
  height: 10px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
  margin: 12px 0 4px;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width 0.15s;
}
.outputs {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}
.out {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
}
.out-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.out-head h3 {
  font-size: 0.98rem;
  margin: 0;
}
.out-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.out-text {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  min-height: 120px;
  resize: vertical;
}
.out-html {
  overflow: auto;
  max-height: 520px;
}
.out-html:focus-visible {
  outline: 3px solid var(--focus);
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin: 0;
}
.stats > div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}
.stats dt {
  font-size: 0.8rem;
  color: var(--text-2);
  font-weight: 600;
}
.stats dd {
  margin: 2px 0 0;
  font-size: 1.3rem;
  font-weight: 750;
  color: var(--text);
  overflow-wrap: anywhere;
}
.stats.big dd {
  font-size: 1.7rem;
  color: var(--primary);
}
.tbl-wrap {
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.tbl-wrap table {
  min-width: 340px;
}
.out canvas,
.out img.preview {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
  background: repeating-conic-gradient(#d8dde8 0 25%, #fff 0 50%) 0 0/16px 16px;
}
.dl-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.dl-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  flex-wrap: wrap;
}
.dl-list .dn {
  flex: 1;
  min-width: 140px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.dl-list .ds {
  color: var(--text-3);
  font-size: 0.82rem;
}
.result-line {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.swatch {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  vertical-align: middle;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 10px;
}
.badge.pass {
  background: var(--ok-bg);
  color: var(--ok);
}
.badge.fail {
  background: var(--danger-bg);
  color: var(--danger);
}
.badge.warn {
  background: var(--warn-bg);
  color: var(--warn);
}
.two-col {
  display: grid;
  gap: 14px;
}
.diff-add {
  background: var(--ok-bg);
  color: var(--ok);
}
.diff-del {
  background: var(--danger-bg);
  color: var(--danger);
  text-decoration: line-through;
}

/* 404 */
.center-page {
  text-align: center;
  padding: 70px 0;
}
.center-page .big {
  font-size: 5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

/* print */
@media print {
  .site-header,
  .site-footer,
  .bottom-nav,
  .sidebar,
  .to-top,
  .hero-search,
  .actions {
    display: none !important;
  }
  body {
    padding: 0 !important;
  }
}

/* directory (home) */
.dir-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 768px) {
  .dir-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}
@media (min-width: 1024px) {
  .dir-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.dir-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0;
}
.dir-group summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
}
.dir-group summary::-webkit-details-marker {
  display: none;
}
.dir-group summary a {
  color: var(--text);
  text-decoration: none;
}
.dir-group summary::after {
  content: "+";
  margin-left: auto;
  font-size: 1.3rem;
  color: var(--primary);
}
.dir-group[open] summary::after {
  content: "\2212";
}
.dir-links {
  list-style: none;
  margin: 0;
  padding: 0 14px 12px;
  columns: 1;
  font-size: 0.92rem;
}
.dir-links li {
  margin: 3px 0;
}
@media (min-width: 768px) {
  .dir-links {
    columns: 2;
  }
}

/* layout robustness (grid/flex children must be allowed to shrink) */
.tool-layout > article,
.tool-layout > aside,
.tool .outputs,
.tool .out,
.tool .fields > .field {
  min-width: 0;
}
.theme-switch {
  margin-right: 2px;
}
body {
  overflow-x: clip;
}

/* ===== Two-level navigation: categories > subcategories (added for the expanded catalog) ===== */
.dd-panel.mega {
  position: fixed;
  top: calc(var(--header-h) + 4px);
  left: 50%;
  transform: translateX(-50%);
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 90px);
  overflow: auto;
  padding: 16px 18px 10px;
}
.mm-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px 16px;
}
.mm-grid > li {
  margin: 0;
}
.dd-panel .mm-cat {
  font-weight: 700;
  font-size: 0.9rem;
  padding: 6px 6px;
}
.mm-subs {
  list-style: none;
  margin: 0 0 8px;
  padding: 0 0 0 42px;
}
.mm-subs li {
  margin: 0;
}
.dd-panel .mm-subs a {
  padding: 4px 6px;
  font-weight: 500;
  font-size: 0.84rem;
  color: var(--text-2);
}
.dd-panel .mm-subs a:hover,
.dd-panel .mm-subs a:focus {
  color: var(--primary);
}
.mm-foot {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  margin: 6px 0 0;
  padding-top: 8px;
}
.mm-foot a {
  display: inline-flex !important;
}
@media (max-width: 1180px) {
  .mm-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 1000px) {
  .mm-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.drawer .d-heading span {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 4px;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
}
.drawer .d-cat summary {
  font-weight: 600;
}
.sub-grid {
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr);
}
.sub-grid > li {
  margin: 0;
}
.sub-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition:
    box-shadow 0.15s,
    border-color 0.15s;
}
.sub-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.sub-card .sc-name {
  font-weight: 700;
}
.sub-card .sc-desc {
  color: var(--text-2);
  font-size: 0.9rem;
}
.sub-card .sc-count {
  margin-top: auto;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sub-card .sc-count .ico {
  width: 1em;
  height: 1em;
}
@media (min-width: 640px) {
  .sub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1000px) {
  .sub-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.sub-section {
  margin: 0 0 28px;
}
.sub-section h3 {
  font-size: 1.1rem;
  margin: 0 0 4px;
}
.sub-section h3 a {
  color: inherit;
  text-decoration: none;
}
.sub-section h3 a:hover {
  text-decoration: underline;
}
.sub-section .section-head {
  margin-bottom: 12px;
}
.sub-section .section-head p {
  margin: 0;
}
.sub-links {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.sub-links li {
  margin: 0;
}
.dir-links .dir-sub {
  grid-column: 1/-1;
  margin-top: 6px;
}
.side-more {
  margin: 8px 0 0;
  font-size: 0.88rem;
}
.tool-custom {
  margin: 14px 0;
}

/* long URLs / code in article text must wrap on phones */
.article-section :is(p, li, dd, code),
.prose :is(p, li, code) {
  overflow-wrap: break-word;
}
