﻿:root {
  --ink: #1d1c1b;
  --paper: #f5f3e9;
  --paper-dark: #dfdbc9;
  --accent: #8d1b14;
  --accent-soft: #c45f4b;
  --frame: #2f3135;
  --gold: #8f7f54;
  --footer: #171a1d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: "Libre Baskerville", Georgia, serif;
  background:
    radial-gradient(circle at 10% 12%, rgba(255, 255, 255, 0.7) 0 20%, rgba(255, 255, 255, 0) 55%),
    radial-gradient(circle at 88% 28%, rgba(255, 255, 255, 0.65) 0 16%, rgba(255, 255, 255, 0) 45%),
    linear-gradient(180deg, #f6f3e8 0%, #ebe8db 100%);
}

.site-header {
  background:
    linear-gradient(180deg, rgba(17, 21, 28, 0.96), rgba(9, 11, 15, 0.97)),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 2px,
      rgba(0, 0, 0, 0.04) 2px,
      rgba(0, 0, 0, 0.04) 6px
    );
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.header-inner {
  width: min(1240px, 94vw);
  margin: 0 auto;
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #f3f1e5;
}

.brand-icon {
  height: 42px;
  width: 42px;
  border: 2px solid #f0ead3;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: "IM Fell English SC", serif;
  font-size: 17px;
  line-height: 1;
  letter-spacing: 0.08em;
  color: #f0ead3;
}

.brand-text {
  font-family: "Cormorant Garamond", serif;
  font-size: 2.15rem;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-links a {
  color: #ece8d7;
  text-decoration: none;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.22rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.header-links a:hover {
  border-color: #ece8d7;
}

.page {
  width: min(1240px, 94vw);
  margin: 26px auto 38px;
}

.headline {
  margin: 24px 0 24px;
  text-align: center;
  color: #a62420;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.6rem, 2.8vw, 3.2rem);
  letter-spacing: 0.01em;
  font-weight: 500;
}

.workbench {
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.73), rgba(255, 255, 255, 0.62)),
    linear-gradient(135deg, rgba(200, 196, 177, 0.35), rgba(255, 255, 255, 0.4));
  border: 1px solid rgba(111, 105, 90, 0.25);
  box-shadow: 0 10px 34px rgba(52, 52, 52, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  padding: 18px;
}

.step-card {
  border: 1px solid #c9c4b3;
  background: rgba(248, 246, 239, 0.9);
  margin-bottom: 18px;
  transition: border-color 0.25s ease;
}

.step-card:last-child {
  margin-bottom: 0;
}

.step-card.is-active {
  border-color: #9c947d;
  box-shadow: inset 0 0 0 1px rgba(226, 223, 210, 0.8);
}

.step-title {
  background: #dedbcd;
  border-bottom: 1px solid #c7c2b0;
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 500;
  padding: 13px 18px;
}

.step-content {
  padding: 16px;
}

.import-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr)) auto;
  align-items: end;
  gap: 14px;
}

.import-form label,
.preview-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: #312f28;
}

.required {
  color: #b52b22;
}

input[type="text"],
input[type="file"] {
  background: #faf8f0;
  border: none;
  border-bottom: 2px dotted #696052;
  padding: 9px 10px;
  font-family: "Libre Baskerville", serif;
  font-size: 0.94rem;
}

input[type="text"]:focus,
input[type="file"]:focus {
  outline: 2px solid rgba(141, 27, 20, 0.2);
}

.btn-ribbon,
.btn-light {
  border: none;
  cursor: pointer;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn-ribbon {
  color: #f3eee6;
  background: linear-gradient(180deg, #b02822, #8b1812);
  padding: 11px 18px;
  border-radius: 2px;
  box-shadow:
    0 4px 0 #5f0e0c,
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.btn-light {
  color: #403a32;
  background: linear-gradient(180deg, #efecdf, #ddd6c4);
  border: 1px solid #b6af9d;
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 2px 0 rgba(138, 130, 112, 0.58);
}

.btn-ribbon:hover,
.btn-light:hover {
  transform: translateY(-1px);
}

.btn-ribbon:disabled,
.btn-light:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.status-line {
  min-height: 1.3rem;
  margin: 14px 0 0;
  color: #6c1d17;
  font-size: 0.95rem;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.page-indicator {
  min-width: 138px;
  text-align: center;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.28rem;
  font-weight: 700;
}

.thumb-strip {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 6px 4px 12px;
  border-bottom: 1px solid #d4cfbe;
  margin-bottom: 14px;
}

.thumb-item {
  width: 90px;
  min-width: 90px;
  background: #ffffff;
  border: 1px solid #ccc5b2;
  border-radius: 4px;
  padding: 4px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.thumb-item:hover {
  transform: translateY(-1px);
}

.thumb-item.is-active {
  border-color: #a72720;
  box-shadow: 0 0 0 1px rgba(167, 39, 32, 0.3);
}

.thumb-item canvas {
  width: 100%;
  display: block;
  background: #fff;
}

.thumb-caption {
  margin-top: 4px;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(460px, 1fr) 290px;
  gap: 16px;
}

.score-editor {
  position: relative;
  background: #ffffff;
  border: 1px solid #c8c2b0;
  min-height: 350px;
  overflow: hidden;
}

#score-canvas,
#overlay-canvas {
  display: block;
  width: 100%;
  height: auto;
}

#overlay-canvas {
  position: absolute;
  inset: 0;
  cursor: ns-resize;
}

.parts-panel {
  border: 1px solid #c9c2b0;
  background: #f0ede2;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.parts-panel h3,
.preview-parts h3 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.6rem;
}

.hint {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #575146;
}

.parts-list,
.preview-part-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 570px;
  overflow-y: auto;
}

.part-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
}

.part-row input[type="text"] {
  font-size: 0.85rem;
  padding: 7px;
}

.part-row .part-index {
  font-size: 0.74rem;
  color: #6a6458;
  min-width: 28px;
  text-align: center;
}

.part-row input[type="checkbox"] {
  accent-color: #8d1b14;
}

.preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 14px;
}

.preview-layout {
  display: grid;
  grid-template-columns: 290px minmax(380px, 1fr);
  gap: 14px;
}

.preview-parts {
  border: 1px solid #cbc3ad;
  background: #efecde;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-part-btn {
  width: 100%;
  text-align: left;
  border: 1px solid #b6af9d;
  background: #f7f3e9;
  padding: 8px 10px;
  cursor: pointer;
  font-family: "Libre Baskerville", serif;
  font-size: 0.9rem;
}

.preview-part-btn.is-active {
  border-color: #a82721;
  background: #fffdfa;
  box-shadow: inset 0 0 0 1px rgba(168, 39, 33, 0.24);
}

.preview-stage {
  border: 1px solid #cbc3ad;
  background: #ece7d6;
  padding: 14px;
  min-height: 370px;
}

.preview-pages {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  align-items: flex-start;
}

.preview-page {
  background: #fff;
  border: 1px solid #d0cab8;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.site-footer {
  margin-top: 24px;
  background:
    linear-gradient(180deg, rgba(8, 11, 15, 0.98), rgba(12, 15, 20, 0.98)),
    repeating-linear-gradient(
      -30deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 2px,
      rgba(0, 0, 0, 0.03) 2px,
      rgba(0, 0, 0, 0.03) 5px
    );
}

.footer-content {
  width: min(1240px, 94vw);
  margin: 0 auto;
  padding: 24px 0;
  color: #e7e2d4;
  font-size: 0.95rem;
  line-height: 1.55;
}

@media (max-width: 1060px) {
  .import-form {
    grid-template-columns: 1fr 1fr;
  }

  .editor-layout,
  .preview-layout {
    grid-template-columns: 1fr;
  }

  .parts-panel,
  .preview-parts {
    max-height: unset;
  }
}

@media (max-width: 700px) {
  .header-inner {
    min-height: 76px;
  }

  .brand-text {
    font-size: 1.7rem;
  }

  .header-links {
    gap: 12px;
  }

  .header-links a {
    font-size: 1rem;
  }

  .step-title {
    font-size: 1.55rem;
  }

  .import-form {
    grid-template-columns: 1fr;
  }

  .preview-toolbar {
    gap: 10px;
  }
}
