: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%;
}

html {
  scrollbar-gutter: stable both-edges;
  overflow-y: scroll;
}

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: 18px 18px 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;
}

#viewTabs.view-tabs {
  margin-top: 8px;
  display: inline-flex;
  align-items: stretch;
  align-self: flex-start;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.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;
}

#viewTabs .view-tab {
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  margin: 0;
  padding: 7px 10px;
  font-size: 12px;
  background: transparent;
}

#viewTabs .view-tab:last-child {
  border-right: 0;
}

#viewTabs .view-tab:hover {
  background: rgba(255, 255, 255, 0.05);
}

#viewTabs .view-tab[data-active="1"] {
  background: rgba(199, 210, 254, 0.14);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(199, 210, 254, 0.2);
}

.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: var(--mono);
  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);
}

.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: minmax(102px, 116px) 1fr;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: var(--panel);
  padding: 1rem 1.25rem;
  align-items: stretch;
}

.quote-card {
  box-shadow: none;
}

.content {
  display: block;
  min-width: 0;
}

.card > .vote {
  grid-column: 1;
  grid-row: 1 / span 2;
}
.card > .body {
  grid-column: 2;
  grid-row: 1;
}

.vote {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 6px;
  border-right: 1px solid var(--line);
  padding-right: 10px;
  padding-top: 2px;
  min-width: 102px;
  align-self: start;
}

.vote .quote-action-btn {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  height: auto;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 8px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}
.vote .quote-action-btn:hover {
  border-color: rgba(199, 210, 254, 0.35);
  color: var(--text);
}
.vote .quote-action-btn:active {
  transform: translateY(1px);
}
.vote .quote-action-btn:focus-visible {
  outline: 2px solid rgba(199, 210, 254, 0.5);
  outline-offset: 2px;
}
.vote .quote-action-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.vote .quote-action-btn[data-active="1"][data-dir="up"] {
  border-color: rgba(52,211,153,.55);
  color: #d1fae5;
  background: rgba(16,185,129,.16);
}
.vote .quote-action-btn[data-active="1"][data-dir="down"] {
  border-color: rgba(156,163,175,.55);
  color: #d1d5db;
  background: rgba(107,114,128,.18);
}
.vote .quote-action-soft {
  opacity: .9;
  color: color-mix(in srgb, var(--text) 84%, var(--dim) 16%);
}

.vote .score {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  opacity: 0.92;
  width: 100%;
  height: auto;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  line-height: 1.1;
  padding: 4px 8px;
  text-align: center;
}

.vote .app-pill-empty {
  color: var(--dim);
  opacity: .82;
}

.body {
  display: block;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: baseline;
  color: #9ca3af;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.k {
  font-family: var(--mono);
  font-size: 12px;
  opacity: 0.9;
}

.title {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 800;
  color: #fafafa;
  letter-spacing: 0;
  line-height: 1.32;
}

.quote-media-wrap {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  width: 180px;
  min-width: 180px;
  align-self: flex-start;
}

.quote-media {
  display: block;
  width: 100%;
  height: auto;
  max-height: 180px;
  object-fit: cover;
}

.quote-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.quote-main.has-image {
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: start;
}

.quote-copy {
  min-width: 0;
}

.blurb {
  margin: 0.35rem 0 0;
  color: var(--dim);
  font-size: 0.96rem;
  line-height: 1.5;
}

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

.copy-quote-btn,
.source-link-btn {
  min-height: 30px;
  height: 30px;
  min-width: 92px;
  width: 92px;
  padding: 0 10px;
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.source-link-btn {
  text-decoration: none;
}

.btn.glass-btn {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  color: #d0d6dd;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.35);
}

.btn.glass-btn:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  color: #eef2f6;
}

#list {
  display: grid;
  gap: 12px;
}

.more-wrap {
  display: flex;
  justify-content: center;
  padding: 0.9rem 0 0.25rem;
}

.empty-card {
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 12px;
  color: var(--dim);
  text-align: center;
}

.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-controls {
  position: absolute;
  right: 18px;
  top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.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;
}

.scroll-top-btn {
  display: none;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.scroll-top-btn.show {
  display: grid;
}

.back-to-top {
  position: fixed;
  right: 12px;
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  z-index: 9100;
  width: auto;
  min-width: 58px;
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(16, 18, 22, 0.86);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  display: none;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}

.back-to-top.show {
  display: grid;
}

.back-to-top:hover {
  border-color: rgba(199, 210, 254, 0.42);
}

.back-to-top:focus-visible {
  outline: 2px solid rgba(199, 210, 254, 0.55);
  outline-offset: 2px;
}

@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;
    flex-wrap: nowrap;
  }
  .ecosystem-nav a,
  .ecosystem-nav .active {
    white-space: nowrap;
  }
  .wrap {
    padding-left: 12px;
    padding-right: 12px;
  }
  .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);
  }
  .quote-main.has-image {
    grid-template-columns: 1fr;
  }
  .quote-media-wrap {
    width: 100%;
    max-width: 320px;
    min-width: 0;
  }
  .quote-media {
    max-height: 220px;
  }
  .back-to-top {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
}
