@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Space+Grotesk:wght@500;700&display=swap");

:root {
  --bg0: #0f1c24;
  --bg1: #173040;
  --panel: rgba(255, 250, 244, 0.96);
  --ink: #14212b;
  --muted: #5c6b76;
  --line: #d7e0e6;
  --accent: #ff6a3d;
  --accent-2: #0f8b8d;
  --ok: #1f7a4d;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(8, 20, 28, 0.28);
  --radius: 18px;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "DM Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #2a6f7a 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #ff8a5b 0%, transparent 45%),
    linear-gradient(160deg, var(--bg0), var(--bg1) 55%, #102833);
}

body {
  min-height: 100vh;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 48px;
}

.hero {
  color: #f7fafb;
  margin-bottom: 22px;
  animation: rise 0.7s ease both;
}

.brand {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff7f0;
}

.hero h1 {
  margin: 0;
  max-width: 18ch;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
  font-weight: 500;
  line-height: 1.25;
  color: #e8f2f4;
}

.subtitle {
  margin: 12px 0 0;
  max-width: 52ch;
  color: #c5d5db;
  font-size: 1rem;
  line-height: 1.55;
}

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.8s ease 0.08s both;
}

.controls {
  padding: 22px 22px 8px;
  border-bottom: 1px solid var(--line);
}

.ads-box {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid #cfe0e4;
  border-radius: 14px;
  background: #f3fafb;
}

.ads-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.ads-status {
  font-size: 0.86rem;
  color: var(--muted);
}

.ads-status.ok {
  color: var(--ok);
  font-weight: 700;
}

.ads-status.bad {
  color: var(--danger);
  font-weight: 700;
}

.ads-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.ads-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #35515c;
}

.ads-grid .span-2 {
  grid-column: 1 / -1;
}

.ads-grid input,
.ads-grid select {
  border: 1px solid #c4d0d7;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 400;
  background: #fff;
}

.profile-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

@media (max-width: 720px) {
  .ads-grid {
    grid-template-columns: 1fr;
  }

  .profile-row {
    grid-template-columns: 1fr;
  }
}

.field-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input#query {
  width: 100%;
  border: 1px solid #c4d0d7;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 1rem;
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input#query:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(15, 139, 141, 0.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.secondary {
  background: var(--accent-2);
  color: #fff;
}

.btn.ghost {
  background: #e8eef1;
  color: var(--ink);
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.presets-label {
  color: var(--muted);
  font-size: 0.88rem;
}

.chip {
  border: 1px solid #c9d5dc;
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.86rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.chip:hover {
  background: #f0f7f8;
  border-color: var(--accent-2);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.limit-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.check-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  user-select: none;
}

.check-wrap input {
  width: 16px;
  height: 16px;
}

.limit-wrap select,
.limit-wrap input[type="number"] {
  border: 1px solid #c4d0d7;
  border-radius: 10px;
  padding: 6px 10px;
  font: inherit;
  background: #fff;
}

.limit-wrap input[type="number"] {
  width: 72px;
}

.limit-suffix {
  color: var(--muted);
}

.limit-quick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.limit-quick .chip {
  border: 1px solid #c4d0d7;
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.limit-quick .chip:hover,
.limit-quick .chip.active {
  border-color: #2f6fed;
  color: #2f6fed;
  background: #eef4ff;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.status {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #eef6f7;
}

.status.error {
  background: #fdecec;
}

.status-bar {
  height: 8px;
  border-radius: 999px;
  background: #d5e4e7;
  overflow: hidden;
}

.status-fill {
  height: 100%;
  width: 8%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), #2bb3a8);
  transition: width 0.35s ease;
}

.status-text {
  margin: 8px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.source-page {
  margin: 8px 0 0;
  font-size: 0.86rem;
  word-break: break-all;
}

.source-page a {
  color: var(--accent-2);
  font-weight: 600;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 8px;
}

.result {
  padding: 18px 22px 22px;
}

.result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.result-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

#result-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf2f5;
  text-align: left;
  vertical-align: middle;
  font-size: 0.9rem;
}

th {
  position: sticky;
  top: 0;
  background: #f4f8fa;
  z-index: 1;
  font-size: 0.82rem;
  color: #3d4f5b;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: #fafcfd;
}

.thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  background: #eef2f5;
  display: block;
}

.title-cell {
  max-width: 280px;
  line-height: 1.35;
}

.link-btn {
  color: var(--accent-2);
  font-weight: 600;
  text-decoration: none;
}

.link-btn:hover {
  text-decoration: underline;
}

.empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 36px 12px;
}

.footer {
  margin-top: 18px;
  color: #b7c7ce;
  font-size: 0.82rem;
  animation: rise 0.9s ease 0.14s both;
}

.footer p {
  margin: 0;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .page {
    width: min(100% - 20px, 1180px);
    padding-top: 24px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .btn.primary {
    width: 100%;
  }

  .result, .controls {
    padding-left: 14px;
    padding-right: 14px;
  }
}
