/* ------------------------------------------------------------------ bookcase page ("На полях") */
.shelf-body { background: #f1ebe0; min-height: 100vh; }
html:has(.shelf-body) { background: #f1ebe0; }

.notebook-wrap { max-width: 1240px; margin: 0 auto; padding: 10px 24px 48px 44px; }
.notebook {
  position: relative;
  background: #e9dfcc;
  border: 1px solid #d6c7ad;
  box-shadow: 0 14px 30px -18px rgba(80, 60, 40, .35), 0 1px 0 #fff inset;
  padding: 56px 60px 34px;
  min-height: 520px;
}
.rings { position: absolute; left: -32px; top: 108px; display: flex; flex-direction: column; gap: 42px; }
.rings i {
  display: block; width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, #efe8dc 0 45%, #d9cfbf 70%);
  border: 1.5px solid #9d917f; position: relative;
}
.rings i::after { content: ""; position: absolute; left: 14px; top: 13px; width: 30px; height: 2px; background: #9d917f; box-shadow: 0 3px 0 #c8bca8; }
.tape {
  position: absolute; left: 50%; top: -10px; width: 124px; height: 22px; transform: translateX(-50%) rotate(-1deg);
  background: rgba(214, 190, 140, .75); box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

.nb-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.nb-head h1 { margin: .12em 0 0; font-size: clamp(34px, 4.4vw, 56px); font-weight: 500; }
.nb-actions { display: flex; align-items: center; gap: 36px; margin-top: 30px; }
.hint { font-family: var(--script); color: #6d625a; font-size: 21px; line-height: 1.15; transform: rotate(-3deg); }
.card-btn {
  display: inline-block; font-family: var(--sans); font-size: 15px; color: var(--accent-dark); text-decoration: none;
  background: #f6f0e6; border: 1.5px solid #8b6a5a; padding: .6em 1.1em; box-shadow: 3px 3px 0 #c9b79c;
  cursor: pointer; white-space: nowrap;
}
.card-btn:hover { background: #fbf6ee; }
.card-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #c9b79c; }

/* ---- shelves */
.shelves { margin-top: 26px; display: flex; flex-direction: column; gap: 34px; }
.shelf-row { position: relative; padding: 0 3%; }
.shelf-row .books { display: flex; align-items: flex-end; gap: 7px; min-height: 250px; padding: 0 2%; }
/* the plank is in front of the books: its front edge covers the bottoms of the spines */
.shelf-row .plank {
  position: relative; z-index: 3; height: 24px; margin-top: -9px;
  background: linear-gradient(#8a6247 0 5px, #7a5540 5px 100%);
  box-shadow: 0 10px 14px -8px rgba(60, 40, 25, .5);
}
.under { font-family: var(--script); color: var(--accent); font-size: 20px; text-align: right; margin: 12px 3% 0 0; transform: rotate(-2deg); }

.spine {
  position: relative; flex: none; border: 0; padding: 0; cursor: pointer;
  border-radius: 2px 2px 0 0; color: #f7efe2;
  box-shadow: inset -3px 0 0 rgba(0, 0, 0, .12), inset 2px 0 0 rgba(255, 255, 255, .08), 2px 4px 6px -3px rgba(40, 25, 15, .45);
  transition: transform .15s ease;
  display: flex; flex-direction: column; align-items: center; padding: 14px 0 22px;
  transform-origin: bottom center;
}
.spine::before, .spine::after { content: ""; position: absolute; left: 12%; right: 12%; height: 2px; background: rgba(247, 239, 226, .45); }
.spine::before { top: 9px; }
.spine::after { bottom: 17px; }
.spine { rotate: var(--tilt, 0deg); }
.spine:hover, .spine:focus-visible { transform: translateY(-8px); outline: none; }
.spine .orn { font-size: 13px; line-height: 1; margin: 6px 0 8px; opacity: .95; }
.spine .ttl {
  writing-mode: vertical-rl; text-transform: uppercase; font-family: var(--serif); font-weight: 600;
  letter-spacing: .06em; font-size: 14.5px; line-height: 1.15; overflow: hidden; flex: 1; min-height: 0;
  max-width: calc(100% - 6px);
  text-align: start;
}
.bookend {
  flex: none; width: 60px; height: 118px; align-self: flex-end; margin-left: 14px;
  border-radius: 30px 30px 2px 2px; background: #a88a62; border: 2px solid #8c7350;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 26px; color: #efe4cf; box-shadow: 2px 4px 6px -3px rgba(40, 25, 15, .45);
}
.empty-shelf { align-self: center; margin: auto; font-size: 22px; color: var(--ink-soft); text-align: center; line-height: 1.35; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 22px 3% 0; font-family: var(--sans); font-size: 13.5px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 18px; padding: 0 5px; border-radius: 1px; color: #f7efe2; font-style: normal; font-weight: 700; font-size: 12px; }
.auth-line { margin: 14px 3% 0; font-family: var(--sans); font-size: 12.5px; color: var(--muted); }
.auth-line button { font-size: 12.5px; font-family: var(--sans); }

/* ---- tooltip */
.tip {
  position: fixed; z-index: 50; max-width: 300px; pointer-events: none;
  background: #fbf7ef; border: 1px solid #cdbfa9; box-shadow: 0 10px 24px -10px rgba(60, 40, 25, .45);
  padding: 12px 14px; font-size: 16px; line-height: 1.3;
}
.tip .t-title { font-weight: 700; font-size: 19px; line-height: 1.15; }
.tip .t-author { margin-top: 2px; }
.tip .t-row { font-family: var(--sans); font-size: 12.5px; color: var(--ink-soft); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.tip .t-row i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.tip .t-note { font-style: italic; margin-top: 8px; color: #5a5047; white-space: pre-line; }
/* long reviews make the tooltip wider instead of being cut */
.tip.wide { max-width: 460px; }
.tip.xwide { max-width: min(760px, calc(100vw - 16px)); }
.tip .t-reviews { margin-top: 9px; padding-top: 3px; border-top: 1px solid #e6dccb; }
.tip .rev { font-size: 14.5px; line-height: 1.32; margin-top: 6px; }
.tip .rev-head { margin-right: 6px; }

/* ---- a member's review (tooltip and presentation viewer): name in bold in the member's colour */
.rev-who { font-family: var(--sans); font-weight: 700; }
.rev-rating { font-family: var(--sans); font-weight: 700; font-size: .82em; color: var(--ink-soft); margin-left: 6px; }
.rev-text { white-space: pre-line; }
.tip .t-foot { font-family: var(--sans); font-size: 11.5px; color: var(--accent); margin-top: 9px; letter-spacing: .03em; }

/* ---- modals */
.modal { border: 1px solid #cdbfa9; background: #f6f0e6; color: var(--ink); padding: 0; box-shadow: 0 30px 60px -20px rgba(40, 25, 15, .5); }
.modal::backdrop { background: rgba(60, 45, 30, .45); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 18px 22px 12px; border-bottom: 1.5px solid var(--line); }
.modal-head h2 { margin: .1em 0 0; font-weight: 600; font-size: 28px; line-height: 1.1; }
.modal-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.modal .close { background: none; border: 0; font-size: 30px; line-height: 1; color: var(--muted); padding: 0 4px; }
.modal .close:hover { color: var(--accent); }
.viewer { width: min(1100px, 94vw); height: 92vh; }
.viewer[open] { display: flex; flex-direction: column; }
.viewer-body { flex: 1; display: flex; min-height: 0; }
.viewer-body .pdf-pages { min-width: 0; }
/* reviews next to the slides */
.viewer-reviews { flex: none; width: 330px; overflow-y: auto; border-left: 1.5px solid var(--line); padding: 16px 20px 22px; }
.viewer-reviews h3 { font-family: var(--sans); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0 0 8px; }
.viewer-reviews h3:not(:first-child) { margin-top: 20px; }
.viewer-reviews .vr-avg { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-family: var(--sans); font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.viewer-reviews .rev { padding: 10px 0 11px; border-bottom: 1px solid #e3d8c6; font-size: 17px; line-height: 1.35; }
.viewer-reviews .rev-head { display: block; margin-bottom: 2px; font-size: 15px; }
.viewer-reviews .rev-text { display: block; }
.viewer-reviews .vr-note { font-style: italic; font-size: 16.5px; line-height: 1.35; white-space: pre-line; color: #5a5047; }
.viewer-reviews .vr-empty { color: var(--muted); font-size: 16px; }
.pdf-pages { flex: 1; overflow: auto; background: #d9cfbf; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.pdf-page { background: #fff; box-shadow: 0 6px 16px -8px rgba(40, 25, 15, .5); flex: none; }
.pdf-page canvas { display: block; }
.pdf-status { margin: auto; font-size: 20px; color: var(--ink-soft); text-align: center; max-width: 520px; }
.pdf-count { font-family: var(--sans); font-size: 13px; color: var(--muted); white-space: nowrap; }
.editor { width: min(720px, 94vw); }
/* the editor is taller than most screens: its header and Save bar stay put, the fields scroll */
.editor[open] { display: flex; flex-direction: column; overflow: hidden; }
.editor form { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.editor .ed-body { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 14px; }
.editor .modal-foot { border-top: 1.5px solid var(--line); padding-top: 12px; }
.login { width: min(420px, 94vw); }
.ed-body { padding: 16px 22px 6px; }
.ed-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; margin-top: 12px; }
.ed-field { display: flex; flex-direction: column; gap: 4px; font-family: var(--sans); font-size: 12.5px; color: var(--muted); letter-spacing: .02em; position: relative; }
.ed-field.wide { grid-column: 1 / -1; }
.ed-field input, .ed-field textarea {
  font-family: var(--serif); font-size: 18px; color: var(--ink); background: #fbf7ef;
  border: 1.5px solid var(--line); padding: .25em .5em; outline: none; width: 100%;
}
.ed-field input[type=file] { font-family: var(--sans); font-size: 13px; padding: .4em; }
.ed-field input:focus, .ed-field textarea:focus { border-color: var(--accent); }
.ed-sub { font-style: normal; color: var(--muted); letter-spacing: 0; }
.ed-linked { grid-column: 1 / -1; font-family: var(--sans); font-size: 13px; color: var(--ink-soft); margin-top: -4px; }
.ed-linked button { font-size: 13px; font-family: var(--sans); margin-left: 6px; }
[hidden] { display: none !important; }
.file-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-pick .file-name { font-family: var(--serif); font-size: 17px; color: var(--ink-soft); }
.file-pick:has(input:focus-visible) .card-btn { outline: 2px solid var(--accent); }
.ed-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.ed-check input { width: auto; }
.suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 5; list-style: none; margin: 2px 0 0; padding: 0;
  background: #fbf7ef; border: 1px solid #cdbfa9; box-shadow: 0 12px 20px -12px rgba(60, 40, 25, .5); max-height: 290px; overflow-y: auto;
}
.suggest li { padding: 7px 10px; cursor: pointer; font-family: var(--serif); font-size: 17px; color: var(--ink); border-bottom: 1px solid #ece3d4; }
.suggest li small { font-family: var(--sans); font-size: 12px; color: var(--muted); margin-left: 6px; }
.suggest li:hover, .suggest li.active { background: var(--sq-sel); }
.presenters { display: flex; flex-wrap: wrap; gap: 6px; }
.presenters label {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-family: var(--sans); font-weight: 700;
  font-size: 13.5px; color: #4a413a; border: 1px solid #cdbfa9; background: var(--sq-cream); padding: 4px 10px;
}
.presenters label i { width: 11px; height: 15px; border-radius: 1px; display: inline-block; }
.presenters input { position: absolute; opacity: 0; pointer-events: none; }
.presenters label:has(input:checked) { background: var(--sq-sel); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.presenters label:has(input:focus-visible) { outline: 2px solid var(--accent); }
#presenter-other { margin-top: 6px; max-width: 260px; }
/* ---- rating: a star bar whose filled layer is clipped to value/10 (fractions fill part of a star) */
.starbar { position: relative; display: inline-block; white-space: nowrap; line-height: 1; letter-spacing: 0; font-family: var(--sans); }
.starbar .sb-bg { color: #d8ccba; }
.starbar .sb-fg { position: absolute; left: 0; top: 0; overflow: hidden; color: var(--accent); }
.tip .starbar { font-size: 13px; }
.rating-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stars { position: relative; font-size: 22px; }
/* editor: one row per member — name, review, their rating below */
.rv-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.rv-row { display: grid; grid-template-columns: 64px 1fr; gap: 4px 10px; align-items: start; padding-bottom: 10px; border-bottom: 1px solid #e6dccb; }
.rv-row .rv-who { font-family: var(--sans); font-weight: 700; font-size: 14px; padding-top: 6px; }
.rv-row .rating-row { grid-column: 2; gap: 10px; }
.rv-row textarea { font-size: 17px; resize: vertical; }
.rv-avg { font-family: var(--sans); font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.rv-avg .rv-avg-line { display: flex; align-items: center; gap: 8px; }
.rv-avg .starbar { font-size: 15px; }
.stars .star-hit { position: absolute; inset: 0; display: flex; }
.stars .star-hit button { flex: 1; background: none; border: 0; padding: 0; cursor: pointer; }
.stars .star-hit button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rating-row input { width: 3.6em; text-align: center; }
.rating-of { font-family: var(--serif); font-size: 18px; color: var(--ink-soft); margin-left: -6px; }
.rating-row .link { font-size: 15px; }
.ed-error { margin-top: 12px; color: #8a2b22; font-family: var(--sans); font-size: 14px; }
.modal-foot { display: flex; align-items: center; gap: 18px; padding: 12px 22px 18px; }
.modal-foot .grow { flex: 1; }
.modal-foot .btn { box-shadow: 5px 5px 0 var(--shadow-tan); font-size: 16px; }
.link.danger { color: #8a2b22; border-color: #8a2b22; }
.login-note { margin: 0 0 12px; font-size: 17px; color: var(--ink-soft); }

@media (max-width: 760px) {
  .notebook-wrap { padding: 6px 8px 30px 8px; }
  .notebook { padding: 40px 18px 24px; }
  .rings { display: none; }
  .nb-actions { gap: 16px; margin-top: 8px; flex-wrap: wrap; }
  .shelf-row .books { min-height: 210px; gap: 5px; }
  .ed-grid { grid-template-columns: 1fr 1fr; }
  .viewer-body { flex-direction: column; }
  .viewer-reviews { width: auto; max-height: 40%; border-left: 0; border-top: 1.5px solid var(--line); }
  .rv-row { grid-template-columns: 1fr; }
  .rv-row .rating-row { grid-column: 1; }
}
