:root {
  --ink: #14201a;
  --muted: #65746c;
  --paper: #fffefa;
  --soft: #f3f7f1;
  --line: #dfe9df;
  --accent: #0f7a54;
  --accent-dark: #095b3d;
  --gold: #f2b84b;
  --coral: #d95d4f;
  --blue: #286ea8;
  --shadow: 0 18px 50px rgba(20, 32, 26, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(242, 184, 75, 0.2), transparent 32rem),
    linear-gradient(180deg, #fbfff9 0%, var(--soft) 100%);
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  background: rgba(251, 255, 249, 0.88);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: white;
  font-size: 0.84rem;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.16);
}

.search-wrap {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.search-wrap svg,
.icon-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.search-wrap svg {
  color: var(--muted);
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.icon-button {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: white;
  background: var(--ink);
  border: 0;
  border-radius: 50%;
}

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

.text-button {
  min-height: 40px;
  padding: 0 10px;
  color: var(--ink);
  font-weight: 900;
  background: transparent;
  border: 0;
  border-radius: 999px;
}

.text-button:hover {
  background: #eef5ef;
}

.text-button.centered {
  justify-self: center;
  color: var(--muted);
}

.primary-button.small {
  min-height: 40px;
  padding-inline: 15px;
}

.user-pill {
  max-width: 160px;
  overflow: hidden;
  padding: 9px 12px;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #e8f5ee;
  border-radius: 999px;
}

.icon-button.ghost {
  color: var(--ink);
  background: #eef5ef;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 42px 0 26px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 850px;
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.primary-button {
  min-height: 46px;
  padding: 0 20px;
  color: white;
  font-weight: 900;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(15, 122, 84, 0.2);
}

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

.filters {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 0 22px;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.filter {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 16px;
  color: var(--muted);
  font-weight: 800;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.filter.active {
  color: white;
  background: var(--ink);
  border-color: var(--ink);
}

.matches-section {
  display: grid;
  gap: 16px;
  margin: 4px 0 28px;
  padding: 20px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(20, 32, 26, 0.06);
}

.section-head {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  line-height: 1.05;
}

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

.match-card {
  display: grid;
  gap: 8px;
  min-height: 156px;
  padding: 16px;
  color: var(--ink);
  text-decoration: none;
  background: #f7faf6;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.match-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 122, 84, 0.1);
}

.match-format {
  width: fit-content;
  padding: 5px 9px;
  color: white;
  font-size: 0.74rem;
  font-weight: 900;
  background: var(--accent);
  border-radius: 999px;
}

.match-card strong {
  line-height: 1.2;
}

.match-card span:not(.match-format),
.match-card small {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.match-page {
  padding-bottom: 56px;
}

.match-detail-card {
  display: grid;
  gap: 20px;
  margin: 34px 0 60px;
  padding: clamp(24px, 5vw, 48px);
  background: white;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

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

.match-facts div {
  display: grid;
  gap: 6px;
  padding: 16px;
  background: #f7faf6;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.match-facts span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.match-summary {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.match-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.match-button {
  display: inline-grid;
  place-items: center;
  width: fit-content;
  min-width: 150px;
  text-decoration: none;
}

.masonry {
  column-count: 4;
  column-gap: 18px;
  padding-bottom: 56px;
}

.pin-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 18px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(20, 32, 26, 0.08);
  break-inside: avoid;
  cursor: zoom-in;
}

.pin-art {
  position: relative;
  min-height: 230px;
  overflow: hidden;
  color: white;
  background: #dfe9df;
}

.pin-art img {
  display: block;
  width: 100%;
  min-height: 230px;
  object-fit: cover;
}

.pin-badge {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 1;
  width: fit-content;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 999px;
}

.pin-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.pin-body h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.2;
}

.pin-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.pin-meta {
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.source-link {
  width: fit-content;
  color: var(--blue);
  font-size: 0.9rem;
  font-weight: 900;
  text-decoration: none;
}

.source-link:hover {
  text-decoration: underline;
}

.poll-chip {
  width: fit-content;
  padding: 6px 10px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  background: #e8f5ee;
  border-radius: 999px;
}

.poll-builder {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: #f7faf6;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.poll-builder h3 {
  margin: 0;
  font-size: 1.1rem;
}

.poll-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.poll-box {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: #f7faf6;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.poll-box h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.poll-options {
  display: grid;
  gap: 8px;
}

.poll-option {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  overflow: hidden;
  padding: 9px 12px;
  color: var(--ink);
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.poll-option.selected {
  border-color: var(--accent);
}

.poll-fill {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 0;
  background: rgba(15, 122, 84, 0.16);
}

.poll-label,
.poll-count {
  position: relative;
  z-index: 1;
  font-weight: 900;
}

.poll-count,
.poll-total {
  color: var(--muted);
}

.poll-total {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
}

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

.pin-actions button {
  cursor: pointer;
}

.action {
  min-height: 36px;
  padding: 0 12px;
  color: var(--ink);
  font-weight: 800;
  background: #eef5ef;
  border: 0;
  border-radius: 999px;
}

.action.active {
  color: white;
  background: var(--coral);
}

.save.active {
  background: var(--blue);
}

.empty-state {
  margin: 28px 0 60px;
  padding: 28px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.composer {
  width: min(520px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.pin-dialog {
  width: min(960px, calc(100% - 24px));
  max-height: min(860px, calc(100vh - 24px));
  padding: 0;
  overflow: hidden;
  background: white;
  border: 0;
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.pin-dialog::backdrop {
  background: rgba(20, 32, 26, 0.5);
  backdrop-filter: blur(5px);
}

.pin-detail {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  max-height: min(860px, calc(100vh - 24px));
}

.detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
}

.detail-image {
  min-height: 420px;
  background: #e6eee8;
}

.detail-image img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: min(860px, calc(100vh - 24px));
  object-fit: cover;
}

.detail-copy {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 34px;
  overflow-y: auto;
}

.detail-copy h2 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1;
}

.detail-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.pin-badge.inline {
  position: static;
  color: white;
  background: var(--accent);
}

.composer::backdrop {
  background: rgba(20, 32, 26, 0.46);
  backdrop-filter: blur(5px);
}

.composer-card {
  display: grid;
  gap: 16px;
  padding: 24px;
  background: white;
}

.form-message {
  margin: 0;
  padding: 11px 12px;
  color: var(--accent-dark);
  font-weight: 800;
  background: #e8f5ee;
  border-radius: 12px;
}

.form-message.error {
  color: #a73529;
  background: #fff0ee;
}

.paste-zone {
  display: grid;
  min-height: 180px;
  place-items: center;
  overflow: hidden;
  padding: 14px;
  color: var(--muted);
  text-align: center;
  background: #f7faf6;
  border: 2px dashed #b8c9bd;
  border-radius: 16px;
  outline: none;
}

.paste-zone:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 122, 84, 0.14);
}

.paste-zone strong,
.paste-zone span {
  display: block;
}

.paste-zone strong {
  color: var(--ink);
  font-size: 1rem;
}

.paste-zone span {
  max-width: 280px;
  margin-top: 6px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.paste-zone img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 12px;
}

.paste-zone.has-image {
  padding: 8px;
  border-style: solid;
  background: white;
}

.web-image-tool {
  display: grid;
  gap: 10px;
}

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

.fetch-button {
  min-height: 46px;
  padding-inline: 14px;
  background: #eef5ef;
}

.image-results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  background: #f7faf6;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.image-choice {
  aspect-ratio: 1;
  overflow: hidden;
  padding: 0;
  background: white;
  border: 2px solid transparent;
  border-radius: 12px;
}

.image-choice.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 122, 84, 0.14);
}

.image-choice img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.signup-only {
  display: none;
}

.is-signup .signup-only {
  display: grid;
}

.composer-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.composer h2 {
  margin: 0;
  font-size: 1.8rem;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

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

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 122, 84, 0.14);
}

@media (max-width: 980px) {
  .masonry {
    column-count: 3;
  }

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

  .pin-detail {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .detail-image {
    min-height: 340px;
  }

  .detail-copy {
    padding: 22px;
  }
}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .account-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .search-wrap {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .hero {
    grid-template-columns: 1fr;
    align-items: start;
    padding-top: 24px;
  }

  .hero .primary-button {
    width: 100%;
  }

  .masonry {
    column-count: 2;
    column-gap: 12px;
  }

  .user-pill {
    max-width: 96px;
  }

  .pin-card {
    margin-bottom: 12px;
    border-radius: 16px;
  }

  .pin-body {
    padding: 13px;
  }

  .image-results {
    grid-template-columns: repeat(3, 1fr);
  }

  .poll-options-grid {
    grid-template-columns: 1fr;
  }

  .section-head,
  .match-facts {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 440px) {
  .app-shell {
    width: min(100% - 18px, 1180px);
  }

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

  .account-actions {
    gap: 4px;
  }

  .text-button {
    padding-inline: 8px;
  }

  h1 {
    font-size: clamp(1.8rem, 11vw, 2.7rem);
  }

  .masonry {
    column-count: 1;
  }

  .match-strip {
    grid-template-columns: 1fr;
  }
}
