:root {
  --bg: #0f1220;
  --surface: #191d31;
  --surface-2: #222742;
  --border: #2e3358;
  --text: #eef0ff;
  --text-muted: #a6adcc;
  --accent: #4f46e5;
  --accent-hover: #6366f1;
  --accent-soft: #a5b4fc;
  --danger: #ff7b7b;
  --success: #6ee7a8;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1c2140 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.hero {
  text-align: center;
  padding: 4rem 1rem 2rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.5rem);
  letter-spacing: -0.02em;
}

.hero h1 span {
  color: var(--accent-soft);
}

.tagline {
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-size: 1.1rem;
}

.intro {
  max-width: 620px;
  margin: 0.75rem auto 0;
  color: var(--text-muted);
  font-size: 1rem;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

.search-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}

.required {
  color: var(--danger);
}

.optional {
  color: var(--text-muted);
  font-weight: normal;
}

input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease;
}

input:focus {
  border-color: var(--accent);
}

button {
  width: 100%;
  padding: 0.85rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 1rem 0 0;
}

.error {
  background: rgba(255, 123, 123, 0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-top: 1rem;
}

#results {
  margin-top: 2rem;
}

.book-card {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
}

.book-card img {
  width: 96px;
  height: 144px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-2);
  flex-shrink: 0;
}

.book-card .placeholder {
  width: 96px;
  height: 144px;
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.book-card h2 {
  margin: 0 0 0.25rem;
  font-size: 1.3rem;
}

.book-card .author {
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.book-card .meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.section-title {
  font-size: 1.1rem;
  margin: 2rem 0 0.75rem;
}

.match-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.match {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}

.match a {
  color: var(--accent-soft);
  font-weight: 600;
  text-decoration: none;
  word-break: break-all;
}

.match a:hover {
  text-decoration: underline;
}

.match .snippet {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.4rem 0 0;
}

.notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-muted);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.empty {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 0;
}

.how-it-works,
.faq {
  margin-top: 3rem;
}

.how-it-works h2,
.faq h2 {
  font-size: 1.25rem;
  margin: 0 0 1rem;
}

.how-it-works ol {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
}

.how-it-works li {
  margin-bottom: 0.5rem;
}

.how-it-works strong {
  color: var(--text);
}

.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.75rem;
  padding: 0.85rem 1rem;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.faq details p {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
}

footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 520px) {
  .book-card {
    flex-direction: column;
  }
}
