:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #657169;
  --line: #dfe7e1;
  --paper: #fbfcf8;
  --surface: #ffffff;
  --green: #2f6b52;
  --green-dark: #214c3b;
  --sage: #e8f0e8;
  --gold: #c88735;
  --blue: #476a9a;
  --rose: #b35d65;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(16px, 4vw, 44px);
  background: rgba(251, 252, 248, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
}

.brand-mark {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-size: 13px;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.primary,
.ghost,
.chip,
.vote-button,
.comment-button,
.auth-tab {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.primary {
  padding: 0 16px;
  background: var(--green);
  color: white;
}

.primary:hover {
  background: var(--green-dark);
}

.ghost {
  padding: 0 12px;
  background: transparent;
  color: var(--green-dark);
}

main {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  align-items: end;
  padding: clamp(24px, 5vw, 52px) 0 28px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 14px;
  font-size: clamp(38px, 7vw, 76px);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 640px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.hero-panel {
  min-height: 170px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

body[data-view="app"] .hero,
body[data-view="user"] .hero,
body[data-view="feed"] .hero,
body[data-view="app"] .home-only,
body[data-view="user"] .home-only,
body[data-view="feed"] .home-only {
  display: none;
}

.hero-panel strong {
  font-size: 52px;
  line-height: 1;
}

.hero-panel span {
  color: var(--muted);
  font-weight: 700;
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 18px;
}

#tagFilters {
  display: contents;
}

.chip {
  white-space: nowrap;
  padding: 0 12px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
}

.chip.active {
  background: var(--sage);
  color: var(--green-dark);
  border-color: #b9d2c3;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.view {
  display: none;
}

.view.active {
  display: grid;
}

.app-card {
  display: flex;
  flex-direction: column;
  min-height: 390px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease;
}

.app-card:hover {
  border-color: #b9d2c3;
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.title-row.large {
  align-items: center;
}

.title-row.large h1 {
  margin-bottom: 0;
}

.app-icon {
  flex: 0 0 auto;
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--sage);
  color: var(--green-dark);
}

.app-card h2 {
  margin-bottom: 8px;
  font-size: 24px;
  line-height: 1.12;
}

.description {
  color: var(--muted);
  line-height: 1.5;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.tag {
  padding: 6px 9px;
  border-radius: 999px;
  background: #eef2ed;
  color: #3d5248;
  font-size: 12px;
  font-weight: 800;
}

.vote-button {
  display: inline-grid;
  min-width: 58px;
  min-height: 54px;
  align-content: center;
  justify-items: center;
  gap: 3px;
  padding: 8px;
  background: #f3f7f3;
  color: var(--green-dark);
}

.vote-button.liked {
  background: var(--green);
  color: white;
}

.card-actions,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.secondary-action,
.action-link,
.back-link,
.reddit-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--green-dark);
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.secondary-action:hover,
.action-link:hover,
.back-link:hover {
  border-color: #b9d2c3;
  background: #f6f8f5;
}

.secondary-action.is-active,
.chip.nav-chip {
  border-color: #b9d2c3;
  background: var(--sage);
  color: var(--green-dark);
}

.link-button,
.comment-author {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green-dark);
  cursor: pointer;
  font-weight: 800;
  text-align: left;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.meta a {
  font-weight: 800;
}

.comments {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.comment {
  padding: 10px;
  border-radius: 8px;
  background: #f6f8f5;
  font-size: 13px;
  line-height: 1.4;
}

.comment strong {
  display: block;
  margin-bottom: 3px;
}

.comment-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
  background: #223f51;
  color: white;
}

.detail-view,
.profile-view {
  gap: 18px;
  padding-top: 18px;
}

.back-link {
  width: fit-content;
}

.detail-hero,
.profile-hero,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 18px;
  align-items: start;
  padding: clamp(18px, 4vw, 30px);
}

.detail-actions {
  display: grid;
  align-content: start;
}

.detail-actions .vote-button {
  width: 100%;
}

.detail-grid,
.profile-columns {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
}

.panel {
  padding: 18px;
}

.panel h2 {
  font-size: 18px;
}

.profile-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8f5;
  cursor: pointer;
  text-align: left;
}

.profile-card small,
.mini-app small {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.avatar {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-weight: 800;
}

.avatar.big {
  width: 78px;
  height: 78px;
  font-size: 24px;
}

.profile-hero {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: clamp(18px, 4vw, 30px);
}

.profile-hero h1 {
  margin-bottom: 8px;
  font-size: clamp(34px, 6vw, 62px);
}

.reddit-link {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stat strong {
  display: block;
  font-size: 30px;
}

.stat span,
.muted {
  color: var(--muted);
}

.feed-view {
  gap: 16px;
  padding-top: 18px;
}

.feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feed-tabs,
.feed-meta,
.feed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-box,
.feed-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.post-box {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.post-box-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.post-box .primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.feed-list {
  display: grid;
  gap: 12px;
}

.feed-item {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.feed-item p {
  margin-bottom: 0;
  color: #2b3730;
  line-height: 1.55;
}

.profile-pill,
.app-pill {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6f8f5;
  color: var(--green-dark);
  padding: 5px 10px 5px 5px;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

.profile-pill .avatar {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.mini-list,
.comments.roomy {
  display: grid;
  gap: 10px;
}

.mini-app {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
}

.mini-app small {
  grid-column: 2;
}

dialog {
  width: min(440px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(20, 30, 25, 0.26);
}

dialog::backdrop {
  background: rgba(14, 22, 17, 0.55);
}

.modal {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
}

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

.modal-head h2 {
  margin: 0;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: #eef2ed;
  cursor: pointer;
  font-weight: 800;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-tab {
  background: #eef2ed;
  color: var(--muted);
}

.auth-tab.active {
  background: var(--green);
  color: white;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: white;
}

textarea {
  resize: vertical;
}

.full {
  width: 100%;
}

.message,
.modal-context {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.demo-users {
  display: grid;
  gap: 8px;
}

.demo-user {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8f5;
  cursor: pointer;
  text-align: left;
  padding: 9px 10px;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-hero,
  .detail-grid,
  .profile-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 12px 14px;
  }

  .brand span:last-child {
    display: none;
  }

  main {
    width: min(100% - 24px, 1160px);
    padding-top: 14px;
  }

  h1 {
    font-size: 44px;
  }

  .hero-copy {
    font-size: 16px;
  }

  .board {
    grid-template-columns: 1fr;
  }

  .app-card {
    min-height: auto;
  }

  .profile-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feed-head,
  .post-box-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .profile-hero {
    align-items: flex-start;
  }

  .card-actions .secondary-action {
    flex: 1 1 auto;
  }
}
