/* Story pictures (Spec 10). Same paper palette and radii as stories.css. */

/* ------------------------------------------------------------- preview (P1) */
.picture-checks {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: 16px;
  background: #e3eddc;
  color: #35602a;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 14px;
}

.picture-checks.warn {
  background: #f6e7d2;
  color: #8a5a12;
}

.picture-checks-glyph {
  font-size: 15px;
}

.picture-checks-sub {
  flex-basis: 100%;
  font-weight: 500;
  opacity: 0.9;
}

.picture-preview-card {
  background: #fdfaf2;
  border: 1.5px solid var(--line, #e6d9c2);
  border-radius: 24px;
  padding: 20px 22px 14px;
  box-shadow: 0 2px 0 rgba(120, 90, 50, 0.06);
}

.picture-preview-title {
  margin: 0 0 12px;
  text-align: center;
  font-size: 1.25em;
  font-weight: 600;
  line-height: 1.3;
}

.picture-preview-card p {
  margin: 0 0 12px;
  font-size: 1em;
  line-height: 1.85;
}

.picture-hint {
  margin: 12px 2px;
  color: #8a7a62;
  font-size: 14px;
  line-height: 1.5;
}

/* ----------------------------------------------------------- pictures step */
.picture-density-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border-radius: 20px;
  background: #fdfaf2;
  border: 1.5px solid var(--line, #e6d9c2);
  margin-bottom: 10px;
}

.picture-density-label {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
}

.picture-round {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 50%;
  border: 2px solid #2f2418;
  background: #fdfaf2;
  font-size: 26px;
  line-height: 1;
  font-weight: 600;
  color: #2f2418;
  cursor: pointer;
}

.picture-round:disabled {
  opacity: 0.35;
}

.picture-density-value {
  min-width: 74px;
  text-align: center;
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.picture-density-value strong {
  font-size: 30px;
  font-weight: 800;
}

.picture-density-value small {
  font-size: 12px;
  font-weight: 700;
  color: #6b5c46;
  margin-top: 2px;
}

.picture-density-note {
  margin: 0 2px 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #6b5c46;
}

.picture-style-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 18px;
  background: #fdfaf2;
  border: 1.5px solid var(--line, #e6d9c2);
  margin-bottom: 16px;
}

.picture-style-thumb {
  width: 76px;
  height: 57px;
  object-fit: cover;
  border-radius: 10px;
  flex: none;
  background: #eee3cf;
}

.picture-style-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.picture-style-kicker {
  font-size: 13px;
  font-weight: 700;
  color: #6b5c46;
}

.picture-style-name {
  font-size: 19px;
  font-weight: 700;
}

.picture-sections {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 18px 8px;
  border-radius: 24px;
  background: #fdfaf2;
  border: 1.5px solid var(--line, #e6d9c2);
}

.picture-section-text {
  margin: 8px 0 14px;
  font-size: 1.06em;
  line-height: 1.85;
}

/* --------------------------------------------------------------- picture box */
.picture-slot {
  margin: 0 0 18px;
}

.picture-box {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 2px dashed #cdb99a;
  background: #f7efdf;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.picture-box-icon {
  flex: none;
  width: 44px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #efe4ce;
  color: #7a6a52;
}

.picture-box-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.picture-box-kicker {
  font-size: 13px;
  font-weight: 800;
  color: #6b5c46;
}

.picture-box-caption {
  font-size: 14.5px;
  line-height: 1.35;
}

.picture-box-pencil {
  flex: none;
  color: #6b5c46;
}

.picture-box-drawn {
  padding: 0;
  border: none;
  background: none;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  overflow: hidden;
}

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

.picture-failed {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1.5px solid #d9a79a;
  background: #f9ece7;
  color: #8a3b25;
}

.picture-failed-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  line-height: 1.4;
}

.picture-flag {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f6e7d2;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.picture-flag-text {
  font-size: 13.5px;
  color: #7a4d12;
  line-height: 1.4;
}

.picture-flag-actions {
  display: flex;
  gap: 8px;
}

.picture-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid #b9a584;
  background: #fdfaf2;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #2f2418;
  cursor: pointer;
}

.picture-chip-btn.primary {
  background: #8f2f24;
  border-color: #8f2f24;
  color: #fff;
}

.picture-chip-btn:disabled {
  opacity: 0.5;
}

/* --------------------------------------------------------- style sheet (P3) */
.picture-sheet-lead {
  margin: 0 0 14px;
  color: #6b5c46;
  font-size: 14.5px;
  line-height: 1.45;
}

.picture-style-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.picture-style-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 8px 8px 10px;
  border-radius: 16px;
  border: 1.5px solid var(--line, #e6d9c2);
  background: #fdfaf2;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
}

.picture-style-card.selected {
  border: 2.5px solid #2f2418;
}

.picture-style-sample {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  background: #eee3cf;
}

.picture-style-card-name {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 700;
}

.picture-style-check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #2f2418;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

/* ------------------------------------------------------- caption sheet (P4) */
.picture-caption-after {
  padding: 14px 16px;
  border-radius: 16px;
  background: #fdfaf2;
  border: 1.5px solid var(--line, #e6d9c2);
  font-size: 1.02em;
  line-height: 1.8;
  margin-bottom: 16px;
}

.picture-caption-label,
.picture-sheet-label {
  display: block;
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
  color: #4d402f;
}

.picture-caption-input {
  width: 100%;
  min-height: 132px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1.5px solid var(--line, #e6d9c2);
  background: #fffdf8;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  resize: vertical;
  color: inherit;
}

.picture-caption-input:focus,
.picture-sheet-caption:focus,
.picture-change-input:focus,
.edit-textarea:focus {
  outline: 2px solid #b9a584;
}

/* ------------------------------------------------------- picture sheet (P8) */
.picture-sheet-main {
  margin-bottom: 18px;
  border-radius: 18px;
  overflow: hidden;
  background: #efe4ce;
  aspect-ratio: 4 / 3;
}

.picture-sheet-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.picture-sheet-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a7a62;
  font-size: 15px;
}

.picture-sheet-block {
  margin-bottom: 20px;
}

.picture-version-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.picture-version {
  position: relative;
  flex: none;
  width: 124px;
  aspect-ratio: 4 / 3;
  padding: 0;
  border-radius: 12px;
  border: 2px solid transparent;
  overflow: hidden;
  background: #efe4ce;
  cursor: pointer;
}

.picture-version.in-use {
  border-color: #2f2418;
}

.picture-version-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.picture-version-check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #2f2418;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.picture-sheet-caption {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1.5px solid var(--line, #e6d9c2);
  background: #fffdf8;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  resize: vertical;
  color: inherit;
  margin-bottom: 10px;
}

.picture-redraw {
  margin-bottom: 4px;
}

.picture-change-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.picture-change-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--line, #e6d9c2);
  background: #fffdf8;
  font: inherit;
  font-size: 15.5px;
  color: inherit;
  min-width: 0;
}

.picture-sheet-hint {
  margin: 8px 0 0;
  font-size: 13.5px;
  color: #8a7a62;
  line-height: 1.45;
}

.picture-sheet-remove {
  display: block;
  margin: 6px auto 0;
  background: none;
  border: none;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #a03a24;
  text-decoration: underline;
  cursor: pointer;
  padding: 10px;
}

/* ------------------------------------------------------------ reader (P5) */
.reader-picture {
  margin: 14px 0 22px;
  border-radius: 18px;
  overflow: hidden;
  background: #e8dcc4;
  aspect-ratio: 4 / 3;
}

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

.reader-picture-waiting {
  background:
    repeating-linear-gradient(135deg,
      #efe3cc 0 14px,
      #e9dbc1 14px 28px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.reader-picture-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #6b5c46;
  font-size: 14px;
  font-weight: 700;
}

/* The reader spans the whole window on desktop (see page-shell.css), so an
   illustration would otherwise grow to the full page width. */
@media (min-width: 720px) {
  .story-reader .reader-picture { max-width: 640px; }
}

.picture-spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(120, 96, 60, 0.25);
  border-top-color: #6b5c46;
  animation: picture-spin 1s linear infinite;
}

@keyframes picture-spin {
  to { transform: rotate(360deg); }
}

/* ----------------------------------------------------- details card (P6) */
.picture-details-row {
  display: flex;
  gap: 8px;
  margin: 8px 0 10px;
}

.picture-details-img,
.picture-details-thumb {
  width: calc((100% - 16px) / 3);
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  object-fit: cover;
  background: #efe4ce;
}

.picture-details-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a7a62;
}

.picture-details-thumb.failed {
  background: #f9ece7;
  border: 1.5px solid #d9a79a;
  color: #a03a24;
}

.picture-details-sub {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #6b5c46;
}

.picture-edit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border-radius: 16px;
  border: 1.5px solid #b9a584;
  background: #fdfaf2;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: #2f2418;
  cursor: pointer;
}

/* ------------------------------------------------------- edit story (P7) */
.edit-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line, #e6d9c2);
  background: #fdfaf2;
  font-size: 14.5px;
  color: #4d402f;
  margin-bottom: 12px;
}

.edit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.edit-chip {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--line, #e6d9c2);
  background: #fdfaf2;
  font: inherit;
  font-size: 14.5px;
  font-weight: 700;
  color: #2f2418;
  cursor: pointer;
}

.edit-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px 6px;
  border-radius: 24px;
  background: #fdfaf2;
  border: 1.5px solid var(--line, #e6d9c2);
}

.edit-section {
  display: flex;
  flex-direction: column;
}

.edit-text {
  position: relative;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1.5px solid #d9c9ac;
  background: #fffdf8;
  margin-bottom: 12px;
  font-size: 1.04em;
  line-height: 1.8;
  cursor: text;
}

.edit-text.edited {
  border-color: #2f2418;
  background: #f6efe0;
}

.edit-text-body {
  padding-right: 26px;
}

.edit-text-pencil {
  position: absolute;
  top: 12px;
  right: 12px;
  color: #8a7a62;
}

.edit-tag,
.edit-new-tag {
  align-self: flex-start;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #efe2c8;
  color: #6b5c46;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.edit-new-tag {
  margin: 6px 0 0;
  background: #e3eddc;
  color: #35602a;
}

.edit-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid #b9a584;
  background: #fff;
  font: inherit;
  font-size: 1.02em;
  line-height: 1.7;
  resize: vertical;
  color: inherit;
}

.edit-text-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.edit-checks {
  margin: 14px 4px 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: #6b5c46;
}

.edit-density-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 6px;
  border: none;
  border-bottom: 1px solid #ece0c9;
  background: none;
  font: inherit;
  font-size: 16px;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.edit-density-row.selected {
  font-weight: 800;
}

.edit-density-count {
  color: #8a7a62;
  font-size: 14px;
}

.edit-story-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --------------------------------------------------------------- list cover */
.stories-list .story-row {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 14px;
  align-items: center;
}

.story-row-cover {
  grid-row: 1 / span 3;
  display: block;
  border-radius: 12px;
  overflow: hidden;
  flex: none;
  background: #f0e6d2;
}

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

.story-row-cover-tile {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #efe3cb;
  color: #4d402f;
  font-size: 26px;
  font-weight: 600;
}

/* --------------------------------------------------------- lesson deck (P9) */
.lesson-story-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  background: #e8dcc4;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a7a62;
}

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

.lesson-drawing-chip {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fdfaf2;
  box-shadow: 0 2px 8px rgba(60, 40, 20, 0.18);
  font-size: 13.5px;
  font-weight: 700;
  color: #2f2418;
}

/* ------------------------------------------------------ save without pictures */
.picture-save-without {
  display: block;
  margin: 10px auto 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #4d402f;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px;
}

.picture-footer-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.picture-footer-actions .btn-outline {
  flex: 1;
}

.picture-trash {
  flex: none;
}

/* ---------------------------------------------------------- edit story page */
#editStoryView .story-create-scroll {
  padding-bottom: 140px;
}

.edit-story-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ------------------------------------------------------------- dev compare */
.compare-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
  font-family: system-ui, sans-serif;
}

.compare-models {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0 20px;
}

.compare-model {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.compare-row {
  display: grid;
  grid-template-columns: 200px repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
  border-top: 1px solid #e6d9c2;
  padding: 14px 0;
}

.compare-card img {
  width: 100%;
  border-radius: 10px;
  display: block;
  background: #efe4ce;
}

.compare-meta {
  font-size: 12.5px;
  color: #6b5c46;
  margin-top: 6px;
  line-height: 1.4;
}

.compare-use {
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #b9a584;
  background: #fdfaf2;
  font-size: 13px;
  cursor: pointer;
}

/* --------------------------------------------------------------- fragments */
.settings-value-button {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 2px 4px 10px;
  border: none;
  background: none;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #6b5c46;
  cursor: pointer;
  white-space: nowrap;
}

.settings-value-button .settings-chevron {
  display: inline-flex;
  width: 18px;
  height: 18px;
}

.settings-value-button .settings-chevron svg {
  width: 18px;
  height: 18px;
}

.story-sheet-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid #b9a584;
  background: #fdfaf2;
  font-size: 21px;
  line-height: 1;
  color: #2f2418;
  cursor: pointer;
  z-index: 2;
}

.picture-style-sheet,
.picture-caption-sheet,
.picture-picture-sheet,
.picture-density-sheet {
  position: relative;
  max-height: 88vh;
  overflow-y: auto;
}

.picture-sheet-body {
  padding-bottom: 8px;
}

.picture-preview-title,
.picture-section-text,
.picture-caption-after {
  word-break: break-word;
}

/* ------------------------------------------------- small character cards */
.story-char-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 4px;
}

.story-char-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 58px;
  padding: 6px 8px 5px;
  border-radius: 12px;
  border: 1.5px solid var(--line, #e6d9c2);
  background: #fdfaf2;
}

.story-char-card.outside {
  border-style: dashed;
  border-color: #b9b0a0;
  background: #f4efe4;
  color: #6b5c46;
}

.story-char-card-char {
  font-size: 26px;
  line-height: 1.1;
  font-family: var(--study-font, "LXGW WenKai", serif);
}

.story-char-card-bar {
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: #d9cbb2;
}

.story-char-card-bar.pinyin {
  height: auto;
  background: none;
  font-size: 11.5px;
  line-height: 1.1;
  text-align: center;
  color: #6b5c46;
}

.story-char-card-count {
  font-size: 12px;
  font-weight: 700;
  color: #6b5c46;
}
