:root {
  --ink: #10233f;
  --ink-soft: #526174;
  --paper: #f5f1e8;
  --card: #fffdf8;
  --line: #d9d3c7;
  --accent: #dc5f33;
  --accent-dark: #ad3f1e;
  --success: #24725a;
  --warning: #9a5a15;
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.site-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--paper); }
.brand-mark svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.header-note { color: var(--ink-soft); font-size: 12px; letter-spacing: .11em; text-transform: uppercase; }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.hero { min-height: 620px; display: grid; grid-template-columns: minmax(0, .9fr) minmax(460px, 1.1fr); align-items: center; gap: clamp(52px, 8vw, 120px); padding: 92px 0 86px; }
.eyebrow { margin: 0 0 22px; color: var(--accent-dark); font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: "Newsreader", Georgia, serif; font-weight: 600; letter-spacing: -.035em; }
h1 { max-width: 720px; margin-bottom: 24px; font-size: clamp(56px, 7.4vw, 102px); line-height: .88; }
.lede { max-width: 570px; margin: 0; color: var(--ink-soft); font-size: clamp(17px, 1.6vw, 20px); line-height: 1.65; }

.search-panel { border-top: 4px solid var(--ink); padding-top: 28px; }
.search-panel label { display: block; margin-bottom: 11px; font-size: 13px; font-weight: 700; }
.input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.input-row input { width: 100%; min-height: 58px; border: 1px solid var(--line); border-right: 0; border-radius: 0; background: var(--card); padding: 0 18px; color: var(--ink); outline: none; }
.input-row input:focus { position: relative; box-shadow: inset 0 0 0 2px var(--ink); }
.input-row button, .book-actions a { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 58px; border: 0; background: var(--ink); color: white; padding: 0 24px; cursor: pointer; font-weight: 700; text-decoration: none; transition: background .18s ease, transform .18s ease; }
.input-row button:hover, .book-actions a.primary:hover { background: #1d385d; }
.input-row button:active, .book-actions a:active { transform: translateY(1px); }
.input-row button:disabled { cursor: wait; opacity: .65; }
.input-row svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.form-error { margin: 10px 0 0; color: #a52d24; font-size: 13px; }
.quick-links { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 17px; color: var(--ink-soft); font-size: 12px; }
.quick-links button { border: 0; border-bottom: 1px solid currentColor; background: transparent; padding: 2px 0; color: inherit; cursor: pointer; }

.status-region { border-top: 1px solid var(--line); padding: 72px 0; }
.idle-state { display: grid; grid-template-columns: 90px minmax(0, 560px); gap: 34px; align-items: start; }
.idle-number { color: var(--accent); font-family: "Newsreader", serif; font-size: 70px; line-height: 1; }
.idle-state h2, .how-it-works h2 { margin-bottom: 14px; font-size: clamp(36px, 5vw, 62px); line-height: .98; }
.idle-state p { color: var(--ink-soft); line-height: 1.7; }
.loading-state { min-height: 180px; display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--ink-soft); }
.spinner { width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-card { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: clamp(32px, 6vw, 76px); align-items: start; }
.cover-wrap { position: relative; aspect-ratio: 2 / 3; overflow: hidden; background: #e4ded2; box-shadow: 0 20px 50px rgba(16,35,63,.15); }
.cover-wrap::after { content: ""; position: absolute; inset: 0; border: 1px solid rgba(16,35,63,.12); pointer-events: none; }
.cover-wrap img { width: 100%; height: 100%; object-fit: cover; }
.result-topline { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 18px; }
.badge { padding: 7px 10px; background: rgba(36,114,90,.11); color: var(--success); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.badge.limited { background: rgba(154,90,21,.1); color: var(--warning); }
.book-id { color: var(--ink-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.book-content h2 { margin-bottom: 9px; font-size: clamp(38px, 5vw, 68px); line-height: .98; }
.book-author { margin-bottom: 28px; color: var(--ink-soft); font-size: 17px; }
.book-meta { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 0 28px; border-block: 1px solid var(--line); }
.book-meta div { padding: 15px 12px 15px 0; }
.book-meta dt { margin-bottom: 4px; color: var(--ink-soft); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.book-meta dd { margin: 0; font-size: 13px; font-weight: 600; }
.book-description { display: -webkit-box; max-width: 700px; margin-bottom: 24px; overflow: hidden; color: var(--ink-soft); line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.access-message { max-width: 720px; margin-bottom: 24px; border-left: 3px solid var(--accent); background: rgba(220,95,51,.07); padding: 14px 16px; color: #694536; font-size: 13px; line-height: 1.55; }
.access-message.success { border-left-color: var(--success); background: rgba(36,114,90,.08); color: #245846; }
.book-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.book-actions a { min-height: 48px; padding: 0 19px; font-size: 13px; }
.book-actions a.secondary { border: 1px solid var(--line); background: transparent; color: var(--ink); }
.book-actions a.secondary:hover { border-color: var(--ink); background: rgba(255,255,255,.35); }

.how-it-works { padding: 90px 0 110px; border-top: 1px solid var(--line); }
.how-it-works h2 { max-width: 640px; margin-bottom: 50px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--line); }
.steps article { min-height: 230px; padding: 28px 30px 20px 0; border-right: 1px solid var(--line); }
.steps article + article { padding-left: 30px; }
.steps article:last-child { border-right: 0; }
.steps span { color: var(--accent); font-family: "Newsreader", serif; font-size: 22px; }
.steps h3 { margin: 48px 0 8px; font-size: 17px; }
.steps p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.65; }

footer { display: flex; justify-content: space-between; gap: 24px; padding: 25px clamp(20px, 5vw, 72px); border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 11px; }
footer p { margin: 0; }

@media (max-width: 820px) {
  .hero { min-height: auto; grid-template-columns: 1fr; gap: 55px; padding: 70px 0; }
  .result-card { grid-template-columns: 155px minmax(0, 1fr); gap: 30px; }
  .book-meta { grid-template-columns: 1fr; }
  .book-meta div { border-bottom: 1px solid var(--line); }
  .book-meta div:last-child { border-bottom: 0; }
}

@media (max-width: 600px) {
  .header-note { display: none; }
  main { width: min(100% - 32px, 1180px); }
  h1 { font-size: clamp(52px, 16vw, 76px); }
  .input-row { grid-template-columns: 1fr; gap: 10px; }
  .input-row input { border-right: 1px solid var(--line); }
  .result-card { grid-template-columns: 1fr; }
  .cover-wrap { width: min(190px, 58vw); }
  .result-topline { align-items: flex-start; flex-direction: column; }
  .idle-state { grid-template-columns: 1fr; gap: 12px; }
  .idle-number { font-size: 48px; }
  .steps { grid-template-columns: 1fr; }
  .steps article, .steps article + article { min-height: 0; padding: 24px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .steps h3 { margin-top: 28px; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
