:root {
  /* ── Color tokens ── */
  --bg-main: #050816;
  --bg-elevated: #0b1020;
  --bg-elevated-softer: #101628;
  --accent: #4f82ff;
  --accent-soft: rgba(79, 130, 255, 0.25);
  --accent-strong: #86a9ff;
  --text-main: #f5f7ff;
  --text-muted: #a0a7c2;
  --border-soft: rgba(255, 255, 255, 0.04);
  --error: #ff6b81;
  --warning: #ffd369;
  --success: #4fd1c5;

  /* ── Spacing tokens ── */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;

  /* ── Typography tokens ── */
  --font-sm: 0.78rem;
  --font-base: 0.95rem;
  --font-lg: 1.4rem;

  /* ── Shape tokens ── */
  --shadow-soft: 0 24px 70px rgba(0, 0, 0, 0.7);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;

  /* ── Focus ring (reusable) ── */
  --focus-ring: 0 0 0 2px var(--accent), 0 0 0 4px rgba(79, 130, 255, 0.25);

  /* Canonical breakpoints (documented; cannot be used in @media):
     --bp-sm: 480px
     --bp-md: 640px
     --bp-lg: 768px  */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: radial-gradient(circle at top, #111b3f 0, #050816 35%, #02030a 100%);
  color: var(--text-main);
}

/* ── Skip link (a11y) ── */

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 9999;
  text-decoration: none;
}

.skip-link:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  width: auto;
  height: auto;
  padding: var(--space-sm) var(--space-md);
  background: var(--accent);
  color: var(--bg-main);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--font-base);
}

/* ── Page layout ── */

.page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  background:
    radial-gradient(circle at 10% 0%, rgba(79, 130, 255, 0.22) 0, transparent 55%),
    radial-gradient(circle at 90% 20%, rgba(150, 90, 255, 0.16) 0, transparent 55%);
}

@media (min-width: 768px) {
  .page {
    padding: var(--space-xl) 56px;
  }
}

/* ── Header ── */

.header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  transition:
    transform 200ms ease,
    filter 200ms ease;
}

.logo-mark:hover {
  transform: scale(1.1);
  filter: drop-shadow(0 0 14px rgba(79, 130, 255, 0.55))
          drop-shadow(0 0 4px rgba(134, 169, 255, 0.4));
}

.logo-mark:active {
  transform: scale(1.02);
}

.logo-mark:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-md);
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── About page ── */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-top: var(--space-lg);
}

@media (min-width: 640px) {
  .about-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.about-pill {
  background: rgba(2, 5, 20, 0.85);
  border-radius: 16px;
  padding: 14px 14px 12px;
  border: 1px solid var(--border-soft);
}

.about-heading {
  margin: 0 0 6px;
  font-size: var(--font-base);
}

.about-text {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.about-footer {
  margin-top: var(--space-lg);
}

.about-link {
  font-size: 0.86rem;
  color: var(--accent-strong);
  text-decoration: none;
}

.about-link:hover {
  text-decoration: underline;
}

.about-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-md);
  text-decoration: underline;
}

/* ── Footer nav ── */

.footer-nav {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .footer-nav {
    grid-template-columns: repeat(2, 1fr);
  }
}

.footer-nav-card {
  display: block;
  text-decoration: none;
  color: var(--text-main);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.02), transparent),
    radial-gradient(circle at top left, rgba(79, 130, 255, 0.12), transparent 50%),
    var(--bg-elevated);
  border-radius: 20px;
  padding: 22px 20px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.footer-nav-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 22px 50px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(79, 130, 255, 0.15);
  border-color: rgba(79, 130, 255, 0.18);
}

.footer-nav-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--accent);
}

.footer-nav-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-strong);
}

.footer-nav-desc {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

/* ── Title ── */

.title {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.title-next {
  color: var(--text-main);
}

.title-pick {
  color: #53bdee;
}

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

/* ── Main content ── */

.main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) 0 32px;
  width: 100%;
}

.hero-shell {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

/* ── Hero background ── */

.hero-background {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  opacity: 0.5;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.hero-row {
  display: flex;
  gap: var(--space-md);
  width: 200%;
  justify-content: space-around;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.hero-cover {
  flex: 0 0 18vw;
  height: 26vw;
  min-width: 120px;
  max-width: 220px;
  max-height: 320px;
  border-radius: 14px;
  object-fit: cover;
  background: rgba(79, 130, 255, 0.06);
  box-shadow:
    0 14px 35px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  opacity: 0.22;
}

.hero-row--slow {
  animation: hero-scroll-left 48s linear infinite;
}

.hero-row--medium {
  animation: hero-scroll-right 36s linear infinite;
}

.hero-row--fast {
  animation: hero-scroll-left 28s linear infinite;
}

/* ── Card ── */

.card {
  width: 100%;
  max-width: 640px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.02), transparent),
    radial-gradient(circle at top left, rgba(79, 130, 255, 0.18), transparent 50%),
    var(--bg-elevated);
  border-radius: 24px;
  padding: 26px 22px 22px;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  position: relative;
  z-index: 1;
}

@media (min-width: 640px) {
  .card {
    padding: 32px 30px 28px;
  }
}

.card-title {
  margin: 0;
  font-size: var(--font-lg);
}

.card-copy {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--font-base);
}

/* ── Form ── */

.form {
  position: relative;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.input {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(1, 4, 15, 0.9);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  color: var(--text-main);
  font-size: var(--font-base);
  outline: none;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease,
    background 120ms ease,
    transform 80ms ease;
}

.input::placeholder {
  color: rgba(160, 167, 194, 0.72);
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(79, 130, 255, 0.4);
  background: var(--bg-main);
  transform: translateY(-1px);
}

.input:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ── Autocomplete ── */

.autocomplete-list {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  z-index: 10;
  max-height: 280px;
  overflow-y: auto;
  border-radius: var(--radius-md);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.02), transparent),
    rgba(11, 16, 32, 0.96);
  border: 1px solid rgba(79, 130, 255, 0.14);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(79, 130, 255, 0.08);
  backdrop-filter: blur(16px);
}

.autocomplete-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 100ms ease;
}

.autocomplete-item:not(:last-child) {
  border-bottom: 1px solid var(--border-soft);
}

.autocomplete-item:hover,
.autocomplete-item--active {
  background: rgba(79, 130, 255, 0.12);
}

.autocomplete-item--empty {
  cursor: default;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  padding: 14px;
  text-align: center;
}

.autocomplete-item--empty:hover {
  background: transparent;
}

.autocomplete-item-title {
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text-main);
}

.autocomplete-item-author {
  font-size: var(--font-sm);
  color: var(--text-muted);
}

/* ── Primary button ── */

.button {
  margin-top: var(--space-xs);
  position: relative;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  background: radial-gradient(circle at 0 0, #86a9ff 0, #4f82ff 35%, #2940a8 85%);
  color: var(--bg-main);
  font-weight: 600;
  font-size: var(--font-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  box-shadow:
    0 18px 35px rgba(21, 40, 105, 0.7),
    0 0 0 1px rgba(17, 34, 84, 0.7);
  overflow: hidden;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    filter 160ms ease;
}

.button-glow {
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 0 0, rgba(255, 255, 255, 0.7) 0, transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(255, 255, 255, 0.3) 0, transparent 55%);
  opacity: 0;
  mix-blend-mode: soft-light;
  filter: blur(5px);
  transition: opacity 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow:
    0 20px 40px rgba(18, 35, 90, 0.9),
    0 0 0 1px rgba(38, 76, 175, 0.8);
  filter: brightness(1.03);
}

.button:hover .button-glow {
  opacity: 1;
}

.button:active {
  transform: translateY(0);
  box-shadow:
    0 12px 25px rgba(5, 9, 24, 0.9),
    0 0 0 1px rgba(19, 38, 92, 0.9);
  filter: brightness(0.98);
}

.button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ── Subtle button (toggle) ── */

.subtle-button {
  margin-top: 2px;
  align-self: flex-start;
  border: 1px solid rgba(79, 130, 255, 0.16);
  background: rgba(79, 130, 255, 0.08);
  color: var(--accent-strong);
  border-radius: var(--radius-pill);
  padding: var(--space-sm) 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

.subtle-button:hover {
  transform: translateY(-1px);
  background: rgba(79, 130, 255, 0.14);
  border-color: rgba(79, 130, 255, 0.24);
}

.subtle-button--active {
  background: rgba(79, 130, 255, 0.18);
  border-color: rgba(79, 130, 255, 0.28);
}

.subtle-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.subtle-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.subtle-button-row .subtle-button {
  margin-top: 0;
}

/* ── Exclusion panel ── */

.exclude-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(1, 4, 15, 0.55);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  max-height: 500px;
  opacity: 1;
  transition:
    max-height 320ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity 220ms ease,
    padding 320ms ease;
}

.exclude-panel--hidden {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-color: transparent;
}

.exclude-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.exclude-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.exclude-input {
  flex: 1;
  min-width: 0;
}

.exclude-add-button,
.exclude-remove-button {
  border: 1px solid rgba(79, 130, 255, 0.16);
  background: rgba(79, 130, 255, 0.08);
  color: var(--accent-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

.exclude-add-button:hover,
.exclude-remove-button:hover {
  transform: translateY(-1px);
  background: rgba(79, 130, 255, 0.14);
  border-color: rgba(79, 130, 255, 0.24);
}

.exclude-add-button:focus-visible,
.exclude-remove-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.exclude-add-button {
  flex: 0 0 auto;
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1;
  font-weight: 700;
}

.exclude-remove-button {
  flex: 0 0 auto;
  padding: 10px 12px;
  font-size: var(--font-sm);
  white-space: nowrap;
}

/* ── Status ── */

.status {
  min-height: 1.25em;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.status[data-tone="info"] {
  color: var(--accent-strong);
}

.status[data-tone="error"] {
  color: var(--error);
}

.status[data-tone="warning"] {
  color: var(--warning);
}

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

/* ── Results ── */

.results {
  margin-top: var(--space-xs);
}

.recommendation-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: var(--space-xs);
}

/* ── Skeleton loader ── */

.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: var(--space-xs);
}

.skeleton-card {
  border-radius: 16px;
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0.06) 8%,
    rgba(255, 255, 255, 0.18) 18%,
    rgba(255, 255, 255, 0.06) 33%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  height: 72px;
}

/* ── Result card (accordion) ── */

.result-card {
  background: var(--bg-elevated-softer);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 200ms ease;
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.55),
    0 0 18px rgba(79, 130, 255, 0.1);
  border-color: rgba(79, 130, 255, 0.14);
}

.result-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--accent);
}

.result-card.expanded {
  border-color: rgba(79, 130, 255, 0.22);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.6),
    0 0 24px rgba(79, 130, 255, 0.15);
}

/* ── Summary row (always visible) ── */

.result-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}

.result-rank {
  flex: 0 0 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--space-sm);
  background: linear-gradient(135deg, rgba(79, 130, 255, 0.28), rgba(79, 130, 255, 0.08));
  border: 1px solid rgba(79, 130, 255, 0.18);
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--accent-strong);
  letter-spacing: 0.02em;
}

.result-cover {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: radial-gradient(circle at 30% 0%, rgba(79, 130, 255, 0.4), transparent 65%),
    var(--bg-main);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-cover--sm {
  flex: 0 0 52px;
  height: 72px;
}

.result-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.result-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(245, 247, 255, 0.7);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.result-summary-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.result-title {
  margin: 0;
  font-size: var(--font-base);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-author {
  margin: 0;
  font-size: 0.8rem;
  color: var(--accent-strong);
}

.result-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.result-genre-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  border-radius: var(--radius-pill);
  background: rgba(79, 130, 255, 0.12);
  border: 1px solid rgba(79, 130, 255, 0.16);
  color: var(--accent-strong);
  white-space: nowrap;
}

.result-genre-overflow {
  background: rgba(79, 130, 255, 0.06);
  border-color: rgba(79, 130, 255, 0.1);
  color: var(--text-muted);
}

.genre-expand-btn {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  border-radius: var(--radius-pill);
  background: rgba(79, 130, 255, 0.06);
  border: 1px solid rgba(79, 130, 255, 0.1);
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

.genre-expand-btn:hover {
  background: rgba(79, 130, 255, 0.16);
  border-color: rgba(79, 130, 255, 0.24);
  color: var(--accent-strong);
}

.result-rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--warning);
}

.result-star-icon {
  width: 12px;
  height: 12px;
  color: var(--warning);
}

.result-pages-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ── Chevron ── */

.result-chevron {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: transform 260ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-chevron svg {
  width: 16px;
  height: 16px;
}

.result-card.expanded .result-chevron {
  transform: rotate(180deg);
  color: var(--accent-strong);
}

/* ── Detail panel (hidden by default) ── */

.result-detail {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition:
    max-height 360ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity 260ms ease;
}

.result-card.expanded .result-detail {
  max-height: 600px;
  opacity: 1;
}

.result-detail-inner {
  display: flex;
  gap: var(--space-md);
  padding: 0 14px 16px;
  border-top: 1px solid var(--border-soft);
  margin-top: 0;
  padding-top: 14px;
}

.result-detail-cover {
  flex: 0 0 100px;
  height: 150px;
  border-radius: 10px;
  overflow: hidden;
  background: radial-gradient(circle at 30% 0%, rgba(79, 130, 255, 0.3), transparent 65%),
    var(--bg-main);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.result-detail-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.result-detail-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* ── Detail meta row (rating + pages side by side) ── */

.result-detail-meta {
  display: flex;
  gap: var(--space-lg);
}

.result-detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-detail-description {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-main);
  line-height: 1.55;
}

.result-detail-reason {
  margin: 0;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.5;
}

.result-detail-isbn {
  margin: 0;
  font-size: var(--font-sm);
  color: var(--text-muted);
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, monospace;
}

.result-detail-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(160, 167, 194, 0.75);
  margin-right: 6px;
}

.result-goodreads-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-strong);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: rgba(79, 130, 255, 0.1);
  border: 1px solid rgba(79, 130, 255, 0.16);
  width: fit-content;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 100ms ease;
}

.result-goodreads-link:hover {
  background: rgba(79, 130, 255, 0.2);
  border-color: rgba(79, 130, 255, 0.3);
  transform: translateY(-1px);
}

.result-goodreads-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ── Mobile adjustments ── */

@media (max-width: 480px) {
  .exclude-row {
    flex-wrap: wrap;
  }

  .exclude-input {
    flex: 1 1 100%;
  }

  .exclude-add-button,
  .exclude-remove-button {
    flex: 1;
  }

  .result-summary {
    gap: var(--space-sm);
    padding: var(--space-sm) 10px;
  }

  .result-cover--sm {
    flex-basis: 42px;
    height: 58px;
  }

  .result-rank {
    flex-basis: 24px;
    height: 24px;
    font-size: 0.72rem;
  }

  .result-title {
    font-size: 0.88rem;
  }

  .result-genre-pill {
    font-size: 0.62rem;
    padding: 1px 6px;
  }

  .result-detail-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .result-detail-cover {
    flex-basis: auto;
    width: 100px;
    height: 150px;
  }

  .result-detail-meta {
    justify-content: center;
  }

  .result-goodreads-link {
    align-self: center;
  }
}

/* ── Keyframes ── */

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* ── Footer ── */

.footer {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-top: var(--space-lg);
  display: flex;
  justify-content: center;
}

.footer-text {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.accent {
  color: var(--accent-strong);
}

/* ── Hero scroll animations ── */

@keyframes hero-scroll-left {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@keyframes hero-scroll-right {
  0% {
    transform: translateX(-50%);
  }
  100% {
    transform: translateX(0);
  }
}

@media (max-width: 640px) {
  .hero-shell {
    min-height: 260px;
  }

  .hero-background {
    inset: -12px;
    opacity: 0.35;
  }

  .hero-cover {
    flex-basis: 70px;
    height: 110px;
    min-width: 70px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-row--slow,
  .hero-row--medium,
  .hero-row--fast {
    animation-duration: 120s;
  }

  .exclude-panel {
    transition: none;
  }
}

/* ── Timeline ── */

.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 0 40px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--accent-soft) 8%,
    var(--accent) 50%,
    var(--accent-soft) 92%,
    transparent
  );
  transform: translateX(-50%);
}

.timeline-step {
  position: relative;
  display: flex;
  align-items: flex-start;
  width: 50%;
  padding: 0 36px 48px;
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 600ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.timeline-step--visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-step:nth-child(odd) {
  align-self: flex-start;
  text-align: right;
  padding-right: 36px;
  padding-left: 0;
}

.timeline-step:nth-child(even) {
  align-self: flex-end;
  text-align: left;
  padding-left: 36px;
  padding-right: 0;
}

.timeline-dot {
  position: absolute;
  top: 4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--bg-main);
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  border: 3px solid var(--bg-main);
  box-shadow:
    0 0 0 2px rgba(79, 130, 255, 0.25),
    0 4px 14px rgba(0, 0, 0, 0.5);
  z-index: 2;
  transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

.timeline-step--visible .timeline-dot {
  transform: scale(1);
}

.timeline-step:nth-child(odd) .timeline-dot {
  right: -16px;
}

.timeline-step:nth-child(even) .timeline-dot {
  left: -16px;
}

.timeline-card {
  flex: 1;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.02), transparent),
    radial-gradient(circle at top left, rgba(79, 130, 255, 0.12), transparent 50%),
    var(--bg-elevated);
  border-radius: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
  transition:
    border-color 200ms ease,
    box-shadow 200ms ease;
}

.timeline-step--visible .timeline-card {
  border-color: rgba(79, 130, 255, 0.1);
}

.timeline-card-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-strong);
}

.timeline-card-body {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.timeline-card-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.timeline-step:nth-child(odd) .timeline-card-tech {
  justify-content: flex-end;
}

.timeline-tech-pill {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  border-radius: var(--radius-pill);
  background: rgba(79, 130, 255, 0.1);
  border: 1px solid rgba(79, 130, 255, 0.16);
  color: var(--accent-strong);
  white-space: nowrap;
}

/* stagger entrance when multiple steps appear at once */
.timeline-step:nth-child(even) { transition-delay: 100ms; }

/* ── Timeline – widen the shell ── */

.how-it-was-made-shell {
  max-width: 840px;
}

/* ── Timeline – responsive ── */

@media (max-width: 640px) {
  .timeline::before {
    left: 16px;
    transform: none;
  }

  .timeline-step,
  .timeline-step:nth-child(odd),
  .timeline-step:nth-child(even) {
    width: 100%;
    text-align: left;
    padding-left: 48px;
    padding-right: 0;
  }

  .timeline-step:nth-child(odd) .timeline-dot,
  .timeline-step:nth-child(even) .timeline-dot {
    left: 0;
    right: auto;
  }

  .timeline-step:nth-child(odd) .timeline-card-tech {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .timeline-step {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .timeline-dot {
    transition: none;
  }
}

/* ── 404 page ── */

.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-md);
  padding: var(--space-xl) var(--space-lg);
}

.error-code {
  font-size: 5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--accent-strong), #53bdee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin: 0;
}

.error-message {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0;
  max-width: 400px;
}

.error-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--accent-strong);
  text-decoration: none;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  background: rgba(79, 130, 255, 0.1);
  border: 1px solid rgba(79, 130, 255, 0.16);
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 100ms ease;
}

.error-link:hover {
  background: rgba(79, 130, 255, 0.2);
  border-color: rgba(79, 130, 255, 0.3);
  transform: translateY(-1px);
}

.error-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
