:root {
  --bg: #0b1020;
  --bg2: #0e1630;
  --card: rgba(255, 255, 255, 0.06);
  --card2: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.12);
  --text: #e8ecff;
  --muted: rgba(232, 236, 255, 0.72);
  --muted2: rgba(232, 236, 255, 0.55);
  --accent: #73d6ff;
  --accent2: #a371f7;
  --good: #7ee787;
  --warn: #f7b955;
  --danger: #ff7b72;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  --r: 18px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f9ff;
    --bg2: #f0f4ff;
    --card: rgba(12, 20, 50, 0.06);
    --card2: rgba(12, 20, 50, 0.09);
    --stroke: rgba(12, 20, 50, 0.12);
    --text: #0b1020;
    --muted: rgba(11, 16, 32, 0.72);
    --muted2: rgba(11, 16, 32, 0.55);
    --accent: #1769ff;
    --accent2: #7c3aed;
    --good: #0f8f4f;
    --warn: #c87300;
    --danger: #d1242f;
    --shadow: 0 14px 40px rgba(12, 20, 50, 0.12);
  }
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue,
    Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 700px at 20% -10%, rgba(115, 214, 255, 0.16), transparent 70%),
    radial-gradient(900px 600px at 92% 6%, rgba(163, 113, 247, 0.16), transparent 70%),
    linear-gradient(180deg, var(--bg), var(--bg2));
  color: var(--text);
  padding: 22px 18px 40px;
}

/* Gate de acesso (somente catálogo) */
.gate {
  max-width: 920px;
  margin: 14vh auto 0;
  padding: 18px;
  border: 1px solid var(--stroke);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--card2), var(--card));
  box-shadow: var(--shadow);
}
.gate h2 {
  margin: 0 0 8px;
  font-size: 16px;
  letter-spacing: 0.01em;
}
.gate p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 13px;
}
.gate .mono {
  margin-top: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  color: var(--muted2);
  border: 1px dashed var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.06);
  overflow: auto;
}

/* Por padrão, esconde catálogo até liberar */
#catalog {
  display: none;
}

html[data-access="allowed"] #catalog {
  display: block;
}
html[data-access="allowed"] #gate {
  display: none;
}
html[data-access="checking"] #gate .state-checking {
  display: block;
}
html[data-access="checking"] #gate .state-denied {
  display: none;
}
html[data-access="denied"] #gate .state-checking {
  display: none;
}
html[data-access="denied"] #gate .state-denied {
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
}

header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 18px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand h1 .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: conic-gradient(from 120deg, var(--accent), var(--accent2), var(--accent));
  box-shadow: 0 0 0 4px rgba(115, 214, 255, 0.12);
}

.brand p {
  margin: 0;
  color: var(--muted);
  max-width: 70ch;
  line-height: 1.6;
  font-size: 13px;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, var(--card2), var(--card));
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
}

.pill kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  border: 1px solid var(--stroke);
  border-bottom-width: 2px;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
  color: var(--text);
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--stroke);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--card2), var(--card));
  box-shadow: var(--shadow);
}

.search {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search input {
  width: 100%;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.12);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
}

.search input:focus-visible {
  outline: 3px solid rgba(115, 214, 255, 0.35);
  outline-offset: 2px;
}

button.chip:focus-visible,
.btn:focus-visible {
  outline: 3px solid rgba(115, 214, 255, 0.35);
  outline-offset: 2px;
}

.search input::placeholder {
  color: var(--muted2);
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button.chip {
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.08);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  user-select: none;
}

button.chip:hover {
  transform: translateY(-1px);
  border-color: rgba(115, 214, 255, 0.35);
  background: rgba(115, 214, 255, 0.08);
}

button.chip[aria-pressed="true"] {
  border-color: rgba(115, 214, 255, 0.55);
  background: rgba(115, 214, 255, 0.14);
  box-shadow: 0 0 0 4px rgba(115, 214, 255, 0.08);
}

.grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

.card {
  grid-column: span 6;
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, var(--card2), var(--card));
  border-radius: var(--r);
  padding: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: -80px -60px auto auto;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle at 30% 30%, rgba(115, 214, 255, 0.22), transparent 62%);
  transform: rotate(14deg);
  pointer-events: none;
}

.card::after {
  content: "";
  position: absolute;
  inset: auto -70px -80px auto;
  width: 210px;
  height: 210px;
  background: radial-gradient(circle at 30% 30%, rgba(163, 113, 247, 0.18), transparent 62%);
  transform: rotate(-10deg);
  pointer-events: none;
}

.card:hover {
  border-color: rgba(115, 214, 255, 0.3);
}

.row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.08);
  font-size: 18px;
  flex: 0 0 auto;
}

.title {
  margin: 0;
  font-size: 14px;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.subtitle {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.meta {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.tag {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.08);
  color: var(--muted);
}

.tag.tech {
  color: var(--text);
  border-color: rgba(115, 214, 255, 0.22);
  background: rgba(115, 214, 255, 0.08);
}

.tag.level {
  color: var(--text);
  border-color: rgba(126, 231, 135, 0.22);
  background: rgba(126, 231, 135, 0.08);
}

.cta {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.08);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(115, 214, 255, 0.35);
  background: rgba(115, 214, 255, 0.08);
}

.btn.primary {
  border-color: rgba(115, 214, 255, 0.55);
  background: linear-gradient(180deg, rgba(115, 214, 255, 0.18), rgba(115, 214, 255, 0.08));
}

.btn .arrow {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.path {
  margin-left: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  color: var(--muted2);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px dashed var(--stroke);
  background: rgba(0, 0, 0, 0.05);
}

.empty {
  grid-column: 1 / -1;
  border: 1px solid var(--stroke);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--card2), var(--card));
  padding: 16px;
  color: var(--muted);
  display: none;
}

footer {
  margin-top: 16px;
  color: var(--muted2);
  font-size: 12px;
  line-height: 1.6;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

footer .small {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

footer a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(115, 214, 255, 0.35);
  text-underline-offset: 3px;
}

@media (max-width: 900px) {
  .card {
    grid-column: span 12;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-actions {
    justify-content: flex-start;
  }
}

