* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f7f5f0;
  color: #1f1e1c;
  line-height: 1.5;
}

a {
  color: #1f1e1c;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 18px 48px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid #e2ddd2;
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.top-links a {
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
}

.top-links a:hover {
  background: #eae5da;
}

.menu-btn {
  border: 1px solid #d5cfc2;
  background: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 1.1rem;
  cursor: pointer;
}

h1 {
  margin: 0 0 20px;
  font-size: 2rem;
}

h2 {
  margin: 28px 0 14px;
  font-size: 1.35rem;
}

.filter-panel {
  background: #fff;
  border: 1px solid #e2ddd2;
  border-radius: 12px;
  padding: 16px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.filter-grid label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.filter-grid input,
.filter-grid select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cfc8ba;
  border-radius: 8px;
  background: #fff;
  font-size: 0.95rem;
}

.entries-list,
.issues-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.entry-card,
.issue-card {
  background: #fff;
  border: 1px solid #e2ddd2;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.entry-meta {
  font-size: 0.85rem;
  color: #666055;
}

.entry-title,
.issue-card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.entry-author {
  font-size: 0.92rem;
  color: #46423b;
}

.entry-note,
.issue-card p {
  margin: 0;
  font-size: 0.95rem;
  color: #3a3630;
}

.entry-actions {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #1f1e1c;
  background: #1f1e1c;
  color: #fff;
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.25;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: #fff;
  color: #1f1e1c;
  border-color: #cfc8ba;
}

.btn-secondary:hover {
  background: #f3efe6;
  opacity: 1;
}
/* Боковое меню */
.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 900;
}

.drawer-backdrop.open {
  display: block;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(85vw, 320px);
  height: 100vh;
  background: #fff;
  z-index: 950;
  padding: 20px;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  overflow-y: auto;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.drawer-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.drawer-close {
  border: 1px solid #d5cfc2;
  background: #fff;
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
}

.drawer-group {
  margin-bottom: 20px;
}

.drawer-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #706a5e;
  margin-bottom: 8px;
}

.drawer-link {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px;
  text-decoration: none;
  border-bottom: 1px solid #f0ece3;
}

/* Модальное окно чтения и предпросмотра аккордов */
.reader-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.reader-modal.open {
  display: block;
}

.reader-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
}

.reader-dialog {
  position: relative;
  z-index: 1001;
  width: min(94vw, 1140px);
  height: min(92vh, 920px);
  max-height: 92vh;
  margin: 4vh auto;
  background: #fff;
  border-radius: 14px;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.reader-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 1px solid #e6e2d8;
  padding-bottom: 14px;
  flex-shrink: 0;
}

.reader-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 8px;
  line-height: 1.7;
  font-size: 1.05rem;
}

.reader-body p {
  margin: 0 0 14px;
  max-width: 78ch;
  white-space: pre-line;
}

.reader-body:empty::before {
  content: "Материал представлен в виде нот, аккордов и PDF-файлов.";
  display: block;
  padding: 16px 18px;
  border: 1px solid #e2ddd2;
  border-radius: 10px;
  background: #faf8f4;
  color: #575249;
  font-size: 0.96rem;
}

.reader-spacer {
  height: 10px;
}

.reader-footer {
  border-top: 1px solid #e6e2d8;
  padding-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.issue-card {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.issue-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.issue-cover-wrap {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  background: #efece4;
  margin-bottom: 6px;
}

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

/* Полноэкранный просмотрщик выпусков */
.issue-viewer {
  display: none;
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 2000;
  background: #141311;
  color: #f7f5f0;
  flex-direction: column;
}

.issue-viewer.open {
  display: flex;
}

.issue-viewer-topbar,
.issue-viewer-bottombar {
  flex: 0 0 auto;
  background: rgba(30, 28, 25, 0.97);
  z-index: 2;
}

/* Верх: название слева, счётчик страниц строго по центру, «закрыть» справа */
.issue-viewer-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 1px solid #332f2a;
}

.issue-viewer-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}

.issue-viewer-page-info {
  justify-self: center;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  color: #f7f5f0;
  white-space: nowrap;
}

.issue-viewer-topbar .viewer-close-btn {
  justify-self: end;
}

/* Низ: все кнопки управления по центру */
.issue-viewer-bottombar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid #332f2a;
}

.viewer-zoom-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.viewer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #4a453d;
  background: #2b2824;
  color: #f7f5f0;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.viewer-btn[hidden] {
  display: none;
}

.viewer-icon-btn {
  min-width: 36px;
  padding: 6px 8px;
  font-size: 1.1rem;
}

.viewer-zoom-label {
  min-width: 64px;
  font-variant-numeric: tabular-nums;
}

.viewer-btn:hover:not(:disabled) {
  background: #3b3731;
}

.viewer-btn:focus-visible {
  outline: 2px solid #f7f5f0;
  outline-offset: 2px;
}

.viewer-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Область со страницами: занимает всё место между панелями и прокручивается при зуме */
.issue-viewer-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  padding: 12px;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
  cursor: zoom-in;
}

.issue-viewer-stage.is-zoomed {
  cursor: grab;
}

.issue-viewer-stage.is-dragging {
  cursor: grabbing;
  user-select: none;
}

/* margin: auto центрирует, но не обрезает увеличенную страницу */
.issue-viewer-pages {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: auto;
  flex: 0 0 auto;
}

.issue-page-image {
  display: block;
  flex: 0 0 auto;
  max-width: none;
  max-height: none;
  background: #fff;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.issue-viewer-status {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20, 19, 17, 0.9);
  color: #f7f5f0;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 3;
  pointer-events: none;
}

.issue-viewer-status:empty {
  display: none;
}

@media (max-width: 640px) {
  .viewer-btn-label {
    display: none;
  }

  .issue-viewer-stage {
    padding: 6px;
  }

  .issue-viewer-bottombar {
    gap: 6px;
    padding-left: 6px;
    padding-right: 6px;
  }

  .viewer-btn {
    min-width: 40px;
    min-height: 40px;
    font-size: 1.1rem;
  }

  .viewer-zoom-label {
    font-size: 0.9rem;
    min-width: 58px;
  }
}

/* Баннер заказа на главной и соцсети */
.order-banner {
  margin-top: 24px;
}

.order-banner-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid #e2ddd2;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.order-banner-link:hover {
  background: #faf8f4;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
}

.social-bar {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #e2ddd2;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.social-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #fff;
  color: #1f1e1c;
  border: 1px solid #e2ddd2;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.social-icon-btn:hover {
  background: #eae5da;
  border-color: #cfc8ba;
  transform: translateY(-1px);
}

.social-svg {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

/* Страница заказа (order.html) */
.muted {
  color: #666055;
}

.offers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.offer-card {
  background: #fff;
  border: 1px solid #e2ddd2;
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.offer-price {
  font-size: 1.45rem;
  font-weight: 700;
  color: #1f1e1c;
}

.order-panel {
  background: #fff;
  border: 1px solid #e2ddd2;
  border-radius: 12px;
  padding: 22px;
}

.order-panel h2 {
  margin: 0 0 18px;
}

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

.form-grid label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfc8ba;
  border-radius: 8px;
  background: #fff;
  color: #1f1e1c;
  font: inherit;
  font-size: 0.95rem;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: none;
  border-color: #1f1e1c;
  background: #fdfcf9;
}

.form-grid textarea {
  min-height: 44px;
  resize: vertical;
}

.estimate-box {
  background: #faf8f4;
  border: 1px solid #e2ddd2;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.estimate-total {
  font-size: 1.12rem;
  font-weight: 700;
}

.status-msg {
  margin-top: 12px;
  font-size: 0.94rem;
  color: #3a3630;
}

.status-msg:empty {
  display: none;
}

@media (max-width: 640px) {
  .reader-dialog {
    width: 96vw;
    height: 94vh;
    max-height: 94vh;
    margin: 3vh auto;
    padding: 16px;
  }

  .top-links {
    display: none;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }

  .order-panel {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .entry-actions .btn {
    padding: 7px 10px;
    font-size: 0.85rem;
  }

}