:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --text: #151515;
  --muted: #5d5d5d;
  --accent: #0a7f5a;
  --error: #ab1f2d;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

body {
  margin: 0;
  background: #ffffff;
  color: var(--text);
}

body.split-view {
  overflow: hidden;
}

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
  background: #ffffff;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.8rem, 2.8vw, 2.5rem);
}

.top-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.45rem;
  position: relative;
  background: #ffffff;
  border-bottom: 1px solid #f0f0f0;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}

.top-nav-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.top-nav-links {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.85rem;
  margin-left: auto;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.top-nav::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.65rem;
  height: 0.65rem;
  background: #ffffff;
}

.top-nav-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.top-nav-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.top-nav-subtitle {
  color: #5a6779;
  font-size: clamp(0.85rem, 2.4vw, 1rem);
  line-height: 1.25;
}

.top-nav-link {
  text-decoration: none;
  font-size: 1.02rem;
  line-height: 1.2;
  color: #222934;
  position: relative;
  display: inline-block;
  padding-bottom: 0.15rem;
}

.top-nav-link:visited {
  color: #222934;
}

.top-nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: #2f59ff;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.top-nav-link.top-nav-link-active,
.top-nav-link.top-nav-link-active:visited {
  color: #2f59ff;
}

.top-nav-link.top-nav-link-active::after {
  transform: scaleX(1);
  transform-origin: left center;
}

.top-nav-link:not(.top-nav-link-active):hover {
  color: #2f59ff;
}

.top-nav-link:not(.top-nav-link-active):hover::after {
  transform: scaleX(1);
  transform-origin: left center;
}

.top-nav-search {
  color: #222934;
  font-size: 1.25rem;
  line-height: 1;
}

@media (max-width: 840px) {
  .top-nav {
    padding: 0.7rem 0.8rem 0.95rem;
  }

  .top-nav-main {
    gap: 0.5rem;
  }

  .top-nav-links {
    gap: 0.55rem;
    font-size: 0.9rem;
  }

  .top-nav-subtitle {
    font-size: 0.84rem;
  }
}

.crawler-links {
  display: none;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

li {
  background: transparent;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 1rem;
}

.media-frame {
  width: 420px;
  max-width: 100%;
  height: 420px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.media-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-caption {
  margin-top: 0.35rem;
}

.media-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.split-layout {
  display: grid;
  --split-divider-size: 12px;
  --split-map-size: minmax(220px, 34%);
  grid-template-rows: var(--split-map-size) var(--split-divider-size) minmax(0, 1fr);
  gap: 0;
}

.split-map {
  border: 1px solid #d6d6d6;
  border-radius: 12px;
  overflow: hidden;
  background: #e9ecef;
  min-height: 240px;
}

.split-feed {
  overflow: auto;
  min-height: 0;
}

.split-resizer {
  position: relative;
  height: var(--split-divider-size);
  cursor: row-resize;
  touch-action: none;
  background: transparent;
}

.split-resizer::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42px;
  height: 4px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: #d2d2d2;
}

body.split-resizing {
  user-select: none;
  cursor: row-resize;
}

.split-feed-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 1px;
  row-gap: 14px;
}

.split-view main {
  height: 100dvh;
  padding: 1rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow: hidden;
}

.split-view .split-content {
  flex: 1 1 auto;
  min-height: 0;
}

.split-view .split-layout {
  height: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

.split-view .split-map {
  min-height: 0;
}

.split-feed-list .media-frame {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 0;
  background: transparent;
  margin: 0;
  position: relative;
}

.split-feed-list > li.media-card {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  min-width: 0;
}

.split-feed-list .media-caption {
  display: none;
}

.split-feed-list .thumb-meta {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.split-feed-list .split-item-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 0.35rem 0;
  padding: 0 2px;
}

.split-feed-list .split-meta-line {
  display: block;
  max-width: 100%;
  font-size: 11px;
  line-height: 1.2;
  color: #4f5a6b;
  background: transparent;
  padding: 0;
  border-radius: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.split-feed-list .split-product-line {
  margin-top: 0.4rem;
  font-size: 12px;
  line-height: 1.3;
  color: #2b3342;
}

.split-feed-list .thumb-city,
.split-feed-list .thumb-price {
  position: absolute;
  font-size: 12px;
  line-height: 1.2;
  color: #fff;
  background: rgba(0, 0, 0, 0.58);
  padding: 3px 6px;
  border-radius: 4px;
  max-width: calc(100% - 12px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.split-feed-list .thumb-city {
  top: 6px;
  left: 6px;
}

.split-feed-list .thumb-price {
  right: 6px;
  bottom: 6px;
}

.split-feed .loading {
  margin: 0.75rem 0 0;
  color: var(--muted);
  text-align: center;
}

.split-load-more-wrap {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
}

.split-load-more-btn {
  border: 1px solid #d2d2d2;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.split-load-more-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

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

pre {
  margin: 0.5rem 0 0.9rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: #0f1720;
  color: #d7e7ff;
  overflow: auto;
  font-size: 0.8rem;
}

.error {
  color: var(--error);
  background: #ffeef0;
  border: 1px solid #ffd5da;
  border-radius: 10px;
  padding: 0.8rem 1rem;
}

.home-feed .loading {
  margin: 0.75rem 0 0;
  color: var(--muted);
  text-align: center;
}

.home-feed .load-more-wrap {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
}

.home-feed .load-more-btn {
  border: 1px solid #d2d2d2;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.home-feed .load-more-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.home-feed .feed-sentinel {
  height: 1px;
}

.home-feed #feed-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 1px;
  row-gap: 1px;
}

.home-feed #feed-list > li.media-card {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  min-width: 0;
}

.home-feed #feed-list > li.media-card .home-product-line {
  margin: 0.35rem 2px 0;
  font-size: 12px;
  line-height: 1.3;
  color: #2b3342;
}

.home-feed #feed-list > li.media-card .media-frame {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 0;
  background: transparent;
  position: relative;
}

.home-feed #feed-list > li.media-card .media-caption {
  display: none;
}

.home-feed #feed-list .thumb-meta {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.home-feed #feed-list .thumb-city,
.home-feed #feed-list .thumb-price {
  position: absolute;
  font-size: 12px;
  line-height: 1.2;
  color: #fff;
  background: rgba(0, 0, 0, 0.58);
  padding: 3px 6px;
  border-radius: 4px;
  max-width: calc(100% - 12px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 820px) {
  .home-feed #feed-list,
  .split-feed-list {
    column-gap: 0.75px;
    row-gap: 8px;
  }

  .home-feed #feed-list > li.media-card,
  .split-feed-list > li.media-card {
    padding: 0;
  }

  .home-feed #feed-list .thumb-city,
  .home-feed #feed-list .thumb-price,
  .split-feed-list .thumb-city,
  .split-feed-list .thumb-price {
    font-size: 10px;
    padding: 2px 4px;
  }

  .home-feed #feed-list .home-product-line,
  .split-feed-list .split-product-line {
    font-size: 11px;
    line-height: 1.15;
    margin-top: 0.25rem;
  }

  .home-feed #feed-list .media-frame,
  .split-feed-list .media-frame {
    width: 100%;
  }
}

.home-feed #feed-list .thumb-city {
  top: 6px;
  left: 6px;
}

.home-feed #feed-list .thumb-price {
  right: 6px;
  bottom: 6px;
}

.details-view main {
  max-width: 980px;
}

.details-card {
  background: transparent;
}

.details-image-wrap {
  width: 100%;
  margin-bottom: 0.9rem;
}

.details-image {
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  display: block;
  background: #ffffff;
}

.details-grid {
  display: grid;
  gap: 0.45rem 0;
}

.details-grid p {
  margin: 0;
  color: #2b3342;
}

.details-title,
.details-meta,
.details-caption {
  margin-top: 0;
  color: #2b3342;
}

.details-title {
  color: #151515;
  margin-bottom: 0.1rem;
}

.details-meta {
  color: #4f5a6b;
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.details-posted {
  font-weight: 500;
}

.details-merchant-link {
  color: #2f59ff;
  text-decoration: none;
}

.details-merchant-link:hover,
.details-merchant-link:focus-visible {
  text-decoration: underline;
}

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