:root {
  color-scheme: light;
  --cream: #f4efe6;
  --cream-deep: #e8ddcb;
  --ink: #0b0a08;
  --muted: #6d6256;
  --line: #d4c6b4;
  --chapter101-accent: #eb4f47;
  --surface: rgba(255, 252, 246, 0.82);
  --shadow: 0 18px 54px rgba(41, 31, 21, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(255, 252, 246, 0.9), transparent 34rem),
    var(--cream);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--chapter101-accent);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 42px 20px;
}

.assistant {
  width: min(860px, 100%);
  display: grid;
  justify-items: center;
  gap: 20px;
}

.logo {
  width: min(380px, 78vw);
  max-height: 280px;
  object-fit: contain;
}

.search-card {
  width: min(760px, 100%);
  display: grid;
  gap: 10px;
}

.search-card label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.query-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.query-box input {
  min-width: 0;
  min-height: 62px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: #fffaf2;
  color: var(--ink);
  font-size: 1.05rem;
  outline: none;
}

.query-box input::placeholder {
  color: #8a7d70;
}

.query-box input:focus {
  box-shadow: inset 0 0 0 2px var(--chapter101-accent);
}

.query-box button {
  min-height: 62px;
  border: 2px solid var(--chapter101-accent);
  border-radius: 6px;
  padding: 0 24px;
  background: transparent;
  color: var(--chapter101-accent);
  font-weight: 800;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.query-box button:hover,
.query-box button:focus-visible {
  background: var(--chapter101-accent);
  color: #fffaf2;
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(235, 79, 71, 0.18);
  outline: none;
}

.query-box button:active {
  background: var(--chapter101-accent);
  color: #fffaf2;
  transform: translateY(0);
  box-shadow: inset 0 2px 5px rgba(11, 10, 8, 0.22);
}

.query-box button:disabled,
.query-box input:disabled {
  cursor: wait;
}

.query-box button:disabled {
  background: rgba(235, 79, 71, 0.08);
  color: var(--chapter101-accent);
  opacity: 0.9;
}

.query-box.is-searching {
  border-color: var(--chapter101-accent);
}

.answer {
  width: min(760px, 100%);
  min-height: 0;
  padding: 8px 2px 0;
  border: 0;
  background: transparent;
  text-align: center;
}

.answer h1,
.answer h2,
.answer p {
  margin: 0;
}

.answer h1 {
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  font-weight: 800;
  line-height: 1.18;
}

.status-line {
  color: var(--chapter101-accent);
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.answer p {
  color: var(--muted);
  line-height: 1.55;
}

.correction {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.stock-count {
  margin-top: 7px;
  color: var(--chapter101-accent);
  font-weight: 900;
}

.literary-profile {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 16px;
  width: 100%;
  padding: 18px;
  border: 1px solid rgba(212, 198, 180, 0.9);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.66);
  box-shadow: 0 12px 32px rgba(41, 31, 21, 0.07);
  text-align: left;
}

.profile-portrait {
  display: grid;
  width: 78px;
  height: 92px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(235, 79, 71, 0.28);
  border-radius: 4px;
  background: #e8ddcb;
  color: var(--chapter101-accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.3rem;
  font-weight: 800;
}

.profile-portrait img,
.result-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-image {
  display: block;
  border: 1px solid rgba(235, 79, 71, 0.28);
  border-radius: 3px;
  background: var(--cream-deep);
  box-shadow: 0 4px 10px rgba(41, 31, 21, 0.12);
}

.author-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-content {
  min-width: 0;
}

.profile-kicker {
  color: var(--chapter101-accent) !important;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.profile-content h1 {
  margin-top: 3px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
}

.profile-description {
  margin-top: 10px !important;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.48 !important;
}

.profile-status {
  margin-top: 10px !important;
  color: var(--chapter101-accent) !important;
  font-size: 0.88rem;
  font-weight: 800;
}

.theme-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.theme-tags span {
  border: 1px solid rgba(235, 79, 71, 0.26);
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(232, 221, 203, 0.48);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.profile-lanes {
  display: grid;
  gap: 3px;
  margin-top: 9px;
}

.profile-lanes span {
  color: var(--chapter101-accent);
  font-size: 0.75rem;
  font-weight: 800;
}

.profile-lanes span::before {
  margin-right: 6px;
  color: var(--chapter101-accent);
  content: "•";
}

.searching-state {
  display: grid;
  align-items: center;
  justify-content: center;
  gap: 15px;
  min-height: 124px;
  margin-top: 68px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.98rem;
  font-style: italic;
  font-weight: 600;
}

.book-hunt {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  width: 154px;
  height: 50px;
  margin: 0 auto;
}

.book-shelf {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 5px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--chapter101-accent);
  background: transparent;
}

.book-spine {
  position: relative;
  z-index: 1;
  width: 18px;
  margin-bottom: 5px;
  border: 1px solid var(--ink);
  border-radius: 1px 2px 0 0;
  background: var(--cream);
  transform-origin: bottom center;
  animation: browse-shelf 5.4s ease-in-out infinite;
}

.book-spine::before,
.book-spine::after {
  position: absolute;
  right: 3px;
  left: 3px;
  border-top: 1px solid var(--ink);
  content: "";
}

.book-spine::before {
  top: 6px;
}

.book-spine::after {
  bottom: 6px;
}

.book-spine-1 {
  height: 35px;
}

.book-spine-2 {
  width: 15px;
  height: 43px;
  animation-delay: 540ms;
}

.book-spine-3 {
  height: 38px;
  animation-delay: 1.08s;
}

.book-spine-4 {
  width: 16px;
  height: 46px;
  border-color: var(--chapter101-accent);
  background: var(--ink);
  animation: pull-book 5.4s ease-in-out infinite 1.62s;
}

.book-spine-4::before,
.book-spine-4::after {
  border-color: var(--chapter101-accent);
}

.book-spine-5 {
  height: 33px;
  animation-delay: 2.16s;
}

.suggestions {
  width: min(760px, 100%);
  display: grid;
  gap: 10px;
}

.shelf-heading {
  margin: 5px 0 2px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.24rem;
  font-weight: 700;
}

.lane-group {
  display: grid;
  gap: 6px;
  padding: 8px 0 3px;
}

.lane-group h3 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
}

.lane-group > p {
  margin: -2px 0 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.lane-books {
  display: grid;
  gap: 8px;
}

.result-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(212, 198, 180, 0.75);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.54);
}

.result-media {
  width: 46px;
  height: 62px;
  overflow: hidden;
  border-radius: 3px;
}

.book-cover-fallback {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border: 1px solid rgba(235, 79, 71, 0.3);
  border-radius: 3px;
  background: var(--cream-deep);
  color: var(--chapter101-accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.68rem;
  font-weight: 800;
}

.book-cover-fallback::before {
  position: absolute;
  width: 32px;
  border-top: 1px solid rgba(235, 79, 71, 0.22);
  content: "";
}

.result-details {
  min-width: 0;
}

.result-card strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.2;
}

.result-author {
  display: block;
  margin-top: 3px;
  color: var(--chapter101-accent);
  font-size: 0.76rem;
  font-weight: 800;
}

.result-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.quantity {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--cream-deep);
  color: var(--chapter101-accent);
  font-size: 0.9rem;
  font-weight: 800;
}

.curator-panel {
  width: min(760px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.admin-shell {
  min-height: 100vh;
  padding: 42px 20px;
  background: var(--cream);
}

.admin-panel {
  width: min(760px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.admin-logo {
  width: 180px;
  justify-self: center;
}

.admin-heading {
  text-align: center;
}

.admin-heading p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-heading h1 {
  margin: 0;
  font-size: 2rem;
}

.admin-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.admin-actions button {
  border: 2px solid var(--chapter101-accent);
  border-radius: 8px;
  padding: 12px 16px;
  background: transparent;
  color: var(--chapter101-accent);
  font-weight: 800;
}

.admin-actions button:hover,
.admin-actions button:focus-visible {
  background: var(--chapter101-accent);
  color: #fffaf2;
  outline: none;
}

.admin-count,
.empty-log {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.miss-list {
  display: grid;
  gap: 10px;
}

.miss-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.62);
}

.miss-card span {
  color: var(--chapter101-accent);
  font-weight: 800;
}

.curator-panel div {
  display: flex;
  gap: 8px;
}

.curator-panel button {
  border: 1px solid var(--chapter101-accent);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255, 250, 242, 0.55);
  color: var(--chapter101-accent);
  font-size: 0.82rem;
  font-weight: 800;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background-color 160ms ease;
}

.curator-panel button:hover,
.curator-panel button:focus-visible {
  border-color: var(--chapter101-accent);
  background: rgba(235, 79, 71, 0.08);
  color: var(--chapter101-accent);
  outline: none;
}

@media (max-width: 560px) {
  .app-shell {
    align-items: start;
    padding-top: 34px;
  }

  .logo {
    width: min(330px, 88vw);
  }

  .query-box {
    grid-template-columns: 1fr;
  }

  .query-box button {
    width: 100%;
  }

  .answer {
    text-align: left;
  }

  .literary-profile {
    grid-template-columns: 62px minmax(0, 1fr);
    padding: 14px;
  }

  .profile-portrait {
    width: 62px;
    height: 76px;
  }

  .result-card {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 8px;
  }

  .result-media {
    width: 42px;
    height: 58px;
  }

  .quantity {
    grid-column: 2;
    justify-self: start;
  }

  .curator-panel {
    align-items: flex-start;
    flex-direction: column;
  }
}

@keyframes browse-shelf {
  0%,
  78%,
  100% {
    transform: translateX(0) rotate(0);
  }

  84% {
    transform: translateX(1px) rotate(2deg);
  }

  92% {
    transform: translateX(-1px) rotate(-2deg);
  }
}

@keyframes pull-book {
  0%,
  68%,
  100% {
    transform: translateX(0) translateY(0) rotate(0);
  }

  76% {
    transform: translateX(8px) translateY(-3px) rotate(3deg);
  }

  86% {
    transform: translateX(8px) translateY(-3px) rotate(3deg);
  }
}
