* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 32px 16px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: linear-gradient(180deg, #f3f0e4 0%, #e7e0c8 100%);
  font-family: Georgia, 'Times New Roman', serif;
  color: #3a3320;
}

.card {
  width: 100%;
  max-width: 860px;
  background: #fffdf5;
  border: 1.5px solid #b8862c;
  border-radius: 14px;
  padding: 28px 32px 32px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

h1 { margin: 0 0 6px; color: #4a6b2a; font-size: 28px; }
h2 { margin: 26px 0 8px; color: #4a6b2a; font-size: 19px; }

.hint { margin: 0 0 20px; color: #8a7a4a; font-size: 14px; line-height: 1.5; }
.hint.tight { margin: 0 0 10px; }
.hint b { color: #6a5a2a; }

fieldset {
  border: 1.5px solid #d8cfa8;
  border-radius: 10px;
  padding: 12px 14px 14px;
  margin: 0 0 16px;
}
legend { padding: 0 6px; color: #4a6b2a; font-weight: 700; font-size: 14px; }

.radio { display: flex; align-items: flex-start; gap: 9px; padding: 5px 0; font-size: 14px; cursor: pointer; line-height: 1.4; }
.radio input { margin-top: 3px; flex: none; }
.radio.standalone { margin: 0 0 16px; }

/* Поля выравниваем по НИЗУ: подписи бывают разной высоты (одна строка против двух),
   и без этого соседние селекты стоят на разном уровне. */
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin: 0 0 16px; }
.fld { flex: 1 1 200px; display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: #6a5a2a; }
.fld.small { flex: 0 0 90px; }
.fld input, .fld select {
  font-family: Georgia, serif; font-size: 15px; padding: 8px 10px;
  border: 1.5px solid #d8cfa8; border-radius: 8px; background: #fff; color: #3a3320;
}
.fld input:focus, .fld select:focus { outline: none; border-color: #5a8835; }

/* --- сетка-конструктор --- */
.grid-wrap { overflow-x: auto; padding-bottom: 4px; }

table.rz {
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 100%;
}
table.rz th, table.rz td { border: 1.2px solid #cfc4a0; padding: 0; }
table.rz th {
  background: #e8dcb4; color: #4a6b2a; font-size: 13px; font-weight: 700;
  padding: 6px 4px; white-space: nowrap;
}
table.rz th.t-col, table.rz td.t-col { width: 92px; }
table.rz td input {
  width: 100%; border: none; background: transparent; font-family: Georgia, serif;
  font-size: 14px; color: #3a3320; padding: 9px 6px; text-align: center;
}
table.rz td input:focus { outline: 2px solid #5a8835; outline-offset: -2px; background: #f4f8ea; }
table.rz td.t-col input { font-size: 13px; color: #8a7a4a; }
table.rz.icons td input { font-size: 16px; padding: 16px 6px; }
table.rz tr td:first-child input::placeholder { color: #bdb08a; }

/* --- банк предметов --- */
.tabs { display: flex; gap: 8px; margin: 0 0 10px; }
.tab {
  font-family: Georgia, serif; font-size: 13px; padding: 7px 14px; cursor: pointer;
  border: 1.5px solid #d8cfa8; border-radius: 999px; background: #fffdf5; color: #6a5a2a;
}
.tab.active { background: #c8d8a4; border-color: #5a8835; color: #3a5520; font-weight: 700; }

.bank { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.bank button {
  font-family: Georgia, serif; font-size: 14px; padding: 7px 12px; cursor: pointer;
  border: 1.5px solid #d8cfa8; border-radius: 9px; background: #fff; color: #3a3320;
}
.bank button:hover { border-color: #5a8835; background: #f4f8ea; }
.bank button .e { margin-right: 5px; }

/* --- кнопки --- */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; }
.actions button {
  font-family: Georgia, serif; font-size: 15px; padding: 11px 20px; cursor: pointer;
  border: 1.5px solid #d8cfa8; border-radius: 10px; background: #fffdf5; color: #4a6b2a; font-weight: 700;
}
.actions button:hover { border-color: #5a8835; background: #f4f8ea; }
.actions button.primary { background: #c8d8a4; border-color: #5a8835; color: #3a5520; }
.actions button.primary:hover { background: #d6e4b6; }

.note {
  margin: 12px 0 0; padding: 10px 12px; font-size: 13px; line-height: 1.5;
  background: #f4f8ea; border: 1.5px solid #a8c880; border-radius: 8px; color: #3a5520;
  word-break: break-all;
}

@media (max-width: 620px) {
  .card { padding: 20px 16px 24px; }
  h1 { font-size: 23px; }
  table.rz th, table.rz td input { font-size: 13px; }
  table.rz th.t-col, table.rz td.t-col { width: 68px; }
}

/* --- галочки полей страницы книги --- */
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 14px; }
.checks label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; padding: 3px 0; }
.fld.inline { margin-top: 10px; max-width: 150px; }
.fld.small { flex: 0 0 110px; }

/* --- карточки книг --- */
.books { display: flex; flex-direction: column; gap: 8px; }
.books details {
  border: 1.5px solid #d8cfa8; border-radius: 10px; background: #fff; padding: 0 12px;
}
.books summary {
  cursor: pointer; padding: 10px 2px; font-size: 15px; color: #4a6b2a; font-weight: 700;
  list-style: none; display: flex; align-items: baseline; gap: 8px;
}
.books summary::-webkit-details-marker { display: none; }
.books summary::before { content: "▸"; color: #b8862c; }
.books details[open] summary::before { content: "▾"; }
.books summary .bk-name { font-weight: 400; color: #8a7a4a; font-size: 14px; }
.books .bk-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; padding: 4px 0 14px; }
.books .bk-body label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #6a5a2a; }
.books .bk-body input, .books .bk-body textarea, .books .bk-body select {
  font-family: Georgia, serif; font-size: 15px; padding: 7px 9px;
  border: 1.5px solid #d8cfa8; border-radius: 8px; background: #fffdf5; color: #3a3320;
}
.books .bk-body textarea { resize: vertical; min-height: 62px; }
.books .bk-body input:focus, .books .bk-body textarea:focus, .books .bk-body select:focus {
  outline: none; border-color: #5a8835;
}

/* --- превью поля --- */
.preview {
  border: 1.5px solid #d8cfa8; border-radius: 12px; background: #fdf7e6;
  padding: 10px; overflow: hidden; margin: 0 0 4px;
}
.preview svg { display: block; width: 100%; height: auto; }
.preview .sheetline { pointer-events: none; }

/* --- список историй на печать --- */
.preview { border: 1.5px solid #d8cfa8; border-radius: 12px; background: #fdf7e6; padding: 12px 16px; }
.preview ol { margin: 0; padding-left: 20px; }
.preview li { font-size: 15px; color: #3a3320; margin: 4px 0; }
.preview .theme { color: #8a7a4a; font-size: 13px; }

/* --- онлайн-игра --- */
.card.game { max-width: 680px; }
.progress { font-size: 13px; color: #8a7a4a; margin-bottom: 14px; }
.ask-hint { margin: 0 0 4px; color: #8a7a4a; font-size: 15px; }
.ask-word { margin: 0 0 4px; font-size: 30px; font-weight: 700; color: #4a6b2a; line-height: 1.2; }
.ask-ex { margin: 0 0 16px; color: #b8862c; font-size: 14px; font-style: italic; }
#word {
  width: 100%; font-family: Georgia, serif; font-size: 20px; padding: 12px 14px;
  border: 1.5px solid #d8cfa8; border-radius: 10px; background: #fff; color: #3a3320;
}
#word:focus { outline: none; border-color: #5a8835; }
.story-text {
  font-size: 20px; line-height: 1.75; color: #3a3320; background: #fffdf5;
  border: 1.5px solid #d8cfa8; border-radius: 12px; padding: 18px 20px; margin: 0 0 18px;
}
.story-text b { color: #c85a1e; }

/* --- превью набора картинок --- */
.preview { border: 1.5px solid #d8cfa8; border-radius: 12px; background: #fdf7e6; padding: 12px; }
.preview .row-items { display: flex; flex-wrap: wrap; gap: 10px; }
.preview figure { margin: 0; width: 92px; text-align: center; }
.preview figure svg { display: block; width: 62px; height: 62px; margin: 0 auto; }
.preview figcaption { font-size: 11px; color: #8a7a4a; margin-top: 2px; line-height: 1.2; }

/* --- превью листа в конструкторе --- */
.preview .ptask { font-size: 15px; color: #3a3320; margin: 0 0 10px; text-align: center; }
.preview svg.scene { display: block; width: 100%; max-width: 340px; height: auto; margin: 0 auto; }
.preview .leg { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 10px; font-size: 13px; color: #6b6045; }
.preview .leg span { display: inline-flex; align-items: center; gap: 6px; }
.preview .leg i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid #7a6242; display: inline-block; }
.preview .frow { margin-bottom: 14px; }
.preview .fcap { font-size: 14px; color: #3a3320; margin-bottom: 6px; }
.preview .fbody { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.preview .tgt { display: inline-block; border: 2px dashed #7a6242; border-radius: 50%; opacity: .6; }
.preview .line { display: inline-block; height: 14px; border: 2px dashed #7a6242; border-radius: 7px; opacity: .6; }
