:root {
  font-family: Arial, sans-serif;
  color: #35263b;
  background: #faf5fa;
  --accent: #73517c;
}
* {
  box-sizing: border-box;
}
body {
  max-width: 1100px;
  margin: 24px auto;
  padding: 16px;
}
a {
  color: var(--accent);
}
h1 {
  font-size: clamp(1.7rem, 5vw, 2.5rem);
}
h2 {
  font-size: 1.35rem;
}
section,
.panel {
  background: white;
  border: 1px solid #eee3ef;
  border-radius: 18px;
  padding: 22px;
  margin: 18px 0;
  box-shadow: 0 5px 20px #35263b05;
}
label {
  display: block;
  margin: 8px 0;
  font-size: 0.95rem;
}
input,
button,
select,
textarea {
  font: inherit;
  border-radius: 8px;
  padding: 11px;
  max-width: 100%;
}
input,
select,
textarea {
  border: 1px solid #d9cddd;
  background: #fff;
}
label input:not([type="checkbox"]),
label textarea,
label select {
  display: block;
  width: 100%;
  margin-top: 6px;
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}
button {
  background: var(--accent);
  color: #fff;
  border: 0;
  cursor: pointer;
  margin: 4px 3px;
  min-height: 44px;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button.secondary {
  background: #eee5f1;
  color: #35263b;
}
.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.stat {
  background: #f5edf7;
  padding: 18px;
  border-radius: 12px;
}
.stat strong {
  font-size: 1.4rem;
  display: block;
  margin-bottom: 8px;
}
.order {
  border-top: 1px solid #eee;
  padding: 16px 0;
}
.order header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.muted {
  color: #796b7e;
  font-size: 0.9rem;
  line-height: 1.6;
}
.notice {
  position: sticky;
  top: 0;
  background: #35263b;
  color: #fff;
  padding: 12px;
  border-radius: 10px;
  z-index: 10;
  white-space: pre-line;
}
.notice:empty {
  display: none;
}
nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 24px 0;
}
summary {
  cursor: pointer;
  font-weight: bold;
  padding: 10px 0;
}
.full {
  grid-column: 1/-1;
}
small {
  display: block;
  margin: 6px 0;
}
#bookSelect,
#packSelect {
  max-width: 100%;
}
#detail {
  white-space: normal;
}
#detail dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
}
#detail dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}
.book {
  border: 1px solid #eee;
  border-radius: 14px;
  padding: 16px;
}
.book img {
  width: 100%;
  height: 230px;
  object-fit: contain;
  background: #faf5fa;
}
.viewer-image {
  width: 100%;
  height: min(70vh, 850px);
  object-fit: contain;
  background: #f7f4f8;
}
.viewer-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.viewer-nav input {
  width: 90px;
}
.viewer-title {
  scroll-margin-top: 50px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 600px) {
  body {
    margin: 6px auto;
    padding: 12px;
  }
  section,
  .panel {
    padding: 16px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .toolbar > * {
    flex: 1;
    min-width: 90px;
  }
  #detail dl {
    grid-template-columns: 1fr;
  }
  #detail dt {
    font-weight: bold;
  }
  .viewer-nav {
    gap: 4px;
  }
}
.grid > * {
  min-width: 0;
}
input[type="file"] {
  display: block;
  width: 100%;
}
@media (max-width: 600px) {
  .grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
