:root {
  --image-panel-border: rgba(40, 30, 20, 0.12);
  --image-panel-bg: #fbf9f4;
  --image-panel-muted: #8a7c6b;
  --image-accent: #9b5f2e;
}

.letter-id {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem 0;
}

.letter-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.letter-images {
  width: 100%;
}

.image-panel {
  border: 1px solid var(--image-panel-border);
  background: var(--image-panel-bg);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 8px 18px rgba(30, 20, 10, 0.08);
}

.thumbnail-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}

.thumbnail {
  border: 1px solid var(--image-panel-border);
  border-radius: 8px;
  padding: 4px;
  background: #fff;
  cursor: pointer;
}

.thumbnail img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
}

.thumbnail.active {
  border-color: var(--image-accent);
  box-shadow: 0 0 0 2px rgba(155, 95, 46, 0.2);
}

.image-empty {
  font-size: 0.8rem;
  color: var(--image-panel-muted);
  margin-top: 10px;
  display: none;
}

.letter-content.images-empty .image-empty {
  display: block;
}

.image-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.image-modal.active {
  display: flex;
}

.image-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 12, 6, 0.65);
}

.image-modal-content {
  position: relative;
  z-index: 1;
  background: #fffdf8;
  border-radius: 12px;
  padding: 16px;
  max-width: min(90vw, 900px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--image-panel-border);
  box-shadow: 0 16px 32px rgba(20, 12, 6, 0.35);
}

.image-modal-img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--image-panel-border);
  background: #f3efe6;
}

.image-modal-close {
  position: absolute;
  top: 6px;
  right: 10px;
  border: none;
  background: transparent;
  font-size: 28px;
  cursor: pointer;
  color: var(--image-panel-muted);
}

.image-modal-actions {
  display: flex;
  justify-content: center;
}

.image-modal-download {
  font-size: 0.85rem;
  color: var(--image-accent);
  text-decoration: none;
  border: 1px solid rgba(155, 95, 46, 0.3);
  padding: 6px 12px;
  border-radius: 6px;
  background: #fff6ec;
}

.image-modal-download:hover {
  border-color: var(--image-accent);
}

.image-modal-caption {
  font-size: 0.85rem;
  color: var(--image-panel-muted);
  text-align: center;
}
