:root {
  --orange: #f47b20;
  --orange-dark: #d9650e;
  --blue: #1a5aa6;
  --text: #222;
  --muted: #777;
  --line: #e3e3e3;
  --bg: #f2f2f2;
  --card: #fff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* top strip */
.topbar { background: #3a3a3a; color: #ddd; font-size: 12px; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; height: 30px; }
.debug-toggle { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 5px; }

/* header + search */
.header { background: #fff; border-bottom: 3px solid var(--orange); }
.header-inner { display: flex; align-items: center; gap: 28px; padding: 16px; }
.logo { font-size: 30px; font-weight: bold; color: var(--blue); letter-spacing: -1px; white-space: nowrap; }
.logo span { color: var(--orange); }
.logo:hover { text-decoration: none; }

.search { flex: 1; display: flex; }
.search input {
  flex: 1; min-width: 0;
  height: 42px; padding: 0 12px;
  font-size: 16px;
  border: 2px solid var(--orange); border-right: 0;
  border-radius: 3px 0 0 3px;
  outline: none;
}
.search #limit {
  flex: 0 0 72px; width: 72px;
  height: 42px; padding: 0 8px;
  font-size: 16px; text-align: center;
  border: 2px solid var(--orange); border-left: 1px solid #ddd; border-right: 0;
  outline: none;
}
.search #limit::placeholder { color: #aaa; }
.search button {
  height: 42px; padding: 0 26px;
  font-size: 16px; font-weight: bold;
  color: #fff; background: var(--orange);
  border: 0; border-radius: 0 3px 3px 0;
  cursor: pointer;
}
.search button:hover { background: var(--orange-dark); }
.real-search {
  height: 42px; padding: 0 16px; margin-left: 8px;
  display: inline-flex; align-items: center;
  font-size: 15px; font-weight: bold; white-space: nowrap;
  color: var(--blue); background: #fff;
  border: 2px solid var(--blue); border-radius: 3px;
}
.real-search:hover { background: var(--blue); color: #fff; text-decoration: none; }

/* page chrome */
.crumbs { margin: 14px 0 6px; font-size: 12px; color: var(--muted); }
.crumbs span { margin: 0 4px; }
.summary { margin: 0 0 10px; font-size: 13px; color: var(--muted); min-height: 18px; }
.summary b { color: var(--text); }
.debug-only { display: none; }
body.debug .debug-only { display: inline; }

/* result rows */
.results { background: var(--card); border: 1px solid var(--line); }
.results:empty { display: none; }

.item {
  display: flex; gap: 14px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: inherit;
}
.item:last-child { border-bottom: 0; }
.item:hover { background: #fbf7f2; text-decoration: none; }
.item:hover .item-title { text-decoration: underline; }

.thumb {
  position: relative; flex: 0 0 160px; height: 120px;
  background: #eee; border-radius: 2px; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #bbb; font-size: 12px; }
.thumb .count {
  position: absolute; right: 4px; bottom: 4px;
  background: rgba(0, 0, 0, .6); color: #fff;
  font-size: 11px; padding: 1px 5px; border-radius: 2px;
}

.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.item-title { color: var(--blue); font-size: 16px; font-weight: bold; line-height: 1.25; overflow-wrap: anywhere; }
.item-title.blocked { color: #d32f2f; }
.item-title.expired { color: #d9a300; }
.item-desc {
  color: #555; font-size: 13px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.item-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 11px; padding: 2px 6px; border-radius: 2px; background: #f0f0f0; color: #555; }
.tag.new { background: #e5f4e3; color: #2e7d32; }
.tag.biz { background: #e6eef8; color: var(--blue); }
.item-meta { margin-top: auto; font-size: 12px; color: var(--muted); }
.item-meta .verified { color: #2e7d32; }

.item-side { flex: 0 0 auto; text-align: right; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; }
.price { font-size: 18px; font-weight: bold; white-space: nowrap; }
.dbg {
  display: none;
  font: 11px/1.4 Consolas, monospace;
  background: #fff4d6; color: #7a5200; border: 1px solid #f0d58a;
  padding: 2px 6px; border-radius: 2px; white-space: nowrap;
}
body.debug .dbg { display: inline-block; }

.empty { padding: 30px; text-align: center; color: var(--muted); }

/* pagination */
.pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin: 18px 0 30px; }
.pager a, .pager span {
  min-width: 34px; height: 34px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #fff; border-radius: 2px;
}
.pager a:hover { border-color: var(--orange); text-decoration: none; }
.pager .current { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: bold; }

.footer { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 12px; padding: 16px 0; }

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: stretch; gap: 10px; }
  .logo { font-size: 26px; }
  .search { flex-wrap: wrap; }
  .search input#q { flex-basis: 0; }
  .search button { padding: 0 14px; }
  .real-search { flex-basis: 100%; justify-content: center; margin: 8px 0 0; }
  .item { flex-wrap: wrap; }
  .thumb { flex-basis: 110px; height: 85px; }
  .item-body { flex-basis: calc(100% - 124px); }
  .item-side { flex-basis: 100%; flex-direction: row; align-items: center; }
}
