:root {
  --bg: #0f1117;
  --bg-elev: #1a1d27;
  --bg-input: #171a22;
  --text: #e6e9f0;
  --text-dim: #9aa2b1;
  --accent: #fb7299;
  --accent-strong: #f25c86;
  --border: #2a2e3a;
  --error: #ff5c5c;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 20px 24px;
}

.hero { text-align: center; margin-bottom: 28px; }
.hero h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.subtitle {
  margin: 0;
  color: var(--text-dim);
  font-size: 15px;
}

/* --- search form -------------------------------------------------------- */
.search {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.search input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease;
}
.search input:focus { border-color: var(--accent); }
.search input::placeholder { color: var(--text-dim); }

.search button {
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}
.search button:hover { background: var(--accent-strong); }
.search button:disabled { opacity: 0.6; cursor: not-allowed; }

.input-error {
  color: var(--error);
  font-size: 13px;
  margin: 0 4px 10px;
}

.hint {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 4px 28px;
}
.hint .example {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  font-size: 13px;
  padding: 3px 12px;
  margin-left: 4px;
  cursor: pointer;
}
.hint .example:hover { border-color: var(--accent); }

/* --- result ------------------------------------------------------------- */
.result {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.cover-wrap {
  /* 16:10-ish natural ratio preserved; cap height so it never dominates. */
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  margin-bottom: 14px;
  max-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cover {
  display: block;
  max-width: 100%;
  max-height: 380px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.cover-skeleton {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.skeleton-inner {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Keep the native hidden attribute authoritative over the flex layout above. */
.cover-skeleton[hidden] { display: none !important; }

.meta { margin-bottom: 14px; }
.title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  /* two-line clamp for long titles */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.byline {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.dot { opacity: 0.5; }

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.actions button {
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.actions button:disabled { opacity: 0.5; cursor: not-allowed; }
.actions .primary { color: #fff; background: var(--accent); }
.actions .primary:hover:not(:disabled) { background: var(--accent-strong); }
.actions .ghost { color: var(--text); background: transparent; border: 1px solid var(--border); }
.actions .ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

.image-error {
  color: var(--error);
  font-size: 13px;
  margin: 12px 4px 0;
}

/* --- status / footer ---------------------------------------------------- */
.status {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  min-height: 20px;
  margin: 0;
}
.foot {
  margin-top: 40px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}
.foot p { margin: 0; }

@media (max-width: 480px) {
  .page { padding: 32px 14px 20px; }
  .search { flex-direction: column; }
  .search button { width: 100%; }
  .actions button { flex: 1; }
}
