:root {
  color-scheme: light;
  --bg: #faf7f5;
  --card: #ffffff;
  --text: #201c1b;
  --muted: #8c827c;
  --line: #ebe3de;
  --accent: #ff2e4d;
  --accent-2: #ff6a3d;
  --accent-soft: #ffe9ec;
  --ok: #17a05a;
  --warn: #c07a00;
  --err: #d92b3a;
  --shadow: 0 10px 30px rgba(60, 30, 20, .07), 0 2px 6px rgba(60, 30, 20, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #151110;
    --card: #1e1918;
    --text: #f4ece9;
    --muted: #a59892;
    --line: #2e2624;
    --accent: #ff5069;
    --accent-2: #ff7c4d;
    --accent-soft: #3a1d22;
    --ok: #3fbf7f;
    --warn: #e0a53a;
    --err: #ff6b74;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 32px 20px 48px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

header, main, footer { max-width: 880px; margin: 0 auto; }

.site-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.logo {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px rgba(255, 46, 77, .28);
  position: relative;
}
.logo::after {
  content: "";
  position: absolute;
  inset: 13px 13px auto auto;
  width: 18px;
  height: 14px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 3px 0 -1px rgba(0, 0, 0, .12);
}

h1 { font-size: 22px; margin: 0; letter-spacing: .2px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .08em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea::placeholder { color: var(--muted); opacity: .75; }
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.hint { color: var(--muted); font-size: 12.5px; }

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s, box-shadow .15s, opacity .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .55; }

.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px rgba(255, 46, 77, .25);
}
.btn.primary:hover:not(:disabled) { box-shadow: 0 8px 22px rgba(255, 46, 77, .32); }
.btn.small { padding: 7px 14px; font-size: 13px; }

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}
.btn.ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--muted);
  background: var(--bg);
}

.statusline {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.status { font-size: 13px; color: var(--muted); flex: 1; min-width: 180px; }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.error { color: var(--err); }
.status.busy::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 7px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -1px;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.bar {
  width: 160px;
  height: 5px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
  flex: none;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .25s ease;
}

.result-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.titles { min-width: 0; flex: 1; }
h2 {
  margin: 0 0 3px;
  font-size: 16.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.meta { margin: 0; color: var(--muted); font-size: 12.5px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
}

.thumb {
  position: relative;
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  background: var(--bg);
  cursor: pointer;
  aspect-ratio: 3 / 4;
  transition: border-color .15s, opacity .15s, filter .15s;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb.on { border-color: var(--accent); }
.thumb.off { opacity: .4; filter: grayscale(1); }
.thumb .idx {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 1px 7px;
  font-size: 11px;
  color: #fff;
  background: rgba(0, 0, 0, .5);
  border-radius: 99px;
  backdrop-filter: blur(4px);
}
.thumb .check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
  transition: opacity .15s, transform .15s;
}
.thumb.off .check { opacity: 0; transform: scale(.6); }
.thumb.broken::after {
  content: "加载失败";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.tip { margin: 12px 0 0; color: var(--muted); font-size: 12px; }

.log {
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--warn);
}
.log ul { margin: 0; padding-left: 18px; }
.log li { margin: 2px 0; }

.site-foot {
  margin-top: 26px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 520px) {
  body { padding: 20px 14px 36px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .bar { width: 100%; }
  .actions { width: 100%; }
}
