:root {
  --bg: #0c0d0f;
  --panel: #111214;
  --panel2: #15171a;
  --text: #f5f6f7;
  --dim: #9aa3b2;
  --muted: #6b7280;
  --border: #2a2a2a;
  --line: #1e1e1e;
  --accent: #c7d2fe;
  --accent2: #e0e7ff;
  --shadow: rgba(0, 0, 0, 0.35);
  --good: #34d399;
  --bad: #fb7185;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  --sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.45;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent2);
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 54px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: 10px;
  padding: 0.5rem 0.7rem;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  transform: translateY(-140%);
  transition: transform 0.15s ease;
  z-index: 20000;
}
.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-top: 3.2rem;
}

.view-tabs {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.view-tab {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  color: var(--dim);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
.view-tab:hover {
  border-color: rgba(199, 210, 254, 0.35);
  color: var(--text);
}
.view-tab[data-active="1"] {
  border-color: rgba(199, 210, 254, 0.45);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(199, 210, 254, 0.18) inset;
}
.view-tab:focus-visible {
  outline: 2px solid rgba(199, 210, 254, 0.5);
  outline-offset: 2px;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10001;
  background: linear-gradient(180deg, rgba(12, 13, 15, 0.96), rgba(12, 13, 15, 0.9));
  backdrop-filter: saturate(120%) blur(6px);
  border-bottom: 1px solid var(--line);
}

.topbar-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ecosystem-nav {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ecosystem-nav a,
.ecosystem-nav .active {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0.35rem 0.45rem;
  border-radius: 0.45rem;
}

.ecosystem-nav a {
  color: var(--dim);
}

.ecosystem-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.ecosystem-nav .active {
  color: #9ae6b4;
  background: rgba(72, 187, 120, 0.16);
  border: 1px solid rgba(72, 187, 120, 0.35);
}

.brand {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  text-decoration: none;
}
.brand:hover {
  color: var(--accent2);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--dim);
  font-size: 12px;
  white-space: nowrap;
}

.fineprint {
  margin: 18px auto 0;
  max-width: 1100px;
  border-top: 1px solid var(--line);
  padding: 14px 18px 0;
  text-align: center;
  color: var(--dim);
  font-size: 12px;
  position: relative;
}

.footer-about-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.about-panel {
  margin: 10px auto 0;
  max-width: 720px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.45rem 0.6rem;
}
.about-panel summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  list-style: none;
}
.about-panel summary::-webkit-details-marker {
  display: none;
}
.about-panel p {
  margin: 0.5rem 0 0;
  color: var(--dim);
  font-size: 0.76rem;
  line-height: 1.45;
}

.footer-controls {
  position: absolute;
  right: 18px;
  top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.55rem;
  font-size: 0.72rem;
  line-height: 1;
  background: var(--panel);
  color: var(--dim);
}
.status-ok {
  border-color: rgba(72, 187, 120, 0.45);
  color: #9ae6b4;
}

.theme-picker {
  position: relative;
}
.theme-toggle {
  appearance: none;
  -webkit-appearance: none;
  min-height: 40px;
  min-width: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.theme-toggle:focus-visible {
  outline: 2px solid rgba(199, 210, 254, 0.8);
  outline-offset: 2px;
}
.palette-icon {
  position: relative;
  width: 18px;
  height: 18px;
}
.palette-icon span {
  display: block;
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.palette-icon span:nth-child(1) {
  left: 0;
  top: 2px;
  background: #7db5ff;
}
.palette-icon span:nth-child(2) {
  right: 0;
  top: 0;
  background: #d28cff;
}
.palette-icon span:nth-child(3) {
  left: 1px;
  bottom: 0;
  background: #ff8aa3;
}
.palette-icon span:nth-child(4) {
  right: 1px;
  bottom: 2px;
  background: #89d9b8;
}
.theme-popover {
  position: absolute;
  bottom: calc(100% + 0.45rem);
  right: 0;
  top: auto;
  display: none;
  gap: 0.45rem;
  flex-wrap: wrap;
  width: 190px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--panel);
  z-index: 30;
}
.theme-popover.open {
  display: flex;
}
.theme-swatch {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
}
.theme-swatch.active {
  border-color: var(--accent);
}
.sw-dark {
  background: #0c0d0f;
}
.sw-navy {
  background: #081423;
}
.sw-plum {
  background: #1a1022;
}
.sw-dawn {
  background: #f6efe8;
}

/* Float palette on desktop; leave it in footer flow on mobile. */
@media (min-width: 900px) {
  .footer-theme-picker {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 15000;
  }
}
@media (max-width: 640px) {
  .site-header {
    padding-top: 5.4rem;
  }
  .topbar-content {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.4rem;
  }
  .ecosystem-nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.1rem;
    
  }
  .ecosystem-nav a,
  .ecosystem-nav .active {
    white-space: nowrap;
  }
  .footer-controls {
    position: static;
    margin: 10px auto 0;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  .theme-popover {
    right: 0;
    left: auto;
    width: min(220px, 92vw);
  }
}

.btn {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  color: var(--text);
  padding: 9px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}
.btn:hover {
  border-color: rgba(199, 210, 254, 0.35);
}
.btn:active {
  transform: translateY(1px);
}
.btn:focus-visible {
  outline: 2px solid rgba(199, 210, 254, 0.5);
  outline-offset: 2px;
}

main {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.card {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  padding: 12px;
  align-items: stretch;
}

.content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-width: 0;
}

/* Backward-compat with older cached JS markup:
   .card had children: .vote + .thumb + .body.
   Force thumb/text into right column with text under image. */
.card > .vote {
  grid-column: 1;
  grid-row: 1 / span 2;
}
.card > .thumb {
  grid-column: 2;
  grid-row: 1;
}
.card > .body {
  grid-column: 2;
  grid-row: 2;
}

.vote {
  display: grid;
  grid-template-rows: 32px 1fr 32px;
  place-items: center;
  gap: 6px;
  border-right: 1px solid var(--line);
  padding-right: 10px;
}

.vote button {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--dim);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}
.vote button:hover {
  border-color: rgba(199, 210, 254, 0.35);
  color: var(--text);
}
.vote button:active {
  transform: translateY(1px);
}
.vote button:focus-visible {
  outline: 2px solid rgba(199, 210, 254, 0.5);
  outline-offset: 2px;
}
.vote button:disabled {
  opacity: 0.6;
  cursor: wait;
}
.vote button[data-active="1"][data-dir="up"] {
  border-color: rgba(52, 211, 153, 0.45);
  color: var(--good);
}
.vote button[data-active="1"][data-dir="down"] {
  border-color: rgba(251, 113, 133, 0.45);
  color: var(--bad);
}

.vote .score {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  color: var(--text);
  opacity: 0.92;
}

.body {
  display: block;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: baseline;
  color: var(--dim);
  font-size: 12px;
}

.k {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  opacity: 0.9;
}

.title {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.2px;
  line-height: 1.2;
}

.blurb {
  margin: 0;
  color: var(--dim);
  font-size: 13px;
  line-height: 1.35;
}

.thumb {
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--panel2);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.95) contrast(1.02);
}

.thumb.broken {
  display: grid;
  place-items: center;
  color: var(--dim);
  font-size: 12px;
}

.thumb.broken::after {
  content: "Image unavailable";
}

/* FCC Header System v1 (canonical) */
.site-header{
  display:flex;
  flex-direction:column;
  gap:.65rem;
  padding-top:3.2rem;
}
.topbar{
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:10001;
  background:linear-gradient(180deg, rgba(12,13,15,.96), rgba(12,13,15,.9));
  backdrop-filter:saturate(120%) blur(6px);
  border-bottom:1px solid var(--line);
}
.topbar-content{
  max-width:1100px;
  margin:0 auto;
  padding:.65rem 1.5rem;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
}
.brand,
.brand a{
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
  font-size:1.5rem;
  font-weight:800;
  line-height:1;
  color:var(--accent);
  text-decoration:none;
}
.brand:hover,
.brand a:hover{
  color:var(--accent-2, var(--accent2));
  text-decoration:none;
}
.ecosystem-nav{
  display:flex;
  align-items:center;
  gap:.55rem;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.ecosystem-nav a,
.ecosystem-nav .active{
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
  font-size:.9rem;
  line-height:1;
  padding:.35rem .45rem;
  border-radius:.45rem;
}
.ecosystem-nav a{
  color:var(--text-dim, var(--dim));
  text-decoration:none;
}
.ecosystem-nav a:hover{
  color:var(--text);
  background:rgba(255,255,255,.05);
  text-decoration:none;
}
.ecosystem-nav .active{
  color:#9ae6b4;
  background:rgba(72,187,120,.16);
  border:1px solid rgba(72,187,120,.35);
}
@media (max-width:640px){
  .site-header{padding-top:5.4rem;}
  .topbar-content{
    align-items:flex-start;
    flex-direction:column;
    gap:.4rem;
  }
  .ecosystem-nav{
    width:100%;
    justify-content:flex-start;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    flex-wrap:nowrap;
    padding-bottom:.1rem;
  }
  .ecosystem-nav a,
  .ecosystem-nav .active{
    white-space:nowrap;
  }
}

.m-top6 {
  margin-top: 6px;
}

.arrow-icon {
  transform-origin: 50% 50%;
}

.arrow-icon.up {
  transform: rotate(0deg);
}

.arrow-icon.down {
  transform: rotate(180deg);
}
