:root {
  --bg: #ffffff;
  --fg: #0b0b0b;
  --muted: rgba(11, 11, 11, 0.65);
  --border: rgba(11, 11, 11, 0.14);
  --card: #ffffff;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.06);
  --radius: 16px;

  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "PingFang SC", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

html[data-theme="dark"] {
  --bg: #000000;
  --fg: #f2f2f2;
  --muted: rgba(242, 242, 242, 0.68);
  --border: rgba(242, 242, 242, 0.18);
  --card: #000000;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.5;
  letter-spacing: 0.01em;
}

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

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

.skip {
  position: absolute;
  left: 14px;
  top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  transform: translateY(-150%);
  transition: transform 120ms ease;
  z-index: 10;
}

.skip:focus {
  transform: translateY(0%);
  outline: none;
}

.mono {
  font-family: var(--mono);
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 34px 18px 68px;
}

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

.brand {
  min-width: 0;
}

.kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  opacity: 0.62;
}

.title {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: clamp(36px, 5vw, 64px);
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.subtitle {
  margin: 14px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 14px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.icon-btn {
  height: 42px;
  width: 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.controls {
  margin-top: 22px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.search {
  flex: 1 1 260px;
  min-width: 220px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 14px;
  opacity: 0.6;
  pointer-events: none;
}

input[type="search"] {
  width: 100%;
  height: 42px;
  padding: 0 12px 0 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
}

input[type="search"]:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-btn {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 6px 2px;
  cursor: pointer;
  opacity: 0.72;
  border-bottom: 1px solid transparent;
}

.filter-btn:hover {
  opacity: 1;
}

.filter-btn[aria-pressed="true"] {
  opacity: 1;
  border-bottom-color: currentColor;
}

.main {
  margin-top: 18px;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  padding: 0 4px;
}

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

@media (min-width: 780px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: dense;
    grid-auto-rows: 190px;
  }
}

@media (min-width: 1120px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 120ms ease, background 120ms ease, color 120ms ease,
    border-color 120ms ease;
}

.card:hover {
  background: var(--fg);
  color: var(--bg);
  border-color: currentColor;
  transform: translateY(-2px);
}

.card:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.span-wide {
  grid-column: span 2;
}

.span-tall {
  grid-row: span 2;
}

@media (max-width: 779px) {
  .span-wide,
  .span-tall {
    grid-column: auto;
    grid-row: auto;
  }
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dots {
  display: inline-flex;
  gap: 6px;
  opacity: 0.65;
}

.dots span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  border: 1px solid currentColor;
}

.host {
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 58%;
}

.card-title {
  font-family: var(--mono);
  letter-spacing: -0.02em;
  font-size: 18px;
  line-height: 1.15;
  margin: 0;
}

.card-sub {
  font-size: 13px;
  opacity: 0.7;
  margin-top: 2px;
}

.card-desc {
  font-size: 13px;
  margin: 0;
  opacity: 0.92;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  opacity: 0.8;
}

.actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
}

.actions a {
  opacity: 0.8;
}

.actions a:hover {
  opacity: 1;
}

.footer {
  margin-top: 42px;
  text-align: center;
  color: var(--muted);
}

.rule {
  width: 120px;
  height: 1px;
  background: var(--border);
  margin: 0 auto 18px;
}

.footer-quote {
  margin: 0;
  font-size: 13px;
}

.dialog {
  width: min(1100px, calc(100vw - 20px));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  padding: 0;
  background: var(--bg);
  color: var(--fg);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .dialog::backdrop {
  background: rgba(255, 255, 255, 0.12);
}

.dialog-frame {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: min(82vh, 840px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.window-dots {
  display: inline-flex;
  gap: 6px;
  opacity: 0.6;
  flex: 0 0 auto;
}

.window-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
}

.dialog-title {
  min-width: 0;
  flex: 1 1 auto;
}

.dialog-name {
  font-family: var(--mono);
  letter-spacing: -0.02em;
}

.dialog-host {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.dialog-actions {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex: 0 0 auto;
}

.btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--fg);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  text-decoration: none;
  opacity: 0.9;
}

.btn:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.btn-outline {
  background: var(--bg);
  color: var(--fg);
  border-color: var(--border);
}

.dialog-body {
  position: relative;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg);
  z-index: 1;
}

#dialogFrame {
  position: relative;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 0;
}

.dialog-footer {
  padding: 14px 16px 18px;
}

.dialog-desc {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .skip {
    transition: none;
  }
}

