:root {
  --bg: #f6f1e8;
  --paper: #fffdf8;
  --ink: #17201f;
  --muted: #66706e;
  --line: #dfd9ce;
  --accent: #173f39;
  --accent-2: #c69b57;
  --danger: #9f2d24;
  --shadow: 0 22px 60px rgba(23, 32, 31, .09);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(198,155,87,.13), transparent 24rem),
    var(--bg);
  line-height: 1.6;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button, .button { cursor: pointer; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

.shell { width: min(1160px, calc(100% - 36px)); margin: 0 auto; }
.site-header {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(18px);
  background: rgba(246,241,232,.86);
  border-bottom: 1px solid rgba(23,32,31,.08);
}
.nav { height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 800; letter-spacing: -.03em; font-size: 1.15rem; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: Georgia, serif; font-size: 1.15rem; }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a { color: var(--muted); text-decoration: none; font-weight: 650; font-size: .95rem; }
.nav-links a:hover { color: var(--ink); }

.hero { padding: 90px 0 58px; }
.hero-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 64px; align-items: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: .74rem; font-weight: 800; color: var(--accent); }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.05; margin: 0; }
h1 { font-size: clamp(3.1rem, 7vw, 6.4rem); letter-spacing: -.055em; max-width: 820px; }
h2 { font-size: clamp(2.15rem, 4.2vw, 3.9rem); letter-spacing: -.04em; }
.hero p { max-width: 650px; font-size: 1.08rem; color: var(--muted); margin: 24px 0 30px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 48px; padding: 0 19px; border-radius: 999px; border: 1px solid var(--accent); text-decoration: none; font-weight: 750; transition: .2s ease; }
.button.primary { background: var(--accent); color: white; }
.button.secondary { background: transparent; color: var(--accent); }
.button.danger { background: var(--danger); border-color: var(--danger); color: white; }
.button:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(23,63,57,.14); }
.button.small { min-height: 38px; padding: 0 14px; font-size: .9rem; }

.hero-art { position: relative; min-height: 430px; }
.book-stack { position: absolute; inset: 0; display: grid; place-items: center; }
.book-shape { position: absolute; width: 250px; height: 340px; border-radius: 8px 18px 18px 8px; box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.3); }
.book-shape.one { background: #173f39; transform: rotate(-9deg) translate(-55px, 16px); }
.book-shape.two { background: #c69b57; transform: rotate(6deg) translate(48px, -18px); }
.book-shape.three { background: #efe5d3; transform: rotate(-1deg); padding: 36px 30px; display: flex; flex-direction: column; justify-content: space-between; }
.book-shape.three strong { font-family: Georgia, serif; font-size: 2.1rem; line-height: 1.05; }
.book-shape.three span { color: var(--muted); font-size: .9rem; }

.section { padding: 64px 0 88px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.section-head p { margin: 0; color: var(--muted); max-width: 510px; }
.search-wrap { margin: 0 0 28px; position: relative; }
.search-wrap input { width: 100%; min-height: 54px; padding: 0 18px 0 48px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; outline: none; }
.search-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(23,63,57,.08); }
.search-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.book-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 24px; }
.book-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 10px 34px rgba(23,32,31,.045); display: flex; flex-direction: column; }
.cover-wrap { aspect-ratio: 4/5; background: #e9e1d4; overflow: hidden; position: relative; }
.cover-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.book-card:hover .cover-wrap img { transform: scale(1.025); }
.cover-placeholder { height: 100%; display: grid; place-items: center; padding: 24px; text-align: center; background: linear-gradient(145deg,#173f39,#2e655d); color: white; font-family: Georgia, serif; font-size: 1.55rem; }
.card-body { padding: 22px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.card-body h3 { font-size: 1.55rem; }
.meta { color: var(--accent-2); font-size: .86rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.description { color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-actions { display: flex; gap: 9px; margin-top: auto; padding-top: 6px; }
.empty { text-align: center; padding: 56px 22px; border: 1px dashed #cfc6b8; border-radius: var(--radius); color: var(--muted); background: rgba(255,253,248,.5); }

.about-box { background: var(--accent); color: #fff; border-radius: 32px; padding: clamp(32px,6vw,72px); display: grid; grid-template-columns: .8fr 1.2fr; gap: 50px; }
.about-box p { color: rgba(255,255,255,.72); margin: 0; font-size: 1.06rem; }

.site-footer { padding: 28px 0 48px; color: var(--muted); }
.footer-inner { padding-top: 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; font-size: .9rem; }
.footer-inner a { text-decoration: none; color: var(--muted); }

/* Book detail */
.detail { padding: 72px 0 96px; }
.detail-grid { display: grid; grid-template-columns: 390px 1fr; gap: 64px; align-items: start; }
.detail-cover { border-radius: 20px; overflow: hidden; background: #e9e1d4; box-shadow: var(--shadow); min-height: 480px; }
.detail-cover img { width: 100%; aspect-ratio: 4/5.4; object-fit: cover; }
.detail-content h1 { font-size: clamp(2.7rem,5vw,5rem); }
.detail-content .author { color: var(--muted); font-size: 1.2rem; margin: 16px 0 28px; }
.detail-content .long-description { white-space: pre-line; color: #424c49; font-size: 1.04rem; }
.detail-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 30px 0; }
.detail-meta { border-top: 1px solid var(--line); margin-top: 34px; padding-top: 22px; display: grid; gap: 8px; color: var(--muted); }
.back-link { display: inline-flex; margin-bottom: 30px; text-decoration: none; font-weight: 750; color: var(--accent); }

/* Admin */
.admin-page { min-height: 100vh; background: #f2eee6; }
.admin-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 80px; }
.admin-top { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom: 30px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 24px; padding: 28px; box-shadow: 0 14px 42px rgba(23,32,31,.05); }
.login-panel { width: min(470px, calc(100% - 32px)); margin: 10vh auto 0; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1/-1; }
label { font-weight: 750; font-size: .92rem; }
input, textarea, select { width: 100%; border: 1px solid #d6d0c5; border-radius: 12px; background: white; padding: 12px 13px; outline: none; color: var(--ink); }
textarea { min-height: 135px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(23,63,57,.08); }
.help { color: var(--muted); font-size: .82rem; }
.status { margin-top: 14px; padding: 11px 13px; border-radius: 10px; background: #eef3f0; color: var(--accent); font-size: .9rem; }
.status.error { background: #f8e8e5; color: var(--danger); }
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 26px; }
.manage-list { display: grid; gap: 12px; }
.manage-row { display:grid; grid-template-columns: 62px 1fr auto; align-items:center; gap:16px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.manage-row img { width:62px; height:78px; object-fit:cover; border-radius:8px; background:#e9e1d4; }
.manage-row strong { display:block; }
.manage-row span { color:var(--muted); font-size:.86rem; }
.manage-actions { display:flex; gap:8px; flex-wrap:wrap; }
.progress { width: 100%; height: 8px; border-radius: 999px; overflow: hidden; background: #e6e0d6; margin-top: 10px; }
.progress > div { height:100%; width:0; background: var(--accent); transition: width .2s; }
.security-note { border-left: 4px solid var(--accent-2); padding: 12px 14px; background: #fbf4e8; color:#66563f; border-radius: 0 10px 10px 0; font-size: .9rem; }

@media (max-width: 900px) {
  .hero-grid, .about-box, .detail-grid { grid-template-columns: 1fr; }
  .hero-art { min-height: 360px; }
  .book-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .detail-cover { max-width: 420px; }
}
@media (max-width: 620px) {
  .shell { width: min(100% - 24px, 1160px); }
  .nav-links a:not(.keep) { display:none; }
  .hero { padding-top: 58px; }
  .hero-art { min-height: 315px; }
  .book-shape { width: 195px; height: 265px; }
  .book-shape.three { padding: 27px 22px; }
  .book-shape.three strong { font-size:1.6rem; }
  .book-grid { grid-template-columns: 1fr; }
  .section-head, .footer-inner, .admin-top { align-items:flex-start; flex-direction:column; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column:auto; }
  .manage-row { grid-template-columns: 52px 1fr; }
  .manage-row img { width:52px; height:68px; }
  .manage-actions { grid-column:1/-1; }
}
