* { box-sizing: border-box; }

body {
  margin: 0;
  background: linear-gradient(180deg, var(--page-sky) 0, var(--bg) 420px) no-repeat, var(--bg);
  color: var(--text);
  font: 1rem/1.5 var(--font-text);
}

a { color: var(--brand-ink); }
[hidden] { display: none !important; }
:where(a, button):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.home-symbols { position: absolute; }

.hero {
  container-type: inline-size;
  position: relative;
  isolation: isolate;
  text-align: center;
  padding: 84px clamp(12px, 3vw, 24px) 60px;
  background: var(--hero-sky);
}

.hero h1 {
  max-width: 25ch;
  margin: 0 auto 22px;
  font: 700 clamp(1.85rem, 1.4rem + 2vw, 2.8rem)/1.14 var(--font-brand);
  text-wrap: balance;
}

.sky { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.sky :is(.c, .s, .moon, .hills) { position: absolute; }
.sky .s { width: 9px; height: 9px; color: var(--spark); opacity: .6; }
.sky .hills { inset: auto 0 0; width: 100%; height: 46px; }
.sky :is(.moon, .night) { display: var(--night-sky, none); }
.sky .moon { filter: drop-shadow(0 0 10px #f4e7b059); }
@media (prefers-reduced-motion: no-preference) {
  .sky .c { animation: drift var(--drift-time) ease-in-out infinite alternate; }
  .sky .s { animation: var(--twinkle) 3.2s ease-in-out var(--spark-delay) infinite; }
  @keyframes drift { to { transform: translateX(var(--d)); } }
  @keyframes twinkle { 0%, 100% { opacity: .35; } 50% { opacity: .9; } }
  @keyframes twinkle-night { 0%, 60%, 100% { opacity: .45; } 75% { opacity: 1; } }
  .quick a, .card { transition: box-shadow var(--t-fast), border-color var(--t-fast); }
}

.search {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-2);
  box-shadow: var(--sh-1);
}

.search:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.search svg { flex: 0 0 22px; width: 22px; height: 22px; }
.search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}
.search input::placeholder { color: var(--text-3); opacity: 1; }

.quick {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  max-width: 900px;
  margin: 22px auto 0;
}

.quick a, .card {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--sh-1);
}
.quick a:hover, .card:hover { border-color: var(--brand); box-shadow: var(--sh-2); }
.quick a {
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 16px 4px;
  font: 700 .875rem/1.2 var(--font-brand);
  white-space: nowrap;
}

/* 6 × 130px plus 5 × 16px gaps. */
@container (width < 860px) {
  .quick { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 560px; }
}
@container (width < 420px) {
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

.f-pdf { --fc: var(--pdf); --fb: var(--pdf-bg); }
.f-img { --fc: var(--img); --fb: var(--img-bg); }
.f-data { --fc: var(--data); --fb: var(--data-bg); }
.f-doc { --fc: var(--doc); --fb: var(--doc-bg); }
.f-qr { --fc: var(--qr); --fb: var(--qr-bg); }

.tile {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--fb);
  color: var(--fc);
}
.tile svg { width: 24px; height: 24px; }
.quick .tile { width: 52px; height: 52px; border-radius: 15px; }
.quick .tile svg { width: 28px; height: 28px; }

.trustline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 16px 0 0;
  color: var(--text-2);
  font-size: .875rem;
}
.trustline svg { width: 18px; height: 18px; color: var(--ok); }

.home-content {
  max-width: 1148px;
  margin: 0 auto;
  padding: 0 clamp(12px, 3vw, 24px);
}

.shelf { margin: 0 0 32px; }
.shelf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.shelf h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font: 700 clamp(1.1rem, 1rem + .5vw, 1.4rem)/1.25 var(--font-brand);
}
.dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--fc); }
.shelf-head a { display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 232px), 1fr)); gap: 12px; }
.card { min-height: 68px; padding: 10px; gap: 10px; font-weight: 650; }

.more-tools, .search-status { margin: 0 0 24px; font-size: .9rem; }
.search-status:empty { margin: 0; }
#tools[data-filtered] :is(.more-tools, #recent-tools) { display: none; }

.home-install > :is(button, div) { margin: 0 auto 20px; }
.install-banner, .ios-tip {
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.ios-close, .footer-share {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand-ink);
  font: inherit;
  cursor: pointer;
}
.footer-share { text-decoration: underline; }

.home-ad { margin: 24px auto; overflow: hidden; }
.home-ad ins { display: block; width: 100%; max-height: 70vh; }
@media (max-width: 480px) { .home-ad ins { max-height: 50vh; } }
@media print { .home-ad { display: none; } }

.premium-section, .faq-section { margin: 32px 0; }
.premium-section { text-align: center; }
.faq-section h2, .premium-section h2 { font-family: var(--font-brand); }
.faq-item {
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.faq-item h3 { margin: 0 0 8px; font-size: 1.05rem; }
.faq-item p { margin: 0; color: var(--text-2); }

.site-footer { padding: 24px 16px; background: var(--surface); color: var(--text-2); text-align: center; }
.site-footer > div:first-child { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 18px; }
.site-footer > div:not(:first-child) { margin-top: 8px; font-size: .8rem; }
