:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger-bg: #fef2f2;
  --danger-text: #991b1b;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,.06);
}

:root[data-theme="dark"] {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: #334155;
  --danger-bg: #3b1d1d;
  --danger-text: #fecaca;
  --shadow: 0 8px 24px rgba(0,0,0,.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --border: #334155;
    --danger-bg: #3b1d1d;
    --danger-text: #fecaca;
    --shadow: 0 8px 24px rgba(0,0,0,.3);
  }
}

body { margin:0; font-family: system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif; background:var(--bg); color:var(--text); }
.header { text-align:center; padding:32px 16px 8px; }
.header h1 { margin:0; font-size:1.6rem; }
.subtitle { color:var(--muted); margin:6px 0 0; }
.container { max-width:720px; margin:0 auto; padding:16px; display:flex; flex-direction:column; gap:16px; }
.card { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); padding:16px; }
.input-row input, .link-row input { width:100%; padding:12px 14px; border:1px solid var(--border); border-radius:10px; font-size:1rem; background:var(--card); color:var(--text); box-sizing:border-box; }
.btn-row { display:flex; flex-wrap:wrap; gap:10px; margin-top:12px; }
.btn { padding:10px 16px; border:none; border-radius:10px; cursor:pointer; font-size:.95rem; font-weight:600; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; }
.btn.primary { background:var(--primary); color:#fff; }
.btn.primary:hover { background:var(--primary-hover); }
.btn.secondary { background:transparent; border:1px solid var(--border); color:var(--text); }
.btn.ghost { background:transparent; color:var(--muted); }
.auto-row { display:flex; align-items:center; gap:8px; margin-top:12px; color:var(--muted); font-size:.9rem; }
.state.hidden, .result.hidden { display:none; }
.error { background:var(--danger-bg); color:var(--danger-text); border-color:var(--danger-bg); }
.skeleton { background:linear-gradient(90deg,#e5e7eb 25%,#f3f4f6 50%,#e5e7eb 75%); background-size:200% 100%; animation:shimmer 1.2s infinite; border-radius:8px; }
@keyframes shimmer { 0%{background-position:200% 0}100%{background-position:-200% 0} }
@media (prefers-color-scheme: dark) { .skeleton { background:linear-gradient(90deg,#334155 25%,#475569 50%,#334155 75%); background-size:200% 100%; } }
.product { display:flex; gap:14px; align-items:flex-start; }
.product img { width:120px; height:120px; object-fit:cover; border-radius:10px; border:1px solid var(--border); flex-shrink:0; }
.product-info h2 { margin:0 0 8px; font-size:1.05rem; line-height:1.35; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.prices { display:flex; gap:10px; align-items:baseline; }
.sale-price { font-size:1.25rem; font-weight:700; color:var(--primary); }
.original-price { color:var(--muted); text-decoration:line-through; font-size:.9rem; }
.link-row { display:flex; flex-wrap:wrap; gap:10px; margin-top:14px; align-items:center; }
.link-row input { flex:1 1 260px; }
.link-row .btn, .link-row a { flex:0 0 auto; }
@media (max-width:520px) {
  .product img { width:90px; height:90px; }
  .link-row { flex-direction:column; align-items:stretch; }
  .link-row input, .link-row .btn, .link-row a { width:100%; }
}
