.album-workspace {
  color: var(--ui-ink, #31484a);
  font:
    15px/1.7 Inter,
    'PingFang SC',
    sans-serif;
}
html[data-workspace-translating] .album-workspace {
  visibility: hidden;
}

.workspace-heading {
  max-width: 1480px;
  margin: auto;
  padding: 28px 32px 18px;
}
.workspace-heading h1 {
  font:
    36px/1.4 'Songti SC',
    serif;
  margin: 18px 0 8px;
}
.workspace-heading p {
  margin: 0;
  color: var(--ui-muted, #687b78);
}
.workspace-layout {
  max-width: 1480px;
  margin: auto;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 28px;
  padding: 0 32px 65px;
}
.workspace-panel,
.workspace-result {
  min-width: 0;
}
.workspace-panel {
  padding: 20px;
  border: 1px solid var(--ui-line, #cfdfd6);
  border-radius: 22px;
  background: var(--ui-card-surface, #ffffff70);
}
.album-workspace fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 23px;
  min-width: 0;
}
.album-workspace legend {
  font-weight: 600;
  margin-bottom: 12px;
}
.workspace-upload {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1px dashed var(--ui-line, #cfdfd6);
  border-radius: 14px;
  cursor: pointer;
}
.workspace-upload span,
.workspace-note,
.planner-choice small {
  font-size: 12px;
  color: var(--ui-muted, #687b78);
}
.workspace-upload input {
  max-width: 100%;
  font-size: 12px;
}
#photo-list {
  max-height: 260px;
  overflow: auto;
  padding: 0;
  list-style: none;
}
#photo-list li {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}
#photo-list img {
  width: 42px;
  height: 50px;
  object-fit: contain;
  border-radius: 4px;
}
#photo-list .photo-name {
  font-size: 12px;
  overflow-wrap: anywhere;
}
#photo-list .photo-actions {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
#photo-list button {
  padding: 1px 6px;
  min-height: 22px;
  font-size: 11px;
}
.workspace-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}
.album-workspace input[type='text'],
.album-workspace input[type='number'],
.album-workspace select,
.album-workspace textarea {
  width: 100%;
  box-sizing: border-box;
  color: inherit;
  font: inherit;
  border: 1px solid #dbe8e1;
  background: #ffffffb8;
  border-radius: 10px;
  padding: 9px 11px;
}
.album-workspace textarea {
  resize: vertical;
  line-height: 1.8;
}
.album-workspace button {
  color: inherit;
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--ui-line, #cfdfd6);
  border-radius: 999px;
  background: var(--ui-card-surface, #ffffff80);
  padding: 8px 14px;
  transition:
    background 0.2s,
    border-color 0.2s;
}
.album-workspace button:hover:not(:disabled) {
  background: var(--ui-hover-surface, #ffffffbd);
  border-color: var(--ui-control-line, #acc8ba);
}
.album-workspace button:active:not(:disabled) {
  transform: translateY(1px);
}
.album-workspace button:disabled {
  opacity: 0.45;
  cursor: default;
}
.album-workspace :focus-visible {
  outline: 2px solid #6d9785;
  outline-offset: 3px;
}
.workspace-primary {
  width: 100%;
  margin-top: 18px;
  background: #dceee4b3 !important;
}
.workspace-check {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 15px;
  font-size: 13px;
}
.planner-choice {
  display: flex;
  gap: 10px;
  align-items: start;
  padding: 11px 0;
  cursor: pointer;
}
.planner-choice input {
  margin-top: 6px;
}
.planner-choice span,
.planner-choice small {
  display: block;
}
.saved-plans {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}
.saved-plans button[aria-pressed='true'] {
  background: #e0eee5b8;
  border-color: var(--ui-control-line, #acc8ba);
}
#status {
  font-size: 13px;
  overflow-wrap: anywhere;
}
.workspace-result {
  border-radius: 22px;
  padding: 18px 0;
}
.workspace-result-heading {
  padding: 0 18px;
}
.workspace-result-heading h2 {
  font:
    26px 'Songti SC',
    serif;
  margin: 0;
}
.workspace-result-heading p {
  font-size: 13px;
  color: var(--ui-muted, #687b78);
}
.workspace-empty {
  display: grid;
  place-items: center;
  min-height: 500px;
  border: 1px dashed var(--ui-line, #cfdfd6);
  border-radius: 22px;
  color: var(--ui-muted, #687b78);
  padding: 25px;
  text-align: center;
}
.workspace-result .album-scene {
  position: relative;
  width: 100%;
  height: 680px;
  --page-width: min(26vw, 360px);
  --page-height: calc(var(--page-width) * 1.416666667);
}
.workspace-result .album-caption {
  padding: 0 20px;
  bottom: 65px;
}
.workspace-result .album-controls {
  bottom: 15px;
}
.workspace-result .album-controls button {
  font-size: 13px;
}
.workspace-result .handwritten {
  font-family: 'Songti SC', serif;
}
.workspace-result .album-status {
  font-size: 11px;
}
.writing-panel {
  margin: 20px 18px;
  padding: 20px;
  background: var(--ui-card-surface, #ffffff70);
  border: 1px solid var(--ui-line, #cfdfd6);
  border-radius: 18px;
}
.writing-panel h3 {
  font:
    23px 'Songti SC',
    serif;
  margin: 0;
}
.writing-panel textarea {
  margin-top: 12px;
}
.workspace-downloads {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 15px 18px;
}
.workspace-result > .workspace-note {
  padding: 0 18px;
}
.workspace-heading .brand:hover {
  color: var(--ui-ink);
  text-decoration: underline;
}
.workspace-heading .brand:active {
  transform: translateY(1px);
}
@media (max-width: 900px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }
  .workspace-result .album-scene {
    --page-width: 36vw;
    height: 610px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .album-workspace button {
    transition: none;
  }
  .album-workspace button:active {
    transform: none;
  }
}

.cover-previews {
  display: flex;
  gap: 24px;
  padding: 16px;
}
.cover-previews figure {
  margin: 0;
  max-width: 220px;
}
.cover-previews img {
  display: block;
  width: 100%;
  box-shadow: 0 5px 18px #31484a20;
}
.cover-previews figcaption {
  margin-top: 8px;
}

/* Custom visible upload surface; the native input remains keyboard accessible. */
.album-workspace .workspace-upload {
  position: relative;
  align-items: flex-start;
  gap: 12px;
  transition:
    background 0.2s,
    border-color 0.2s;
}
.album-workspace .workspace-upload-title {
  font-size: 16px;
  font-weight: 600;
  color: inherit;
}
.album-workspace .workspace-upload input[type='file'] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
.album-workspace .workspace-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 22px;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  background: var(--ui-card-surface);
  font: inherit;
  color: inherit;
}
.album-workspace .workspace-upload:hover {
  background: var(--ui-hover-surface);
  border-color: var(--ui-control-line);
}
.album-workspace .workspace-upload:active {
  background: var(--ui-card-surface);
}
.album-workspace .workspace-upload:focus-within {
  outline: 2px solid #6d9785;
  outline-offset: 3px;
}
.album-workspace fieldset:disabled .workspace-upload {
  opacity: 0.45;
  cursor: default;
}
.album-workspace select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23243838' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 18px;
  background-position: right 15px center;
}
.album-workspace [hidden] {
  display: none !important;
}
.generation-progress {
  padding: 15px 18px;
  margin: 16px 0 22px;
  border: 1px solid var(--ui-line);
  border-radius: 15px;
  background: var(--ui-card-surface);
}
.progress-heading {
  display: flex;
  gap: 15px;
  align-items: baseline;
  justify-content: space-between;
  font-size: 14px;
}
#progress-elapsed {
  font-size: 12px;
  white-space: nowrap;
  color: var(--ui-muted);
  font-variant-numeric: tabular-nums;
}
.generation-progress progress {
  display: block;
  width: 100%;
  height: 7px;
  margin: 14px 0 9px;
  accent-color: #8fb8aa;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
}
.generation-progress progress::-webkit-progress-bar {
  background: #dbe8e1;
}
.generation-progress progress::-webkit-progress-value {
  background: #8fb8aa;
  transition: width 0.2s;
}
#progress-count {
  font-size: 12px;
  margin: 0;
}
#progress-history {
  font-size: 11px;
  color: var(--ui-muted);
  padding-left: 18px;
  margin: 9px 0 0;
}
@media (prefers-reduced-motion: reduce) {
  .album-workspace .book-writing-hit,
  .generation-progress progress::-webkit-progress-value {
    transition: none;
  }
}

.workspace-result > .generation-progress {
  position: static;
  margin: 14px 18px 22px;
  background: var(--ui-hover-surface, #f6fbf8ed);
}
#progress-history {
  max-height: 34px;
  overflow: auto;
}

/* Paper-face editing follows the same perspective and animation as the album. */
.rotating-book-editor .album-book,
.rotating-book-editor .album-book * {
  pointer-events: none;
}
.rotating-book-editor .album-flat-page::after,
.rotating-book-editor .album-cover-inner::after {
  pointer-events: none;
}
.album-workspace .book-writing-hit {
  position: absolute;
  pointer-events: auto;
  cursor: text;
  height: var(--writing-row-height);
  padding: 0;
  margin: 0;
  min-height: 0;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  transform: none;
  backface-visibility: hidden;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.album-workspace .book-writing-hit:hover:not(:disabled),
.album-workspace .book-writing-hit:focus-visible {
  background: transparent;
  border-color: transparent;
  transform: none;
  outline: none;
}
.album-workspace .book-writing-input {
  position: absolute;
  pointer-events: auto;
  box-sizing: border-box;
  resize: none;
  margin: 0;
  padding: 0 3px;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: #303d38;
  font-family: PhotoJournalHand, cursive;
  overflow: hidden;
  box-shadow: none;
}
.album-workspace .book-writing-input[aria-invalid='true'] {
  border-color: #b36253;
}
.album-workspace .book-edit-done {
  position: absolute;
  bottom: 65px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  z-index: 5;
}
.album-workspace .book-edit-done:active {
  transform: translateX(-50%);
}
.rotating-book-editor {
  container-type: inline-size;
  min-width: 0;
  overflow: visible;
}
.rotating-book-editor .album-scene[data-editing='true'] .album-controls {
  z-index: 6;
}
/* Keep progress above the book instead of floating over its paper. */
.rotating-book-editor .album-scene {
  height: min(680px, calc(100vh - 160px));
  min-height: 500px;
  --page-width: min(25vw, calc((100vh - 280px) / 1.416666667), 350px, calc((100cqw - 64px) / 2));
  --page-height: calc(var(--page-width) * 1.416666667);
}
.generation-progress[data-stage='complete'] #progress-history {
  display: none;
}

.album-workspace .book-writing-hit:active:not(:disabled) {
  transform: none;
}

/* Hover follows just the printed wave; the editor has no area-sized frame. */
.album-workspace .book-writing-hit {
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
}
.album-workspace .book-writing-hit svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  opacity: 0;
  pointer-events: none;
}
.album-workspace .book-writing-hit polyline {
  fill: none;
  stroke: #527f6e;
  stroke-width: 3;
}
.album-workspace .book-writing-hit:hover svg,
.album-workspace .book-writing-hit:focus-visible svg {
  opacity: 1;
}
.album-workspace .book-writing-input:focus,
.album-workspace .book-writing-input:focus-visible {
  outline: none;
  outline-offset: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.book-page-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 900px;
  height: 1275px;
  transform-origin: 0 0;
  pointer-events: none;
  z-index: 3;
}
.book-page-overlay .book-writing-hit svg {
  pointer-events: none;
}

.print-settings {
  border-top: 1px solid var(--ui-line);
  margin-top: 20px;
  padding-top: 16px;
}
.print-settings h3 {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 14px;
}
.print-settings summary {
  cursor: pointer;
  font-size: 13px;
  padding: 8px 0;
}
.print-settings details > .workspace-field {
  margin-top: 12px;
}
.print-settings input,
.print-settings select {
  width: 100%;
  min-width: 0;
}
.print-settings input:invalid {
  border-color: #b87b70;
}
.album-workspace .workspace-cover-picker {
  margin: 22px 0;
  padding-top: 18px;
  border-top: 1px solid var(--ui-line);
}
.workspace-cover-picker > .workspace-field {
  max-width: 320px;
}
.workspace-cover-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 16px 10px;
  margin: 12px 0;
}
.workspace-cover-options button {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 4px !important;
  min-width: 0;
  white-space: normal;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  box-shadow: none;
}
.workspace-cover-options button[aria-pressed='true'] {
  border-color: var(--ui-green);
  background: var(--ui-hover-surface);
}

.album-workspace:has(#album-format option[value='square-210']:checked) .workspace-cover-options {
  --cover-thumbnail-ratio: 1;
}
.album-workspace:has(#album-format option[value='a4-landscape']:checked) .workspace-cover-options {
  --cover-thumbnail-ratio: 297 / 210;
}
.workspace-cover-options img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--cover-thumbnail-ratio, 148 / 210);
  object-fit: contain;
  box-shadow: 2px 3px 6px #25372e20;
}
.workspace-cover-options span {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 3.2em;
  font-size: 10px;
  line-height: 1.6;
  margin-top: 5px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.workspace-draft {
  margin: 1rem 0;
  padding: 0.85rem;
  border: 1px solid var(--border, #c9dcd5);
  border-radius: 12px;
  background: #f5faf7;
}

.workspace-draft p {
  margin: 0 0 0.65rem;
}

.workspace-draft [data-stage='error'] {
  color: #9b3434;
}

.workspace-draft button {
  margin: 0.25rem 0.35rem 0 0;
}

@media (max-width: 700px), (pointer: coarse) and (max-width: 1100px) {
  .workspace-heading {
    padding: 22px 16px 16px;
  }
  .workspace-heading h1 {
    font-size: 29px;
  }
  .workspace-layout {
    padding: 0 12px 40px;
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .workspace-panel {
    padding: 16px;
  }
  .album-workspace input[type='text'],
  .album-workspace select {
    font-size: 16px;
    min-height: 44px;
  }
  #photo-list button {
    min-height: 44px;
    min-width: 44px;
  }
  .rotating-book-editor {
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
  .rotating-book-editor .album-scene {
    --page-width: calc((100cqw - 64px) / 2);
    height: 430px;
    min-height: 400px;
  }
  .workspace-cover-options span {
    white-space: normal;
  }
}

.album-workspace .book-writing-hit:focus-visible,
.album-workspace .book-writing-input:focus-visible {
  outline: 3px solid #285e51;
  outline-offset: -3px;
}
.album-workspace .language-picker {
  margin-top: 12px;
}

.workspace-heading {
  position: relative;
}
.workspace-heading .brand {
  display: inline-flex;
  align-items: center;
}
.workspace-heading .language-picker {
  margin: 0 0 0 auto;
}

@media (min-width: 1100px) {
  .rotating-book-editor .album-scene[data-format='a4-landscape'] {
    --page-width: min(30vw, 470px, calc((100cqw - 64px) / 2));
  }
}

@media (max-width: 700px) {
  .workspace-cover-options {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px 6px;
  }
}

/* A compact reserve pool: placed photographs live on the book itself. */
#photo-list.photo-pool {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  list-style: none;
  max-height: 480px;
}
#photo-list.photo-pool .photo-pool-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: #ffffff80;
  cursor: grab;
}
#photo-list.photo-pool .photo-pool-card:active {
  cursor: grabbing;
}
#photo-list.photo-pool .photo-pool-card img {
  width: 100%;
  height: 112px;
  object-fit: contain;
  border-radius: 5px;
  background: #f1f2ec;
}
.photo-pool-actions {
  display: flex;
  justify-content: flex-end;
  gap: 3px;
}
.album-workspace .photo-pool-actions button {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  margin: 0;
  padding: 2px;
  font-size: 17px;
  line-height: 1;
}
#photo-list.photo-pool .photo-drag-over {
  border: 2px solid var(--ui-green);
}
.photo-edit-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 12px 0;
  min-height: 40px;
}
.photo-edit-toolbar[hidden] {
  display: none;
}
.album-workspace .photo-edit-toolbar button {
  margin: 0;
  min-height: 40px;
  padding: 7px 18px;
}
.book-text-clipboard {
  order: -1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-end: auto;
}
.book-text-clipboard[hidden] {
  display: none;
}
.book-text-clipboard button {
  flex: 0 0 auto;
}
.book-text-clipboard [role='status'] {
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1.35;
}
.rotating-book-editor .album-scene[data-photo-mode='true'] .album-book {
  transform: none !important;
}
.album-workspace .book-photo-hit {
  position: absolute;
  display: block;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 3px solid transparent;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  z-index: 2;
}
.album-workspace .book-photo-hit:hover:not(:disabled),
.album-workspace .book-photo-hit:focus-visible {
  border-color: #3c7969;
  background: #3c796910;
  outline: none;
}
.book-photo-hit-label {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 6px 12px;
  background: #fffffff0;
  border-radius: 5px;
  font-size: 28px;
  line-height: 1.4;
  color: #345a4e;
  opacity: 0;
  pointer-events: none;
}
.book-photo-hit:hover .book-photo-hit-label,
.book-photo-hit:focus-visible .book-photo-hit-label {
  opacity: 1;
}
.book-photo-hit[aria-pressed='true'] .book-photo-hit-label {
  opacity: 0;
}
.book-photo-corner {
  position: absolute;
  width: min(30%, var(--book-photo-corner-zone, 65px));
  height: min(30%, var(--book-photo-corner-zone, 65px));
  touch-action: none;
  cursor: nwse-resize;
}
.book-photo-corner:is([data-corner='ne'], [data-corner='sw']) {
  cursor: nesw-resize;
}
.book-photo-corner:is([data-corner='nw'], [data-corner='ne']) { top: 0; }
.book-photo-corner:is([data-corner='sw'], [data-corner='se']) { bottom: 0; }
.book-photo-corner:is([data-corner='nw'], [data-corner='sw']) { left: 0; }
.book-photo-corner:is([data-corner='ne'], [data-corner='se']) { right: 0; }
.book-photo-corner::after {
  content: '';
  position: absolute;
  inset: inherit;
  width: min(100%, var(--book-photo-corner-mark, 28px));
  height: min(100%, var(--book-photo-corner-mark, 28px));
  box-sizing: border-box;
  border: 2px solid var(--ui-page);
  border-radius: 3px;
  background: var(--ui-ink);
  opacity: 0;
  pointer-events: none;
}
.book-photo-hit[aria-pressed='true'] .book-photo-corner::after {
  opacity: 1;
}
@media (hover: hover) {
  .book-photo-hit:hover .book-photo-corner::after {
    opacity: 1;
  }
}
[data-resizing-photo] .book-photo-hit .book-photo-corner::after,
[data-moving-photo] .book-photo-hit .book-photo-corner::after,
.is-dragging-photo .book-photo-hit {
  border: 4px dashed #4b8d76;
  background: #4b8d7610;
}
.album-workspace .book-photo-hit.photo-drag-over {
  border: 7px solid #28785e;
  background: #4b8d7633;
}
:is(.photo-replace-dialog, #draft-entry-choice) {
  width: min(760px, calc(100vw - 32px));
  max-height: 85dvh;
  padding: 28px;
  border: 1px solid var(--ui-line);
  border-radius: 18px;
  color: var(--ui-ink);
  background: var(--ui-page);
  box-shadow: 0 18px 70px #152d2630;
}
:is(.photo-replace-dialog, #draft-entry-choice)::backdrop {
  background: color-mix(in srgb, var(--ui-ink) 28%, transparent);
}
:is(.photo-replace-dialog, #draft-entry-choice) h2 {
  margin: 0 45px 20px 0;
  font-size: 24px;
}
:is(.photo-replace-dialog, #draft-entry-choice) p {
  font-size: 14px;
  color: var(--ui-muted);
}
#draft-entry-choice {
  width: min(32rem, calc(100vw - 32px));
}
#draft-entry-choice .photo-dialog-footer {
  flex-wrap: wrap;
}
.album-workspace .photo-dialog-close {
  position: absolute;
  right: 15px;
  top: 15px;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 25px;
}
.photo-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 20px;
}
.album-workspace .photo-choice-grid button {
  min-width: 0;
  margin: 0;
  padding: 5px;
  border-radius: 8px;
}
.photo-choice-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}
.photo-replace-dialog summary {
  cursor: pointer;
  margin-top: 18px;
  font-size: 14px;
}
.photo-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.album-workspace .photo-dialog-footer button {
  margin: 0;
}
@media (max-width: 700px) {
  :is(.photo-replace-dialog, #draft-entry-choice) {
    padding: 20px;
  }
  .photo-choice-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .album-workspace .photo-pool-actions button {
    width: 40px;
    min-height: 40px;
  }
}

/* Album setup and the book share one work surface. */
.workspace-heading,
.workspace-layout {
  max-width: 1280px;
}
.workspace-heading {
  display: flex;
  align-items: center;
  gap: 26px;
  padding-bottom: 24px;
}
.workspace-heading h1 {
  margin: 0;
  border-inline-start: 1px solid var(--ui-line);
  padding-inline-start: 24px;
  font-size: 20px;
}
.workspace-layout {
  align-items: start;
}
.workspace-panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 18px 16px 0 0;
}
.workspace-fold {
  margin: 12px 0;
  border-bottom: 1px solid var(--ui-line);
}
.workspace-fold > summary {
  padding: 10px 0;
  cursor: pointer;
  font-size: 14px;
}
.workspace-fold[open] {
  padding-bottom: 12px;
}
.workspace-panel p:empty,
.workspace-result-heading p:empty,
#photo-list:empty {
  display: none;
}
#planner-controls .planner-choice:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-inline-end: 14px;
  padding: 4px 0;
}
.planner-choice input {
  margin: 0;
  accent-color: var(--ui-ink);
}
.planner-choice strong {
  font-size: 14px;
  font-weight: 500;
}
.album-workspace .workspace-primary {
  background: var(--ui-ink, #31484a) !important;
  color: white;
}
.workspace-draft {
  padding: 0;
  background: transparent;
  border: 0;
}
.workspace-result-heading {
  padding: 0 0 16px;
}
.workspace-empty {
  min-height: clamp(270px, 40vh, 410px);
  background: var(--ui-card-surface);
  border: 0;
  border-radius: 8px;
}
.selected-cover {
  display: block;
  height: clamp(184px, 31vh, 290px);
  max-width: 85%;
  object-fit: contain;
  box-shadow: 2px 4px 9px #243d341f;
}
.workspace-cover-options {
  display: flex;align-items: flex-start;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 3px 3px 10px;
  scrollbar-width: thin;
}
.workspace-cover-options button {
  flex: 0 0 78px;
  scroll-snap-align: start;
}
.workspace-cover-options span {
  min-height: 0;
  font-size: 12px;
}
@media (max-width: 900px) {
  .workspace-panel {
    padding: 0;
  }
  .workspace-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
  }
  .workspace-heading .language-picker {
    grid-area: 1 / 2;
    justify-self: end;
  }
  .workspace-heading h1 {
    grid-column: 1 / -1;
    border-inline-start: 0;
    padding-inline-start: 0;
    font-size: 22px;
  }
  .workspace-result {
    padding-top: 0;
  }
}

.import-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--ui-line);
  border-radius: 12px;
}
.album-workspace .import-box .workspace-upload {
  justify-content: center;
  align-items: center;
  min-height: 40px;
  margin: 0;
  border: 0;
  padding: 0;
}
.album-workspace .import-box .workspace-upload-button {
  padding: 4px 12px;
  font-size: 14px;
}
.workspace-draft:has(#draft-status:empty) {
  display: none;
}

.workspace-export > summary {
  width: fit-content;
  cursor: pointer;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  padding: 7px 18px;
}
.workspace-export[open] > summary {
  margin-bottom: 12px;
}

.album-workspace .album-book {
  transform: none !important;
}
.workspace-cover-picker {
  min-inline-size: 0;
  max-inline-size: 100%;
}
.cover-scroll-controls {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.cover-scroll-controls button {
  padding: 0;
  width: 32px;
  height: 32px;
  font: 22px/1 sans-serif;
}

/* The editor becomes visible with both inside pages in their reading position. */
#workspace-book:not([data-ready='true']) {
  visibility: hidden;
}

#book-stage {
  position: relative;
}
html.restoring-album {
  scroll-behavior: auto;
  overflow-anchor: none;
}
.album-refresh-frame {
  position: fixed;
  z-index: 5;
  pointer-events: none;
}

/* Free text is drawn on the same paper plane as the editable photographs. */
.album-workspace :is(.book-text-paper, .book-text-hit) {
  position: absolute;
  display: block;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  margin: 0;
  box-shadow: none;
  background: transparent;
  pointer-events: auto;
  cursor: text;
}
.album-workspace .book-text-paper {
  inset: 0;
}
.album-workspace .book-turn-edge {
  --book-turn-gap: 4px;
  --book-turn-zone: 32px;
  --book-turn-gutter: var(--book-turn-left);
  position: absolute;
  top: var(--book-turn-top);
  right: calc(100% - var(--book-turn-gutter) + var(--book-turn-gap));
  height: var(--book-turn-height);
  width: max(0px, min(var(--book-turn-zone), calc(var(--book-turn-gutter) - var(--book-turn-gap))));
  z-index: 2;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
}
.album-workspace .book-turn-edge[data-action='next'] {
  --book-turn-gutter: var(--book-turn-right);
  right: auto;
  left: calc(100% - var(--book-turn-gutter) + var(--book-turn-gap));
}
.album-workspace .book-turn-edge:is(:hover, :active):not(:disabled) {
  background: transparent;
  transform: none;
}
.book-turn-edge::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border: solid var(--ui-ink);
  border-width: 0 0 1.25px 1.25px;
  transform: translate(-50%, -50%) rotate(45deg);
  opacity: 0;
  pointer-events: none;
}
.book-turn-edge[data-action='next']::after {
  transform: translate(-50%, -50%) rotate(225deg);
}
@media (hover: hover) {
  .book-turn-edge:hover::after {
    opacity: 0.85;
  }
}
@media (pointer: coarse) {
  .album-workspace .book-turn-edge {
    --book-turn-zone: 44px;
  }
  .book-turn-edge::after {
    opacity: 0.65;
  }
}
[data-placing-text] .book-turn-edge,
[data-editing='true'] .book-turn-edge,
[data-moving-photo] .book-turn-edge,
[data-resizing-photo] .book-turn-edge {
  visibility: hidden;
}
.album-workspace .spread-turn {
  z-index: 2;
}
[data-placing-text] .book-text-paper {
  cursor: copy;
}
[data-placing-text] :is(.book-writing-hit, .book-text-hit, .book-photo-hit) {
  pointer-events: none;
}
.book-text-paste-preview {
  position: absolute;
  border: var(--text-paste-line, 1px) dashed #41796a;
  background: #78aa931c;
  pointer-events: none;
}
.album-workspace .book-text-hit {
  z-index: 3;
}
.album-workspace.is-dragging-photo .book-text-hit {
  pointer-events: none;
}
.album-workspace :is(.book-text-paper, .book-text-hit):is(:hover, :active):not(:disabled) {
  background: transparent;
  border-color: transparent;
  transform: none;
}
.album-workspace .book-text-paper:focus-visible {
  outline: none;
}
.album-workspace .book-text-paper:focus-visible::after {
  content: '';
  position: absolute;
  left: 12%;
  top: 14%;
  width: 4px;
  height: 36px;
  background: #285e51;
  pointer-events: none;
}
.album-workspace .book-text-hit:focus-visible {
  outline: 3px solid #285e51;
  outline-offset: -3px;
}
@media (hover: hover) {
  .album-workspace .book-text-hit:hover {
    box-shadow: 0 0 0 2px #4b807297;
  }
}
.book-text-frame {
  --text-ui-unit: 1px;
  position: absolute;
  z-index: 4;
  outline: var(--text-ui-unit) solid #41796a;
  outline-offset: var(--text-ui-unit);
  pointer-events: none;
}
.book-text-frame:has(textarea[aria-invalid='true']) {
  outline-color: #a44a3f;
}
.album-workspace .book-text-frame :is(.book-writing-input, .book-writing-preview) {
  inset: 0;
  width: 100%;
  height: 100%;
  outline: 0;
  outline-offset: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  min-height: 0;
  transform-origin: top left;
}
.album-workspace .book-writing-preview {
  box-sizing: border-box;
  overflow: hidden;
}
.album-workspace .book-text-handle {
  position: absolute;
  z-index: 1;
  width: calc(18 * var(--text-ui-unit));
  height: calc(18 * var(--text-ui-unit));
  min-height: 0;
  padding: 0;
  margin: 0;
  border: var(--text-ui-unit) solid #41796a;
  border-radius: calc(3 * var(--text-ui-unit));
  background: #f4f6ef;
  pointer-events: auto;
  touch-action: none;
}
.album-workspace .book-text-handle::before {
  position: absolute;
  inset: calc(-3 * var(--text-ui-unit));
  content: '';
}
.album-workspace .book-text-handle:active {
  transform: none;
  background: #dcece5;
}
.album-workspace .book-text-move {
  top: calc(-24 * var(--text-ui-unit));
  left: calc(50% - 9 * var(--text-ui-unit));
  z-index: 2;
  cursor: move;
}
.album-workspace .book-text-move::after {
  display: block;
  width: calc(8 * var(--text-ui-unit));
  height: calc(12 * var(--text-ui-unit));
  margin: auto;
  background: radial-gradient(circle, #30594e 24%, transparent 28%) 0 0 /
    calc(4 * var(--text-ui-unit)) calc(4 * var(--text-ui-unit));
  content: '';
}
.album-workspace :is(.book-text-resize, .book-text-resize-start) {
  top: calc(50% - 9 * var(--text-ui-unit));
  width: calc(11 * var(--text-ui-unit));
  cursor: ew-resize;
}
.album-workspace .book-text-resize {
  right: calc(-13 * var(--text-ui-unit));
}
.album-workspace .book-text-resize-start {
  left: calc(-13 * var(--text-ui-unit));
}
.book-text-frame[data-inset-start] .book-text-resize-start {
  left: calc(3 * var(--text-ui-unit));
}
.book-text-frame[data-inset-end] .book-text-resize {
  right: calc(3 * var(--text-ui-unit));
}
.book-text-frame[data-inset-move] .book-text-move {
  top: calc(3 * var(--text-ui-unit));
}
.album-workspace :is(.book-text-resize, .book-text-resize-start)::after {
  display: block;
  content: '';
  margin: auto;
  width: calc(4 * var(--text-ui-unit));
  height: calc(8 * var(--text-ui-unit));
  border-inline: var(--text-ui-unit) solid #41796a;
}
[data-adjusting-text='true'] .book-page-overlay::before {
  position: absolute;
  inset: var(--text-safe-y, 42px) var(--text-safe-right, 42px)
    var(--text-safe-y, 42px) var(--text-safe-left, 42px);
  z-index: 3;
  border: 2px dashed #527f6e8c;
  content: '';
  pointer-events: none;
}
.book-text-alignment-line {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  background: #408479;
  opacity: 0.52;
}
.book-text-alignment-line[data-aligned] {
  opacity: 0.9;
}
.book-text-alignment-line[data-axis='x'] {
  inset-block: 0;
  width: var(--text-guide-width);
}
.book-text-alignment-line[data-axis='y'] {
  inset-inline: 0;
  height: var(--text-guide-width);
}
.album-workspace .book-text-tools {
  position: fixed;
  z-index: 55;
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  width: max-content;
  overflow-y: auto;
  padding: 9px;
  border: 1px solid #cbdcd4;
  border-radius: 10px;
  background: #f4f7f2;
  color: #233e37;
  box-shadow: 0 6px 22px #34544b26;
  font: 12px/1.25 system-ui, sans-serif;
}
.album-workspace .book-text-tools label {
  display: grid;
  gap: 3px;
  font-size: 11px;
  color: #435b53;
}
.album-workspace .book-text-tools-expanded {
  width: 420px;
}
.album-workspace .book-text-tools .book-writing-input {
  position: static;
  flex: 0 0 100%;
  min-width: 0;
  height: clamp(52px, 15dvh, 90px);
  padding: 6px 9px;
  border: 1px solid #bdcec4;
  border-radius: 5px;
  background: #fff;
  color: #233e37;
  font-size: 18px;
  line-height: 1.35;
  overflow: auto;
}
.album-workspace .book-text-tools :is(select, input, button) {
  min-width: 0;
  width: auto;
  height: 32px;
  min-height: 32px;
  margin: 0;
  padding: 4px 7px;
  border: 1px solid #bdcec4;
  border-radius: 5px;
  background: #eef4ee;
  color: #233e37;
  font-size: 12px;
  line-height: 1.2;
}
.album-workspace .book-text-tools input[type='number'] {
  width: 52px;
}
.album-workspace .book-text-tools input[type='color'] {
  width: 37px;
  padding: 3px;
}
.album-workspace .book-text-tools .book-edit-done {
  position: static;
  transform: none;
  border-color: #9abfaf;
  background: #daeee3;
}
.album-workspace .book-text-tools :is(select, input, button):focus-visible {
  outline: 2px solid #285e51;
  outline-offset: 1px;
}
@media (pointer: coarse) {
  .album-workspace .book-opening-note-start {
    height: var(--opening-note-height);
  }
  .album-workspace .book-opening-note-start svg {
    height: var(--opening-note-line-share);
  }
  .album-workspace .book-opening-note-continuation {
    pointer-events: none;
  }
  .album-workspace .book-text-handle::before {
    inset: calc(-9 * var(--text-ui-unit));
  }
  .album-workspace .book-text-tools :is(select, input, button) {
    height: 44px;
    min-height: 44px;
    font-size: 16px;
  }
}

.book-photo-size-preview {
  position: absolute;
  inset: 0;
  background-size: 200% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
}
.book-photo-size-marker {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}
.book-photo-size-outline {
  position: absolute;
  z-index: 3;
  outline: 3px solid var(--ui-ink);
  box-shadow: 0 0 0 5px var(--ui-page);
  pointer-events: none;
}
.book-photo-size-controls {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}
.album-workspace .book-photo-size-grip {
  position: absolute;
  margin: 0;
  pointer-events: none;
  opacity: 0;
}
.album-workspace .book-photo-size-grip:focus-visible,
.book-photo-size-controls[data-dragging='true'] .book-photo-size-grip {
  opacity: 1;
}
.album-workspace .book-photo-size-controls button:active:not(:disabled) {
  transform: none;
}
.album-workspace .book-photo-size-grip {
  width: 44px;
  height: 44px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  touch-action: none;
  cursor: nwse-resize;
}
.book-photo-size-grip::after {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 4px;
  border: 2px solid var(--ui-page);
  background: var(--ui-ink);
  box-shadow: 0 1px 5px color-mix(in srgb, var(--ui-ink) 45%, transparent);
}
.album-workspace .book-photo-size-grip:focus-visible {
  outline: 2px solid var(--ui-ink);
  outline-offset: -7px;
}
.album-workspace .book-photo-size-grip:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.book-photo-size-limit {
  position: absolute;
  width: max-content;
  max-width: min(232px, calc(68vw - 12px));
  padding: 4px 7px;
  border-radius: 5px;
  background: var(--ui-page);
  color: var(--ui-ink);
  font-size: 11px;
  line-height: 1.4;
  box-shadow: 0 1px 5px color-mix(in srgb, var(--ui-ink) 22%, transparent);
  pointer-events: none;
}
.album-workspace .book-photo-size-grip:is([data-corner='ne'], [data-corner='sw']) {
  cursor: nesw-resize;
}
html:is([data-book-photo-resize-cursor='nw'], [data-book-photo-resize-cursor='se']) * {
  cursor: nwse-resize !important;
}
html:is([data-book-photo-resize-cursor='ne'], [data-book-photo-resize-cursor='sw']) * {
  cursor: nesw-resize !important;
}
@media (pointer: coarse) {
  .album-workspace .photo-edit-toolbar .book-photo-size-replace {
    min-height: 44px;
  }
}

.album-workspace [data-moving-photo] .book-photo-hit:not(.photo-drag-over):not(:disabled) {
  background: transparent;
  border-color: transparent;
}
html[data-book-photo-resize-cursor='move'] * { cursor: grabbing !important; }
