.tools-page {
  --bg:#f3f6f2;
  --paper:#fff;
  --ink:#20373a;
  --muted:#4f6469;
  --stroke:#bacbc6;
  --teal-dark:#295a4e;
  --accent:#365f27;
  --cta-bg:#d9f49a;
  --cta-hover:#cce982;
  --topbar:#fff;
  --brand-border:#b9cbc4;
  --hero-bg:radial-gradient(ellipse at 86% 48%,#d5e8c9 0%,#e2eee1 41%,#edf4ec 73%);
  --hero-border:#b5ccb8;
  --hero-copy:#405d57;
  --secondary-border:#839d8e;
  --secondary-hover:#dcead9;
  --filter-ink:#3a5558;
  --filter-active:#e4efdf;
  --filter-border:#839e74;
  --card-shade:#f8fcfa;
  --card-copy:#435c62;
  --chip-bg:#edf2f0;
  --card-tone:#4a5e70;
  --scaling:#43652a;
  --maps:#246963;
  --archive:#845524;
  --mods:#634c8a;
  --engines:#91483d;
  --build:#325b8c;
  --library:#446740;
  --compatibility:#485e9b;
  --footer:#eaf0ec;
  --diagram-dots:#98baa2;
  --diagram-wire:#82a38d;
  --diagram-fill:#d0e5d3;
  --diagram-line:#4c725f;
  --diagram-accent:#42692a;
  color-scheme:light;
}
html[data-gw-theme="dark"] .tools-page {
  --bg:#0b141e;
  --paper:#111e2a;
  --ink:#eef5f6;
  --muted:#a8bcc6;
  --stroke:#30414d;
  --teal-dark:#c0e6da;
  --accent:#daf98b;
  --cta-bg:#daf98b;
  --cta-hover:#ecffb6;
  --topbar:#0e1923;
  --brand-border:#3e5661;
  --hero-bg:radial-gradient(ellipse at 86% 48%,#1c403a 0%,#132a31 41%,#14252f 73%);
  --hero-border:#35524f;
  --hero-copy:#c6d9dc;
  --secondary-border:#6e898a;
  --secondary-hover:#203a41;
  --filter-ink:#c8d8df;
  --filter-active:#273833;
  --filter-border:#95ae71;
  --card-shade:#162430;
  --card-copy:#bcd0da;
  --chip-bg:#233443;
  --card-tone:#c4d4dc;
  --scaling:#daf98b;
  --maps:#86ddd2;
  --archive:#f0c384;
  --mods:#c6b5ff;
  --engines:#f2a99e;
  --build:#9ac5ff;
  --library:#b2dba6;
  --compatibility:#aabfff;
  --footer:#101c27;
  --diagram-dots:#3c6059;
  --diagram-wire:#57857a;
  --diagram-fill:#17362f;
  --diagram-line:#a3c8b9;
  --diagram-accent:#dafa83;
  color-scheme:dark;
}
.tools-page .container { width:min(1160px, calc(100% - 48px)); }
.tools-page .topbar { height:68px; background:var(--topbar); }
.tools-page .navlinks { color:var(--muted); }
.tools-page .navlinks [aria-current] { color:var(--accent); }
.tools-page .brand img { border-color:var(--brand-border); }
.tools-preferences { display:flex; gap:7px; }
.tools-language,.tools-theme { display:grid; place-items:center; min-width:44px; height:44px; border:1px solid var(--stroke); border-radius:9px; color:var(--ink); background:transparent; font-weight:700; }
.tools-language:hover,.tools-theme:hover { border-color:var(--accent); }
.tools-page :is(a,button,summary,input,select):focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
.tools-theme svg { display:block; width:20px; height:20px; }
.tools-icon-sun,html[data-gw-theme="dark"] .tools-icon-moon { display:none; }
html[data-gw-theme="dark"] .tools-icon-sun { display:block; }
.tools-page .skip { color:#0b141e; }
.visually-hidden { position:absolute; overflow:hidden; width:1px; height:1px; clip-path:inset(50%); white-space:nowrap; }
.tools-hero {
  display:grid;
  grid-template-columns:minmax(0, 1.16fr) minmax(0, .84fr);
  align-items:center;
  gap:20px;
  margin-top:28px;
  padding:clamp(26px, 3.6vw, 48px) clamp(28px, 5.2vw, 66px);
  background:var(--hero-bg);
  border:1px solid var(--hero-border);
  border-radius:22px;
}
.tools-hero h1 { margin:0; font-size:clamp(2.6rem, 5.5vw, 4.5rem); line-height:.99; letter-spacing:-.067em; }
.tools-hero h1 em { color:var(--accent); font-style:normal; }
.tools-hero p { max-width:40ch; margin:20px 0 24px; color:var(--hero-copy); font-size:clamp(1rem, 1.5vw, 1.15rem); }
.tools-hero-actions { display:flex; gap:10px; flex-wrap:wrap; }
.tools-primary,.tools-secondary { min-height:44px; display:inline-flex; align-items:center; justify-content:center; gap:10px; padding:9px 14px; border-radius:8px; font-size:.875rem; font-weight:700; }
.tools-primary { border:1px solid var(--accent); background:var(--cta-bg); color:#192522; }
.tools-primary:hover { background:var(--cta-hover); }
.tools-secondary { border:1px solid var(--secondary-border); color:var(--ink); }
.tools-secondary:hover { background:var(--secondary-hover); }
.tools-art svg { display:block; width:100%; max-width:390px; margin-inline:auto; }
.tools-directory { padding:36px 0 52px; scroll-margin-top:20px; }
.tools-directory h2 { font-size:clamp(1.65rem, 3.5vw, 2.25rem); letter-spacing:-.045em; margin:0 0 15px; }
.tool-fields { display:grid; grid-template-columns:minmax(0,1fr) minmax(150px,190px) minmax(150px,190px) auto; gap:10px; }
.tool-search,.tool-platform { display:flex; align-items:center; min-width:0; min-height:46px; background:var(--paper); border:1px solid var(--stroke); border-radius:9px; }
.tool-search svg { width:20px; height:20px; flex:none; margin-left:12px; color:var(--accent); }
.tool-search input,.tool-platform select { width:100%; min-width:0; min-height:44px; border:0; padding:0 12px; border-radius:8px; color:var(--ink); background:transparent; }
.tool-search input::placeholder { color:var(--muted); }
.tool-platform select { background:var(--paper); }
.tool-search:focus-within { border-color:var(--accent); }
.tool-search input:focus-visible { outline-offset:-3px; }
.tool-filter-row { display:flex; flex-wrap:wrap; gap:7px; margin-top:14px; }
.tool-filter { display:inline-flex; align-items:center; gap:7px; min-height:38px; padding:6px 10px; border:1px solid var(--stroke); border-radius:8px; color:var(--filter-ink); font-size:.85rem; font-weight:600; line-height:1.3; }
.tool-filter svg { width:16px; height:16px; flex:none; }
.tool-filter:hover { border-color:#839b98; }
.tool-filter[aria-current] { background:var(--filter-active); border-color:var(--filter-border); color:var(--accent); }
.tool-results { display:flex; align-items:center; gap:12px; justify-content:space-between; margin:14px 0 10px; min-height:36px; font-size:.875rem; color:var(--muted); }
.tool-results p { margin:0; }
.tool-results a { color:var(--accent); text-decoration:underline; text-underline-offset:3px; padding-block:6px; }
.tool-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); align-items:start; gap:13px; padding:0; margin:0; list-style:none; }
.tool-card {
  position:relative;
  padding:17px;
  min-width:0;
  background:linear-gradient(160deg,var(--card-shade),var(--paper) 72%);
  border:1px solid var(--stroke);
  border-top:3px solid var(--tone,var(--card-tone));
  border-radius:13px;
  transition:border-color .2s ease, background-color .2s ease;
}
.tool-card:hover { border-color:var(--tone,var(--card-tone)); }
.tool-item[data-category="scaling"] { --tone:var(--scaling); }
.tool-item[data-category="maps"] { --tone:var(--maps); }
.tool-item[data-category="archive"] { --tone:var(--archive); }
.tool-item[data-category="mods"] { --tone:var(--mods); }
.tool-item[data-category="engines"] { --tone:var(--engines); }
.tool-item[data-category="build"] { --tone:var(--build); }
.tool-item[data-category="library"] { --tone:var(--library); }
.tool-item[data-category="compatibility"] { --tone:var(--compatibility); }
.tool-item[data-category="recomp"] { --tone:var(--build); }
.tool-item[data-category="sdk"] { --tone:var(--maps); }
.tool-item[data-category="emulation"] { --tone:var(--mods); }
.tool-card-top { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.tool-category { display:flex; align-items:center; gap:8px; color:var(--tone,var(--card-tone)); font-size:.78rem; font-weight:700; line-height:1.25; }
.tool-icon,.tool-share { flex:none; display:grid; place-items:center; width:40px; height:40px; border:1px solid var(--stroke); border-radius:9px; }
.tool-icon { background:var(--card-shade); }
.tool-icon svg,.tool-share svg { width:18px; height:18px; }
.tool-share { background:transparent; color:var(--muted); }
.tool-share:hover { border-color:var(--accent); color:var(--accent); }
.tool-card h3 { margin:13px 0 6px; font-size:1.32rem; letter-spacing:-.028em; line-height:1.2; overflow-wrap:anywhere; }
.tool-card h3 a:hover { color:var(--tone,var(--accent)); text-decoration:underline; text-underline-offset:3px; }
.tool-description { min-height:4.5em; margin:0 0 13px; color:var(--card-copy); font-size:.9rem; overflow-wrap:anywhere; }
.tool-platforms { display:flex; flex-wrap:wrap; gap:5px; padding:0; margin:0 0 12px; list-style:none; }
.tool-platforms li { color:var(--filter-ink); padding:2px 7px; border-radius:5px; background:var(--chip-bg); font-size:.75rem; }
.tool-platforms .tool-console { color:var(--tone,var(--card-tone)); font-weight:700; }
.tool-instructions { border-top:1px solid var(--stroke); padding:0 0 8px; font-size:.875rem; }
.tool-instructions summary { cursor:pointer; color:var(--ink); font-weight:700; padding:9px 0; min-height:40px; }
.tool-instructions ol { padding-left:22px; margin:0 0 8px; color:var(--muted); }
.tool-instructions li + li { margin-top:5px; }
.tool-instructions a { color:var(--accent); text-decoration:underline; }
.tool-references { display:flex; gap:12px; flex-wrap:wrap; }
.tool-quick-guide { padding:0; margin:0 0 6px; border:1px solid var(--stroke); border-radius:9px; background:var(--card-shade); }
.tool-quick-guide summary { display:flex; align-items:center; gap:8px; min-height:44px; padding:8px 11px; list-style:none; }
.tool-quick-guide summary::-webkit-details-marker { display:none; }
.tool-quick-guide summary:hover { color:var(--accent); }
.tool-quick-guide summary small { margin-left:auto; color:var(--muted); font-size:.75rem; font-weight:600; white-space:nowrap; }
.tool-quick-guide summary::after { content:""; width:7px; height:7px; margin:0 3px 3px 4px; border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(45deg); }
.tool-quick-guide[open] summary::after { transform:rotate(225deg); margin-top:5px; }
.tool-guide-body { margin:0 11px; padding:12px 0; border-top:1px solid var(--stroke); }
.tool-guide-body ol { display:grid; gap:10px; list-style:none; counter-reset:guide-step; padding:0; margin:0; }
.tool-guide-body li { display:grid; grid-template-columns:23px minmax(0,1fr); gap:8px; counter-increment:guide-step; margin:0; color:var(--card-copy); overflow-wrap:anywhere; }
.tool-guide-body li + li { margin-top:0; }
.tool-guide-body li::before { content:counter(guide-step); display:grid; place-items:center; align-self:start; width:23px; height:23px; border-radius:7px; background:var(--filter-active); color:var(--accent); font-weight:700; }
.tool-guide-body .tool-references { margin-top:11px; }
.tool-actions { display:flex; justify-content:space-between; flex-wrap:wrap; gap:8px; align-items:center; color:var(--ink); font-size:.86rem; font-weight:600; }
.tool-actions a { display:inline-flex; align-items:center; min-height:35px; }
.tool-actions a:hover { text-decoration:underline; text-underline-offset:3px; }
.tool-actions .tool-source { color:var(--tone,var(--accent)); gap:5px; }
.tools-empty { border:1px solid var(--stroke); border-radius:12px; padding:24px; color:var(--muted); background:var(--paper); }
.tools-footer { border-top:1px solid var(--stroke); background:var(--footer); color:var(--muted); }
.tools-footer .container { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-block:20px; }
.tools-footer-logo { color:var(--ink); font:700 1.4rem 'Pixelify Sans',sans-serif; letter-spacing:.03em; }
@media (max-width:900px) { .tool-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:620px) {
  .tools-page .container { width:calc(100% - 28px); }
  .tools-page .topbar { height:auto; padding:9px 0 7px; }
  .tools-page .topinner { display:grid; grid-template-columns:1fr auto; gap:5px 8px; }
  .tools-page .navlinks { grid-column:1 / -1; grid-row:2; margin:0; gap:0; justify-content:space-between; font-size:.86rem; }
  .tools-page .navlinks a { display:flex; align-items:center; min-height:38px; }
  .tools-hero { grid-template-columns:1fr; gap:0; padding:23px 19px 11px; margin-top:15px; border-radius:15px; }
  .tools-hero p { margin:13px 0 15px; }
  .tools-art svg { max-height:106px; margin-top:7px; }
  .tools-directory { padding-top:24px; }
  .tool-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .tool-search,.tools-search-submit { grid-column:1 / -1; }
  .tool-filter { min-height:42px; }
  .tool-grid { grid-template-columns:1fr; }
  .tool-description { min-height:0; }
}
@media (prefers-reduced-motion:reduce) {
  html:has(.tools-page) { scroll-behavior:auto; }
  .tool-card { transition:none; }
}
