@font-face {
  font-family: Hannari;
  src: url("fonts/HannariMincho-Regular.otf") format("opentype");
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #173e3a;
  --bg: #e5f7f2;
  --panel: #b9ede3;
  --accent: #116e65;
  --paper: #fffaf1;
  font-family: Hannari, "Hiragino Mincho ProN", "Yu Mincho", serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding: 30px 18px 46px; }
button, input, select, textarea { font: inherit; color: inherit; border-radius: 0; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #854300; outline-offset: 3px; }
.masthead { text-align: center; margin: 0 auto 24px; }
h1 {
  display: inline-block;
  margin: 0;
  padding: 13px 22px;
  font-size: clamp(1.15rem, 4.8vw, 2rem);
  letter-spacing: .05em;
  font-weight: normal;
  border: 2px solid var(--ink);
  background: var(--accent);
  color: var(--paper);
  outline: 1px solid var(--paper);
  outline-offset: -7px;
  box-shadow: 5px 5px var(--ink);
}
.masthead p { margin: 16px 0 0; }
.desk {
  max-width: 950px;
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}
.controls { display: grid; gap: 18px; min-width: 0; }
.panel {
  min-width: 0;
  border: 2px solid var(--ink);
  padding: 15px;
  background: var(--panel);
  box-shadow: 5px 5px var(--ink);
}
h2 { margin: 0 0 12px; font-size: 1.2rem; border-bottom: 1px solid var(--ink); padding-bottom: 6px; }
label { display: block; margin: 10px 0 5px; }
input:not([type="checkbox"], [type="range"]), select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--ink);
  padding: 8px;
  background: var(--paper);
}
textarea { resize: vertical; }
input[type="range"] { width: 100%; margin: 0; }
input[type="range"], input[type="checkbox"] { accent-color: var(--accent); }
input[type="file"]::file-selector-button { font: inherit; }
.input-row, .actions { display: flex; gap: 8px; }
.actions { flex-wrap: wrap; margin-top: 10px; }
button {
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 7px 10px;
  box-shadow: 2px 2px var(--ink);
}
button:hover { background: #e5f7f2; }
button:active { transform: translate(2px, 2px); box-shadow: none; }
.input-row button { flex-shrink: 0; }
.primary {
  width: 100%;
  margin-top: 12px;
  padding: 11px;
  border-width: 2px;
  outline: 1px solid var(--paper);
  outline-offset: -5px;
  color: var(--paper);
  background: var(--accent);
}
.primary:hover { background: #095951; }
.primary:focus-visible { outline: 3px solid #854300; outline-offset: 3px; }
.status { margin: 7px 0 0; font-size: .875rem; overflow-wrap: anywhere; }
.results, .tags { list-style: none; margin: 8px 0 0; padding: 0; }
.results {
  border: 1px solid var(--ink);
  background: var(--paper);
  max-height: 15rem;
  overflow: auto;
}
.results li + li { border-top: 1px solid #8eb3aa; }
.results button {
  width: 100%;
  text-align: left;
  border: 0;
  box-shadow: none;
  overflow-wrap: anywhere;
}
.results small { display: block; font-size: .875rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { max-width: 100%; }
.tags button { max-width: 100%; text-align: left; overflow-wrap: anywhere; }
.tags .specific { background: #e5f7f2; border-style: dashed; }
.check { display: flex; align-items: center; gap: 4px; }
.preview { position: sticky; top: 16px; }
.book {
  position: relative;
  display: grid;
  isolation: isolate;
  overflow: hidden;
  container-type: inline-size;
  aspect-ratio: 2 / 3;
  border: 2px solid var(--ink);
  background: #eef8ed url("covers/default.png") center / cover;
}
#cover-image, .book-frame { position: absolute; pointer-events: none; }
#cover-image { inset: var(--image-top, 0) auto auto var(--image-left, 0); width: var(--image-width, 100%); height: var(--image-height, 100%); }
.book-frame { inset: 3.4%; border: 1px solid var(--paper); outline: 1px solid var(--ink); }
.book-content {
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  padding: 9% 7%;
  min-width: 0;
  min-height: 0;
  gap: 4cqi;
  overflow: hidden;
}
.book-title {
  margin: 0;
  font-size: clamp(13px, 6cqi, 30px);
  line-height: 1.45;
  padding: 5%;
  text-align: center;
  background: var(--paper);
  border: 2px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: -5px;
  overflow-wrap: anywhere;
  overflow: auto;
  min-height: 0;
}
.book-band {
  flex-shrink: 0;
  padding: 3% 4%;
  color: var(--paper);
  background: #104e48;
  border-block: 2px solid var(--ink);
  margin-inline: -8.2%;
  text-align: center;
  font-size: clamp(12px, 4.2cqi, 20px);
  overflow-wrap: anywhere;
  max-height: 38cqi;
  line-height: 1.25;
  overflow: auto;
}
.book-band p { margin: 0; }
.book-band p:empty { display: none; }
.book-band p + p:not(:empty) { margin-top: 2px; }
@media (max-width: 700px) {
  .desk { grid-template-columns: minmax(0, 1fr); max-width: 480px; }
  .preview { position: static; }
}
