:root {
  --brand: #4f46e5;
  --brand-ink: #3730a3;
  --brand-soft: #eef2ff;
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #6b7280;
  --line: #e5e7eb;
  --bg: #f8fafc;
  --card: #ffffff;
  --remote: #4f46e5;
  --skills: #059669;
  --grants: #d97706;
  --migration: #db2777;
  --open: #047857; --open-bg: #d1fae5;
  --always: #1d4ed8; --always-bg: #dbeafe;
  --check: #92400e; --check-bg: #fef3c7;
  --closed: #4b5563; --closed-bg: #e5e7eb;
  --radius: 14px;
  --tabs-h: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
}
a { color: var(--brand); }
img, svg { display: block; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #a5b4fc; outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.loading { color: var(--ink-3); padding-top: 32px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: rgba(255,255,255,.94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-name { font-weight: 750; font-size: 19px; letter-spacing: -.01em; }
.fa { color: var(--brand); font-weight: 700; margin-inline-start: 2px; }
.by { font-size: 13px; color: var(--ink-3); }

/* tabs */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid var(--line);
}
.tabs a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--ink-3); font-size: 12px; font-weight: 600;
}
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tabs a.active { color: var(--brand); }
.tabs a.active svg { stroke-width: 2.2; }
.badge {
  position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}

/* hero */
.hero {
  background: linear-gradient(160deg, #4f46e5 0%, #3730a3 100%); color: #fff;
  padding: 28px 0 30px;
}
.hero h1 { margin: 0 0 8px; font-size: clamp(26px, 6vw, 36px); line-height: 1.15; letter-spacing: -.02em; }
.hero p { margin: 0 0 18px; color: #e0e7ff; max-width: 34em; }
.search {
  display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 12px; padding: 4px 4px 4px 14px;
  box-shadow: 0 6px 20px rgba(17, 24, 39, .18);
}
.search svg { width: 20px; height: 20px; stroke: var(--ink-3); fill: none; stroke-width: 2; flex: none; }
.search input { flex: 1; border: 0; outline: 0; padding: 10px 0; min-width: 0; background: transparent; color: var(--ink); }
.search button { border: 0; background: var(--brand); color: #fff; border-radius: 9px; padding: 9px 14px; font-weight: 650; cursor: pointer; }
.trust { margin-top: 14px; font-size: 13px; color: #c7d2fe; display: flex; gap: 6px; align-items: center; }
.trust svg { width: 16px; height: 16px; stroke: #a7f3d0; fill: none; stroke-width: 2.4; }

/* sections */
.section { margin: 26px auto 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.section-head a { font-size: 14px; font-weight: 600; text-decoration: none; }

/* pillars */
.pillars { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .pillars { grid-template-columns: repeat(4, 1fr); } }
.pillar {
  display: block; text-decoration: none; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; border-top: 4px solid var(--c);
}
.pillar .ico { width: 34px; height: 34px; border-radius: 10px; background: color-mix(in srgb, var(--c) 12%, #fff); display: grid; place-items: center; margin-bottom: 10px; }
.pillar .ico svg { width: 20px; height: 20px; stroke: var(--c); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pillar strong { display: block; font-size: 15px; }
.pillar span { font-size: 13px; color: var(--ink-3); }

/* cards */
.list { display: grid; gap: 10px; }
.card {
  position: relative; display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 12px 14px 18px; overflow: hidden;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.card-main { flex: 1; min-width: 0; }
.card a.title { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 16px; line-height: 1.3; }
.card a.title::after { content: ""; position: absolute; inset: 0; }
.card .org { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.card .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; font-size: 13px; color: var(--ink-3); }
.cat-label { font-weight: 650; color: var(--c); }
.save {
  position: relative; z-index: 2; flex: none; align-self: flex-start; width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer;
}
.save svg { width: 20px; height: 20px; stroke: var(--ink-3); fill: none; stroke-width: 2; stroke-linejoin: round; }
.save[aria-pressed="true"] { background: var(--brand-soft); border-color: #c7d2fe; }
.save[aria-pressed="true"] svg { stroke: var(--brand); fill: var(--brand); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.open { color: var(--open); background: var(--open-bg); }
.pill.always { color: var(--always); background: var(--always-bg); }
.pill.check { color: var(--check); background: var(--check-bg); }
.pill.closed { color: var(--closed); background: var(--closed-bg); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #fce7f3; color: #9d174d; }

/* explore */
.filters { position: sticky; top: 53px; z-index: 10; background: var(--bg); padding: 12px 0 10px; }
.filters .search { box-shadow: none; border: 1px solid var(--line); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 13px;
  font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.selects { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.selects select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 14px; }
.toggle { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; color: var(--ink-2); }
.toggle input { width: 18px; height: 18px; accent-color: var(--brand); }
.count { font-size: 14px; color: var(--ink-3); margin: 6px 0 10px; }
.empty { text-align: center; color: var(--ink-3); padding: 36px 16px; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* detail */
.back { display: inline-flex; align-items: center; gap: 6px; margin: 16px 0 8px; text-decoration: none; font-weight: 600; font-size: 15px; }
.detail { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.detail-head { padding: 18px 18px 14px; border-top: 6px solid var(--c); }
.detail-head h1 { margin: 6px 0 4px; font-size: 24px; line-height: 1.2; letter-spacing: -.01em; }
.detail-head .org { color: var(--ink-2); }
.detail-body { padding: 0 18px 18px; }
.facts { display: grid; gap: 10px; margin: 6px 0 16px; padding: 12px; background: var(--bg); border-radius: 12px; font-size: 14px; }
.facts div { display: grid; grid-template-columns: 92px 1fr; gap: 8px; }
.facts dt { color: var(--ink-3); font-weight: 600; }
.facts dd { margin: 0; }
.detail h2 { font-size: 16px; margin: 18px 0 6px; }
.detail ul { margin: 0; padding-left: 20px; }
.detail li { margin: 4px 0; }
.tip { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); font-size: 15px; }
.tip strong { display: block; margin-bottom: 2px; }
.actions { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line); background: #fff; font-weight: 700; text-decoration: none; color: var(--ink); cursor: pointer;
}
.btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn[aria-pressed="true"] { background: var(--brand-soft); border-color: #c7d2fe; color: var(--brand); }
.btn[aria-pressed="true"] svg { fill: var(--brand); }
.verified { margin-top: 14px; font-size: 13px; color: var(--ink-3); }

/* guides */
.guide-card { display: block; text-decoration: none; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; border-left: 5px solid var(--c); }
.guide-card strong { display: block; font-size: 16px; line-height: 1.3; }
.guide-card span { display: block; font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.guide-card small { display: block; color: var(--ink-3); margin-top: 6px; font-size: 12px; font-weight: 600; }
.article { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px; border-top: 6px solid var(--c); }
.article h1 { margin: 6px 0 8px; font-size: 24px; line-height: 1.2; }
.article .lead { color: var(--ink-2); font-size: 17px; margin: 0 0 6px; }
.article h2 { font-size: 17px; margin: 20px 0 4px; }
.article p { margin: 0; }

.foot { margin: 34px auto 24px; font-size: 13px; color: var(--ink-3); text-align: center; }
.foot p { margin: 4px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 60;
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.back svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
