:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #1c1f26;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #4338ca;
  --accent-soft: #eef2ff;
  --ai: #0ea5a4;
  --ai-soft: #ecfdf5;
  --price: #b45309;
  --biz: #c026d3;
  --err: #b91c1c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 600;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.jump,
.url-loader {
  display: flex;
  align-items: center;
  gap: 6px;
}

.jump label,
.url-loader label { color: var(--muted); }
.jump input,
.url-loader input {
  width: 80px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}
.url-loader input { width: min(360px, 36vw); }
.jump .of { color: var(--muted); font-size: 13px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
  border-radius: 6px;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}
.btn:hover { background: #e0e7ff; }
.btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px 24px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent-soft);
  color: var(--accent);
}
.badge.ai { background: var(--ai-soft); color: var(--ai); }

.src-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}
.src-link:hover { color: var(--accent); }
.err { color: var(--err); font-size: 12px; }

.card h2 {
  margin: 4px 0 8px;
  font-size: 20px;
  line-height: 1.3;
}
.subhead {
  margin: 0 0 8px;
  color: var(--muted);
  font-style: italic;
}
.summary { margin: 0 0 12px; }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 12px;
}

.price {
  font-weight: 700;
  color: var(--price);
  margin-right: 4px;
}
.price em { color: var(--muted); font-weight: 400; font-style: normal; font-size: 12px; }

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 12px;
  border: 1px solid var(--line);
}
.chip.muted { color: var(--muted); }
.chip.biz { background: #fdf4ff; color: var(--biz); border-color: #f5d0fe; }

.photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 8px 0 16px;
}
.photos img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  background: #f1f5f9;
}

.description {
  white-space: pre-wrap;
  font-family: inherit;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  max-height: 320px;
  overflow: auto;
  margin: 0 0 16px;
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0 0 12px;
}
.kv dt {
  color: var(--muted);
  font-size: 13px;
}
.kv dd {
  margin: 0;
  font-size: 14px;
}

.card h3 {
  margin: 16px 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--ai-soft);
  color: #0f766e;
  font-size: 12px;
  border: 1px solid #ccfbf1;
}
.tag.kw {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #c7d2fe;
}
.tag.missing {
  background: #fef2f2;
  color: var(--err);
  border-color: #fecaca;
}

.best-photo {
  position: relative;
  width: 160px;
  margin: 4px 0 12px;
}
.best-photo img {
  width: 160px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f1f5f9;
  display: block;
}
.best-photo-label {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(14, 165, 164, 0.92);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary.semantic {
  background: var(--ai-soft);
  border: 1px solid #ccfbf1;
  border-radius: 8px;
  padding: 10px 12px;
  font-style: italic;
}

.bullets {
  margin: 0 0 12px;
  padding-left: 20px;
}
.bullets li {
  margin: 0 0 4px;
  font-size: 14px;
}

.empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--muted);
}
.empty-error { color: var(--err); }

.prompt-editor {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.prompt-editor .card-header {
  margin-bottom: 6px;
}

.badge.prompt {
  background: #fff7ed;
  color: #c2410c;
}

.prompt-hint {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.prompt-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 280px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfbfd;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.prompt-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.prompt-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}
.btn.primary:hover { background: #3730a3; }
