@import url('data:text/css,');

:root {
  --ink: #202621;
  --muted: #71766f;
  --paper: #f5f1e8;
  --cream: #ebe4d7;
  --white: #fffdf8;
  --green: #375d4b;
  --green-dark: #29483a;
  --coral: #d96c4d;
  --gold: #d8a54b;
  --line: rgba(32, 38, 33, .13);
  --serif: Georgia, 'Times New Roman', serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(217,108,77,.3); outline-offset: 2px; }

.topbar { height: 76px; padding: 0 clamp(24px, 5vw, 76px); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 1px solid var(--line); background: rgba(245,241,232,.9); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font: 600 21px var(--serif); }
.brand-mark { display: grid; place-items: center; width: 34px; height: 38px; color: var(--paper); background: var(--green); border-radius: 3px 8px 8px 3px; font: italic 700 21px var(--serif); box-shadow: inset 4px 0 rgba(255,255,255,.14); }
nav { display: flex; align-self: stretch; gap: 28px; }
.nav-link { border: 0; background: none; color: var(--muted); cursor: pointer; position: relative; font-size: 14px; }
.nav-link.active { color: var(--ink); font-weight: 650; }
.nav-link.active::after { content: ''; position: absolute; height: 2px; background: var(--coral); left: 0; right: 0; bottom: -1px; }
.top-add { justify-self: end; }
.button { border: 0; border-radius: 6px; padding: 11px 17px; cursor: pointer; font-weight: 650; font-size: 14px; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--green); box-shadow: 0 5px 14px rgba(55,93,75,.17); }
.button-primary:hover { background: var(--green-dark); }
.button-quiet { background: #eee8dc; }
.button.danger { color: #a74332; background: #f7e5df; }

main { max-width: 1440px; margin: 0 auto; }
.hero { min-height: 295px; padding: 62px clamp(24px, 7vw, 100px) 52px; display: flex; align-items: center; justify-content: space-between; gap: 50px; position: relative; overflow: hidden; }
.hero::after { content: 'M'; position: absolute; right: 5%; top: -95px; font: italic 450px/.9 var(--serif); color: rgba(55,93,75,.035); pointer-events: none; }
.eyebrow { margin: 0 0 12px; color: var(--coral); font-weight: 750; letter-spacing: .18em; font-size: 11px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font: 500 clamp(40px, 5vw, 68px)/1.03 var(--serif); letter-spacing: -.035em; margin-bottom: 17px; }
.hero-copy { color: var(--muted); max-width: 590px; font: 17px/1.6 var(--serif); margin-bottom: 0; }
.quote { max-width: 300px; border-left: 1px solid var(--gold); padding: 8px 0 8px 29px; position: relative; z-index: 1; }
.quote-mark { position: absolute; left: 13px; top: -13px; color: var(--gold); font: 42px var(--serif); }
.quote p { font: italic 18px/1.5 var(--serif); margin-bottom: 8px; }
.quote small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }

.dashboard { margin: 0 clamp(24px, 5vw, 76px) 68px; border: 1px solid var(--line); background: rgba(255,253,248,.65); display: grid; grid-template-columns: repeat(3, 1fr) 1.35fr; box-shadow: 0 10px 35px rgba(44,40,31,.045); }
.stat, .goal-card { min-height: 108px; padding: 24px 28px; display: flex; align-items: center; gap: 17px; border-right: 1px solid var(--line); }
.stat-icon { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; font-weight: bold; }
.coral { background: var(--coral); } .gold { background: var(--gold); } .green { background: var(--green); }
.stat div, .goal-copy { display: flex; flex-direction: column; gap: 4px; }
.stat strong { font: 500 27px var(--serif); }
.stat div span, .goal-copy > span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.goal-card { border-right: 0; justify-content: space-between; cursor: pointer; }
.goal-card:hover { background: rgba(255,255,255,.5); }
.goal-copy strong { font: 500 22px var(--serif); }
.goal-copy em { color: var(--muted); font: normal 12px var(--sans); }
.goal-ring { width: 59px; height: 59px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--coral) 0%, #ded8cd 0); position: relative; }
.goal-ring::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--white); }
.goal-ring span { position: relative; font-size: 11px; font-weight: 750; }

.library { background: var(--white); border-top: 1px solid var(--line); padding: 55px clamp(24px, 5vw, 76px) 90px; min-height: 500px; }
.section-heading { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 33px; }
h2 { font: 500 37px/1.1 var(--serif); letter-spacing: -.02em; margin: 0; }
.search { width: min(330px, 100%); height: 43px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--muted); }
.search:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(55,93,75,.08); }
.search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 13px; }
.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 32px; border-bottom: 1px solid var(--line); }
.filters { display: flex; gap: 27px; overflow-x: auto; }
.filter { border: 0; background: none; padding: 0 0 14px; cursor: pointer; color: var(--muted); font-size: 13px; white-space: nowrap; position: relative; }
.filter span { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 5px; padding: 0 5px; background: #eee8dc; border-radius: 10px; font-size: 10px; }
.filter.active { color: var(--green); font-weight: 700; }
.filter.active::after { content: ''; position: absolute; height: 2px; left: 0; right: 0; bottom: -1px; background: var(--green); }
.sort-label { color: var(--muted); font-size: 12px; padding-bottom: 13px; white-space: nowrap; }
.sort-label select { border: 0; background: transparent; color: var(--ink); margin-left: 5px; font-size: 12px; }

.book-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 34px 24px; }
.book-card { min-width: 0; cursor: pointer; }
.book-card:focus-visible { outline: 3px solid rgba(217,108,77,.3); outline-offset: 4px; border-radius: 5px; }
.cover { aspect-ratio: .72; border-radius: 4px 9px 9px 4px; padding: 21px 17px; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 12px 22px rgba(38,37,32,.13), inset 5px 0 rgba(255,255,255,.13), inset -2px 0 rgba(0,0,0,.08); transition: transform .24s ease, box-shadow .24s ease; color: #fffaf0; }
.book-card:hover .cover { transform: translateY(-5px) rotate(-.3deg); box-shadow: 0 19px 28px rgba(38,37,32,.17), inset 5px 0 rgba(255,255,255,.13); }
.cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,.12), transparent 45%, rgba(0,0,0,.11)); pointer-events: none; }
.cover-ornament { width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.55); border-radius: 50%; display: grid; place-items: center; font: italic 19px var(--serif); }
.cover-title { font: 500 clamp(19px, 2vw, 27px)/1.05 var(--serif); letter-spacing: -.02em; position: relative; z-index: 1; overflow-wrap: anywhere; }
.cover-author { text-transform: uppercase; letter-spacing: .14em; font-size: 8px; opacity: .8; position: relative; z-index: 1; }
.card-info { padding: 15px 3px 0; }
.status-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.badge { padding: 4px 7px; border-radius: 3px; font-size: 9px; text-transform: uppercase; letter-spacing: .07em; font-weight: 750; }
.badge.reading { color: #b64c36; background: #f9e4dd; }.badge.want { color: #846720; background: #f6edcf; }.badge.finished { color: var(--green); background: #deebe4; }
.rating { color: var(--gold); letter-spacing: 1px; font-size: 10px; }
.card-title { font: 600 18px/1.25 var(--serif); margin: 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-author { color: var(--muted); font-size: 12px; margin-bottom: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-track { height: 3px; border-radius: 3px; background: #e4dfd5; overflow: hidden; }
.progress-fill { height: 100%; background: var(--coral); border-radius: inherit; }
.progress-copy { display: flex; justify-content: space-between; margin-top: 5px; color: var(--muted); font-size: 9px; }
.empty-state { text-align: center; padding: 65px 20px; color: var(--muted); }
.empty-state > span { display: block; font: 54px var(--serif); color: var(--gold); }
.empty-state h3 { color: var(--ink); font: 500 25px var(--serif); margin: 10px 0 8px; }
.empty-state p { font-size: 13px; margin-bottom: 20px; }

footer { padding: 29px clamp(24px, 5vw, 76px); display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); }
footer span { color: var(--ink); font: 600 16px var(--serif); }
footer p { margin: 0; }

dialog { width: min(620px, calc(100% - 28px)); max-height: calc(100vh - 40px); border: 0; border-radius: 9px; padding: 0; background: var(--white); color: var(--ink); box-shadow: 0 26px 80px rgba(20,24,20,.3); }
dialog::backdrop { background: rgba(28,34,29,.55); backdrop-filter: blur(3px); }
dialog form { padding: 29px; overflow-y: auto; max-height: calc(100vh - 40px); }
.small-dialog { width: min(440px, calc(100% - 28px)); }
.dialog-head { display: flex; align-items: start; justify-content: space-between; margin-bottom: 25px; }
.dialog-head h2 { font-size: 30px; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #eee8dc; font-size: 24px; cursor: pointer; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field span { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 5px; background: white; padding: 11px 12px; color: var(--ink); outline: none; }
.field textarea { resize: vertical; }
.dialog-actions { display: flex; align-items: center; gap: 10px; margin-top: 25px; }
.action-spacer { flex: 1; }
.toast { position: fixed; left: 50%; bottom: 25px; transform: translate(-50%, 20px); padding: 11px 17px; border-radius: 5px; background: var(--ink); color: white; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1000px) {
  .dashboard { grid-template-columns: repeat(3, 1fr); }
  .goal-card { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .topbar { grid-template-columns: 1fr auto; height: 66px; padding-inline: 18px; }
  nav { display: none; } .top-add { font-size: 0; padding: 10px 12px; }.top-add span { font-size: 18px; }
  .hero { padding: 43px 22px 36px; display: block; min-height: auto; }
  .quote { display: none; } h1 { font-size: 43px; }
  .dashboard { margin: 0 18px 48px; grid-template-columns: 1fr 1fr; }
  .stat, .goal-card { min-height: 92px; padding: 18px; }
  .stat:nth-child(2) { border-right: 0; }.stat:nth-child(3) { border-top: 1px solid var(--line); }
  .goal-card { grid-column: auto; border-left: 0; align-items: center; }
  .goal-copy strong { font-size: 17px; }.goal-ring { width: 49px; height: 49px; }.stat-icon { display: none; }
  .library { padding: 40px 18px 65px; }.section-heading { align-items: stretch; flex-direction: column; }.search { width: 100%; }
  .filter-row { align-items: start; }.filters { gap: 20px; }.sort-label { display: none; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
  .cover { padding: 17px 14px; }.cover-title { font-size: clamp(17px, 5vw, 23px); }
  footer { flex-direction: column; gap: 8px; }.form-grid { grid-template-columns: 1fr; }.field.full { grid-column: auto; }
}
@media (max-width: 390px) { .dashboard { grid-template-columns: 1fr; }.stat, .goal-card { border-right: 0; border-top: 1px solid var(--line); }.stat:first-child { border-top: 0; }.goal-card { grid-column: auto; }.book-grid { gap-inline: 12px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
