:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-soft: #eef4f2;
  --ink: #17211f;
  --muted: #5d6b67;
  --line: #d9e2df;
  --accent: #176b5f;
  --accent-strong: #0d4f46;
  --accent-soft: #dff1ed;
  --warning: #a26316;
  --danger: #b3261e;
  --success: #1b7f45;
  --shadow: 0 18px 44px rgba(18, 42, 38, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(223, 241, 237, 0.8), rgba(245, 247, 246, 0) 330px),
    var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 14px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid rgba(217, 226, 223, 0.9);
  background: rgba(245, 247, 246, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(23, 107, 95, 0.2);
}

.brand-mark svg {
  width: 28px;
  height: 28px;
  fill: none;
}

.brand-mark path:first-child {
  fill: currentColor;
  opacity: 0.18;
  stroke: currentColor;
  stroke-width: 2;
}

.brand-mark path:last-child {
  fill: currentColor;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-actions a {
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

.top-actions a:hover,
.top-actions a:focus-visible {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
  outline: none;
}

main {
  padding: clamp(18px, 4vw, 42px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 20px;
  max-width: 1240px;
  margin: 0 auto;
  align-items: start;
}

.tool-panel,
.queue-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tool-panel {
  padding: clamp(18px, 3vw, 30px);
}

.queue-panel {
  min-height: 512px;
  padding: 20px;
}

.tool-heading,
.queue-header,
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.08;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
}

.download-form {
  margin-top: 26px;
}

.download-form label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  padding: 16px;
  border: 1px solid #cbd8d4;
  border-radius: 8px;
  color: var(--ink);
  background: #fbfdfc;
  outline: none;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(23, 107, 95, 0.12);
}

.form-row {
  margin-top: 14px;
}

.counter {
  color: var(--muted);
  font-size: 14px;
}

.primary-button,
.ghost-button,
.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  min-width: 132px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  color: #fff;
  background: var(--accent);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--accent-strong);
  outline: none;
}

.primary-button:disabled {
  cursor: not-allowed;
  border-color: #9eb0ab;
  background: #9eb0ab;
}

.ghost-button {
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
}

.ghost-button:hover,
.ghost-button:focus-visible {
  color: var(--ink);
  background: var(--surface-soft);
  outline: none;
}

button svg,
.download-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 360px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: min(180px, 60%);
  height: auto;
  margin-bottom: 14px;
  fill: none;
  stroke: #9db4ad;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state path:nth-of-type(1) {
  fill: #dff1ed;
  stroke: var(--accent);
}

.task-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.task-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.task-top,
.task-meta,
.task-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.task-title {
  min-width: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.task-url {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.status {
  flex: 0 0 auto;
  min-width: 78px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.status[data-status="success"] {
  color: var(--success);
  background: #e5f5eb;
}

.status[data-status="failed"] {
  color: var(--danger);
  background: #fde8e6;
}

.status[data-status="downloading"],
.status[data-status="parsing"],
.status[data-status="detecting"],
.status[data-status="queued"] {
  color: var(--warning);
  background: #fff1dc;
}

.progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ece9;
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.24s ease;
}

.task-meta {
  color: var(--muted);
  font-size: 13px;
}

.task-actions {
  justify-content: flex-end;
}

.download-link {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--accent);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.download-link:hover,
.download-link:focus-visible {
  outline: none;
  background: #cde9e3;
}

.seo-band {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
}

.section-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 0;
}

.section-inner p {
  max-width: 860px;
  margin: 10px 0 18px;
  color: var(--muted);
}

.keyword-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.keyword-grid a {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  font-weight: 700;
  text-align: center;
}

footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px clamp(18px, 4vw, 42px) 36px;
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  max-width: min(92vw, 520px);
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #17211f;
  box-shadow: var(--shadow);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast[data-open="true"] {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

  .queue-panel {
    min-height: 360px;
  }

  .keyword-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  main {
    padding: 14px;
  }

  .tool-heading,
  .queue-header,
  .form-row,
  .task-top,
  .task-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }

  textarea {
    min-height: 220px;
  }

  .task-actions {
    justify-content: stretch;
  }

  .download-link {
    width: 100%;
  }

  .keyword-grid {
    grid-template-columns: 1fr 1fr;
  }
}
