@font-face {
  font-family: "Libre Baskerville";
  src: url("/assets-v7/fonts/LibreBaskerville.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("/assets-v7/fonts/Lora.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("/assets-v7/fonts/Caveat.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}
.page-ready,
.page-warning {
  border: 1px solid #b9cfb6;
  border-radius: 999px;
  background: #eff8ed;
  color: #356037;
  padding: 5px 8px;
  font-size: 8px;
  font-weight: 900;
  white-space: nowrap;
}
.page-warning {
  border-color: #e0b3a1;
  background: #fff0e9;
  color: #9a4029;
}
.curve-circle {
  border-radius: 50% !important;
  display: grid !important;
  place-items: center !important;
  text-align: center !important;
  padding: 18% !important;
}
.advanced-type-tools {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.advanced-type-tools label {
  display: grid;
  gap: 4px;
  font-size: 9px;
  font-weight: 850;
}
.advanced-type-tools select {
  padding: 8px;
  border: 1px solid #d5b998;
  border-radius: 8px;
}
.saved-text-styles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.saved-text-styles > button {
  border: 1px solid #d4b997;
  border-radius: 9px;
  background: #fff;
  padding: 8px;
}
:root {
  --ink: #2f2823;
  --muted: #7b6d62;
  --paper: #fffaf2;
  --paper2: #f6ecde;
  --line: #ddcdbb;
  --brand: #a84f2b;
  --brand2: #7f3b22;
  --gold: #c5964f;
  --green: #61725a;
  --rose: #b66b72;
  --blue: #58778a;
  --shadow: 0 18px 48px rgba(54, 38, 26, 0.16);
  --shadow2: 0 8px 22px rgba(54, 38, 26, 0.12);
  --radius: 16px;
  --serif: Georgia, "Times New Roman", serif;
  --sans:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--sans);
  color: var(--ink);
  background: #f8f0e5;
}
body {
  overflow-x: hidden;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
img {
  max-width: 100%;
}
a {
  color: inherit;
}
.hidden {
  display: none !important;
}
.btn {
  border: 1px solid var(--line);
  background: #fffaf4;
  color: var(--ink);
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 2px 5px rgba(45, 32, 22, 0.04);
}
.btn:hover {
  border-color: #b99f87;
  background: #fff;
}
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn.primary:hover {
  background: var(--brand2);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.btn.danger {
  color: #a52828;
  border-color: #e9bcbc;
  background: #fff9f9;
}
.btn.small {
  padding: 7px 10px;
  font-size: 11px;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
}
.icon-btn:hover {
  background: #fff8ef;
  border-color: #bd9f84;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #efe3d3;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 950;
  color: var(--brand);
}
.muted {
  color: var(--muted);
}
#toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  max-width: 390px;
  background: #2f2925;
  color: #fff;
  padding: 12px 15px;
  border-radius: 13px;
  box-shadow: var(--shadow);
  font-size: 12px;
  animation: toastin 0.18s ease;
}
.toast.error {
  background: #8f2525;
}
.toast.success {
  background: #2f6d42;
}
@keyframes toastin {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* Brand / dashboard */
.app-shell {
  min-height: 100vh;
}
.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 243, 0.94);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 70;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #b85b34, #8c4127);
  color: white;
  font-size: 20px;
  box-shadow: 0 5px 14px rgba(129, 59, 35, 0.25);
}
.brand-title {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 20px;
  line-height: 1;
}
.brand-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.account-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 5px 10px 5px 5px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #302820;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}
.dashboard {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 30px 70px;
}
.guest-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  gap: 52px;
  align-items: center;
  min-height: calc(100vh - 150px);
}
.guest-copy h1,
.dash-hero h1 {
  font-family: var(--serif);
  font-weight: 900;
  letter-spacing: -0.035em;
}
.guest-copy h1 {
  font-size: clamp(54px, 6vw, 86px);
  line-height: 0.95;
  margin: 9px 0 22px;
  max-width: 700px;
}
.guest-copy p {
  font-size: 17px;
  line-height: 1.7;
  color: #765a47;
  max-width: 670px;
}
.guest-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}
.guest-note {
  margin-top: 18px;
  max-width: 670px;
  border: 1px solid #e4bd7e;
  background: #fff2d9;
  border-radius: 15px;
  padding: 13px 15px;
  font-size: 12px;
  line-height: 1.55;
  color: #6e4a30;
}
.guest-art {
  min-height: 430px;
  display: grid;
  place-items: center;
}
.hero-book {
  width: min(520px, 100%);
  aspect-ratio: 4/3;
  border-radius: 34px;
  background: #d9c29e;
  padding: 36px;
  transform: rotate(1deg);
  box-shadow: var(--shadow);
  position: relative;
}
.hero-book:before {
  content: "";
  position: absolute;
  left: 18px;
  top: 28px;
  bottom: 28px;
  width: 12px;
  border-radius: 9px;
  background: #b58d62;
  box-shadow: inset -3px 0 rgba(75, 48, 25, 0.14);
}
.hero-page {
  height: 100%;
  background: #fff8ec;
  border-radius: 12px;
  position: relative;
  box-shadow: 0 12px 24px rgba(73, 48, 27, 0.16);
  overflow: hidden;
}
.hero-photo {
  position: absolute;
  width: 43%;
  height: 48%;
  left: 11%;
  top: 18%;
  background: #a7ad90;
  border: 10px solid white;
  box-shadow: 0 7px 13px #0002;
  transform: rotate(-4deg);
}
.hero-note {
  position: absolute;
  width: 35%;
  right: 8%;
  bottom: 12%;
  padding: 15px;
  background: #f5dd92;
  font-family: var(--serif);
  font-weight: 800;
  transform: rotate(3deg);
  box-shadow: 0 7px 12px #0002;
}
.hero-tape {
  position: absolute;
  width: 22%;
  height: 28px;
  left: 39%;
  top: 8%;
  background: rgba(205, 151, 103, 0.68);
  transform: rotate(7deg);
}
.dash-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.dash-hero h1 {
  font-size: 48px;
  margin: 5px 0 4px;
}
.dash-hero p {
  margin: 0;
  color: var(--muted);
}
.shelf-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 18px 0 22px;
  flex-wrap: wrap;
}
.search-box {
  position: relative;
  min-width: 320px;
  flex: 1;
  max-width: 520px;
}
.search-box input {
  width: 100%;
  padding: 12px 14px 12px 38px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  font-size: 13px;
}
.search-box:before {
  content: "⌕";
  position: absolute;
  left: 13px;
  top: 8px;
  font-size: 19px;
  color: #8b7867;
}
.filter-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
}
.filter-chip {
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 850;
}
.filter-chip.active {
  background: #302820;
  color: #fff;
  border-color: #302820;
}
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}
.book-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 12px rgba(52, 38, 26, 0.05);
  transition: 0.18s ease;
}
.book-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow2);
}
.book-cover {
  height: 215px;
  position: relative;
  background: linear-gradient(145deg, #eadcc9, #f8f0e5);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.book-cover-fallback {
  width: 72%;
  height: 72%;
  background: #fff8ef;
  box-shadow: 0 12px 22px #0002;
  border: 10px solid #f4eee3;
  display: grid;
  place-items: center;
}
.cover-mini-page {
  width: 68%;
  height: 58%;
  background: linear-gradient(135deg, #cdbba5 0 48%, #aa8d71 49% 100%);
  box-shadow: 0 7px 12px #0002;
}
.book-card-body {
  padding: 15px;
}
.book-card-body h3 {
  font-family: var(--serif);
  font-size: 22px;
  margin: 6px 0;
}
.book-meta {
  display: flex;
  gap: 7px;
  font-size: 10px;
  color: var(--muted);
}
.card-actions {
  display: flex;
  gap: 7px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid #eee2d4;
}
.empty-state {
  padding: 55px 25px;
  text-align: center;
  border: 2px dashed #cdbba5;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.45);
}
.empty-state .big {
  font-size: 46px;
}
.empty-state h2 {
  font-family: var(--serif);
  font-size: 28px;
  margin: 8px 0;
}
.empty-state p {
  max-width: 520px;
  margin: 0 auto 16px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(38, 29, 22, 0.52);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 200;
  backdrop-filter: blur(4px);
}
.modal {
  width: min(760px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #fffaf3;
  border: 1px solid #e2d3c1;
  border-radius: 22px;
  box-shadow: 0 28px 90px rgba(20, 15, 11, 0.35);
  overflow: hidden;
}
.modal.wide {
  width: min(980px, 97vw);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 {
  font-family: var(--serif);
  font-size: 28px;
  margin: 3px 0 0;
}
.modal-body {
  padding: 22px;
  overflow: auto;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
.auth-tabs button {
  padding: 10px;
  border: 0;
  background: #fff;
  font-weight: 900;
}
.auth-tabs button.active {
  background: #2f2823;
  color: #fff;
}
.form-stack {
  display: grid;
  gap: 12px;
}
.field {
  display: grid;
  gap: 6px;
}
.field > label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 950;
  color: #765e4c;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 11px;
  background: #fff;
  font-size: 12px;
  color: var(--ink);
}
.field textarea {
  min-height: 82px;
  resize: vertical;
}
.error-box {
  padding: 10px;
  border: 1px solid #e9b4b4;
  background: #fff1f1;
  color: #a12828;
  border-radius: 10px;
  font-size: 11px;
}
.info-box {
  padding: 14px;
  border: 1px solid #e5c792;
  background: #fff2da;
  border-radius: 13px;
  line-height: 1.55;
  font-size: 12px;
}
.create-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.create-mode {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  text-align: left;
}
.create-mode.active {
  border: 2px solid var(--brand);
  background: #fff6ef;
}
.create-mode strong {
  display: block;
  font-family: var(--serif);
  font-size: 18px;
}
.create-mode span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.4;
}
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.template-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  padding: 13px;
  text-align: left;
  min-height: 120px;
  position: relative;
}
.template-card.active {
  border: 2px solid var(--brand);
  background: #fff5ed;
}
.template-card .template-emoji {
  font-size: 28px;
}
.template-card h4 {
  font-family: var(--serif);
  font-size: 17px;
  margin: 5px 0;
}
.template-card p {
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted);
  margin: 0;
}
.template-card .premium-lock {
  position: absolute;
  right: 8px;
  top: 8px;
  font-size: 9px;
  background: #2f2823;
  color: #fff;
  padding: 4px 6px;
  border-radius: 999px;
}
.size-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.size-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 11px;
  text-align: center;
  font-size: 11px;
  font-weight: 850;
}
.size-card.active {
  border: 2px solid var(--brand);
}

/* Editor layout */
.editor-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #eae0d2;
  overflow: hidden;
}
.editor-top {
  height: 64px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #fffaf3;
  border-bottom: 1px solid var(--line);
  z-index: 40;
}
.editor-title {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
}
.editor-title input {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 20px;
  border: 0;
  background: transparent;
  min-width: 100px;
  max-width: 420px;
  color: var(--ink);
  padding: 4px 5px;
  border-radius: 7px;
}
.editor-title input:focus {
  outline: 2px solid #d7a987;
  background: #fff;
}
.save-state {
  font-size: 10px;
  color: #5f7656;
  white-space: nowrap;
}
.save-state.error {
  color: #a52a2a;
}
.editor-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.editor-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
}
.asset-panel,
.prop-panel {
  background: #fffaf3;
  min-height: 0;
}
.asset-panel {
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
}
.prop-panel {
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.asset-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overflow-x: hidden;
  background: #f4e9dc;
}
.asset-nav button {
  width: 100%;
  min-height: 48px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 5px 3px;
  font-size: 8px;
  font-weight: 900;
  color: #695649;
}
.asset-nav button span {
  display: block;
  font-size: 16px;
  line-height: 1.05;
  margin-bottom: 3px;
}
.asset-nav button.active {
  background: #2f2823;
  color: #fff;
}
.asset-content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}
.panel-title {
  font-family: var(--serif);
  font-size: 20px;
  margin: 0 0 4px;
}
.panel-help {
  font-size: 10px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 12px;
}
.upload-zone {
  border: 2px dashed #c6a787;
  border-radius: 14px;
  background: #fff;
  padding: 16px 10px;
  text-align: center;
  font-weight: 900;
  font-size: 11px;
}
.upload-zone:hover {
  background: #fff7ec;
  border-color: var(--brand);
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 11px;
}
.media-card {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  position: relative;
}
.media-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.media-card .media-add {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: #2f2823;
  color: #fff;
  font-weight: 900;
}
.asset-search {
  display: flex;
  gap: 6px;
  margin-bottom: 9px;
}
.asset-search input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
  font-size: 11px;
}
.category-pills {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 5px;
}
.category-pills button {
  white-space: nowrap;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 9px;
  font-weight: 850;
}
.category-pills button.active {
  background: #2f2823;
  color: #fff;
}
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.sticker-btn {
  aspect-ratio: 1;
  border: 1px solid #eadcca;
  border-radius: 12px;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 29px;
  transition: 0.12s;
}
.sticker-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 11px #0001;
}
.asset-section {
  margin: 15px 0;
}
.asset-section h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 7px;
  color: #765f4d;
}
.asset-list {
  display: grid;
  gap: 7px;
}
.asset-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px;
}
.asset-tile:hover {
  background: #fff6eb;
  border-color: #c9a788;
}
.asset-tile .tile-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #f3e5d2;
  font-size: 22px;
  flex: 0 0 auto;
}
.asset-tile strong {
  font-size: 11px;
  display: block;
}
.asset-tile small {
  font-size: 9px;
  color: var(--muted);
  line-height: 1.3;
  display: block;
  margin-top: 2px;
}
.paper-grid,
.border-grid,
.layout-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}
.paper-swatch,
.border-swatch,
.layout-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 7px;
  text-align: left;
}
.paper-preview {
  height: 60px;
  border-radius: 8px;
  border: 1px solid #ddd;
}
.paper-swatch strong,
.border-swatch strong,
.layout-card strong {
  display: block;
  font-size: 10px;
  margin-top: 5px;
}
.border-preview {
  height: 65px;
  background: #fbf3e8;
  border-radius: 7px;
  position: relative;
}
.border-preview:after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 3px solid #8f6d50;
}
.border-preview.double:after {
  border: 5px double #8f6d50;
}
.border-preview.stitched:after {
  border: 2px dashed #8f6d50;
}
.border-preview.scallop:after {
  border: 8px dotted #b06c5e;
}
.border-preview.photo:after {
  border: 10px solid #fff;
  box-shadow: 0 2px 8px #0002;
}
.layout-preview {
  height: 72px;
  background: #f6eee2;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}
.layout-preview span {
  position: absolute;
  background: #b9a58f;
  border: 4px solid white;
  box-shadow: 0 2px 6px #0001;
}
.layout-preview .t {
  height: 5px;
  background: #6f5c4b;
  border: 0;
  box-shadow: none;
}
.gif-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}
.gif-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  position: relative;
  aspect-ratio: 1;
}
.gif-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gif-card button {
  position: absolute;
  inset: auto 5px 5px auto;
  border: 0;
  background: #2f2823;
  color: #fff;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  font-weight: 900;
}
.provider-note {
  padding: 10px;
  border: 1px solid #e4ca9e;
  background: #fff3da;
  border-radius: 11px;
  font-size: 10px;
  line-height: 1.4;
  color: #674a31;
}
.canvas-area {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #d9cfc1;
}
.canvas-toolbar {
  height: 52px;
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: #f8f1e7;
  border-bottom: 1px solid #cdbba7;
}
.tool-group {
  display: flex;
  gap: 6px;
  align-items: center;
}
.tool-hint {
  font-size: 10px;
  color: #776759;
}
.canvas-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 28px;
  display: grid;
  place-items: center;
  background-color: #d9d0c3;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.22) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.22) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.22) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.22) 75%);
  background-size: 24px 24px;
  background-position:
    0 0,
    0 12px,
    12px -12px,
    -12px 0;
}
.scrap-page {
  position: relative;
  box-shadow: 0 25px 60px rgba(55, 40, 29, 0.28);
  background: #f6eddf;
  overflow: visible;
  transform-origin: center;
}
.scrap-page.landscape {
  width: min(900px, 78vw);
  aspect-ratio: 4/3;
}
.scrap-page.square {
  width: min(760px, 70vw);
  aspect-ratio: 1;
}
.scrap-page.portrait {
  height: min(720px, 72vh);
  aspect-ratio: 3/4;
}
.page-inner {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.page-border {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 999;
}
.page-border.double:after {
  content: "";
  position: absolute;
  inset: 2.3%;
  border: 7px double var(--page-border-color, #8b6a50);
}
.page-border.stitched:after {
  content: "";
  position: absolute;
  inset: 2.5%;
  border: 3px dashed var(--page-border-color, #8b6a50);
  border-radius: 6px;
}
.page-border.scallop:after {
  content: "";
  position: absolute;
  inset: 1.8%;
  border: 10px dotted var(--page-border-color, #9f6a62);
  border-radius: 14px;
}
.page-border.vintage:before,
.page-border.vintage:after {
  content: "";
  position: absolute;
  inset: 2.2%;
  border: 2px solid var(--page-border-color, #74563d);
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.45),
    inset 0 0 0 7px var(--page-border-color, #74563d);
}
.page-border.lace:after {
  content: "";
  position: absolute;
  inset: 1.5%;
  border: 12px double var(--page-border-color, #d9c6b1);
  border-radius: 18px;
  opacity: 0.9;
}
.page-border.film:after {
  content: "";
  position: absolute;
  inset: 1.3%;
  border: 13px dashed #2f2925;
  box-shadow: inset 0 0 0 4px #f4eee3;
}
.page-border.dotted:after {
  content: "";
  position: absolute;
  inset: 2.2%;
  border: 4px dotted var(--page-border-color, #8b6a50);
  border-radius: 6px;
}
.page-border.postage:after {
  content: "";
  position: absolute;
  inset: 1.7%;
  border: 10px dashed var(--page-border-color, #8b6a50);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.55);
}
.page-border.corners:after {
  content: "";
  position: absolute;
  inset: 2.4%;
  background:
    linear-gradient(
        var(--page-border-color, #8b6a50),
        var(--page-border-color, #8b6a50)
      )
      left top/18% 5px no-repeat,
    linear-gradient(
        var(--page-border-color, #8b6a50),
        var(--page-border-color, #8b6a50)
      )
      left top/5px 18% no-repeat,
    linear-gradient(
        var(--page-border-color, #8b6a50),
        var(--page-border-color, #8b6a50)
      )
      right top/18% 5px no-repeat,
    linear-gradient(
        var(--page-border-color, #8b6a50),
        var(--page-border-color, #8b6a50)
      )
      right top/5px 18% no-repeat,
    linear-gradient(
        var(--page-border-color, #8b6a50),
        var(--page-border-color, #8b6a50)
      )
      left bottom/18% 5px no-repeat,
    linear-gradient(
        var(--page-border-color, #8b6a50),
        var(--page-border-color, #8b6a50)
      )
      left bottom/5px 18% no-repeat,
    linear-gradient(
        var(--page-border-color, #8b6a50),
        var(--page-border-color, #8b6a50)
      )
      right bottom/18% 5px no-repeat,
    linear-gradient(
        var(--page-border-color, #8b6a50),
        var(--page-border-color, #8b6a50)
      )
      right bottom/5px 18% no-repeat;
}
.page-border.torn:after {
  content: "";
  position: absolute;
  inset: 1.6%;
  border: 7px dashed var(--page-border-color, #8b6a50);
  filter: drop-shadow(1px 2px 0 rgba(255, 255, 255, 0.7));
  clip-path: polygon(
    0 1%,
    3% 0,
    6% 2%,
    10% 0,
    14% 1%,
    18% 0,
    23% 2%,
    28% 0,
    34% 1%,
    39% 0,
    44% 2%,
    50% 0,
    56% 1%,
    62% 0,
    68% 2%,
    74% 0,
    80% 1%,
    86% 0,
    92% 2%,
    97% 0,
    100% 2%,
    99% 100%,
    95% 98%,
    90% 100%,
    84% 99%,
    78% 100%,
    72% 98%,
    66% 100%,
    60% 99%,
    54% 100%,
    48% 98%,
    42% 100%,
    36% 99%,
    30% 100%,
    24% 98%,
    18% 100%,
    12% 99%,
    6% 100%,
    0 98%
  );
}
.page-border.notebook:after {
  content: "";
  position: absolute;
  inset: 2%;
  border-top: 2px solid var(--page-border-color, #6889a0);
  border-bottom: 2px solid var(--page-border-color, #6889a0);
  box-shadow: inset 34px 0 0 -32px #bd6960;
}
.page-border.floral:after {
  content: "❀  ❧  ❀  ❧  ❀";
  position: absolute;
  inset: 1.7%;
  border: 3px solid var(--page-border-color, #718164);
  border-radius: 18px;
  color: var(--page-border-color, #718164);
  font-size: 24px;
  letter-spacing: 12px;
  text-align: center;
  padding-top: 4px;
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.45);
}
.texture-linen {
  background-color: #f4eadc;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(105, 76, 48, 0.055) 0 1px,
      transparent 1px 4px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(105, 76, 48, 0.035) 0 1px,
      transparent 1px 5px
    );
}
.texture-kraft {
  background-color: #cfae84;
  background-image: radial-gradient(#916b43 0.55px, transparent 0.7px);
  background-size: 6px 6px;
}
.texture-ledger {
  background-color: #f7f0df;
  background-image:
    linear-gradient(rgba(102, 135, 164, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(176, 87, 72, 0.09) 1px, transparent 1px);
  background-size:
    100% 26px,
    28px 100%;
}
.texture-floral {
  background-color: #f5e7e1;
  background-image:
    radial-gradient(
      circle at 12px 12px,
      rgba(178, 102, 116, 0.15) 0 5px,
      transparent 6px
    ),
    radial-gradient(
      circle at 29px 29px,
      rgba(95, 122, 84, 0.12) 0 4px,
      transparent 5px
    );
  background-size: 42px 42px;
}
.texture-blueprint {
  background-color: #dce7eb;
  background-image:
    linear-gradient(rgba(70, 98, 111, 0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 98, 111, 0.11) 1px, transparent 1px);
  background-size: 22px 22px;
}
.texture-parchment {
  background:
    radial-gradient(
      circle at 25% 15%,
      rgba(255, 255, 255, 0.5),
      transparent 30%
    ),
    linear-gradient(135deg, #ead8b7, #f4e7cc 50%, #e3c99e);
}
.texture-christmas {
  background-color: #e8efe5;
  background-image: repeating-linear-gradient(
    45deg,
    rgba(145, 45, 42, 0.08) 0 8px,
    transparent 8px 16px
  );
}
.texture-denim {
  background-color: #c9d9df;
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(55, 82, 94, 0.09) 0 1px,
      transparent 1px 4px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.3) 0 1px,
      transparent 1px 4px
    );
}
.texture-night {
  background: #283545;
  background-image: radial-gradient(#fff9 1px, transparent 1.4px);
  background-size: 34px 34px;
}
.texture-pinkdots {
  background: #f7e2e5;
  background-image: radial-gradient(#dca5ad 2px, transparent 2.5px);
  background-size: 24px 24px;
}
.texture-school {
  background: #f5f1de;
  background-image: linear-gradient(#d5e0ea 1px, transparent 1px);
  background-size: 100% 26px;
}
.texture-map {
  background: #e9dfc6;
  background-image:
    linear-gradient(
      25deg,
      transparent 46%,
      rgba(91, 115, 112, 0.08) 48%,
      transparent 50%
    ),
    linear-gradient(
      -20deg,
      transparent 47%,
      rgba(159, 105, 70, 0.07) 49%,
      transparent 51%
    );
  background-size: 72px 55px;
}
.canvas-element {
  position: absolute;
  user-select: none;
  touch-action: none;
  transform-origin: center;
  overflow: visible;
}
.canvas-element.selected {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
.element-inner {
  width: 100%;
  height: 100%;
  position: relative;
}
.photo-wrap {
  width: 100%;
  height: 100%;
  background: white;
  box-sizing: border-box;
}
.photo-inner {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #e5d8ca;
}
.photo-inner img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
}
.frame-none {
  padding: 0;
}
.frame-simple {
  padding: 4px;
  background: #fff;
  box-shadow: 0 5px 12px #0002;
}
.frame-polaroid {
  padding: 4.5% 4.5% 12%;
  background: #fff;
  box-shadow: 0 9px 22px #0003;
}
.frame-gold {
  padding: 5px;
  background: #bd8b35;
  box-shadow: 0 7px 18px #0002;
}
.frame-wood {
  padding: 7px;
  background: linear-gradient(90deg, #7f593b, #b5865c, #765034);
  box-shadow: 0 8px 18px #0002;
}
.frame-film {
  padding: 7px;
  background: #252525;
  box-shadow: 0 8px 18px #0003;
}
.frame-torn {
  padding: 7px;
  background: #f9f5ed;
  clip-path: polygon(
    1% 0,
    99% 1%,
    100% 20%,
    99% 39%,
    100% 60%,
    99% 80%,
    100% 99%,
    80% 100%,
    61% 99%,
    41% 100%,
    20% 99%,
    0 100%,
    1% 79%,
    0 61%,
    1% 42%,
    0 19%
  );
}
.photo-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border: 2px dashed #a88d73;
  color: #7d6955;
  background: rgba(255, 255, 255, 0.55);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  padding: 8px;
}
.text-inner {
  width: 100%;
  height: 100%;
  white-space: pre-wrap;
  line-height: 1.12;
  word-break: break-word;
  overflow: hidden;
  outline: 0;
}
.text-inner[contenteditable="true"] {
  cursor: text;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(168, 79, 43, 0.2);
}
.note-inner {
  width: 100%;
  height: 100%;
  padding: 10%;
  background: var(--note-color, #f4dda0);
  font-family: var(--serif);
  box-shadow: 0 7px 14px rgba(45, 32, 22, 0.18);
  overflow: hidden;
  white-space: pre-wrap;
}
.label-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7%;
  text-align: center;
  font-family: var(--serif);
  font-weight: 900;
  background: #fff7e7;
  border: 2px solid #9b7658;
  border-radius: 999px;
}
.sticker-inner {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: clamp(20px, 7vw, 74px);
  line-height: 1;
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.13));
}
.tape-inner {
  width: 100%;
  height: 100%;
  background: var(--tape-color, rgba(218, 164, 116, 0.72));
  box-shadow: inset 0 0 0 1px #0001;
  opacity: 0.9;
}
.border-element {
  width: 100%;
  height: 100%;
  border: var(--b-width, 6px) var(--b-style, double) var(--b-color, #7a5d45);
  pointer-events: none;
}
.envelope {
  width: 100%;
  height: 100%;
  position: relative;
  perspective: 500px;
}
.envelope-body {
  position: absolute;
  inset: 18% 4% 4%;
  background: var(--env-color, #d8b58c);
  border: 1px solid #815f3e55;
  box-shadow: 0 8px 18px #0002;
  overflow: hidden;
}
.envelope-body:before,
.envelope-body:after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 72%;
  height: 90%;
  background: color-mix(in srgb, var(--env-color, #d8b58c) 88%, #fff 12%);
  transform-origin: bottom;
}
.envelope-body:before {
  left: -18%;
  transform: skewX(28deg);
}
.envelope-body:after {
  right: -18%;
  transform: skewX(-28deg);
}
.envelope-flap {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 18%;
  height: 45%;
  background: var(--env-flap, #c79768);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  transition: transform 0.45s ease;
  z-index: 5;
}
.envelope-card {
  position: absolute;
  left: 13%;
  right: 13%;
  top: 12%;
  height: 72%;
  background: #fff9ed;
  border: 1px solid #d8c6af;
  box-shadow: 0 4px 8px #0002;
  z-index: 3;
  transform: translateY(31%);
  transition: transform 0.5s ease;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 7%;
  text-align: center;
  font-family: var(--serif);
  font-size: clamp(10px, 1.4vw, 18px);
}
.envelope-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.envelope.open .envelope-flap {
  transform: rotateX(175deg);
}
.envelope.open .envelope-card {
  transform: translateY(-15%);
}
.interactive-hint {
  position: absolute;
  left: 50%;
  bottom: 5%;
  transform: translateX(-50%);
  z-index: 10;
  background: #2f2823;
  color: white;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 8px;
  font-weight: 900;
  white-space: nowrap;
}
.mini-flipbook {
  width: 100%;
  height: 100%;
  position: relative;
  background: #5a4233;
  border-radius: 5px;
  padding: 5%;
  box-shadow: 0 8px 18px #0003;
  overflow: hidden;
}
.mini-flip-page {
  width: 100%;
  height: 100%;
  background: #fff9ee;
  border-radius: 3px;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.mini-flip-page img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mini-flip-page .flip-text {
  padding: 10%;
  text-align: center;
  font-family: var(--serif);
  white-space: pre-wrap;
}
.mini-flip-controls {
  position: absolute;
  left: 50%;
  bottom: 4%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  z-index: 7;
}
.mini-flip-controls button {
  width: 25px;
  height: 25px;
  border: 0;
  border-radius: 50%;
  background: #2f2823;
  color: #fff;
  font-size: 10px;
}
.scratch-card {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #f8efe3;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 9%;
  font-family: var(--serif);
}
.scratch-cover {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #9c9c9c, #dedede, #888);
  display: grid;
  place-items: center;
  color: #333;
  font-weight: 950;
  transition: opacity 0.35s;
}
.scratch-card.revealed .scratch-cover {
  opacity: 0;
  pointer-events: none;
}
.pocket {
  width: 100%;
  height: 100%;
  position: relative;
}
.pocket-back {
  position: absolute;
  inset: 10% 5% 5%;
  background: #b9865b;
  box-shadow: 0 7px 14px #0002;
}
.pocket-card {
  position: absolute;
  left: 15%;
  right: 15%;
  top: 0;
  height: 75%;
  background: #fff9ec;
  box-shadow: 0 4px 9px #0002;
  padding: 8%;
  font-family: var(--serif);
  transform: translateY(16%);
  transition: transform 0.4s;
}
.pocket.open .pocket-card {
  transform: translateY(-22%);
}
.pocket-front {
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: 5%;
  height: 62%;
  background: #d1a273;
  clip-path: polygon(0 18%, 50% 0, 100% 18%, 100% 100%, 0 100%);
}
.gif-inner {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.gif-inner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.selection-toolbar {
  position: absolute;
  left: 50%;
  top: -46px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid #cfbba7;
  border-radius: 12px;
  background: #fffaf3;
  box-shadow: 0 8px 20px #0002;
  z-index: 90;
  white-space: nowrap;
}
.selection-toolbar button {
  height: 29px;
  min-width: 29px;
  border: 0;
  border-radius: 8px;
  background: #f3e8db;
  font-size: 10px;
  font-weight: 900;
}
.selection-toolbar button:hover {
  background: #e8d4c0;
}
.selection-toolbar .move-handle {
  cursor: grab;
  background: #2f2823;
  color: white;
}
.resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid white;
  background: var(--brand);
  border-radius: 50%;
  z-index: 95;
}
.resize-handle.nw {
  left: -8px;
  top: -8px;
  cursor: nwse-resize;
}
.resize-handle.ne {
  right: -8px;
  top: -8px;
  cursor: nesw-resize;
}
.resize-handle.sw {
  left: -8px;
  bottom: -8px;
  cursor: nesw-resize;
}
.resize-handle.se {
  right: -8px;
  bottom: -8px;
  cursor: nwse-resize;
}
.rotate-handle {
  position: absolute;
  width: 17px;
  height: 17px;
  border: 2px solid white;
  background: #2f2823;
  border-radius: 50%;
  left: 50%;
  bottom: -30px;
  transform: translateX(-50%);
  z-index: 95;
  cursor: grab;
}
.rotate-stem {
  position: absolute;
  left: 50%;
  bottom: -19px;
  width: 1px;
  height: 14px;
  background: var(--brand);
}
.page-strip {
  height: 112px;
  flex: 0 0 auto;
  border-top: 1px solid #cdbba7;
  background: #f5ece0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  overflow-x: auto;
}
.page-thumb {
  width: 106px;
  flex: 0 0 auto;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #fff;
  padding: 4px;
}
.page-thumb.active {
  border-color: var(--brand);
}
.page-thumb-preview {
  height: 70px;
  position: relative;
  overflow: hidden;
  border: 1px solid #d5c8b7;
  background: #f8f0e3;
}
.page-thumb-preview .mini-el {
  position: absolute;
  background: #8f6b50;
}
.page-thumb-preview .mini-el.photo {
  background: #b1a18e;
  border: 2px solid white;
}
.page-thumb-preview .mini-el.text {
  height: 4px !important;
  background: #6d5748;
}
.page-thumb-preview .mini-el.sticker {
  border-radius: 50%;
  background: #c98d73;
}
.page-thumb label {
  display: block;
  font-size: 9px;
  margin-top: 2px;
  text-align: center;
  font-weight: 900;
  color: #78685c;
}
.new-page-card {
  width: 92px;
  height: 84px;
  flex: 0 0 auto;
  border: 2px dashed #b9a68c;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.55);
  font-weight: 900;
  color: #725d4a;
}
.new-page-card:hover {
  background: #fff;
}
.prop-head {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.prop-head h3 {
  font-family: var(--serif);
  font-size: 21px;
  margin: 2px 0;
}
.prop-head p {
  font-size: 10px;
  color: var(--muted);
  margin: 2px 0;
}
.prop-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 13px;
}
.quick-edit {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.quick-edit .btn {
  flex: 1;
  min-width: 80px;
}
.prop-section {
  padding: 12px 0;
  border-top: 1px solid #eadfd2;
}
.prop-section:first-child {
  border-top: 0;
  padding-top: 0;
}
.prop-section h4 {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #755f4e;
  margin: 0 0 9px;
}
.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.range-line {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 7px;
  align-items: center;
}
.range-line output {
  font-size: 10px;
  text-align: right;
  color: var(--muted);
}
.swatch-line {
  display: flex;
  gap: 7px;
}
.swatch-line input[type="color"] {
  width: 48px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
  background: #fff;
}
.swatch-line input[type="text"] {
  flex: 1;
}
.mini-list {
  display: grid;
  gap: 6px;
}
.mini-list-row {
  display: grid;
  grid-template-columns: 38px 1fr 28px;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 5px;
}
.mini-list-row img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 6px;
}
.mini-list-row button {
  border: 0;
  background: #f0e3d4;
  border-radius: 7px;
  height: 28px;
}
.no-selection {
  padding: 20px 10px;
  text-align: center;
  color: var(--muted);
}
.no-selection .big {
  font-size: 35px;
}
.no-selection h3 {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--ink);
  margin: 6px 0;
}
.no-selection p {
  font-size: 11px;
  line-height: 1.5;
}
.context-help {
  padding: 10px;
  border-radius: 11px;
  background: #f4e8d8;
  font-size: 10px;
  line-height: 1.45;
  color: #685444;
}

/* Preview/share viewer */
.book-viewer {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: radial-gradient(circle at top, #5b4637, #251e19 65%);
  color: #fff;
  display: flex;
  flex-direction: column;
}
.viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
}
.viewer-head h2 {
  font-family: var(--serif);
  font-size: 24px;
  margin: 0;
}
.viewer-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 8px;
  overflow: auto;
}
.viewer-book {
  position: relative;
  perspective: 1500px;
}
.viewer-page {
  position: relative;
  background: #f6ecdd;
  color: #2f2925;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transition:
    transform 0.45s ease,
    opacity 0.3s ease;
}
.viewer-page.landscape {
  width: min(980px, 88vw);
  aspect-ratio: 4/3;
}
.viewer-page.square {
  height: min(78vh, 760px);
  aspect-ratio: 1;
}
.viewer-page.portrait {
  height: min(80vh, 780px);
  aspect-ratio: 3/4;
}
.viewer-page.turning {
  transform: rotateY(-9deg) scale(0.985);
  opacity: 0.82;
}
.viewer-element {
  position: absolute;
  overflow: visible;
  transform-origin: center;
}
.viewer-controls {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.viewer-controls .btn {
  background: #fff;
  color: #2f2925;
}
.viewer-counter {
  font-size: 11px;
  color: #d8c8bb;
  min-width: 100px;
  text-align: center;
}
.share-box {
  display: grid;
  gap: 13px;
}
.share-url {
  display: flex;
  gap: 7px;
}
.share-url input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  font-size: 12px;
}
.export-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.export-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  text-align: left;
}
.export-card strong {
  display: block;
}
.export-card span {
  font-size: 10px;
  color: var(--muted);
}

/* Print */
#print-root {
  display: none;
}
@media print {
  body {
    overflow: visible;
    background: #fff;
  }
  .app-shell,
  .editor-shell,
  .book-viewer,
  .modal-backdrop,
  #toast-root {
    display: none !important;
  }
  #print-root {
    display: block !important;
  }
  .print-page {
    page-break-after: always;
    width: 10in;
    height: 7.5in;
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    background: #fff;
  }
  .print-page:last-child {
    page-break-after: auto;
  }
}
@media print {
  .print-cover-page {
    padding: 0;
  }
  .print-cover-page > .designed-cover {
    width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
  }
  .print-cover-page .cover-safe-note {
    display: none;
  }
  .print-cover-page .cover-lettering strong {
    font-size: var(--cover-title-size);
  }
}

/* Responsive */
.mobile-drawer,
.mobile-panel-buttons {
  display: none;
}
@media (max-width: 1120px) {
  .editor-main {
    grid-template-columns: 245px minmax(0, 1fr) 270px;
  }
  .scrap-page.landscape {
    width: min(800px, 75vw);
  }
  .dashboard {
    padding-left: 20px;
    padding-right: 20px;
  }
  .guest-hero {
    grid-template-columns: 1fr 440px;
    gap: 28px;
  }
}
@media (max-width: 920px) {
  .guest-hero {
    grid-template-columns: 1fr;
  }
  .guest-art {
    min-height: 330px;
  }
  .hero-book {
    max-width: 470px;
  }
  .editor-main {
    display: block;
    position: relative;
  }
  .asset-panel,
  .prop-panel {
    display: none;
  }
  .canvas-area {
    height: 100%;
  }
  .mobile-panel-buttons {
    display: flex;
    gap: 5px;
  }
  .mobile-drawer {
    display: flex;
    position: absolute;
    inset: 0;
    z-index: 80;
    background: rgba(35, 27, 21, 0.48);
  }
  .mobile-drawer.right {
    justify-content: flex-end;
  }
  .mobile-drawer-panel {
    width: min(380px, 90vw);
    height: 100%;
    background: #fffaf3;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px #0004;
  }
  .mobile-drawer-panel .asset-panel {
    display: grid;
    width: 100%;
    height: 100%;
    border: 0;
  }
  .mobile-drawer-panel .prop-panel {
    display: flex;
    width: 100%;
    height: 100%;
    border: 0;
  }
  .scrap-page.landscape {
    width: min(820px, 90vw);
  }
  .scrap-page.square {
    width: min(680px, 86vw);
  }
  .scrap-page.portrait {
    height: min(670px, 66vh);
  }
  .template-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 680px) {
  .topbar {
    height: 62px;
    padding: 0 10px;
  }
  .brand-title {
    font-size: 16px;
  }
  .brand-mark {
    width: 36px;
    height: 36px;
  }
  .brand-sub,
  .account-text {
    display: none;
  }
  .dashboard {
    padding: 20px 12px 50px;
  }
  .guest-copy h1 {
    font-size: 50px;
  }
  .guest-copy p {
    font-size: 14px;
  }
  .dash-hero {
    align-items: flex-start;
    flex-direction: column;
  }
  .dash-hero h1 {
    font-size: 38px;
  }
  .search-box {
    min-width: 100%;
    max-width: none;
  }
  .book-grid {
    grid-template-columns: 1fr;
  }
  .create-modes,
  .template-grid {
    grid-template-columns: 1fr;
  }
  .editor-top {
    height: auto;
    min-height: 62px;
    padding: 7px;
    align-items: flex-start;
  }
  .editor-title input {
    font-size: 16px;
    max-width: 165px;
  }
  .editor-actions {
    gap: 3px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .editor-actions .btn {
    padding: 7px 8px;
    font-size: 10px;
  }
  .editor-actions .label {
    display: none;
  }
  .canvas-toolbar {
    height: auto;
    min-height: 44px;
    padding: 5px;
  }
  .tool-hint {
    display: none;
  }
  .canvas-scroll {
    padding: 17px 7px;
  }
  .scrap-page.landscape {
    width: 95vw;
  }
  .scrap-page.square {
    width: 92vw;
  }
  .scrap-page.portrait {
    height: min(570px, 64vh);
  }
  .page-strip {
    height: 96px;
  }
  .page-thumb {
    width: 84px;
  }
  .page-thumb-preview {
    height: 54px;
  }
  .selection-toolbar {
    top: -40px;
    max-width: 88vw;
    overflow-x: auto;
  }
  .viewer-page.landscape {
    width: 95vw;
  }
  .viewer-head h2 {
    font-size: 18px;
  }
  .export-grid {
    grid-template-columns: 1fr;
  }
}

/* ================================================================
   V9.8 SPACIOUS FLOATING STUDIO
   Append this block last so it overrides every earlier layout pass.
   Existing data attributes and editor behavior remain unchanged.
   ================================================================ */
@media (min-width: 921px) {
  .studio-editor-main {
    position: relative;
    display: block;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    isolation: isolate;
    background: #d9d0c3;
  }

  .studio-canvas-area {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    z-index: 1;
  }

  .studio-canvas-area .canvas-toolbar {
    width: max-content;
    max-width: calc(100% - 40px);
    height: auto;
    min-height: 48px;
    margin: 14px auto 0;
    padding: 7px 9px;
    border: 1px solid #e6e1d3;
    border-radius: 16px;
    background: rgba(253, 251, 247, 0.88);
    box-shadow:
      0 12px 34px rgba(66, 43, 27, 0.13),
      0 2px 7px rgba(66, 43, 27, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 12;
  }

  .studio-canvas-area .canvas-scroll {
    position: absolute;
    inset: 0 0 104px;
    padding: 82px 46px 38px;
  }

  .studio-float-panel {
    position: absolute;
    top: 78px;
    bottom: 122px;
    width: 310px;
    min-height: 0;
    overflow: hidden;
    border: 1px solid #e6e1d3;
    border-radius: 20px;
    background: rgba(247, 244, 235, 0.94);
    box-shadow:
      0 22px 55px rgba(61, 40, 25, 0.17),
      0 4px 12px rgba(61, 40, 25, 0.08);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transition:
      transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1),
      box-shadow 0.26s ease;
    z-index: 25;
  }

  .studio-assets {
    left: 14px;
    grid-template-columns: 64px minmax(0, 1fr);
    transform: translateX(calc(-100% + 66px));
  }
  .studio-assets:hover,
  .studio-assets:focus-within,
  .studio-assets.is-open {
    transform: translateX(0);
    box-shadow:
      0 28px 68px rgba(61, 40, 25, 0.22),
      0 5px 15px rgba(61, 40, 25, 0.1);
  }

  .studio-properties {
    right: 14px;
    display: flex;
    flex-direction: column;
    transform: translateX(calc(100% - 52px));
  }
  .studio-properties:hover,
  .studio-properties:focus-within,
  .studio-properties.is-open {
    transform: translateX(0);
    box-shadow:
      0 28px 68px rgba(61, 40, 25, 0.22),
      0 5px 15px rgba(61, 40, 25, 0.1);
  }
  .studio-properties:before {
    content: "EDIT";
    position: absolute;
    left: 9px;
    top: 18px;
    writing-mode: vertical-rl;
    color: #8c2d38;
    font-size: 9px;
    font-weight: 950;
    letter-spacing: 0.18em;
    pointer-events: none;
  }
  .studio-properties:hover:before,
  .studio-properties:focus-within:before,
  .studio-properties.is-open:before {
    opacity: 0;
  }

  .studio-float-panel .asset-content,
  .studio-float-panel .prop-body {
    scrollbar-width: thin;
  }

  .btn,
  .icon-btn,
  .canvas-toolbar .tool-group {
    border-color: #e6e1d3;
    background: rgba(253, 251, 247, 0.82);
    box-shadow:
      0 8px 22px rgba(64, 42, 26, 0.1),
      0 2px 5px rgba(64, 42, 26, 0.07);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  .btn:hover:not(:disabled),
  .icon-btn:hover {
    background: #fff;
    border-color: #cdbda8;
    box-shadow:
      0 13px 28px rgba(64, 42, 26, 0.15),
      0 3px 7px rgba(64, 42, 26, 0.08);
  }
  .btn.primary {
    background: linear-gradient(145deg, #9b3b47, #7d2530);
    border-color: #76232d;
    color: #fff;
  }

  .scrap-page.landscape {
    width: min(1080px, calc(100vw - 110px), calc((100vh - 250px) * 4 / 3));
  }
  .scrap-page.square {
    width: min(860px, calc(100vw - 110px), calc(100vh - 250px));
  }
  .scrap-page.portrait {
    height: min(790px, calc(100vh - 250px), calc((100vw - 110px) * 4 / 3));
  }
}

@media (prefers-reduced-motion: reduce) {
  .studio-float-panel {
    transition: none;
  }
}

.embedded-page {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform: translateZ(0);
}
.embedded-el {
  position: absolute;
  transform-origin: center;
  overflow: hidden;
}
.embedded-el .sticker-inner {
  font-size: clamp(8px, 2vw, 24px);
}
.embedded-el .text-inner,
.embedded-el .note-inner,
.embedded-el .label-inner {
  font-size: 6px !important;
}
.embedded-el .selection-toolbar,
.embedded-el .resize-handle,
.embedded-el .rotate-handle,
.embedded-el .rotate-stem,
.embedded-el .interactive-hint {
  display: none !important;
}
.craft-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}
.craft-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 11px;
  padding: 6px;
  text-align: center;
  overflow: hidden;
}
.craft-btn:hover {
  border-color: #bc987b;
  background: #fff8ee;
}
.craft-btn img {
  display: block;
  width: 100%;
  height: 64px;
  object-fit: contain;
}
.craft-btn span {
  font-size: 9px;
  font-weight: 850;
  color: #654f3e;
}
.craft-inner {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 5px 4px rgba(0, 0, 0, 0.12));
}
.craft-inner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* V6 Keepsake Atelier */
:root {
  --ink: #30271f;
  --muted: #79695d;
  --paper: #fffaf2;
  --paper2: #f5e8d8;
  --line: #dcc8b1;
  --brand: #a44728;
  --brand2: #71301d;
  --gold: #c59a54;
  --green: #596f5a;
  --rose: #a85f68;
  --blue: #4f7285;
  --shadow: 0 24px 64px rgba(52, 34, 22, 0.2);
  --shadow2: 0 12px 30px rgba(52, 34, 22, 0.15);
}
body {
  background-color: #f5eadc;
  background-image:
    radial-gradient(
      circle at 12% 10%,
      rgba(255, 255, 255, 0.82),
      transparent 29%
    ),
    linear-gradient(120deg, rgba(172, 111, 68, 0.045), transparent 46%);
}
.topbar {
  background: rgba(255, 249, 240, 0.94);
  box-shadow: 0 8px 28px rgba(63, 42, 26, 0.07);
}
.brand-mark {
  background: linear-gradient(145deg, #bf6338, #82351f);
  border: 1px solid #d89a76;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.35),
    0 7px 17px rgba(118, 48, 28, 0.28);
}
.btn {
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}
.btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(62, 42, 27, 0.12);
}
.open-studio {
  background: #e3eedf;
  color: #39533a;
  border: 1px solid #b9cfb4;
}
.book-card,
.community-card {
  border-color: #d8c1a7;
  box-shadow: 0 11px 30px rgba(58, 39, 25, 0.1);
}
.book-card:hover,
.community-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 44px rgba(58, 39, 25, 0.16);
}
.book-cover {
  background: radial-gradient(circle at 20% 10%, #fff9ed, #e1c8a7 72%);
}
.guest-hero {
  position: relative;
}
.guest-hero:after {
  content: "✦";
  position: absolute;
  right: 46%;
  top: 9%;
  font-size: 30px;
  color: #c79a56;
  opacity: 0.55;
}
.hero-book {
  background: linear-gradient(135deg, #9c6744, #d4b68b);
  border: 1px solid #805237;
  box-shadow: 0 32px 70px rgba(60, 38, 21, 0.29);
}
.hero-page {
  background-color: #fbf3e5;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(120, 80, 44, 0.035) 0 1px,
    transparent 1px 5px
  );
}
.editor-main {
  grid-template-columns: 260px minmax(0, 1fr) 290px;
}
.asset-panel,
.prop-panel {
  box-shadow: 0 0 24px rgba(65, 44, 29, 0.06);
  z-index: 4;
}
.canvas-scroll {
  padding: 24px 18px;
  place-items: center;
  scrollbar-color: #9c7a60 #eadfd1;
}
.scrap-page.landscape {
  width: min(900px, calc(100vw - 610px));
}
.scrap-page.square {
  width: min(760px, calc(100vw - 610px));
}
.scrap-page {
  border: 1px solid rgba(105, 72, 43, 0.22);
  box-shadow: 0 30px 70px rgba(55, 37, 23, 0.3);
}
.canvas-toolbar {
  background: rgba(255, 249, 241, 0.93);
  backdrop-filter: blur(10px);
}
.asset-nav {
  background: linear-gradient(#f3e5d5, #ead8c5);
}
.asset-nav button {
  transition: 0.15s;
}
.asset-nav button.active {
  background: linear-gradient(145deg, #46362c, #241d18);
  box-shadow: 0 6px 14px #3b2b2144;
}
.panel-title {
  font-size: 22px;
}
.heirloom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.heirloom-btn {
  border: 1px solid #dfcbb5;
  border-radius: 13px;
  background: linear-gradient(#fffdf8, #f8efe3);
  padding: 6px;
  min-width: 0;
  text-align: center;
  transition: 0.16s;
}
.heirloom-btn:hover {
  transform: translateY(-2px);
  border-color: #ae7655;
  box-shadow: 0 8px 18px #4d2f1e20;
}
.heirloom-btn strong {
  font-size: 8px;
  line-height: 1.2;
  display: block;
  color: #5d4939;
}
.heirloom-thumb,
.heirloom-sticker {
  display: block;
  background-image: url("heirloom-sticker-sheet.png");
  background-repeat: no-repeat;
  background-size: 400% 400%;
  background-position: calc(var(--sprite-x) * 33.333%)
    calc(var(--sprite-y) * 33.333%);
}
.heirloom-thumb {
  width: 100%;
  aspect-ratio: 1;
  margin: auto;
}
.heirloom-sticker {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 8px 5px rgba(50, 32, 20, 0.2));
}
.sticker-btn {
  background: linear-gradient(#fff, #f9f1e7);
  filter: saturate(0.88);
}
.photo-editor-launch {
  width: 100%;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #a44728, #74301e);
}
.photo-studio {
  width: min(1080px, 97vw);
}
.photo-studio-body {
  display: grid;
  grid-template-columns: minmax(340px, 1.2fr) minmax(300px, 0.8fr);
  min-height: 620px;
  overflow: hidden;
}
.photo-stage {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 26px;
  background: radial-gradient(circle, #56453a, #241d19);
}
.photo-stage-frame {
  width: min(580px, 100%);
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #161311;
  border: 13px solid #f9f3ea;
  box-shadow: 0 30px 60px #0007;
}
.photo-stage-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-stage p {
  color: #ddcdbd;
  font-size: 10px;
  text-align: center;
  max-width: 480px;
}
.photo-tools {
  overflow: auto;
  padding: 20px;
  background: #fffaf3;
  display: grid;
  align-content: start;
  gap: 12px;
}
.photo-presets,
.photo-tool-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.photo-control {
  display: grid;
  gap: 6px;
  border-bottom: 1px solid #eadccc;
  padding-bottom: 9px;
}
.photo-control label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.photo-control output {
  color: var(--brand);
}
.photo-control input {
  width: 100%;
  accent-color: var(--brand);
}
.envelope {
  cursor: pointer;
  isolation: isolate;
}
.envelope-back {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 18%;
  bottom: 4%;
  background: color-mix(in srgb, var(--env-color, #d8b58c) 82%, #6c4228 18%);
  border: 1px solid #6f4a2d66;
  box-shadow: 0 10px 22px #0002;
  z-index: 1;
}
.envelope-card {
  left: 13%;
  right: 13%;
  top: 12%;
  height: 72%;
  z-index: 2;
  transform: translateY(35%);
  transition:
    transform 0.55s cubic-bezier(0.2, 0.75, 0.2, 1),
    box-shadow 0.4s;
  padding: 8%;
  border-radius: 2px;
  background-color: #fff9ed;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(98, 69, 44, 0.04) 0 1px,
    transparent 1px 4px
  );
}
.envelope-front {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 39%;
  bottom: 4%;
  z-index: 3;
  background: var(--env-color, #d8b58c);
  clip-path: polygon(0 0, 50% 43%, 100% 0, 100% 100%, 0 100%);
  border-bottom: 1px solid #815f3e55;
}
.envelope-front:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    32deg,
    transparent 49%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 52%
  );
}
.envelope-flap {
  z-index: 5;
  backface-visibility: hidden;
}
.envelope.open .envelope-flap {
  transform: rotateX(178deg);
  z-index: 1;
}
.envelope.open .envelope-card {
  transform: translateY(-28%);
  box-shadow: 0 15px 24px #0003;
  z-index: 4;
}
.envelope-empty {
  font: 700 10px/1.3 var(--sans);
  color: #8a6f59;
}
.envelope-card img {
  border: 5px solid #fff;
  box-shadow: 0 4px 8px #0002;
}
.mini-flipbook {
  background: var(--book-cover, #5a4233);
  padding: 7% 6% 8% 9%;
  border-radius: 8px;
  overflow: visible;
  isolation: isolate;
}
.mini-flipbook:before {
  content: "";
  position: absolute;
  inset: 2%;
  border: 1px solid rgba(255, 225, 183, 0.5);
  border-radius: 6px;
  pointer-events: none;
}
.mini-flip-spine {
  position: absolute;
  left: 3%;
  top: 5%;
  bottom: 5%;
  width: 7%;
  border-radius: 6px;
  background: linear-gradient(90deg, #0004, #fff2, #0003);
  z-index: 6;
}
.mini-flip-page {
  transform-origin: left center;
  box-shadow: 0 4px 10px #0003;
  transition:
    transform 0.18s ease,
    opacity 0.18s ease;
}
.mini-flipbook.flipping .mini-flip-page {
  transform: perspective(600px) rotateY(-82deg);
  opacity: 0.32;
}
.mini-flip-count {
  position: absolute;
  right: 8%;
  top: 7%;
  background: #2a211bcc;
  color: #fff;
  border-radius: 999px;
  padding: 2px 5px;
  font-size: 7px;
  z-index: 8;
}
.mini-flip-controls {
  bottom: -13px;
}
.mini-flip-controls button {
  box-shadow: 0 4px 10px #0004;
  border: 1px solid #fff6;
}
.mini-flip-controls button:hover {
  background: var(--brand);
}
.pocket {
  cursor: pointer;
  isolation: isolate;
}
.pocket-back {
  z-index: 1;
}
.pocket-card {
  z-index: 2;
  transition: transform 0.5s cubic-bezier(0.2, 0.75, 0.2, 1);
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0 20px,
    rgba(92, 124, 149, 0.13) 21px
  );
}
.pocket-front {
  z-index: 3;
}
.pocket.open .pocket-card {
  transform: translateY(-38%);
}
.interactive-hint {
  transition: 0.2s;
}
.envelope.open .interactive-hint,
.pocket.open .interactive-hint {
  opacity: 0.15;
}
.community-main {
  max-width: 1380px;
  margin: 0 auto;
  padding: 38px 30px 80px;
}
.community-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 35px;
  align-items: end;
  padding: 34px;
  border: 1px solid #d8c1a4;
  border-radius: 28px;
  background:
    radial-gradient(
      circle at 90% 10%,
      rgba(223, 184, 121, 0.25),
      transparent 28%
    ),
    linear-gradient(135deg, #fffaf1, #f0dfc9);
  box-shadow: 0 18px 45px rgba(58, 39, 24, 0.1);
}
.community-hero h1,
.creator-profile h1 {
  font: 900 clamp(38px, 5vw, 70px)/0.98 var(--serif);
  letter-spacing: -0.035em;
  margin: 7px 0 12px;
}
.community-hero p {
  max-width: 780px;
  color: #715b49;
  line-height: 1.65;
}
.community-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 18px;
}
.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 22px;
}
.community-card {
  background: #fffaf3;
  border: 1px solid #d9c3ab;
  border-radius: 22px;
  overflow: hidden;
  transition: 0.2s;
}
.community-cover {
  height: 245px;
  display: block;
  position: relative;
  overflow: hidden;
  background: #e2cdb2;
}
.community-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: 0.3s;
}
.community-card:hover .community-cover img {
  transform: scale(1.025);
}
.community-cover-fallback {
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  background: linear-gradient(145deg, #caa97e, #f1dec2);
  font-family: var(--serif);
}
.community-cover-fallback span {
  font-size: 42px;
  color: #fff;
}
.community-category {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fff9;
  font-size: 9px;
  font-weight: 950;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}
.community-card-body {
  padding: 15px;
}
.creator-line {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}
.creator-line span:last-child {
  display: grid;
}
.creator-line small {
  color: var(--muted);
  font-size: 9px;
}
.community-card h3 {
  font: 900 23px/1.05 var(--serif);
  margin: 11px 0 7px;
}
.community-card h3 a {
  text-decoration: none;
}
.community-card-body > p {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  min-height: 34px;
}
.community-stats {
  display: flex;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid #eadccc;
}
.community-stats button {
  border: 0;
  border-radius: 999px;
  background: #f2e6d7;
  padding: 6px 9px;
  font-size: 10px;
  font-weight: 850;
}
.community-stats button.active {
  background: #ad4f42;
  color: #fff;
}
.community-stats button:last-child {
  margin-left: auto;
}
.community-loading {
  padding: 70px;
  text-align: center;
  font: 800 20px var(--serif);
  color: #735a46;
}
.creator-profile {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 30px;
  border-radius: 26px;
  background: linear-gradient(135deg, #fffaf2, #ecd8bd);
  border: 1px solid #d7bfa2;
  margin-bottom: 24px;
}
.creator-avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #503c2e;
  color: #fff;
  font: 900 34px var(--serif);
  border: 8px solid #fff7eb;
  box-shadow: 0 13px 28px #0002;
}
.creator-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.creator-copy h1 {
  font-size: 48px;
  margin-bottom: 3px;
}
.creator-copy p {
  max-width: 680px;
  line-height: 1.55;
}
.creator-meta {
  display: flex;
  gap: 13px;
  flex-wrap: wrap;
  font-size: 10px;
  color: #6d5a4a;
}
.comment-list {
  display: grid;
  gap: 9px;
  max-height: 380px;
  overflow: auto;
}
.comment {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}
.comment time {
  margin-left: 8px;
  color: var(--muted);
  font-size: 9px;
}
.comment p {
  margin: 6px 0 0;
  line-height: 1.5;
}
.comment-form {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.comment-form textarea {
  min-height: 90px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
}
.empty-mini {
  padding: 25px;
  text-align: center;
  color: var(--muted);
}
.privacy-check {
  font-size: 11px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.publish-panel,
.share-panel,
.export-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.publish-controls {
  display: flex;
  gap: 8px;
  margin-top: 11px;
}
.publish-controls select {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px;
  background: #fff;
}
.export-grid {
  margin-top: 9px;
}
@media (max-width: 1120px) {
  .editor-main {
    grid-template-columns: 235px minmax(0, 1fr) 260px;
  }
  .scrap-page.landscape {
    width: min(840px, calc(100vw - 535px));
  }
  .scrap-page.square {
    width: min(700px, calc(100vw - 535px));
  }
}
@media (max-width: 920px) {
  .scrap-page.landscape {
    width: min(820px, 90vw);
  }
  .scrap-page.square {
    width: min(680px, 86vw);
  }
  .photo-studio-body {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .photo-stage {
    min-height: 420px;
  }
  .photo-tools {
    overflow: visible;
  }
  .community-hero {
    grid-template-columns: 1fr;
  }
  .creator-profile {
    grid-template-columns: 100px 1fr;
  }
  .creator-profile > .btn {
    grid-column: 1/-1;
  }
  .creator-avatar {
    width: 100px;
    height: 100px;
  }
}
@media (max-width: 680px) {
  .heirloom-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .community-main {
    padding: 18px 11px 50px;
  }
  .community-hero {
    padding: 22px;
  }
  .community-grid {
    grid-template-columns: 1fr;
  }
  .community-cover {
    height: 260px;
  }
  .creator-profile {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .creator-avatar {
    margin: auto;
  }
  .creator-meta {
    justify-content: center;
  }
  .photo-studio-body {
    min-height: 0;
  }
  .photo-stage {
    min-height: 320px;
    padding: 15px;
  }
  .photo-stage-frame {
    border-width: 8px;
  }
  .publish-controls {
    display: grid;
  }
  .top-actions .open-studio {
    display: none;
  }
}

.service-link {
  border-color: #b98b55;
  background: #fff4dd;
  color: #70452d;
  text-decoration: none;
}
.service-link:hover {
  background: #f4dfb8;
  border-color: #9d6e3d;
}
@media (max-width: 900px) {
  .topbar .service-link {
    font-size: 0;
    width: 40px;
    height: 40px;
    padding: 0;
  }
  .topbar .service-link:before {
    content: "⌂";
    font-size: 18px;
  }
  .guest-actions .service-link {
    width: auto;
    height: auto;
    padding: 10px 14px;
    font-size: 12px;
  }
  .guest-actions .service-link:before {
    content: none;
  }
}

/* V7 Creative Family Studio */
.collection-sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  padding-bottom: 18px;
}
.collection-sticker-btn {
  aspect-ratio: 1;
  border: 1px solid #dfcbb5;
  border-radius: 12px;
  background: linear-gradient(#fffdf9, #f6eadc);
  padding: 3px;
  overflow: hidden;
  transition: 0.14s;
}
.collection-sticker-btn:hover {
  transform: translateY(-2px) scale(1.035);
  border-color: #a86442;
  box-shadow: 0 8px 18px #3d251522;
}
.collection-sticker-btn span,
.collection-sticker {
  display: block;
  width: 100%;
  height: 100%;
  background-image: var(--sticker-sheet);
  background-repeat: no-repeat;
  background-size: 1000% 1000%;
  background-position: calc(var(--sticker-x) * 11.111%)
    calc(var(--sticker-y) * 11.111%);
  filter: drop-shadow(0 6px 5px rgba(44, 28, 17, 0.2));
}
.sticker-collection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0 8px;
  padding: 9px 10px;
  border-radius: 10px;
  background: #ead8c1;
}
.sticker-collection-head strong {
  font: 900 16px var(--serif);
}
.sticker-collection-head span {
  font-size: 9px;
  color: var(--muted);
}
.v7-category-pills {
  flex-wrap: wrap;
  overflow: visible;
  max-height: 145px;
  overflow-y: auto;
}
.v7-category-pills button {
  flex: 1 0 auto;
}
.photo-inner {
  position: relative;
}
.photo-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    transparent 42%,
    rgba(18, 10, 6, 0.82) 100%
  );
  z-index: 3;
}
.crop-help {
  max-width: 560px;
  padding: 10px 13px;
  border-radius: 11px;
  background: #fff3;
  color: #f6e7d7;
  font-size: 10px;
  line-height: 1.45;
}
.photo-section-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 950;
  color: var(--brand);
  padding: 10px 0 2px;
  border-top: 1px solid #e4d3c0;
}
.photo-tools .field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}
.text-format-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.text-format-row .btn {
  flex: 1;
}
.flip-upload-label {
  display: block;
  text-align: center;
  margin-bottom: 9px;
}
.flip-add-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.selection-toolbar.named-tools {
  top: -49px;
  gap: 2px;
  padding: 4px;
  max-width: none;
  overflow: visible;
}
.selection-toolbar.named-tools button {
  min-width: 46px;
  height: 39px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0;
  padding: 2px 5px;
  border-radius: 6px;
}
.selection-toolbar.named-tools b {
  font-size: 13px;
  line-height: 1;
}
.selection-toolbar.named-tools small {
  font-size: 7px;
  font-weight: 900;
  line-height: 1.1;
}
.selection-toolbar.named-tools .move-handle {
  cursor: grab;
  background: #5c493c;
  color: #fff;
}
.selection-toolbar.named-tools button:last-child {
  color: #a32020;
  background: #fff0f0;
}
.envelope {
  overflow: visible;
}
.envelope-card {
  top: 24%;
  height: 65%;
  transform: translateY(28%) scale(0.94);
  opacity: 0;
  visibility: hidden;
}
.envelope.open .envelope-card {
  transform: translateY(-58%) scale(1);
  opacity: 1;
  visibility: visible;
}
.envelope-front {
  top: 34%;
  filter: drop-shadow(0 8px 8px rgba(45, 27, 15, 0.22));
}
.envelope-back {
  top: 25%;
  border-radius: 4px;
}
.envelope-flap {
  filter: drop-shadow(0 3px 3px rgba(52, 31, 18, 0.22));
}
.envelope.open .envelope-flap {
  filter: none;
}
.mini-flipbook {
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 40%),
    repeating-linear-gradient(
      90deg,
      transparent 0 4px,
      rgba(0, 0, 0, 0.035) 5px
    );
}
.mini-flip-page {
  border: 1px solid #ccbfae;
  background-color: #fffaf0;
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0 15px,
    rgba(91, 119, 139, 0.08) 16px
  );
}
.mini-flip-controls {
  display: grid;
  grid-template-columns: 30px minmax(54px, 1fr) 30px;
  gap: 4px;
  left: 7%;
  right: 4%;
  bottom: -19px;
}
.mini-flip-controls button {
  width: auto;
  height: 27px;
  border-radius: 999px;
  font-size: 12px;
}
.mini-flip-controls .flip-auto {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 950;
  background: #f1c56b;
  color: #2f251e;
}
.mini-flip-controls .flip-auto.running {
  background: #9e4932;
  color: #fff;
}
.mini-flip-spine:after {
  content: "";
  position: absolute;
  left: 50%;
  top: 8%;
  bottom: 8%;
  border-left: 1px dashed #f3d7a777;
}
.asset-content {
  scrollbar-width: thin;
  scrollbar-color: #ac876a #f4e8d9;
}
.prop-head {
  background: linear-gradient(135deg, #fffaf2, #f2e1cd);
}
.context-help strong {
  color: var(--brand);
}
@media (max-width: 680px) {
  .collection-sticker-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .selection-toolbar.named-tools {
    top: -47px;
    max-width: 92vw;
    overflow-x: auto;
  }
  .selection-toolbar.named-tools button {
    min-width: 44px;
  }
  .v7-category-pills {
    max-height: 112px;
  }
}

/* V8 Heirloom Studio visual system — sticker artwork intentionally unchanged */
:root {
  --surface: #fffaf2;
  --surface-raised: #fffdf8;
  --surface-tint: #f3e5d2;
  --line: #d6bea2;
  --brand: #9f482c;
  --brand-deep: #6f2e1d;
  --gold: #c69845;
  --ink: #2f271f;
  --muted: #766453;
  --shadow: 0 12px 30px rgba(59, 38, 22, 0.13);
  --shadow2: 0 20px 48px rgba(49, 30, 17, 0.2);
}
body {
  background:
    radial-gradient(circle at 12% 0, rgba(198, 152, 69, 0.12), transparent 28%),
    linear-gradient(135deg, #f8efe3, #ead9c4);
  color: var(--ink);
}
button,
.btn,
input,
select,
textarea {
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease,
    background 0.18s ease;
}
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(159, 72, 44, 0.26);
  outline-offset: 2px;
  border-color: var(--brand) !important;
}
.btn {
  border: 1px solid #cdb292;
  background: linear-gradient(180deg, #fffefa, #f5e7d5);
  box-shadow:
    0 3px 0 rgba(92, 55, 31, 0.12),
    0 7px 16px rgba(69, 43, 25, 0.08);
  font-weight: 900;
  letter-spacing: 0.01em;
}
.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: #a97452;
  box-shadow:
    0 5px 0 rgba(92, 55, 31, 0.12),
    0 12px 24px rgba(69, 43, 25, 0.14);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(92, 55, 31, 0.14);
}
.btn.primary {
  background: linear-gradient(145deg, #b05a36, #7b321f);
  border-color: #692918;
  color: #fff;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.28),
    0 4px 0 #5d2618,
    0 10px 22px rgba(91, 36, 20, 0.23);
}
.site-header,
.editor-top {
  background: linear-gradient(180deg, #fffdf7, #f7ead9);
  border-bottom: 1px solid #cdb28f;
  box-shadow: 0 8px 24px rgba(66, 41, 24, 0.1);
}
.book-card,
.community-card,
.modal,
.publish-panel,
.share-panel,
.export-panel {
  border: 1px solid #d3b994;
  background: linear-gradient(145deg, #fffdf8, #f8eddf);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.8),
    var(--shadow);
}
.book-card {
  border-radius: 24px;
}
.book-card:hover,
.community-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow2);
}
.asset-panel,
.prop-panel {
  background: linear-gradient(180deg, #fffaf2, #f4e5d3);
}
.asset-nav {
  background: linear-gradient(180deg, #ead9c4, #dfc7aa);
  box-shadow: inset -1px 0 rgba(255, 255, 255, 0.6);
}
.asset-nav button {
  border: 1px solid transparent;
}
.asset-nav button:hover {
  background: rgba(255, 255, 255, 0.58);
  border-color: #ceb18f;
  transform: translateY(-1px);
}
.asset-nav button.active {
  background: linear-gradient(145deg, #513c2e, #2f251e);
  border-color: #201914;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.18),
    0 6px 14px rgba(44, 29, 18, 0.25);
}
.asset-tile,
.paper-swatch,
.border-swatch,
.layout-card,
.template-card,
.create-mode,
.size-card,
.mini-list-row {
  border-color: #d8bea0;
  background: linear-gradient(145deg, #fffefb, #f6e9d8);
  box-shadow: 0 4px 12px rgba(67, 42, 24, 0.07);
}
.asset-tile:hover,
.paper-swatch:hover,
.border-swatch:hover,
.layout-card:hover,
.template-card:hover,
.create-mode:hover,
.size-card:hover {
  transform: translateY(-2px);
  border-color: #a96843;
  box-shadow: 0 10px 22px rgba(67, 42, 24, 0.13);
}
.field input,
.field textarea,
.field select,
.asset-search input,
.search-box input {
  border: 1px solid #cdb493;
  background: #fffdf9;
  box-shadow: inset 0 2px 5px rgba(67, 42, 24, 0.06);
}
.prop-head {
  border-bottom: 1px solid #ceb290;
  background:
    radial-gradient(circle at 90% 0, rgba(198, 152, 69, 0.2), transparent 40%),
    linear-gradient(135deg, #fffaf2, #ecd8bd);
}
.prop-section {
  border-top-color: #d9c1a4;
}
.context-help {
  border: 1px solid #ddc29e;
  background: linear-gradient(135deg, #fff5df, #f1dfc4);
  box-shadow: inset 4px 0 #c69845;
}
.canvas-area {
  background: #cbbba7;
}
.canvas-toolbar {
  background: linear-gradient(180deg, #fff9ef, #ead9c4);
  box-shadow: 0 6px 16px rgba(52, 34, 21, 0.09);
}
.canvas-scroll {
  background-color: #c9bba8;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.18) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.18) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.18) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.18) 75%);
  box-shadow: inset 0 10px 30px rgba(46, 29, 17, 0.12);
}
.scrap-page {
  box-shadow:
    0 4px 0 #aa9279,
    0 30px 70px rgba(48, 30, 17, 0.34);
}
.page-border.double:after {
  border-style: double;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.55),
    0 0 0 1px rgba(65, 42, 25, 0.18);
}
.page-border.stitched:after {
  filter: drop-shadow(0 1px rgba(255, 255, 255, 0.7));
}
.page-border.scallop:after {
  filter: drop-shadow(0 2px 1px rgba(65, 42, 25, 0.17));
}
.selection-toolbar.named-tools {
  border: 1px solid #bea07d;
  background: linear-gradient(180deg, #fffdf8, #eddbc5);
  box-shadow: 0 10px 25px rgba(49, 31, 18, 0.25);
}
.selection-toolbar.named-tools button {
  border: 1px solid #d6bea1;
  background: linear-gradient(#fffefa, #f0dfca);
  box-shadow: 0 2px 4px rgba(61, 38, 21, 0.1);
}
.selection-toolbar.named-tools button:hover {
  transform: translateY(-2px);
  border-color: #a8603c;
  box-shadow: 0 6px 12px rgba(61, 38, 21, 0.18);
}
.book-viewer {
  background: radial-gradient(circle at 50% 0, #6d523d, #241b15 68%);
}
.viewer-page {
  box-shadow:
    0 5px 0 #a99177,
    0 35px 100px rgba(0, 0, 0, 0.62);
}
.mini-flipbook {
  border: 1px solid rgba(53, 31, 17, 0.65);
  border-radius: 11px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 230, 189, 0.16),
    0 12px 24px rgba(45, 27, 15, 0.32);
}
.mini-flipbook:before {
  border: 2px double rgba(255, 222, 170, 0.58);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.13);
}
.mini-flip-page {
  border: 1px solid #c3a982;
  box-shadow:
    0 2px 0 #d7c4a9,
    0 5px 0 #bda988,
    0 10px 18px rgba(35, 23, 14, 0.32);
}
.mini-flipbook.flipping .mini-flip-page {
  transform: perspective(700px) rotateY(-88deg) translateX(-2%);
  opacity: 0.22;
}
.mini-flipbook.flipped-in .mini-flip-page {
  animation: flip-settle 0.22s ease-out;
}
@keyframes flip-settle {
  from {
    transform: perspective(700px) rotateY(24deg);
    opacity: 0.55;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.mini-flip-controls {
  z-index: 20;
}
.mini-flip-controls button {
  border: 1px solid #d7b985;
  background: linear-gradient(#fff8e8, #e7cfa6);
  color: #33271e;
  box-shadow:
    0 3px 0 #9b7b55,
    0 7px 13px rgba(38, 24, 14, 0.28);
}
.mini-flip-controls button:hover {
  transform: translateY(-2px);
  background: linear-gradient(#c7653e, #873922);
  color: #fff;
}
.mini-flip-controls button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #8c6a46;
}
.mini-flip-controls .flip-auto {
  background: linear-gradient(#f4cf78, #c4943e);
  border-color: #9c712d;
}
.mini-flip-controls .flip-auto.running {
  background: linear-gradient(#b9573b, #7a2d1f);
  border-color: #682217;
  color: #fff;
}
.mini-flip-count {
  border: 1px solid rgba(255, 235, 205, 0.42);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  font-weight: 900;
}
.modal-backdrop {
  background: rgba(35, 24, 17, 0.64);
  backdrop-filter: blur(7px);
}
.filter-chip,
.category-pills button {
  border-color: #d1b695;
  background: linear-gradient(#fffdf8, #f1dfca);
  box-shadow: 0 2px 6px rgba(60, 38, 22, 0.06);
}
.filter-chip:hover,
.category-pills button:hover {
  transform: translateY(-1px);
  border-color: #aa6a45;
}
.filter-chip.active,
.category-pills button.active {
  background: linear-gradient(145deg, #513c2e, #2f251e);
  border-color: #2a211b;
  box-shadow: 0 5px 12px rgba(43, 28, 17, 0.24);
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* V8.1 focused creative workflow */
.editor-main {
  grid-template-columns: 290px minmax(0, 1fr) 350px;
}
.prop-panel {
  box-shadow: -10px 0 28px rgba(50, 31, 18, 0.08);
  z-index: 5;
}
.prop-head {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 18px 18px 15px;
}
.prop-head h3 {
  font-size: 24px;
}
.prop-body {
  padding: 14px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.prop-section {
  border: 1px solid #d8bea0 !important;
  border-radius: 16px;
  padding: 15px !important;
  background: linear-gradient(145deg, #fffdf8, #f4e5d3);
  box-shadow: 0 7px 18px rgba(60, 37, 21, 0.08);
}
.prop-section h4 {
  font-size: 10px;
  color: #6e4b35;
  margin-bottom: 12px;
}
.quick-edit {
  position: sticky;
  top: 88px;
  z-index: 2;
  padding: 8px;
  border: 1px solid #d4b999;
  border-radius: 14px;
  background: rgba(255, 250, 242, 0.94);
  backdrop-filter: blur(8px);
}
.photo-upload-card {
  min-height: 134px;
  border: 1px solid #caa57e;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 0, rgba(198, 152, 69, 0.18), transparent 48%),
    linear-gradient(145deg, #fffdf8, #f0dfca);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  text-align: center;
  cursor: pointer;
  box-shadow:
    inset 0 1px #fff,
    0 8px 20px rgba(64, 39, 21, 0.1);
}
.photo-upload-card:hover {
  transform: translateY(-2px);
  border-color: #9f482c;
  box-shadow: 0 13px 26px rgba(64, 39, 21, 0.16);
}
.photo-upload-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(#b75c38, #7b321f);
  color: #fff;
  font-size: 23px;
  box-shadow: 0 4px 0 #5d2618;
}
.photo-upload-card strong {
  font: 900 17px var(--serif);
}
.photo-upload-card small {
  font-size: 9px;
  color: var(--muted);
  max-width: 190px;
}
.photo-empty {
  margin-top: 13px;
  padding: 25px 10px;
  border: 1px solid #ddc7aa;
  border-radius: 16px;
  background: #fff9f0;
  text-align: center;
  display: grid;
  gap: 5px;
}
.photo-empty span {
  font-size: 30px;
}
.photo-empty strong {
  font: 900 15px var(--serif);
}
.photo-empty small {
  font-size: 9px;
  color: var(--muted);
}
.gif-entry-card {
  padding: 18px;
  border: 1px solid #d0af85;
  border-radius: 20px;
  background:
    radial-gradient(circle at 90% 0, rgba(198, 152, 69, 0.24), transparent 38%),
    linear-gradient(145deg, #fffaf0, #e9d3b6);
  box-shadow: var(--shadow);
  text-align: center;
}
.gif-entry-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #4f3b2d, #231b16);
  color: #f5cb76;
  font-weight: 950;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 18px #0003;
}
.gif-entry-card h3 {
  font: 900 24px var(--serif);
  margin: 0 0 5px;
}
.gif-entry-card p {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}
.gif-browser-open {
  width: 100%;
  margin: 8px 0 14px;
}
.gif-quick-row {
  display: flex;
  gap: 5px;
  justify-content: center;
  flex-wrap: wrap;
}
.gif-quick-row button {
  border: 1px solid #cfb18b;
  border-radius: 999px;
  background: #fffaf1;
  padding: 6px 9px;
  font-size: 9px;
  font-weight: 900;
}
.gif-browser-modal {
  width: min(1120px, 96vw);
  height: min(820px, 92vh);
}
.gif-browser-body {
  padding: 20px;
  overflow: auto;
  display: grid;
  gap: 14px;
  align-content: start;
}
.gif-search-large {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 8px;
  background: rgba(255, 250, 242, 0.94);
  backdrop-filter: blur(8px);
  border-radius: 15px;
}
.gif-search-large input {
  min-width: 0;
  border: 1px solid #c8a984;
  border-radius: 13px;
  padding: 13px 15px;
  font-size: 14px;
  background: #fff;
}
.gif-category-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.gif-browser-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.gif-result {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid #d3b895;
  border-radius: 15px;
  overflow: hidden;
  background: #ead9c4;
  padding: 0;
  box-shadow: 0 7px 18px rgba(49, 30, 17, 0.12);
}
.gif-result img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gif-result span {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(38, 28, 21, 0.88);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  opacity: 0;
  transform: translateY(5px);
}
.gif-result:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow2);
}
.gif-result:hover span,
.gif-result:focus-visible span {
  opacity: 1;
  transform: none;
}
.gif-welcome {
  padding: 70px 20px;
  text-align: center;
  border: 1px solid #dcc4a5;
  border-radius: 18px;
  background: #fff9ef;
  display: grid;
  gap: 6px;
}
.gif-welcome strong {
  font: 900 24px var(--serif);
}
.gif-welcome span,
.giphy-credit {
  font-size: 10px;
  color: var(--muted);
}
.giphy-credit {
  text-align: right;
}
.gif-loading {
  padding: 45px;
  text-align: center;
  font: 900 20px var(--serif);
}
.photo-studio-backdrop {
  isolation: isolate;
}
.photo-studio {
  height: min(860px, 94vh);
  border: 1px solid #c9aa83;
}
.photo-studio-body {
  min-height: 0;
  flex: 1;
}
.photo-stage-frame {
  border: 10px solid #fff9ef;
  border-radius: 4px;
  box-shadow:
    0 4px 0 #b49a7b,
    0 24px 58px rgba(0, 0, 0, 0.48);
}
.photo-tools {
  padding: 22px;
}
.photo-tool-actions {
  position: sticky;
  bottom: 0;
  padding: 10px 0;
  background: linear-gradient(transparent, #fffaf3 22%);
}
body:not(.photo-studio-open) .photo-studio-backdrop {
  display: none !important;
}
.field select[data-prop="fontFamily"] {
  min-height: 44px;
  font-size: 13px;
}
.field select[data-prop="fontFamily"] option {
  padding: 8px;
  font-size: 15px;
}
@media (max-width: 1220px) {
  .editor-main {
    grid-template-columns: 250px minmax(0, 1fr) 310px;
  }
  .gif-browser-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 760px) {
  .gif-browser-modal {
    width: 98vw;
    height: 94vh;
  }
  .gif-browser-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .gif-search-large {
    grid-template-columns: 1fr;
  }
  .prop-body {
    padding: 10px;
  }
}

/* V8.2 persistent-outline and missing-photo cleanup */
.new-page-card {
  border: 1px solid #c9ae8c;
  background: linear-gradient(145deg, #fffdf8, #edddca);
  box-shadow: 0 4px 12px rgba(58, 36, 20, 0.08);
}
.new-page-card:hover {
  border-color: #9f482c;
  background: #fff9ef;
  transform: translateY(-2px);
  box-shadow: 0 9px 20px rgba(58, 36, 20, 0.14);
}
.upload-zone,
.empty-state {
  border-style: solid;
}
.photo-placeholder {
  border: 1px solid #c9ad8d;
  background: linear-gradient(
    145deg,
    rgba(255, 253, 248, 0.88),
    rgba(239, 222, 202, 0.88)
  );
  border-radius: 10px;
}
.photo-placeholder.photo-missing {
  color: #77553e;
  line-height: 1.45;
}
.photo-placeholder.photo-missing small {
  font-size: 8px;
  font-weight: 700;
  color: #9b6b50;
}

/* V8.3 verified fixes from live screenshots */
.modal-backdrop {
  z-index: 5000;
}
.prop-body > .quick-edit {
  position: static;
  top: auto;
  z-index: auto;
  margin-bottom: 0;
}
.photo-editor-launch {
  position: relative;
  z-index: 1;
  display: block;
  visibility: visible;
}
.resize-handle,
.rotate-handle,
.selection-toolbar [data-move-handle] {
  pointer-events: auto;
}

/* V8.7 editor correctness: borders intentionally unchanged */
.photo-inner img,
.photo-stage-frame img {
  object-fit: contain;
}
.photo-stage-frame {
  background: #eee2d2;
}
.photo-stage {
  background: radial-gradient(circle at 50% 38%, #5a493c, #2b231e 72%);
  padding: 20px;
}
.photo-stage-frame img {
  transform-origin: center center;
}
.canvas-element.toolbar-below .selection-toolbar.named-tools {
  top: calc(100% + 8px);
}
.photo-studio {
  height: min(820px, 92vh);
}
.photo-studio-body {
  grid-template-columns: minmax(430px, 1.35fr) minmax(360px, 0.9fr);
}
.photo-tools {
  padding: 18px;
  scrollbar-gutter: stable;
}
.photo-tool-actions {
  position: static;
  background: transparent;
  padding: 4px 0;
}
@media (max-width: 920px) {
  .photo-studio-body {
    grid-template-columns: 1fr;
  }
  .photo-stage {
    min-height: 390px;
  }
  .canvas-element.toolbar-below .selection-toolbar.named-tools {
    left: 0;
    right: auto;
  }
}

/* V8.8 guided creation and professional arrangement */
.canvas-toolbar {
  flex-wrap: wrap;
}
.arrange-bar {
  order: 3;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border-top: 1px solid #d8c1a4;
  overflow-x: auto;
  background: #f7ead8;
}
.arrange-bar > span {
  font-size: 9px;
  font-weight: 950;
  text-transform: uppercase;
  color: #7d5b43;
  min-width: 58px;
}
.arrange-bar button,
.arrange-bar summary {
  white-space: nowrap;
  border: 1px solid #ceb18e;
  border-radius: 7px;
  background: #fffaf2;
  padding: 5px 7px;
  font-size: 8px;
  font-weight: 850;
}
.arrange-bar details {
  position: relative;
}
.arrange-bar details > div {
  position: absolute;
  z-index: 400;
  top: 27px;
  left: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  width: 170px;
  padding: 7px;
  background: #fff;
  border: 1px solid #caae8a;
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.canvas-element.multi-selected {
  outline: 2px solid #3979b7;
  outline-offset: 2px;
}
.canvas-element.primary-selected {
  outline-color: #a64e32;
}
.canvas-element.locked {
  cursor: not-allowed;
}
.lock-badge {
  position: absolute;
  right: 3px;
  top: 3px;
  z-index: 900;
  background: #fff;
  border-radius: 999px;
  padding: 3px;
  font-size: 9px;
}
.layers-modal {
  width: min(620px, 94vw);
}
.layer-list {
  display: grid;
  gap: 6px;
  max-height: 70vh;
  overflow: auto;
}
.layer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  border: 1px solid #ddc7ab;
  border-radius: 10px;
  background: #fffaf2;
  padding: 5px;
}
.layer-row.active {
  border-color: #a54f33;
  box-shadow: inset 4px 0 #a54f33;
}
.layer-row > [data-layer-select] {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 7px;
}
.layer-row > div {
  display: flex;
  gap: 3px;
}
.layer-row > div button {
  width: 31px;
  height: 31px;
  border: 1px solid #d1b796;
  border-radius: 7px;
  background: #fff;
}
.snap-guide {
  position: absolute;
  z-index: 2000;
  pointer-events: none;
  background: #2c8fc9;
  box-shadow: 0 0 0 1px #fff9;
}
.snap-guide-x {
  top: 0;
  bottom: 0;
  width: 2px;
}
.snap-guide-y {
  left: 0;
  right: 0;
  height: 2px;
}
.spacing-badge {
  position: absolute;
  z-index: 2001;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  padding: 5px 8px;
  border-radius: 999px;
  background: #247baa;
  color: #fff;
  font-size: 8px;
  box-shadow: 0 3px 10px #0003;
  pointer-events: none;
}
.guided-modal {
  width: min(980px, 96vw);
}
.guided-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.guided-upload,
.guided-review {
  grid-column: 1/-1;
  padding: 17px;
  border: 1px dashed #b98761;
  border-radius: 14px;
  background: #fff9ef;
  display: grid;
  gap: 5px;
}
.guided-upload input {
  margin-top: 8px;
}
.guided-file-summary {
  grid-column: 1/-1;
  font-size: 10px;
  color: #715b49;
}
.guided-actions {
  grid-column: 1/-1;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
@media (max-width: 720px) {
  .guided-grid {
    grid-template-columns: 1fr;
  }
  .guided-grid > * {
    grid-column: 1;
  }
  .arrange-bar {
    padding-bottom: 9px;
  }
}

/* V8.9 interactive keepsakes and handmade illustrated interface */
.envelope {
  overflow: visible;
  cursor: pointer;
  filter: drop-shadow(0 10px 10px rgba(64, 39, 22, 0.24));
  perspective: 700px;
}
.envelope-shadow {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -7%;
  height: 14%;
  border-radius: 50%;
  background: #3b241833;
  filter: blur(5px);
}
.envelope-back {
  position: absolute;
  inset: 13% 3% 3%;
  border-radius: 7px;
  background: linear-gradient(
    155deg,
    color-mix(in srgb, var(--env-color), white 20%),
    var(--env-color)
  );
  border: 2px solid color-mix(in srgb, var(--env-color), #69422b 28%);
  box-shadow: inset 0 0 0 3px #fff5;
}
.envelope-front {
  position: absolute;
  inset: 34% 3% 3%;
  z-index: 5;
  border-radius: 0 0 7px 7px;
  background:
    linear-gradient(
      150deg,
      transparent 49%,
      color-mix(in srgb, var(--env-color), #b9794b 12%) 50%
    ),
    linear-gradient(210deg, transparent 49%, var(--env-color) 50%);
  border: 0;
}
.envelope-front:after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0 0 7px 7px;
  border: 2px solid color-mix(in srgb, var(--env-color), #69422b 30%);
  border-top: 0;
}
.envelope-flap {
  position: absolute;
  z-index: 7;
  left: 3%;
  right: 3%;
  top: 13%;
  height: 49%;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--env-flap), white 28%),
    var(--env-flap)
  );
  transform-origin: top center;
  transition:
    transform 0.48s cubic-bezier(0.2, 0.7, 0.2, 1),
    z-index 0.05s 0.24s;
  filter: drop-shadow(0 3px 2px #43291b3a);
}
.envelope-card {
  position: absolute;
  z-index: 3;
  left: 10%;
  right: 10%;
  top: 18%;
  height: 68%;
  box-sizing: border-box;
  padding: 10% 8%;
  border: 2px solid #d2b994;
  border-radius: 5px;
  background: linear-gradient(#fffdf7, #f5e6cf);
  box-shadow: 0 5px 12px #3e251a30;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  transform: translateY(16%) scale(0.93);
  transition:
    transform 0.52s 0.16s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.4s;
}
.envelope-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.envelope-note {
  display: block;
  font:
    700 9px/1.35 Georgia,
    serif;
  color: #59402e;
  text-align: center;
}
.envelope-seal {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 12%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 28%, #d87858, #843422 70%);
  color: #ffdba2;
  border: 1px solid #6f291c;
  box-shadow: 0 2px 4px #0003;
}
.envelope.open .envelope-flap {
  transform: rotateX(180deg);
  z-index: 2;
}
.envelope.open .envelope-card {
  transform: translateY(-58%) scale(1);
  z-index: 6;
  box-shadow: 0 16px 25px #3e251a42;
}
.envelope.open .envelope-seal {
  opacity: 0;
}
.envelope .interactive-hint {
  z-index: 12;
  bottom: -25px;
  background: #3f2d22;
  color: #fff;
  border: 1px solid #d4b485;
  border-radius: 999px;
  padding: 5px 9px;
  box-shadow: 0 4px 9px #0003;
}
.mini-flipbook {
  overflow: visible;
  border: 2px solid color-mix(in srgb, var(--book-cover), #000 25%);
  border-radius: 13px;
  background: var(--book-cover);
  box-shadow:
    0 5px 0 color-mix(in srgb, var(--book-cover), #000 35%),
    0 15px 25px #3320154a;
  padding: 8px 8px 46px 15px;
  box-sizing: border-box;
}
.mini-flip-cover {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 14px;
  border-radius: 10px 0 0 10px;
  background: linear-gradient(90deg, #0004, #fff2, #0003);
  z-index: 12;
}
.mini-flip-cover span {
  display: none;
}
.mini-flip-spine {
  left: 13px;
  top: 5%;
  bottom: 5%;
  width: 5px;
  background: repeating-linear-gradient(0deg, #d9b166 0 3px, #6c4526 3px 6px);
  border-radius: 5px;
  z-index: 15;
}
.mini-flip-pages {
  height: 100%;
  border-radius: 5px;
  background: #d8c5a8;
  box-shadow:
    2px 3px 0 #b59a76,
    4px 6px 0 #8f7454;
}
.mini-flip-page {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  border: 1px solid #cdb58f;
  border-radius: 4px;
  background-color: #fffaf0;
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0 17px,
    #8ea3b21b 18px
  );
  transform-origin: left center;
  backface-visibility: hidden;
  overflow: hidden;
}
.mini-flip-page.page-turn-forward {
  animation: paper-turn-forward 0.52s ease-in-out;
}
.mini-flip-page.page-turn-back {
  animation: paper-turn-back 0.52s ease-in-out;
}
.mini-flip-footer {
  position: absolute;
  left: 18px;
  right: 6px;
  bottom: 5px;
  height: 36px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 5px;
}
.mini-flip-count {
  position: static;
  padding: 3px 6px;
  font-size: 7px;
  white-space: nowrap;
}
.mini-flip-controls {
  position: static;
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  gap: 4px;
}
.mini-flip-controls button {
  height: 29px;
  min-width: 0;
  border-radius: 7px;
  font-size: 11px;
}
.mini-flip-controls .flip-auto {
  font-size: 7px;
}
.mini-flip-controls .flip-auto.running {
  background: #7f2f23;
  color: #fff;
}
.mini-page-icon {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #fffdf6, #ead6b8);
  border: 1px solid #c9ab82;
  font:
    900 14px Georgia,
    serif;
}
@keyframes paper-turn-forward {
  0% {
    transform: perspective(700px) rotateY(0);
    filter: brightness(1);
  }
  48% {
    transform: perspective(700px) rotateY(-88deg);
    filter: brightness(0.72);
  }
  52% {
    transform: perspective(700px) rotateY(88deg);
    filter: brightness(0.75);
  }
  100% {
    transform: perspective(700px) rotateY(0);
    filter: brightness(1);
  }
}
@keyframes paper-turn-back {
  0% {
    transform: perspective(700px) rotateY(0);
  }
  48% {
    transform: perspective(700px) rotateY(88deg);
  }
  52% {
    transform: perspective(700px) rotateY(-88deg);
  }
  100% {
    transform: perspective(700px) rotateY(0);
  }
}
.asset-nav button .tile-icon,
.asset-tile .tile-icon,
.photo-upload-icon,
.gif-entry-mark {
  filter: drop-shadow(0 3px 2px #54321f35);
}
.asset-tile,
.create-mode,
.layout-card,
.template-card {
  position: relative;
  overflow: hidden;
}
.asset-tile:before,
.create-mode:before,
.layout-card:before,
.template-card:before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, #fff8 0 2px, transparent 3px),
    linear-gradient(135deg, #fff6, transparent 45%);
  mix-blend-mode: soft-light;
}
.asset-panel,
.prop-panel {
  background-image:
    radial-gradient(circle at 20% 0, #fff9, transparent 28%),
    repeating-linear-gradient(0deg, transparent 0 22px, #8f634108 23px);
}
.gif-upload-direct {
  display: block;
  margin: 8px 0;
  text-align: center;
}
.gif-maker-modal {
  width: min(900px, 96vw);
}
.gif-maker-body {
  display: grid;
  gap: 15px;
}
.gif-frame-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  min-height: 85px;
  padding: 10px;
  border: 1px solid #d6b991;
  border-radius: 14px;
  background: #f5e5d1;
}
.gif-frame-strip > div {
  position: relative;
  aspect-ratio: 1;
  border: 5px solid #fff;
  border-radius: 7px;
  box-shadow: 0 4px 9px #4d2f1d2a;
  overflow: hidden;
}
.gif-frame-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gif-frame-strip b {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #79331f;
  color: #fff;
  font-size: 9px;
}
.gif-maker-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 700px) {
  .gif-frame-strip {
    grid-template-columns: repeat(3, 1fr);
  }
  .gif-maker-settings {
    grid-template-columns: 1fr;
  }
}

/* V9 friendly writing workspace */
.text-editor-modal {
  width: min(900px, 94vw);
  max-height: 92vh;
  overflow: auto;
}
.text-editor-modal .modal-body {
  display: grid;
  gap: 16px;
  padding: 20px;
}
.text-editor-writing {
  display: grid;
  gap: 8px;
  font-weight: 800;
  color: #6b4632;
}
.text-editor-writing textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 2px solid #b77b55;
  border-radius: 15px;
  background: #fffdf8;
  padding: 18px;
  font:
    20px/1.55 Georgia,
    serif;
  color: #30251f;
  box-shadow: inset 0 2px 7px rgba(77, 45, 28, 0.08);
}
.text-editor-writing textarea:focus {
  outline: 4px solid rgba(181, 91, 57, 0.18);
  border-color: #9f4f32;
}
.text-editor-tools {
  display: grid;
  grid-template-columns: 2fr 0.7fr 1fr 0.7fr;
  gap: 10px;
  align-items: end;
}
.text-editor-format {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.text-editor-preview {
  min-height: 92px;
  padding: 18px;
  border: 1px solid #dcc3a3;
  border-radius: 14px;
  background: linear-gradient(135deg, #fffaf0, #f4e5cc);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.text-editor-done {
  justify-self: end;
  min-width: 180px;
}
.text-editor-launch {
  width: 100%;
  margin: 0 0 12px;
}
@media (max-width: 700px) {
  .text-editor-tools {
    grid-template-columns: 1fr 1fr;
  }
  .text-editor-writing textarea {
    min-height: 180px;
    font-size: 18px;
  }
}

/* V9.1 professional library, type, recovery, collaboration and smart layouts */
.photo-library-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 10px 0;
}
.photo-library-tools input,
.photo-library-tools select,
.font-search {
  min-width: 0;
  border: 1px solid #d5b998;
  border-radius: 9px;
  background: #fff;
  padding: 8px;
  font-size: 9px;
}
.photo-library-tools label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 800;
}
.library-count {
  padding: 7px 9px;
  border-radius: 9px;
  background: #f1dfc8;
  font-size: 9px;
}
.pro-media-card {
  aspect-ratio: auto;
  min-height: 118px;
  padding-bottom: 28px;
}
.pro-media-card > img {
  aspect-ratio: 1;
  height: auto;
}
.pro-media-card > small {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 7px;
}
.media-favorite {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 25px;
  height: 25px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #8e7968;
}
.media-favorite.active {
  background: #b54848;
  color: #fff;
}
.media-badges {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 31px;
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.media-badges span {
  padding: 2px 4px;
  border-radius: 999px;
  background: #2e2925dd;
  color: #fff;
  font-size: 6px;
}
.media-badges .warn {
  background: #a23f29;
}
.media-group > h4 {
  display: flex;
  justify-content: space-between;
  margin: 12px 0 5px;
}
.phone-upload {
  width: 100%;
  margin-top: 12px;
}
.layout-actions {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  margin: 8px 0;
}
.layout-card small {
  font-size: 7px;
  color: #806956;
}
.title-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 9px 0;
}
.title-presets button,
.font-pairings button {
  border: 1px solid #d6b997;
  border-radius: 9px;
  background: #fff8ee;
  padding: 9px;
  font-weight: 850;
}
.font-pairings {
  display: grid;
  gap: 5px;
  margin: 11px 0;
}
.font-pairings strong {
  font-size: 9px;
  text-transform: uppercase;
}
.font-preview-list {
  display: grid;
  gap: 6px;
}
.font-preview-list button {
  display: grid;
  text-align: left;
  border: 1px solid #ddc8ad;
  border-radius: 11px;
  background: #fff;
  padding: 9px;
}
.font-preview-list span {
  font: 8px sans-serif;
  color: #806b58;
}
.font-preview-list b {
  font-size: 18px;
}
.curve-arch {
  border-radius: 50% 50% 0 0 !important;
  padding-top: 9% !important;
  transform: perspective(300px) rotateX(-8deg);
}
.recovery-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}
.recovery-actions input {
  border: 1px solid #d3b796;
  border-radius: 10px;
  padding: 10px;
}
.last-saved-card {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  border-radius: 12px;
  background: #efe0ca;
}
.revision-list {
  display: grid;
  gap: 7px;
}
.revision-list article {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px;
  border: 1px solid #dfc9ad;
  border-radius: 11px;
  background: #fff;
}
.revision-list article div {
  display: grid;
}
.revision-list small {
  color: #806d5d;
}
.collaboration-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.collaboration-grid section,
.collaboration-grid form {
  padding: 13px;
  border: 1px solid #ddc5a8;
  border-radius: 13px;
  background: #fffaf2;
}
.contributor {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  margin-top: 7px;
}
.contributor div {
  display: grid;
}
.request-compose {
  display: grid;
  gap: 6px;
}
.request-compose input {
  padding: 9px;
  border: 1px solid #d7bfa1;
  border-radius: 9px;
}
.story-request,
.activity-row {
  padding: 8px;
  border-bottom: 1px solid #eadac7;
}
.story-request p {
  margin: 4px 0;
}
.activity-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px;
}
.activity-row time {
  grid-column: 2;
  color: #8a7463;
  font-size: 8px;
}
.phone-upload-modal {
  text-align: center;
}
.phone-upload-modal img {
  width: min(260px, 80vw);
  margin: auto;
  border: 12px solid #fff;
  box-shadow: 0 8px 25px #0002;
}
@media (max-width: 920px) {
  .editor-shell {
    --mobile-tray: 70px;
  }
  .editor-main {
    padding-bottom: var(--mobile-tray);
  }
  .canvas-area {
    height: calc(100% - var(--mobile-tray));
    display: flex;
    flex-direction: column;
  }
  .canvas-scroll {
    flex: 1;
    order: 1;
    padding: 10px 5px;
    touch-action: pan-x pan-y;
  }
  .canvas-toolbar {
    position: fixed;
    z-index: 75;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: var(--mobile-tray);
    display: flex;
    justify-content: center;
    align-content: center;
    gap: 7px;
    background: #fff8ed;
    border-top: 1px solid #cdb28f;
    box-shadow: 0 -8px 24px #39271924;
  }
  .canvas-toolbar .tool-group {
    display: flex;
    align-items: center;
  }
  .canvas-toolbar .tool-group > .btn {
    min-width: 52px;
    min-height: 48px;
    font-size: 10px;
  }
  .arrange-bar {
    display: none;
  }
  .page-strip {
    order: 2;
    height: 74px;
    flex: 0 0 74px;
  }
  .page-thumb {
    width: 70px;
  }
  .page-thumb-preview {
    height: 42px;
  }
  .selection-toolbar.named-tools button {
    min-width: 52px;
    min-height: 48px;
  }
  .resize-handle {
    width: 24px;
    height: 24px;
  }
  .rotate-handle {
    width: 30px;
    height: 30px;
  }
  .mobile-drawer {
    position: fixed;
    z-index: 100;
    inset: 0;
  }
  .mobile-drawer-panel {
    width: 100vw;
    height: 100dvh;
  }
  .mobile-drawer-panel .asset-content,
  .mobile-drawer-panel .prop-body {
    padding-bottom: 90px;
  }
  .photo-studio {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
  }
  .collaboration-grid {
    grid-template-columns: 1fr;
  }
}

/* V9.3: physical scrapbook shelf, editable covers, and a true fit-to-screen viewer. */
.physical-book {
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.physical-book:hover {
  box-shadow: none;
}
.physical-book .book-cover {
  height: 238px;
  margin: 8px 8px 0 18px;
  border-radius: 8px 18px 18px 8px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--cover-color) 82%, #fff),
    var(--cover-color)
  );
  border: 2px solid color-mix(in srgb, var(--cover-color) 72%, #2d1c12);
  box-shadow:
    inset 8px 0 14px #0003,
    inset -2px 0 #fff4,
    0 14px 26px #321c1238;
  overflow: hidden;
}
.physical-book .book-cover:after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid #f7dca766;
  border-radius: 5px 13px 13px 5px;
  pointer-events: none;
}
.physical-book .book-cover img {
  position: absolute;
  inset: 13% 10% 14% 15%;
  width: 75%;
  height: 73%;
  border: 7px solid #f9ecd8;
  box-shadow: 0 7px 18px #0005;
  border-radius: 3px;
}
.book-spine {
  position: absolute;
  z-index: 3;
  left: 0;
  top: 0;
  bottom: 0;
  width: 15%;
  background: linear-gradient(90deg, #0004, transparent 38%, #fff2 58%, #0003);
  border-right: 1px solid #0004;
}
.book-corners:before,
.book-corners:after {
  content: "";
  position: absolute;
  z-index: 4;
  right: 0;
  width: 34px;
  height: 34px;
  border-right: 6px solid #caa86c;
  border-radius: 0 16px 0 0;
}
.book-corners:before {
  top: 0;
  border-top: 6px solid #caa86c;
}
.book-corners:after {
  bottom: 0;
  border-bottom: 6px solid #caa86c;
  border-radius: 0 0 16px 0;
}
.physical-book .book-cover-fallback {
  width: 72%;
  height: 70%;
  margin-left: 10%;
  border: 0;
  border-radius: 5px;
  background: #f7ead4e8;
  box-shadow:
    inset 0 0 0 2px #7d553e55,
    0 8px 18px #0004;
  padding: 18px;
  text-align: center;
}
.physical-book .book-cover-fallback strong {
  font-family: var(--serif);
  font-size: 20px;
  color: #4d3527;
}
.physical-book .cover-mini-page {
  height: 42%;
  margin-bottom: 10px;
}
.book-favorite {
  position: absolute;
  z-index: 6;
  right: 12px;
  top: 12px;
  background: #fff;
}
.shared-pill {
  margin-left: 5px;
  background: #e1efe1;
}
.physical-book .book-card-body {
  margin: 0 0 8px 10px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 18px 18px;
  background: #fffaf4;
}
.card-actions {
  flex-wrap: wrap;
}
.card-actions .btn {
  flex: 1 1 auto;
}
.cover-editor-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1fr);
  gap: 24px;
  align-items: center;
}
.cover-preview {
  position: relative;
  min-height: 300px;
  border-radius: 8px 22px 22px 8px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--cover-color) 82%, #fff),
    var(--cover-color)
  );
  box-shadow:
    inset 18px 0 22px #0003,
    0 18px 34px #0004;
  display: grid;
  place-items: center;
  padding: 42px;
  overflow: hidden;
}
.cover-preview img {
  position: absolute;
  inset: 15% 12% 20% 18%;
  width: 70%;
  height: 65%;
  object-fit: cover;
  border: 9px solid #f8ead5;
  box-shadow: 0 8px 18px #0005;
}
.cover-preview strong {
  position: relative;
  z-index: 4;
  align-self: end;
  font-family: var(--serif);
  font-size: 24px;
  text-align: center;
  color: #fff;
  text-shadow: 0 2px 7px #000;
}
.create-photo-section .guided-upload {
  display: grid;
}
.viewer-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.viewer-stage {
  padding: 6px;
  overflow: hidden;
}
.viewer-book {
  max-width: 100%;
  max-height: 100%;
  display: grid;
  place-items: center;
}
.viewer-page.landscape {
  width: min(980px, calc(100vw - 24px), calc((100vh - 172px) * 4 / 3));
  height: auto;
  aspect-ratio: 4/3;
}
.viewer-page.square {
  width: min(760px, calc(100vw - 24px), calc(100vh - 172px));
  height: auto;
  aspect-ratio: 1;
}
.viewer-page.portrait {
  height: min(780px, calc(100vh - 172px), calc((100vw - 24px) * 4 / 3));
  width: auto;
  aspect-ratio: 3/4;
}
.viewer-controls {
  height: 64px;
  flex: 0 0 64px;
}
.mobile-drawer-close {
  flex: 0 0 auto;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #2f2823;
  color: #fff;
  padding: 12px 16px;
  font-weight: 900;
  text-align: right;
}
.mobile-drawer-panel > .asset-panel,
.mobile-drawer-panel > .prop-panel {
  min-height: 0;
  flex: 1;
}
@media (max-width: 680px) {
  .cover-editor-grid {
    grid-template-columns: 1fr;
  }
  .cover-preview {
    min-height: 230px;
  }
  .viewer-head {
    padding: 8px 10px;
  }
  .viewer-head h2 {
    font-size: 16px;
  }
  .viewer-head-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .viewer-head-actions .btn {
    padding: 7px 9px;
    font-size: 10px;
  }
  .viewer-page.landscape {
    width: min(calc(100vw - 12px), calc((100vh - 158px) * 4 / 3));
  }
  .viewer-page.square {
    width: min(calc(100vw - 12px), calc(100vh - 158px));
  }
  .viewer-page.portrait {
    height: min(calc(100vh - 158px), calc((100vw - 12px) * 4 / 3));
  }
  .viewer-controls {
    height: 56px;
    flex-basis: 56px;
  }
}

/* V9.4 professional cover designer */
.cover-designer-backdrop {
  padding: 10px;
  background: #17120fd9;
}
.cover-designer-modal {
  width: min(1540px, 99vw);
  height: min(960px, 97vh);
  max-height: none;
  border-radius: 14px;
  overflow: hidden;
  background: #e8d9c5;
  border: 1px solid #b08a5f;
  box-shadow: 0 35px 90px #0009;
}
.cover-designer-modal > form {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.cover-designer-head {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 18px;
  background: linear-gradient(180deg, #33271f, #211914);
  color: #fff5e4;
  border-bottom: 2px solid #a87d48;
}
.cover-designer-head > div:first-child {
  display: flex;
  align-items: center;
  gap: 24px;
}
.cover-designer-head .brand {
  color: #fff5e4;
}
.cover-designer-head .brand-mark {
  border-color: #c7a271;
}
.cover-designer-head > div > span {
  display: grid;
  border-left: 1px solid #8f755c;
  padding-left: 22px;
}
.cover-designer-head > div > span b {
  font: 700 18px var(--serif);
}
.cover-designer-head > div > span small {
  color: #d7c0a3;
}
.cover-designer-actions {
  display: flex;
  gap: 10px;
}
.cover-designer-workspace {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 175px minmax(420px, 1fr) minmax(350px, 430px);
  overflow: hidden;
}
.cover-designer-nav {
  background: #fbf2e5;
  border-right: 1px solid #cdb18c;
  padding: 20px 12px;
  overflow: auto;
}
.cover-designer-nav > strong {
  display: block;
  padding: 0 9px 13px;
  font: 700 17px var(--serif);
  color: #392a21;
}
.cover-designer-nav button {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  text-align: left;
  gap: 8px;
  padding: 12px 9px;
  border: 0;
  border-bottom: 1px solid #e4d3bc;
  background: transparent;
  color: #514034;
  font-weight: 850;
}
.cover-designer-nav button span {
  font: 700 20px var(--serif);
  color: #87633e;
  text-align: center;
}
.cover-designer-nav button.active,
.cover-designer-nav button:hover {
  background: #6e7651;
  color: #fff;
  border-radius: 8px;
}
.cover-designer-nav button.active span,
.cover-designer-nav button:hover span {
  color: #fff;
}
.cover-designer-nav p {
  margin: 22px 8px;
  padding: 13px;
  border: 1px solid #d5bd9d;
  background: #f4e4cd;
  font: 11px/1.5 var(--serif);
  text-align: center;
}
.cover-designer-stage {
  min-width: 0;
  background: radial-gradient(circle at 50% 35%, #645449, #2a2420 72%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 24px 18px;
  overflow: auto;
}
.cover-preview-large {
  width: min(690px, 94%);
  aspect-ratio: 1.32;
  filter: drop-shadow(0 24px 25px #0008);
}
.designed-cover {
  position: relative;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 8px 22px 22px 8px;
  background-color: var(--cover-color);
  background-image:
    linear-gradient(100deg, #0004 0 9%, transparent 14%),
    radial-gradient(circle at 18% 12%, #fff2, transparent 32%),
    repeating-linear-gradient(0deg, #ffffff08 0 1px, #00000008 1px 3px);
  box-shadow:
    inset 14px 0 20px #0004,
    inset 0 0 0 var(--cover-border-width) var(--cover-border);
  font-family: var(--cover-font);
  isolation: isolate;
}
.designed-cover.texture-linen {
  background-image:
    linear-gradient(90deg, #0003 0 10%, transparent 15%),
    repeating-linear-gradient(0deg, #fff1 0 1px, #0001 1px 3px),
    repeating-linear-gradient(90deg, #fff1 0 1px, #0001 1px 4px);
}
.designed-cover.texture-botanical:after {
  content: "❦  ❧";
  position: absolute;
  right: 4%;
  top: 4%;
  font-size: clamp(38px, 6vw, 88px);
  color: var(--cover-border);
  opacity: 0.38;
  transform: rotate(12deg);
}
.designed-cover.texture-map:after {
  content: "N  ·  E  ·  S  ·  W";
  position: absolute;
  right: -3%;
  top: 11%;
  font: 700 12px/1 Georgia;
  color: #fff8;
  letter-spacing: 0.3em;
  transform: rotate(90deg);
}
.designed-cover.texture-confetti:after {
  content: "✦ · ✧ · ✦ · ✧";
  position: absolute;
  inset: 7% 5% auto 17%;
  color: #ffd89999;
  letter-spacing: 1.3em;
}
.designed-cover.texture-paper {
  background-image:
    linear-gradient(90deg, #0003 0 10%, transparent 15%),
    repeating-linear-gradient(3deg, #fff1 0 2px, #00000009 2px 4px);
}
.designed-cover .book-spine {
  width: 11%;
  z-index: 7;
}
.cover-photo-frame {
  position: absolute;
  z-index: 2;
  left: 20%;
  right: 11%;
  top: 12%;
  bottom: 27%;
  display: grid;
  place-items: center;
  border: 10px solid #f4e5cb;
  background: #d8c7aa;
  box-shadow:
    0 8px 18px #0007,
    inset 0 0 0 1px #74563b;
  overflow: hidden;
}
.cover-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-photo-empty {
  color: #7a6856;
  font: 700 14px var(--serif);
}
.cover-lettering {
  position: absolute;
  z-index: 5;
  left: 17%;
  right: 7%;
  display: grid;
  gap: 4px;
  color: var(--cover-title-color);
  text-align: var(--cover-title-align);
  text-shadow: 0 2px 6px #0008;
}
.cover-lettering strong {
  font-family: var(--cover-font);
  font-size: var(--cover-title-size);
  font-weight: var(--cover-title-weight);
  line-height: 1.05;
}
.cover-lettering small {
  font: italic 13px/1.3 var(--cover-font);
}
.position-top .cover-lettering {
  top: 8%;
}
.position-middle .cover-lettering {
  top: 50%;
  transform: translateY(-50%);
}
.position-bottom .cover-lettering {
  bottom: 8%;
}
.layout-full-photo .cover-photo-frame {
  inset: 7% 5% 7% 14%;
  border-width: 5px;
}
.layout-full-photo .cover-lettering {
  padding: 10px;
  background: #2b2019b8;
  border-radius: 4px;
}
.layout-title .cover-photo-frame {
  display: none;
}
.layout-title .cover-lettering {
  inset: 20% 12% 20% 18%;
  place-content: center;
  padding: 14%;
  border: 1px solid var(--cover-border);
}
.layout-collage .cover-photo-frame {
  left: 18%;
  right: 9%;
  top: 10%;
  bottom: 33%;
  box-shadow:
    10px 8px 0 #efe0c3,
    -8px -7px 0 #c9ad7e;
  transform: rotate(-2deg);
}
.cover-flourish {
  position: absolute;
  z-index: 5;
  right: 7%;
  top: 6%;
  font-size: 34px;
  color: var(--cover-border);
}
.border-single {
  outline: 2px solid var(--cover-border);
  outline-offset: -14px;
}
.border-double {
  outline: 6px double var(--cover-border);
  outline-offset: -16px;
}
.border-stitched {
  outline: 2px dashed var(--cover-border);
  outline-offset: -17px;
}
.border-ornate {
  outline: 6px double var(--cover-border);
  outline-offset: -18px;
}
.border-ornate:before {
  content: "◆";
  position: absolute;
  z-index: 8;
  left: 14%;
  bottom: 4%;
  color: var(--cover-border);
}
.cover-safe-note {
  position: absolute;
  right: 9px;
  bottom: 7px;
  z-index: 9;
  padding: 4px 7px;
  border-radius: 999px;
  background: #211914bf;
  color: #fff;
  font: 700 8px sans-serif;
}
.cover-layout-strip {
  width: min(760px, 98%);
  margin-top: 20px;
  color: #f8ead6;
}
.cover-layout-strip > b {
  display: block;
  margin-bottom: 9px;
  font: 700 13px var(--serif);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.cover-layout-strip > div {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}
.cover-layout-choice {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid #9f8873;
  border-radius: 8px;
  background: #f7ebd9;
  color: #3f322a;
  cursor: pointer;
}
.cover-layout-choice.selected {
  outline: 3px solid #7b8a5f;
}
.cover-layout-choice input,
.cover-theme-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.layout-icon {
  height: 48px;
  border-radius: 3px;
  background: #b59a74;
  box-shadow: inset 0 0 0 4px #ead9be;
}
.layout-icon-full-photo {
  box-shadow: inset 0 0 0 1px #ead9be;
}
.layout-icon-title {
  background: linear-gradient(#725442 38%, #ead9be 39% 62%, #725442 63%);
}
.layout-icon-collage {
  background: linear-gradient(90deg, #725442 48%, #ead9be 49% 51%, #98775e 52%);
}
.cover-designer-controls {
  background: #fbf3e7;
  border-left: 1px solid #cdb18c;
  padding: 17px;
  overflow: auto;
  scroll-behavior: smooth;
}
.cover-designer-controls section {
  padding: 0 0 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid #d9c3a5;
}
.cover-designer-controls h3 {
  font: 800 13px var(--serif);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  color: #47362b;
}
.cover-theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.cover-theme-choice {
  display: grid;
  gap: 4px;
  text-align: center;
  cursor: pointer;
}
.cover-theme-choice span {
  height: 48px;
  border: 6px solid #eadbc4;
  border-radius: 6px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--swatch), #fff 18%),
    var(--swatch)
  );
  box-shadow: 0 3px 8px #0002;
}
.cover-theme-choice b {
  font-size: 9px;
}
.cover-theme-choice.selected span {
  outline: 3px solid #6e7651;
}
.cover-upload-button {
  display: block;
  text-align: center;
  margin-bottom: 9px;
}
.cover-control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cover-control-grid .field {
  min-width: 0;
}
.cover-control-grid input,
.cover-control-grid select,
.cover-designer-controls > section > .field input,
.cover-designer-controls > section > .field select {
  width: 100%;
  box-sizing: border-box;
}
.designed-book-card {
  padding: 0 !important;
}
.designed-book-card > .designed-cover {
  height: 100%;
}
.designed-book-card .cover-lettering strong {
  font-size: clamp(16px, calc(var(--cover-title-size) * 0.62), 26px);
}
.designed-book-card .cover-lettering small {
  font-size: 9px;
}
.designed-book-card .cover-photo-frame {
  border-width: 6px;
}
.designed-book-card .cover-flourish {
  font-size: 22px;
}
.designed-book-card .cover-photo-empty,
.designed-book-card .cover-safe-note {
  display: none;
}
.designed-book-card .book-favorite {
  z-index: 20;
}
@media (max-width: 980px) {
  .cover-designer-workspace {
    grid-template-columns: 80px minmax(360px, 1fr) 340px;
  }
  .cover-designer-nav {
    padding: 14px 6px;
  }
  .cover-designer-nav > strong,
  .cover-designer-nav p {
    display: none;
  }
  .cover-designer-nav button {
    grid-template-columns: 1fr;
    text-align: center;
    font-size: 9px;
  }
  .cover-designer-nav button span {
    font-size: 18px;
  }
  .cover-designer-head .brand-sub,
  .cover-designer-head > div > span small {
    display: none;
  }
}
@media (max-width: 720px) {
  .cover-designer-backdrop {
    padding: 0;
  }
  .cover-designer-modal {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
  }
  .cover-designer-head {
    min-height: 62px;
    padding: 7px;
  }
  .cover-designer-head > div > span,
  .cover-designer-head .brand-sub {
    display: none;
  }
  .cover-designer-head .brand-title {
    font-size: 13px;
  }
  .cover-designer-actions .btn {
    padding: 8px;
  }
  .cover-designer-workspace {
    display: flex;
    flex-direction: column;
    overflow: auto;
  }
  .cover-designer-nav {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 20;
    overflow-x: auto;
    padding: 4px;
  }
  .cover-designer-nav button {
    min-width: 78px;
    border: 0;
  }
  .cover-designer-stage {
    overflow: visible;
    padding: 14px 8px;
  }
  .cover-preview-large {
    width: min(520px, 96vw);
  }
  .cover-lettering strong {
    font-size: clamp(19px, 7vw, var(--cover-title-size));
  }
  .cover-layout-strip > div {
    grid-template-columns: repeat(2, 1fr);
  }
  .cover-designer-controls {
    overflow: visible;
    border-left: 0;
    padding: 14px;
  }
  .cover-theme-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* V9.4 embedded replacement Photo Studio */
.photo-studio-shell {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #211914;
  display: grid;
}
.photo-studio-shell iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #211914;
}
.photo-studio-loading {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  color: #f8ead4;
  background: radial-gradient(circle, #4c3b30, #211914);
  font: 700 20px var(--serif);
}
body.photo-studio-open {
  overflow: hidden;
}
/* V9.5 Premium Heirloom editor */
.canvas-element:not(.locked) {
  cursor: grab;
}
.canvas-element:not(.locked):active {
  cursor: grabbing;
}
.canvas-element audio,
.canvas-element button,
.canvas-element [contenteditable="true"] {
  cursor: auto;
}
.drag-hint {
  position: absolute;
  left: 50%;
  top: -77px;
  translate: -50% 0;
  z-index: 1004;
  white-space: nowrap;
  padding: 5px 10px;
  border: 1px solid #b98b55;
  border-radius: 4px;
  background: #2a211be8;
  color: #fff7e8;
  box-shadow: 0 5px 14px #0004;
  font: 800 8px/1 var(--sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
}
.edited-sticker {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 7px 5px #2b1b1133);
}
.voice-memory {
  width: 100%;
  height: 100%;
  min-width: 116px;
  min-height: 52px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  column-gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border: 2px solid #a47743;
  border-radius: 9px 16px 16px 9px;
  background: linear-gradient(135deg, #fff8ea, #ead6b7);
  box-shadow:
    inset 0 0 0 2px #fff9,
    inset 0 0 0 3px #9a70454d,
    0 7px 15px #3923162b;
  overflow: hidden;
  color: #432f24;
}
.voice-memory:after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid #b9905e80;
  border-radius: 5px 11px 11px 5px;
  pointer-events: none;
}
.voice-memory-icon {
  position: relative;
  z-index: 2;
  grid-row: 1/3;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #8f4a35, #542719);
  box-shadow:
    inset 0 1px #fff5,
    0 2px 5px #0004;
}
.voice-memory-icon:before {
  content: "";
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 10px solid #fff3dc;
  margin-left: 3px;
}
.voice-memory-copy {
  position: relative;
  z-index: 2;
  min-width: 0;
  display: grid;
  align-self: end;
}
.voice-memory strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font:
    700 clamp(8px, 1.2vw, 12px)/1.05 "Libre Baskerville",
    Georgia,
    serif;
}
.voice-memory small {
  color: #7b5d45;
  font: 700 7px/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.voice-memory audio {
  position: relative;
  z-index: 3;
  grid-column: 2;
  width: 100%;
  height: 22px;
  min-width: 70px;
}
.pocket {
  overflow: visible;
  isolation: isolate;
  cursor: pointer;
}
.pocket-clip {
  position: absolute;
  inset: 12% 0 0;
  overflow: hidden;
  filter: drop-shadow(0 9px 8px #3c271b35);
}
.pocket-back {
  position: absolute;
  inset: 5% 4% 3%;
  z-index: 1;
  border: 1px solid #76513b;
  background: #cbb595;
}
.pocket-card {
  position: absolute;
  z-index: 2;
  left: 11%;
  right: 11%;
  top: 17%;
  height: 68%;
  box-sizing: border-box;
  padding: 10% 9%;
  border: 1px solid #b69c76;
  border-radius: 2px;
  background: repeating-linear-gradient(
    0deg,
    #fffaf0 0 18px,
    #d8c6a533 19px 20px
  );
  box-shadow: 0 4px 9px #0003;
  transform: translateY(40%);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.pocket-card span {
  display: block;
  font:
    italic 700 clamp(8px, 1vw, 13px)/1.35 "Lora",
    Georgia,
    serif;
  color: #4a382c;
}
.pocket-front {
  position: absolute;
  z-index: 3;
  inset: 38% 3% 1%;
  overflow: hidden;
  border: 1px solid #59624b;
  border-radius: 2px 2px 7px 7px;
  background-color: #788168;
  background-image:
    linear-gradient(90deg, #fff1 1px, transparent 1px),
    linear-gradient(#fff1 1px, transparent 1px),
    radial-gradient(circle at 25% 18%, #aab19855, transparent 34%);
  background-size:
    5px 5px,
    5px 5px,
    100% 100%;
  box-shadow:
    inset 0 0 0 4px #c6b89255,
    inset 0 -9px 17px #27301e35;
}
.pocket-front:before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 10%;
  height: 28%;
  border-bottom: 2px dashed #ddd0ad;
  border-radius: 0 0 50% 50%;
}
.pocket-stitch {
  position: absolute;
  inset: 7px;
  border: 1px dashed #eadbb7aa;
  border-radius: 2px 2px 5px 5px;
}
.pull-tab {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 0;
  translate: -50% 0;
  width: 24%;
  height: 44%;
  min-width: 34px;
  display: grid;
  place-items: end center;
  align-content: end;
  gap: 2px;
  padding-bottom: 5%;
  box-sizing: border-box;
  border: 1px solid #633527;
  border-radius: 4px 4px 1px 1px;
  background: linear-gradient(90deg, #6e352b, #9c5a4a 48%, #6e352b);
  box-shadow:
    inset 0 0 0 2px #d0a67544,
    0 3px 6px #0003;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.pull-tab:before {
  content: "❦";
  position: absolute;
  top: 11%;
  color: #d8b477;
  font-size: clamp(10px, 1.5vw, 18px);
}
.pull-tab b {
  font: 800 6px/1 var(--sans);
  letter-spacing: 0.12em;
  color: #f7dfbd;
}
.pull-tab-eyelet {
  width: 10px;
  height: 10px;
  border: 3px solid #c59a52;
  border-radius: 50%;
  background: #4b2c22;
  box-shadow:
    inset 0 0 0 1px #f3d79a,
    0 1px 2px #0005;
}
.pocket.open .pocket-card {
  transform: translateY(-42%);
}
.pocket.open .pull-tab {
  transform: translateY(-44%);
}
.pocket.open .interactive-hint {
  opacity: 0.18;
}
.pocket .interactive-hint {
  bottom: -21px;
  background: #33261e;
  color: #fff4df;
  border: 1px solid #c59a62;
}
.texture-handmade-cotton {
  background-image:
    radial-gradient(ellipse at 20% 30%, #9b7a5220 0 1px, transparent 2px),
    repeating-linear-gradient(2deg, #fff8ee 0 2px, #e9dcc9 3px 4px);
}
.texture-silk-damask {
  background-image:
    radial-gradient(ellipse at center, #ffffff44, transparent 55%),
    repeating-radial-gradient(
      ellipse at 50% 0,
      #b8a27a22 0 7px,
      transparent 8px 17px
    );
  background-size: 48px 38px;
}
.texture-pressed-botanical {
  background-image:
    linear-gradient(#fff8ecdd, #f1e1cddd),
    radial-gradient(ellipse at 13% 18%, #72805c55 0 8px, transparent 9px),
    radial-gradient(ellipse at 87% 76%, #956f5455 0 10px, transparent 11px);
}
.texture-embossed-leather {
  background-color: #704a36 !important;
  background-image:
    radial-gradient(circle at 30% 20%, #fff2, transparent 35%),
    repeating-linear-gradient(38deg, #00000012 0 1px, transparent 1px 5px);
  color: #fff7e6;
}
.texture-antique-lace {
  background-image:
    radial-gradient(circle, #fffaf2 0 4px, transparent 5px),
    radial-gradient(circle, #cdbb9a 0 2px, transparent 3px),
    linear-gradient(#eee0cb, #f8efe2);
  background-size:
    22px 22px,
    22px 22px,
    100% 100%;
  background-position:
    0 0,
    11px 11px,
    0 0;
}
.texture-marbled-paper {
  background-image: repeating-radial-gradient(
    ellipse at 20% 40%,
    #78816c33 0 6px,
    #b9816c22 7px 13px,
    #e8d6ba 14px 19px
  );
}
.page-border.gilded:after {
  inset: 2.2%;
  border: 7px double var(--page-border-color);
  box-shadow:
    inset 0 0 0 2px #e9ca78,
    inset 0 0 18px #9b6d2430,
    0 0 0 1px #6f431f80;
}
.page-border.embroidered:after {
  inset: 2.5%;
  border: 3px dashed var(--page-border-color);
  box-shadow:
    inset 0 0 0 7px #fff8e8,
    inset 0 0 0 9px var(--page-border-color);
  border-radius: 9px;
}
.page-border.deckled:after {
  inset: 1.7%;
  border: 9px solid transparent;
  outline: 2px solid var(--page-border-color);
  filter: drop-shadow(0 2px 1px #49311c45);
  clip-path: polygon(
    0 1%,
    2% 0,
    4% 1%,
    6% 0,
    8% 1%,
    10% 0,
    92% 0,
    94% 1%,
    96% 0,
    98% 1%,
    100% 0,
    99% 2%,
    100% 4%,
    99% 96%,
    100% 98%,
    99% 100%,
    97% 99%,
    3% 100%,
    1% 99%,
    0 97%,
    1% 3%
  );
}
.page-border.botanical-press:after {
  inset: 2%;
  border: 4px double var(--page-border-color);
  background:
    radial-gradient(ellipse at 2% 2%, #73805d88 0 10px, transparent 11px),
    radial-gradient(ellipse at 98% 98%, #9a746288 0 12px, transparent 13px);
  background-repeat: no-repeat;
}
.page-border.antique-corners:after {
  inset: 2%;
  border: 1px solid var(--page-border-color);
  box-shadow:
    inset 15px 15px 0 -11px #bc9250,
    inset -15px 15px 0 -11px #bc9250,
    inset 15px -15px 0 -11px #bc9250,
    inset -15px -15px 0 -11px #bc9250;
}
.page-border.ribbon-lace:after {
  inset: 2.4%;
  border: 8px ridge #ead7b8;
  outline: 2px solid var(--page-border-color);
  box-shadow: inset 0 0 0 3px #fffaf0;
}
@media (max-width: 680px) {
  .drag-hint {
    top: -72px;
  }
  .voice-memory {
    min-width: 98px;
    padding: 5px 6px;
    grid-template-columns: 29px minmax(0, 1fr);
  }
  .voice-memory-icon {
    width: 28px;
    height: 28px;
  }
  .voice-memory audio {
    height: 20px;
  }
  .pull-tab b {
    display: none;
  }
}

/* V9.5 corrected interactive sizing and reveal media */
.canvas-element:has(.pocket.open) {
  z-index: 1000 !important;
}
.pocket.open .pocket-clip {
  overflow: visible;
}
.pocket.open .pocket-card {
  left: -35%;
  right: -35%;
  height: 190%;
  padding: 7% 8%;
  overflow: auto;
  transform: translateY(-70%);
  box-shadow: 0 10px 20px #0005;
}
.pocket.open .pocket-card span {
  font-size: clamp(6px, 0.72vw, 10px);
  line-height: 1.18;
}
.pocket.open .pull-tab {
  transform: translateY(-31%);
}
.pull-tab {
  width: 16%;
  height: 28%;
  min-width: 24px;
  padding-bottom: 3%;
}
.pull-tab:before {
  top: 7%;
  font-size: clamp(7px, 1vw, 12px);
}
.pull-tab-eyelet {
  width: 7px;
  height: 7px;
  border-width: 2px;
}
.pull-tab b {
  font-size: 5px;
}
.pocket-card span {
  white-space: normal;
  overflow-wrap: anywhere;
}
.pocket.open .pocket-card {
  z-index: 8;
}
.pocket.open .pull-tab {
  z-index: 1;
  opacity: 0;
  pointer-events: none;
}
.scratch-card > div:first-child,
.scratch-reveal-photo {
  width: 100%;
  height: 100%;
}
.scratch-reveal-photo {
  display: block;
  object-fit: cover;
}
.scratch-reveal-text,
.scratch-photo-empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 8%;
  box-sizing: border-box;
  text-align: center;
  overflow: auto;
}
.scratch-photo-empty {
  color: #755f4e;
  font: 700 10px var(--serif);
  background: #f4eadb;
}

/* V9.8.3 targeted workspace height and overflow correction */
html,
body,
#app {
  min-height: 100%;
}
body {
  overflow: auto;
}
body:has(.editor-shell),
body:has(.editor-shell) #app {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}
.editor-shell {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
.editor-main,
.studio-editor-main,
.canvas-area,
.studio-canvas-area {
  min-height: 0;
  overflow: hidden;
}
@media (min-width: 921px) {
  .studio-canvas-area .canvas-scroll {
    inset: 0;
    padding: 72px 34px 12px;
    overflow: hidden;
  }
  .scrap-page.landscape {
    width: min(1160px, calc(100vw - 80px), calc((100dvh - 150px) * 4 / 3));
  }
  .scrap-page.square {
    width: min(930px, calc(100vw - 80px), calc(100dvh - 150px));
  }
  .scrap-page.portrait {
    height: min(870px, calc(100dvh - 150px), calc((100vw - 80px) * 4 / 3));
  }
  .studio-float-panel {
    top: 70px;
    bottom: 18px;
  }
}

/* Asset-library labels must remain readable without changing the artwork itself. */
.pro-media-card > small {
  font-size: 11px;
  line-height: 1.3;
}
.media-badges span {
  font-size: 10px;
  line-height: 1.3;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #8c2d38;
  outline-offset: 2px;
}
