:root {
  --ink: #2f211c;
  --muted: #735f55;
  --paper: #fff8f2;
  --surface: #ffffff;
  --line: #ead8cb;
  --accent: #9d1858;
  --accent-strong: #56082c;
  --gold: #f39200;
  --rose: #b21661;
  --blue: #634e42;
  --logo-brown: #634e42;
  --shadow: 0 18px 45px rgba(86, 8, 44, 0.14);
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 54px);
  background: rgba(255, 248, 242, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
  font-weight: 800;
}

.brand-logo {
  display: block;
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.nav {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

.nav a,
.primary-action,
.download-button,
.back-link {
  text-decoration: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: clamp(28px, 6vw, 80px);
  align-items: center;
  min-height: 560px;
  padding: clamp(38px, 6vw, 82px) clamp(18px, 6vw, 80px);
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.hero h1 {
  margin-bottom: 22px;
  font-size: clamp(2.45rem, 6vw, 5.4rem);
  line-height: 0.98;
}

.hero p:not(.eyebrow) {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.7;
}

.primary-action,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
  font-weight: 800;
}

.primary-action:hover,
.download-button:hover {
  background: var(--accent-strong);
}

.hero-shelf {
  display: flex;
  align-items: end;
  justify-content: center;
  min-height: 360px;
  padding: 28px;
  border-bottom: 16px solid var(--logo-brown);
}

.book-spine {
  display: block;
  width: clamp(44px, 7vw, 82px);
  border-radius: 6px 6px 0 0;
  box-shadow: var(--shadow);
}

.spine-a {
  height: 260px;
  background: var(--accent-strong);
}

.spine-b {
  height: 320px;
  background: var(--accent);
}

.spine-c {
  height: 285px;
  background: var(--gold);
}

.spine-d {
  height: 340px;
  background: var(--logo-brown);
}

.spine-e {
  height: 245px;
  background: #c6575f;
}

.tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 30px clamp(18px, 6vw, 80px);
  border-bottom: 1px solid var(--line);
}

.search-box,
.genre-select-box {
  display: grid;
  gap: 8px;
  width: min(420px, 100%);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.search-box input,
.genre-select-box select {
  width: 100%;
  min-height: 44px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
}

.search-box input {
  padding: 0 14px;
}

.genre-select-box select {
  padding: 0 38px 0 14px;
  cursor: pointer;
  font-weight: 700;
}

.search-box input:focus,
.genre-select-box select:focus {
  outline: 3px solid rgba(157, 24, 88, 0.16);
  border-color: var(--accent);
}

.catalog-section {
  padding: 42px clamp(18px, 6vw, 80px) 72px;
}

.about-section {
  padding: clamp(34px, 6vw, 72px) clamp(18px, 6vw, 80px) 72px;
}

.about-text {
  width: 100%;
  padding: clamp(22px, 4vw, 34px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(99, 78, 66, 0.1);
}

.about-text p {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.75;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.section-heading h2 {
  margin-bottom: 28px;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: clamp(16px, 2vw, 24px);
  align-items: stretch;
  justify-items: center;
}

.book-card {
  width: 100%;
  max-width: 300px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(99, 78, 66, 0.1);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.book-card-link {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
  height: 100%;
  padding: 18px;
  text-decoration: none;
}

.book-cover {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 2 / 3;
  min-height: 0;
  overflow: hidden;
  padding: 22px;
  color: #fff;
  border-radius: 8px;
  box-shadow: inset 12px 0 0 rgba(0, 0, 0, 0.12);
}

.image-cover {
  aspect-ratio: 2 / 3;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.book-cover::after {
  content: "";
  position: absolute;
  inset: 24px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 4px;
  pointer-events: none;
}

.book-cover span,
.book-cover strong,
.book-cover small {
  position: relative;
  z-index: 1;
}

.book-cover span {
  max-width: fit-content;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.book-cover strong {
  font-size: 1.65rem;
  line-height: 1.1;
}

.book-cover small {
  font-weight: 700;
}

.cover-maias {
  background: linear-gradient(135deg, #56082c, #9d1858);
}

.cover-terra {
  background: linear-gradient(135deg, #634e42, #f39200);
}

.cover-historia {
  background: linear-gradient(135deg, #2f211c, #634e42);
}

.cover-ciencias {
  background: linear-gradient(135deg, #9d1858, #f39200);
}

.cover-matematica {
  background: linear-gradient(135deg, #56082c, #634e42);
}

.cover-poesia {
  background: linear-gradient(135deg, #7d1046, #c6575f);
}

.book-card-body h3 {
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.book-card-body p {
  margin-bottom: 16px;
  color: var(--muted);
}

.genre-pill {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 5px 9px;
  color: var(--accent-strong);
  background: #fde8ef;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

dl {
  margin: 0;
}

.book-card-body dl,
.metadata-grid {
  display: grid;
  gap: 10px;
}

.book-card-body dl div,
.metadata-grid div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

dd {
  margin: 0;
  text-align: right;
  font-weight: 800;
}

.detail-main {
  padding: 30px clamp(18px, 6vw, 80px) 72px;
}

.login-main {
  display: grid;
  min-height: calc(100vh - 178px);
  place-items: center;
  padding: clamp(34px, 6vw, 76px) clamp(18px, 6vw, 80px);
}

.login-panel {
  width: min(100%, 460px);
  padding: clamp(24px, 5vw, 38px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

.login-intro {
  margin-bottom: 26px;
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.login-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
}

.login-form input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(157, 24, 88, 0.18);
}

.login-form .primary-action {
  width: 100%;
  border: 0;
  cursor: pointer;
  font-size: 1rem;
}

.compact-status {
  margin: 0;
}

.status-panel {
  width: min(100%, 620px);
}

.status-message {
  display: grid;
  gap: 8px;
  margin: 24px 0;
  padding: 18px;
  border-radius: 8px;
  line-height: 1.5;
}

.status-message strong,
.status-message span {
  display: block;
}

.status-success {
  color: #5f3b00;
  background: #fff3db;
  border: 1px solid #f5c46b;
}

.status-error {
  color: #56082c;
  background: #fde8ef;
  border: 1px solid #e39ab8;
}

.setup-action {
  width: 100%;
}

.admin-main {
  padding: 36px clamp(18px, 6vw, 80px) 72px;
}

.admin-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.admin-heading h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
}

.admin-heading p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
}

.admin-search {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 22px;
}

.admin-search .primary-action {
  border: 0;
  cursor: pointer;
}

.admin-table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(99, 78, 66, 0.1);
}

.admin-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.admin-table th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.table-cover {
  display: block;
  width: 48px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.text-action {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.admin-message {
  margin-bottom: 22px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-actions form {
  margin: 0;
}

.link-button {
  padding: 0;
  color: var(--accent-strong);
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.pagination-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.pagination a,
.pagination button,
.pagination .is-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  padding: 0 12px;
  color: var(--accent-strong);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
}

.pagination .is-current {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.book-form {
  display: grid;
  gap: 20px;
  padding: clamp(20px, 4vw, 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(99, 78, 66, 0.1);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.book-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.book-form input,
.book-form select,
.book-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.book-form textarea {
  resize: vertical;
}

.full-field {
  grid-column: 1 / -1;
}

.current-cover {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.current-cover img {
  width: 120px;
  height: 160px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 24px;
  color: var(--accent-strong);
  font-weight: 800;
}

.book-detail {
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  gap: clamp(28px, 6vw, 76px);
  align-items: start;
}

.detail-cover {
  min-height: 520px;
  position: sticky;
  top: 100px;
}

.detail-image-cover {
  position: sticky;
  top: 100px;
}

.detail-image-cover,
.detail-image-cover img {
  min-height: 520px;
}

.detail-content h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 1;
}

.detail-author {
  color: var(--muted);
  font-size: 1.15rem;
  font-weight: 800;
}

.detail-summary {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.download-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 28px 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.download-panel strong,
.download-panel span {
  display: block;
}

.download-panel span {
  margin-top: 4px;
  color: var(--muted);
}

.download-count {
  font-weight: 800;
}

.detail-section {
  margin-top: 32px;
}

.detail-section h2 {
  margin-bottom: 16px;
  font-size: 1.4rem;
}

.feature-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 0;
  list-style: none;
}

.feature-list li {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 700;
}

.metadata-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.metadata-grid div {
  min-height: 58px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.empty-state,
.not-found {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px clamp(18px, 6vw, 80px);
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.footer-copy,
.footer-logos {
  display: flex;
  align-items: center;
  gap: 18px;
}

.footer-copy {
  flex-wrap: wrap;
}

.footer-logos {
  justify-content: flex-end;
}

.footer-logos img {
  display: block;
  width: 120px;
  height: 34px;
  object-fit: contain;
}

@media (max-width: 820px) {
  .topbar,
  .tools,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-logos {
    justify-content: flex-start;
  }

  .nav {
    justify-content: flex-start;
  }

  .hero,
  .book-detail {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-shelf {
    min-height: 260px;
    padding-inline: 0;
  }

  .detail-cover {
    position: static;
    min-height: 380px;
  }

  .download-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .download-button {
    width: 100%;
  }

  .admin-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-search {
    align-items: stretch;
    flex-direction: column;
  }

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

  .pagination-links {
    justify-content: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .nav {
    flex-wrap: wrap;
  }

  .brand small {
    display: none;
  }

}
