:root {
  --bg: #f6f4f0;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --accent: #d9480f;
  --line: #e5e1da;
  --radius: 14px;
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.error { color: #c92a2a; }
.brand { font-weight: 800; letter-spacing: -0.02em; text-decoration: none; font-size: 1.1rem; }

/* ---------- home ---------- */
.hero { max-width: 760px; margin: 0 auto; padding: 56px 20px 24px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -0.03em; margin: 24px 0 8px; }
.hero p { color: var(--muted); font-size: 1.1rem; }
.search { display: flex; gap: 8px; margin-top: 28px; }
.search input { flex: 1; min-width: 0; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); font-size: 1rem; background: var(--card); }
.search button { padding: 0 22px; border: 0; border-radius: var(--radius); background: var(--accent); color: #fff; font-weight: 600; }
.search button:disabled { opacity: 0.6; }
.status { margin-top: 14px; }
main { max-width: 1200px; margin: 0 auto; padding: 0 20px 64px; }
main h2 { font-size: 1.2rem; margin: 36px 0 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; text-decoration: none; border: 1px solid var(--line); transition: transform 0.15s, box-shadow 0.15s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); }
.thumb { aspect-ratio: 4 / 3; background: #ddd center / cover; position: relative; }
.badge { position: absolute; right: 10px; bottom: 10px; background: rgba(0, 0, 0, 0.75); color: #fff; padding: 4px 10px; border-radius: 99px; font-size: 0.8rem; }
.card-body { padding: 12px 14px 14px; display: grid; gap: 4px; }
.card-body strong { font-size: 0.95rem; line-height: 1.3; }
.card-body .muted { font-size: 0.82rem; }

.tip { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 4px 20px 16px; margin-top: 28px; }
.tip > div { flex: 1 1 360px; }
.bookmarklet { display: inline-block; padding: 10px 18px; border-radius: 99px; background: var(--text); color: #fff; text-decoration: none; font-weight: 600; cursor: grab; white-space: nowrap; }

/* ---------- view ---------- */
.view { display: grid; grid-template-columns: 1fr 360px; height: 100vh; overflow: hidden; }
.stage { position: relative; min-height: 0; }
.stage canvas { display: block; width: 100%; height: 100%; }
.panel { background: var(--card); border-left: 1px solid var(--line); overflow-y: auto; padding: 20px; }
.panel h2 { font-size: 1.1rem; line-height: 1.3; margin: 16px 0 6px; }
.panel h3 { font-size: 0.95rem; margin: 22px 0 10px; }
.price { font-size: 1.4rem; font-weight: 700; margin: 4px 0; }
.summary { line-height: 1.5; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tags span { background: var(--bg); padding: 3px 9px; border-radius: 99px; font-size: 0.78rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line); background: var(--bg); border-radius: 99px; padding: 6px 12px; font-size: 0.85rem; }
.chips button:hover { border-color: var(--accent); }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photos button { padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; aspect-ratio: 1; background: #ddd; position: relative; }
.photos button.located::after { content: '◉'; position: absolute; top: 3px; right: 5px; color: #fff; font-size: 12px; text-shadow: 0 0 4px #000; }
.photos button:hover { border-color: var(--accent); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }

.progress { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 4px; padding: 20px; }
.spinner { width: 42px; height: 42px; margin: 0 auto 10px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toolbar { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); display: flex; background: rgba(255, 255, 255, 0.9); border-radius: 99px; padding: 4px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); backdrop-filter: blur(8px); }
.toolbar button { border: 0; background: transparent; padding: 8px 18px; border-radius: 99px; font-weight: 600; }
.toolbar button.active { background: var(--text); color: #fff; }
.hint { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); margin: 0; background: rgba(0, 0, 0, 0.6); color: #fff; padding: 6px 14px; border-radius: 99px; font-size: 0.8rem; white-space: nowrap; max-width: 95%; overflow: hidden; text-overflow: ellipsis; }
.pip { position: absolute; top: 16px; right: 16px; width: min(34%, 360px); margin: 0; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25); }
.pip img { width: 100%; display: block; cursor: zoom-in; }
.pip figcaption { font-size: 0.78rem; padding: 6px 10px; color: var(--muted); }
.pip button { border: 0; background: none; color: var(--accent); padding: 0; }
dialog { border: 0; border-radius: var(--radius); padding: 0; max-width: 92vw; max-height: 92vh; }
dialog img { display: block; max-width: 92vw; max-height: 84vh; }
dialog form { text-align: right; padding: 8px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.7); }

@media (max-width: 860px) {
  .view { grid-template-columns: 1fr; grid-template-rows: 60vh auto; height: auto; overflow: auto; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .hero { padding-top: 32px; }
  .search { flex-direction: column; }
  .search button { padding: 14px; }
}
