html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: #f3f2ef;
  color: #252525;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

.library {
  background: #f3f2ef;
}

.shelf {
  max-width: 1100px;
  margin: 0 auto;
  padding: 50px 20px;
  font-size: 0;
}

.shelf-with-back {
  padding-top: 75px;
}

.book {
  display: inline-block;
  width: 25%;
  padding: 25px 12px;
  color: #252525;
  font-size: 16px;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  vertical-align: top;
}

.score-cover {
  display: block;
  width: 150px;
  height: 200px;
  margin: 0 auto 13px;
  border: 1px solid #c8c4bc;
  background: #ddd9d1;
  object-fit: cover;
  -webkit-transition: -webkit-transform 120ms ease;
  transition: transform 120ms ease;
}

.catalog-cover {
  border: 2px solid #b9aa87;
}

.catalog-icon {
  position: relative;
  display: block;
  width: 150px;
  height: 200px;
  margin: 0 auto 13px;
}

.folder-shape {
  position: absolute;
  top: 54px;
  left: 50%;
  display: block;
  width: 136px;
  height: 98px;
  margin-left: -68px;
  border: 1px solid #b9aa87;
  border-radius: 5px;
  background: #d4c49d;
}

.folder-tab {
  position: absolute;
  top: -18px;
  left: 10px;
  display: block;
  width: 56px;
  height: 19px;
  border: 1px solid #b9aa87;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: #d4c49d;
}

.catalog-back {
  position: fixed;
  z-index: 4;
  top: 12px;
  left: 12px;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background: rgba(35, 35, 35, 0.68);
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 32px;
  line-height: 37px;
  text-align: center;
  text-decoration: none;
}

.catalog-back:focus {
  outline: 2px solid #56524c;
  outline-offset: 2px;
}

.cover-fallback {
  position: relative;
}

.cover-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  fill: none;
  stroke: #817c73;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.book:hover .score-cover {
  -webkit-transform: translateY(-2px);
  transform: translateY(-2px);
}

.book:focus {
  outline: 2px solid #56524c;
  outline-offset: 4px;
}

.book span {
  display: block;
  max-width: 100%;
  word-wrap: break-word;
}

.viewer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #d8d8d5;
  -webkit-user-select: none;
  user-select: none;
}

.score {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
  opacity: 0;
  -webkit-transition: opacity 120ms ease;
  transition: opacity 120ms ease;
}

.score.ready {
  opacity: 1;
}

.back {
  position: fixed;
  z-index: 4;
  top: 12px;
  left: 12px;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background: rgba(35, 35, 35, 0.68);
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 32px;
  line-height: 37px;
  text-align: center;
  text-decoration: none;
}

.back:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.turn {
  position: fixed;
  z-index: 3;
  top: 0;
  bottom: 0;
  width: 38%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.turn-left {
  left: 0;
}

.turn-right {
  right: 0;
}

.turn:focus {
  outline: none;
}

.empty {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 0;
  display: none;
  width: 100%;
  margin-top: -20px;
  padding: 0 24px;
  color: #555;
  text-align: center;
}

@media (max-width: 800px) {
  .book {
    width: 33.3333%;
  }
}

@media (max-width: 520px) {
  .shelf {
    padding: 25px 10px;
  }

  .book {
    width: 50%;
    padding: 20px 8px;
  }

  .score-cover {
    width: 135px;
    height: 180px;
  }

  .catalog-icon {
    width: 135px;
    height: 180px;
  }

  .folder-shape {
    top: 44px;
  }
}

.upload-fab {
  position: fixed; z-index: 8; right: 18px; bottom: 18px;
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(35,35,35,.78); color: #fff; text-decoration: none;
  font: 32px/45px Arial,sans-serif; text-align: center; box-shadow: 0 4px 18px rgba(0,0,0,.18);
}
.admin-page { min-height: 100vh; padding: 28px 14px; background: #eceae5; }
.admin-card { width: min(680px, 100%); margin: 0 auto; padding: 28px; border-radius: 18px; background: #fff; box-shadow: 0 10px 35px rgba(0,0,0,.08); }
.admin-login-card { max-width: 430px; margin-top: 8vh; }
.admin-card h1 { margin: 10px 0 22px; font-size: 28px; }
.admin-muted { color: #777; margin: -12px 0 22px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.admin-home, .admin-link-button { color: #555; text-decoration: none; font: inherit; }
.admin-link-button { border: 0; background: none; cursor: pointer; padding: 0; }
.admin-form { display: grid; gap: 18px; }
.admin-form label { display: grid; gap: 7px; font-weight: 600; }
.admin-form input[type="text"], .admin-form input[type="password"], .admin-form select {
  width: 100%; border: 1px solid #cfcac0; border-radius: 10px; background: #fff; padding: 12px 13px; font: inherit;
}
.mode-switch { display: flex; gap: 18px; flex-wrap: wrap; padding: 4px 0; }
.mode-switch label { display: flex; grid-gap: 7px; align-items: center; font-weight: 500; }
.dropzone { border: 2px dashed #bdb7aa; border-radius: 14px; padding: 24px; text-align: center; cursor: pointer; background: #faf9f6; }
.dropzone.dragging { border-color: #56524c; background: #f0eee8; }
.dropzone span { color: #777; font-weight: 400; line-height: 1.5; }
.dropzone input { margin: 8px auto; max-width: 100%; }
.dropzone strong { font-size: 14px; color: #4b4945; }
.admin-primary { border: 0; border-radius: 11px; padding: 13px 18px; background: #34322f; color: #fff; font: 600 16px/1.2 inherit; cursor: pointer; }
.admin-alert { border-radius: 10px; padding: 11px 13px; margin-bottom: 18px; }
.admin-alert.success { background: #e7f4e9; color: #285a31; }
.admin-alert.error { background: #fae8e6; color: #7c3028; }
.admin-form small { font-weight: 400; color: #777; }
@media (max-width: 520px) { .admin-card { padding: 20px 16px; border-radius: 14px; } .mode-switch { display: grid; gap: 10px; } }
