:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #111827;
  --accent-text: #ffffff;
  --shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: max(14px, env(safe-area-inset-top)) 14px 12px;
  background: rgba(246, 247, 249, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.back-button,
.home-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  cursor: pointer;
}

.back-button {
  color: var(--accent-text);
  background: var(--accent);
}

.home-button {
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
}

button.home-button {
  font: inherit;
}

.shell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 20px 14px 40px;
}

.hero { padding: 18px 2px 12px; }

h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 7vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.subtle { margin: 0; color: var(--muted); font-size: 14px; }

.search-form { margin: 14px 0 18px; display: flex; gap: 8px; }

.search-input {
  min-width: 0;
  flex: 1;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 14px;
  font-size: 16px;
  background: var(--card);
  color: var(--text);
  outline: none;
}

.search-input:focus { border-color: var(--accent); }

.search-button {
  height: 46px;
  border: 0;
  border-radius: 14px;
  padding: 0 16px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 800;
}

.grid-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 14px;
  min-width: 860px;
}

.section {
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section h2 {
  margin: 0 0 12px;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.links { display: grid; gap: 10px; }

.directory-link,
.directory-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 13px 14px;
  border-radius: 14px;
  line-height: 1.25;
  font-size: 16px;
  text-decoration: none;
  border: 1px solid var(--border);
  background: #fafafa;
  color: var(--item-color, var(--text));
}

.directory-link { font-weight: 700; }
.directory-link:active { transform: scale(0.99); }
.directory-link .arrow { color: var(--item-color, var(--muted)); opacity: 0.75; font-weight: 900; flex: 0 0 auto; }
.directory-text { color: var(--item-color, var(--muted)); }

.empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--card);
  margin-bottom: 14px;
}

.footer { padding: 24px 2px 0; color: var(--muted); font-size: 12px; text-align: center; }
.hidden { display: none !important; }

.install-button {
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.install-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}