@font-face {
  font-family:Lexend;
  src:url('/imagehub/fonts/Lexend.ttf') format('truetype');
  font-weight:100 900;
  font-display:swap;
}
:root {
  color-scheme:light;
  --ink:#173d47;
  --teal:#173f4a;
  --teal-deep:#12333c;
  --cream:#faf4e8;
  --paper:#fffdf7;
  --sand:#f0e4ce;
  --line:#dfd0b7;
  --coral:#ee8165;
  --coral-pale:#fae1d5;
  --muted:#746f64;
  --green:#466b57;
}
* {
  box-sizing:border-box;
}
body {
  margin:0;
  height:100vh;
  height:100dvh;
  overflow:hidden;
  display:grid;
  grid-template-columns:216px 316px minmax(0,1fr);
  grid-template-rows:68px minmax(0,1fr);
  grid-template-areas:'library steps steps' 'library chat book';
  background:var(--cream);
  color:var(--ink);
  font:14px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
}
[hidden] {
  display:none!important;
}
button,input,textarea,select {
  font:inherit;
}
button {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:1px solid var(--line);
  border-radius:5px;
  background:var(--paper);
  color:var(--ink);
  padding:10px 15px;
  cursor:pointer;
  font-weight:600;
  line-height:1.25;
  transition:background .15s,border-color .15s;
}
button:hover:not(:disabled) {
  background:var(--sand);
  border-color:#b7a98e;
}
button:disabled {
  opacity:.45;
  cursor:default;
}
button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,summary:focus-visible {
  outline:3px solid #c56346;
  outline-offset:3px;
}
a {
  color:var(--teal);
}
h1,h2,h3,p {
  margin:0;
}
h1,h2,h3,.brand,.step-name {
  font-family:Lexend,sans-serif;
}
h2 {
  font-size:21px;
  font-weight:550;
  line-height:1.3;
}
h3 {
  font-size:16px;
  font-weight:550;
}
.subtle {
  color:var(--muted);
  font-size:13px;
}
.primary {
  background:var(--teal);
  border-color:var(--teal);
  color:var(--paper);
}
.primary:hover:not(:disabled) {
  background:#245866;
  border-color:#245866;
}
.secondary {
  background:transparent;
  border-color:#bda98b;
}
.text-button {
  padding:5px 0;
  background:none;
  border:0;
  font-size:13px;
  font-weight:550;
  color:var(--teal);
}
.text-button:hover:not(:disabled) {
  background:transparent;
  color:#a34830;
}
.ui-icon {
  display:inline-flex;
  width:18px;
  height:18px;
  flex:none;
}
.ui-icon svg {
  width:100%;
  height:100%;
}
button svg {
  width:18px;
  height:18px;
  flex-shrink:0;
}
#projects {
  grid-area:library;
  background:var(--teal);
  color:var(--cream);
  display:flex;
  flex-direction:column;
  min-height:0;
  z-index:30;
}
.brand {
  height:68px;
  flex:none;
  display:flex;
  align-items:center;
  gap:10px;
  padding:0 22px;
  font-size:23px;
  font-weight:600;
  letter-spacing:-.8px;
  border-bottom:1px solid #ffffff18;
}
.brand svg {
  width:26px;
  height:30px;
  color:var(--coral);
}
.library-heading {
  gap:8px;
  padding:24px 18px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.library-heading h2 {
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:1.5px;
  color:#e9e0cd;
  font-weight:500;
}
#newbook {
  white-space:nowrap;
  font-size:11px;
  color:var(--teal-deep);
  background:var(--coral);
  border-color:var(--coral);
  padding:7px 9px;
}
#newbook:hover {
  background:#f49a81;
}
#plist {
  overflow:auto;
  flex:1;
  min-height:0;
  padding:0 10px 12px;
  scrollbar-width:thin;
  scrollbar-color:#5b7c84 transparent;
  display:flex;
  flex-direction:column;
  gap:7px;
}
.pitem {
  display:flex;
  align-items:center;
  text-align:left;
  justify-content:flex-start;
  gap:11px;
  flex:none;
  width:100%;
  padding:11px 8px;
  background:transparent;
  border:1px solid transparent;
  color:var(--cream);
  border-radius:5px;
}
.pitem:hover:not(:disabled) {
  background:#ffffff0c;
  border-color:#ffffff26;
}
.pitem.active {
  background:var(--teal-deep);
  border-color:#d8bf96;
}
.project-cover {
  width:61px;
  height:76px;
  flex:none;
  background:#294f59;
  display:grid;
  place-items:center;
  border-radius:2px;
  box-shadow:2px 3px 7px #0002;
  overflow:hidden;
}
.project-cover img {
  width:100%;
  height:100%;
  object-fit:cover;
}
.project-cover svg {
  width:24px;
  color:#b8ccca;
}
.project-info {
  min-width:0;
}
.pitem .t {
  font-size:12.5px;
  font-weight:550;
  line-height:1.4;
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.pitem .s {
  font-size:10.5px;
  color:#a8c3c4;
  margin-top:7px;
  font-weight:400;
}
.pitem.active .s {
  color:#efc4a7;
}
.library-footer {
  border-top:1px solid #ffffff20;
  padding:12px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.library-footer button {
  padding:8px 0;
  background:transparent;
  color:#e9e0cf;
  border:0;
  font-weight:400;
  font-size:12px;
}
.library-footer button:hover {
  background:transparent;
  color:#fff;
}
.library-footer .wordmark {
  font-size:10px;
  color:#92b0b6;
  letter-spacing:1px;
}
#stages {
  grid-area:steps;
  display:flex;
  align-items:stretch;
  background:var(--line);
  border-bottom:1px solid var(--line);
  min-width:0;
}
.stage-step {
  position:relative;
  flex:1;
  border:0;
  border-radius:0;
  background:var(--sand);
  padding:0 12px 0 20px;
  gap:9px;
  min-width:0;
  clip-path:polygon(0 0,calc(100% - 15px) 0,100% 50%,calc(100% - 15px) 100%,0 100%,15px 50%);
  margin-left:-13px;
}
.stage-step:first-child {
  margin-left:0;
  clip-path:polygon(0 0,calc(100% - 15px) 0,100% 50%,calc(100% - 15px) 100%,0 100%);
}
.stage-step:last-child {
  clip-path:polygon(0 0,100% 0,100% 100%,0 100%,15px 50%);
}
.stage-step:hover:not(:disabled) {
  background:#e6d7bc;
}
.stage-step.active,.stage-step.active:hover {
  background:var(--coral);
  color:#263b3d;
}
.stage-step:focus-visible {
  outline:0;
  box-shadow:inset 0 0 0 3px #9f452e;
}
.step-name {
  text-transform:uppercase;
  letter-spacing:.5px;
  font-size:12px;
  font-weight:600;
}
.step-number {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid #bfae93;
  width:23px;
  height:23px;
  border-radius:50%;
  font-size:11px;
  flex:none;
}
.stage-step.reached .step-number {
  background:var(--teal);
  border-color:var(--teal);
  color:var(--cream);
}
.stage-step.active .step-number {
  border-color:#673c3080;
}
#chat {
  grid-area:chat;
  min-height:0;
  min-width:0;
  display:flex;
  flex-direction:column;
  background:var(--paper);
  border-right:1px solid var(--line);
}
.chat-heading {
  padding:19px 19px 16px;
  display:flex;
  align-items:center;
  gap:8px;
  border-bottom:1px solid var(--line);
  flex-wrap:wrap;
}
.chat-heading h2 {
  font-size:15px;
}
.connection {
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:6px;
}
.dot {
  width:6px;
  height:6px;
  border-radius:50%;
  background:#b7aea0;
  display:inline-block;
}
.dot.ok {
  background:#558b69;
}
.dot.bad {
  background:#b34c3b;
}
#brain {
  font-size:11px;
  color:var(--muted);
}
.typing {
  color:var(--muted);
  font-size:11px;
  min-height:0;
}
.typing:not(:empty) {
  width:100%;
}
.conversation {
  position:relative;
  display:flex;
  flex-direction:column;
  flex:1;
  min-height:0;
}
#latestMessages {
  position:absolute;
  bottom:12px;
  left:50%;
  transform:translateX(-50%);
  white-space:nowrap;
  padding:8px 12px;
  font-size:11px;
  background:var(--paper);
  box-shadow:0 3px 12px #173f4a25;
  z-index:2;
}
#log {
  flex:1;
  min-height:0;
  overflow:auto;
  overflow-anchor:none;
  padding:19px 15px;
  display:flex;
  flex-direction:column;
  gap:18px;
  scrollbar-width:thin;
  scrollbar-color:#cdbda5 transparent;
}
.msg {
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  font-size:13px;
  line-height:1.6;
  flex-shrink:0;
  max-width:100%;
}
.msg.user {
  align-self:flex-end;
  background:#eadfcb;
  border:1px solid #e0d1b9;
  border-radius:6px 6px 0 6px;
  padding:10px 12px;
  max-width:92%;
}
.msg.agent {
  align-self:stretch;
  padding:0 1px;
}
.msg.sys {
  font-size:11px;
  color:var(--muted);
  padding:4px;
  text-align:center;
}
.msg.agent strong {
  font-weight:650;
}
.chatimg {
  display:block;
  max-width:100%;
  max-height:210px;
  border-radius:3px;
  margin:8px 0;
  cursor:zoom-in;
}
.showgrid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:9px;
  margin:12px 0;
  white-space:normal;
}
.showfig {
  margin:0;
  min-width:0;
}
.showfig img {
  width:100%;
  aspect-ratio:1;
  object-fit:contain;
  background:#f3ecdf;
  border:1px solid var(--line);
  border-radius:3px;
  margin:0;
}
.showfig figcaption {
  font-size:10px;
  line-height:1.4;
  color:var(--muted);
  margin-top:5px;
  text-align:center;
}
.uiact {
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin:6px 0 0;
  white-space:normal;
}
.uiact button {
  font-size:12px;
  padding:8px 10px;
  flex:1;
  text-align:left;
  justify-content:flex-start;
}
.uiact button.uiprime {
  background:var(--sand);
  border-color:#d9c4a4;
  color:var(--ink);
}
.uiact input {
  background:var(--paper);
  color:var(--ink);
  border:1px solid var(--line);
  border-radius:4px;
  padding:8px 10px;
  font:inherit;
  font-size:12px;
  width:100%;
  min-width:0;
}
.uiact :disabled {
  opacity:.45;
}
.msg br:has(+.uiact) {
  display:none;
}
#contextActions {
  background:#f5eddd;
  border-top:1px solid var(--line);
  padding:11px 14px;
  flex:none;
}
#contextActions button {
  white-space:nowrap;
}
.context-label {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  font-size:11px;
  font-weight:600;
  margin-bottom:8px;
}
.context-label .text-button {
  font-size:10px;
  font-weight:400;
}
.review-actions {
  display:flex;
  justify-content:center;
  align-items:center;
  gap:12px;
  margin:18px 0 4px;
  flex:none;
}
.review-actions button {
  min-height:42px;
  padding:11px 22px;
  font-size:13px;
}
.review-actions.compact {
  margin:0;
  gap:7px;
}
.review-actions.compact button {
  font-size:11px;
  padding:9px 8px;
  min-height:35px;
  flex:1;
}
.review-actions.compact .ui-icon {
  width:14px;
  height:14px;
}
#composer {
  position:relative;
  flex:none;
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  padding:13px 14px 15px;
  border-top:1px solid var(--line);
  background:var(--paper);
}
#input {
  width:100%;
  resize:vertical;
  max-height:160px;
  min-height:70px;
  padding:11px 12px;
  line-height:1.45;
  background:#fff;
  color:var(--ink);
  border:1px solid #cabb9f;
  border-radius:5px;
  font-size:13px;
}
#input::placeholder {
  color:#938878;
}
#attach {
  display:none;
}
#send {
  margin-left:auto;
  background:var(--teal);
  border-color:var(--teal);
  color:white;
  font-size:12px;
  padding:9px 15px;
}
#stop {
  border:0;
  background:none;
  color:#9b4634;
  font-size:11px;
  padding:8px;
}
#photoPreviews {
  display:flex;
  gap:10px;
  width:100%;
  overflow-x:auto;
  padding:3px 2px;
}
#photoPreviews:empty {
  display:none;
}
.photo-drop {
  width:100%;
  display:flex;
  align-items:center;
  gap:9px;
  padding:10px;
  border:1px dashed #cabb9f;
  border-radius:5px;
  color:var(--teal);
  background:#fffaf2;
}
.photo-drop>svg {
  width:22px;
  height:22px;
  flex:none;
}
.photo-drop>div {
  min-width:0;
  flex:1;
}
.photo-drop strong {
  display:block;
  font-size:12px;
  font-weight:600;
}
.photo-drop span {
  display:block;
  margin-top:3px;
  font-size:10px;
  color:#817766;
}
.photo-drop .text-button {
  padding:8px 0 8px 4px;
  border:0;
  background:none;
  font-size:11px;
  color:var(--teal);
  text-decoration:underline;
  text-underline-offset:3px;
  flex:none;
}
.photo-drop:focus,
.photo-drop:focus-within,
#composer.drag .photo-drop {
  border-color:var(--teal);
  background:#edf3ed;
  outline:2px solid #173f4a33;
  outline-offset:1px;
}
.photo-preview {
  position:relative;
  flex:0 0 80px;
  min-width:0;
}
.photo-thumbnail {
  display:block;
  width:80px;
  height:76px;
  padding:0;
  border:1px solid var(--line);
  overflow:hidden;
  background:var(--sand);
}
.photo-thumbnail img {
  width:100%;
  height:100%;
  object-fit:cover;
}
.photo-preview .photo-remove {
  position:absolute;
  top:3px;
  right:3px;
  width:23px;
  height:23px;
  padding:0;
  border-radius:50%;
  border:1px solid #ffffffa6;
  background:#173f4ae8;
  color:white;
  font-size:17px;
  line-height:1;
}
.photo-name {
  display:block;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  max-width:80px;
  margin-top:4px;
  color:#817766;
  font-size:10px;
}
.photo-state,
.photo-retry,
#photoStatus {
  font-size:11px;
  color:#954937;
}
.photo-retry {
  padding:2px 0;
  border:0;
  display:block;
  background:none;
  text-decoration:underline;
}
#photoStatus {
  width:100%;
  margin:0;
}
.user-photos {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px;
  margin-top:8px;
}
.user-photos:first-child {
  margin-top:0;
}
.user-photos:has(>.user-photo:only-child) {
  width:160px;
  max-width:100%;
  grid-template-columns:minmax(0,1fr);
}
.user-photo {
  padding:0;
  overflow:hidden;
  border:1px solid #173f4a26;
  background:#fff;
}
.user-photo img {
  display:block;
  width:100%;
  height:120px;
  object-fit:cover;
}
#preview {
  grid-area:book;
  min-height:0;
  min-width:0;
  display:flex;
  flex-direction:column;
  background:var(--cream);
}
.book-heading {
  display:flex;
  align-items:center;
  gap:18px;
  padding:20px 28px 15px;
  flex:none;
  border-bottom:1px solid #e4d7c26b;
}
.book-heading>div {
  min-width:0;
  flex:1;
}
#bookTitle {
  font-size:20px;
  font-weight:550;
  letter-spacing:-.6px;
  line-height:1.35;
}
#bookMeta {
  color:var(--muted);
  font-size:11px;
  margin-top:5px;
}
#read {
  padding:8px 11px;
  font-size:11px;
  white-space:nowrap;
  background:transparent;
  border-color:#c9b99d;
}
.workspace {
  flex:1;
  overflow:auto;
  min-height:0;
  padding:22px 28px 25px;
  scrollbar-width:thin;
  scrollbar-color:#cdbda5 transparent;
}
.workspace:focus {
  outline:none;
}
.section-heading {
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  margin-bottom:18px;
}
.section-heading h2 {
  font-size:18px;
}
.section-heading .subtle {
  font-size:11px;
}
.spread-heading {
  display:flex;
  align-items:baseline;
  gap:7px;
  justify-content:center;
  margin:0 0 19px;
}
.spread-heading h2 {
  font-size:14px;
  font-family:inherit;
  font-weight:600;
}
.spread-heading .subtle {
  font-size:12px;
}
.spread-stage {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  margin:0 -15px;
}
.spread-arrow {
  font-size:36px;
  padding:2px 3px;
  border:0;
  background:none;
  font-weight:300;
  width:25px;
  flex:none;
  color:var(--teal);
}
.spread-arrow:hover:not(:disabled) {
  background:transparent;
  color:#bd593e;
}
.spread-arrow:disabled {
  opacity:.15;
}
.spread-book {
  display:flex;
  align-items:stretch;
  flex:1;
  min-width:0;
  max-width:1120px;
  border:1px solid #d6c6ab;
  border-radius:5px;
  overflow:hidden;
  box-shadow:0 9px 18px #71572c19,0 2px 3px #71572c14;
  background:#fffdf5;
}
.spread-book.single {
  max-width:min(430px,64vh);
}
.spread-page {
  flex:1;
  min-width:0;
  position:relative;
  background:var(--paper);
  display:flex;
  flex-direction:column;
}
.spread-page+.spread-page {
  border-left:1px solid #8c755c50;
}
.spread-page+.spread-page::before {
  content:'';
  width:12px;
  position:absolute;
  top:0;
  bottom:0;
  left:0;
  pointer-events:none;
  background:linear-gradient(90deg,#46361b13,transparent);
  z-index:1;
}
.page-art {
  border:0;
  border-radius:0;
  padding:0;
  display:block;
  width:100%;
  background:var(--paper);
  cursor:zoom-in;
}
.page-art img {
  display:block;
  width:100%;
  aspect-ratio:1;
  object-fit:contain;
}
.unbaked-text {
  padding:14px;
  font-size:15px;
  text-align:center;
}
.page-placeholder {
  aspect-ratio:1;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:14px;
  background:#f2e9d8;
  color:#8c8069;
}
.page-placeholder span {
  font-size:11px;
}
.page-placeholder .ui-icon {
  width:32px;
  height:32px;
  opacity:.5;
}
.page-filmstrip {
  display:flex;
  align-items:stretch;
  justify-content:flex-start;
  gap:9px;
  overflow-x:auto;
  padding:8px 3px 12px;
  margin-top:18px;
  scrollbar-width:thin;
  scrollbar-color:#d0c0a3 transparent;
}
.page-thumb {
  padding:4px;
  border:1px solid transparent;
  display:flex;
  flex-direction:column;
  gap:5px;
  background:none;
  min-width:78px;
  flex:none;
  border-radius:4px;
}
.page-thumb.selected {
  border-color:var(--teal);
  background:#e9eee7;
  box-shadow:0 0 0 1px var(--teal);
}
.thumb-pictures {
  display:flex;
  width:78px;
  height:45px;
  align-items:center;
  justify-content:center;
  border:1px solid #dfd1b9;
  background:var(--paper);
  overflow:hidden;
  border-radius:2px;
}
.thumb-pictures img {
  max-width:50%;
  height:100%;
  object-fit:contain;
  min-width:0;
}
.thumb-pictures img:only-child {
  max-width:100%;
}
.thumb-blank {
  font-size:11px;
  flex:1;
  text-align:center;
  color:var(--muted);
}
.thumb-label {
  font-size:10px;
  font-weight:500;
  color:var(--muted);
}
.page-thumb.selected .thumb-label {
  color:var(--ink);
}
.story-pages {
  display:grid;
  gap:12px;
}
.story-page {
  display:grid;
  grid-template-columns:32px 1fr;
  gap:15px;
  align-items:start;
  background:var(--paper);
  border:1px solid var(--line);
  padding:20px 22px;
  border-radius:5px;
}
.story-page p {
  font-size:16px;
  line-height:1.75;
  color:#423d33;
  white-space:pre-wrap;
}
.page-number {
  font-family:Lexend,sans-serif;
  color:#a68b6b;
  font-size:12px;
  padding-top:6px;
}
.story-edit {
  grid-column:2;
  justify-self:start;
  font-size:11px;
}
.phase-status {
  margin:0 0 20px;
  color:var(--muted);
  font-size:12px;
  line-height:1.5;
}
.phase-approve {
  margin:8px 0 24px;
}
.asset-section+.asset-section {
  margin-top:32px;
}
.asset-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:15px;
}
.asset-card {
  border:1px solid var(--line);
  background:var(--paper);
  border-radius:5px;
  overflow:hidden;
  min-width:0;
  max-width:420px;
}
.asset-card.chosen {
  border-color:var(--teal);
  box-shadow:0 0 0 1px var(--teal);
}
.asset-open {
  border:0;
  border-radius:0;
  padding:0;
  background:none;
  display:block;
  width:100%;
  text-align:left;
}
.asset-open img {
  display:block;
  width:100%;
  aspect-ratio:1.1;
  object-fit:contain;
  background:#f5eddf;
}
.asset-name {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:12px;
  font-size:13px;
  text-transform:capitalize;
}
.status-tag {
  font-size:10px;
  color:#355a47;
  background:#e4ecdf;
  padding:3px 6px;
  border-radius:3px;
  font-weight:400;
}
.asset-card>.review-actions {
  padding:0 11px 12px;
}
.asset-card>.review-actions button {
  font-size:10.5px;
}
.back-link {
  margin-bottom:18px;
}
.asset-canvas {
  display:block;
  background:#f3eadb;
  border:1px solid var(--line);
  padding:0;
  width:100%;
  border-radius:5px;
  cursor:zoom-in;
}
.asset-canvas img {
  display:block;
  max-height:56vh;
  max-width:100%;
  margin:auto;
  object-fit:contain;
}
.asset-description {
  font-size:12px;
  margin-top:15px;
  color:var(--muted);
}
.asset-description summary {
  cursor:pointer;
}
.asset-description p {
  padding-top:10px;
  max-width:650px;
  line-height:1.7;
}
.empty-state {
  min-height:400px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  gap:17px;
  padding:30px 12px;
}
.empty-state>.ui-icon {
  width:44px;
  height:44px;
  color:#c97559;
  background:var(--sand);
  padding:9px;
  box-sizing:content-box;
  border-radius:4px;
  margin-bottom:5px;
}
.empty-state h2 {
  max-width:410px;
  font-size:25px;
  line-height:1.4;
  letter-spacing:-.7px;
}
.empty-state p {
  max-width:360px;
  font-size:14px;
  color:var(--muted);
}
.loading-state {
  color:var(--muted);
  font-size:13px;
}
.decision-actions {
  width:100%;
  max-width:480px;
  margin:8px auto;
}
.decision-actions .uiact {
  margin:10px 0;
}
.decision-actions .uiact button {
  justify-content:center;
  padding:12px 16px;
  font-size:13px;
}
.decision-actions br {
  display:none;
}
.start-choices {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin-top:16px;
  white-space:normal;
}
.start-choice {
  background:var(--paper);
  border:1px solid #cabb9f;
  padding:16px 12px;
  font-size:13px;
  font-weight:550;
  min-height:60px;
}
.start-choice[aria-expanded=true] {
  border-color:var(--teal);
  box-shadow:inset 0 0 0 1px var(--teal);
}
#log .start-choices {
  grid-template-columns:1fr;
}
@media (max-width:520px) {
  .start-choices { grid-template-columns:1fr; }
}
.start-idea-form {
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:12px;
  text-align:left;
  white-space:normal;
  padding:18px;
  border:1px solid var(--line);
  background:var(--paper);
  border-radius:5px;
  margin-top:12px;
}
.start-idea-form label {
  width:100%;
  font-size:12px;
  font-weight:550;
}
.start-idea-form textarea {
  display:block;
  width:100%;
  margin-top:8px;
  padding:10px;
  resize:vertical;
  border:1px solid #cabb9f;
  border-radius:4px;
  background:white;
  font-size:13px;
  line-height:1.5;
  color:var(--ink);
}
.start-idea-form button {
  font-size:12px;
}
.print-panel {
  display:grid;
  grid-template-columns:minmax(150px,.85fr) 1fr;
  align-items:center;
  gap:35px;
  margin:30px 0;
}
.print-cover {
  width:100%;
  box-shadow:5px 9px 15px #71572c25;
  border-radius:3px;
}
.print-placeholder {
  aspect-ratio:1;
  background:var(--sand);
  display:grid;
  place-items:center;
  font-family:Lexend,sans-serif;
}
.print-details h2 {
  font-size:25px;
  line-height:1.35;
  letter-spacing:-.6px;
}
.print-specs {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:9px;
  font-size:12px;
  margin:24px 0;
}
.print-specs dt {
  color:var(--muted);
}
.print-specs dd {
  margin:0;
  text-transform:capitalize;
  font-weight:500;
}
.print-details p {
  font-size:12px;
  line-height:1.7;
  margin-bottom:22px;
}
.print-details button {
  width:100%;
}
.print-decisions {
  margin-top:30px;
}
.print-form, .print-result {
  border-top:1px solid var(--line);
  padding:24px 0;
}
.print-form h3, .print-result h3 { margin-bottom:18px; }
.print-form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.print-form label { display:flex; flex-direction:column; gap:7px; font-size:12px; margin-bottom:14px; }
.print-form input, .print-form select {
  width:100%; min-width:0; padding:11px; border:1px solid var(--line);
  border-radius:3px; background:var(--paper); color:var(--ink); font:inherit;
}
.print-form .subtle, .print-result .subtle { line-height:1.65; margin:12px 0; }
.print-form button { min-height:44px; padding:10px 22px; }
.print-files { display:flex; flex-wrap:wrap; gap:18px; margin:18px 0; }
.print-files a { color:var(--ink); text-underline-offset:4px; }
.print-error { color:#9e3527; line-height:1.6; }
.print-edition { display:flex; flex-direction:column; gap:8px; margin:18px 0; font-size:12px; }
.print-edition select { width:100%; padding:12px; background:var(--paper, #fff); color:var(--ink); border:1px solid var(--line, #ccc); font:inherit; }
.print-proof { display:block; width:100%; height:auto; margin:18px 0; border:1px solid var(--line, #ccc); }
.print-mockups { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px; }
.print-mockups img { width:100%; height:auto; }
.print-orders { margin-top:28px; border-top:1px solid var(--line); padding-top:24px; }
.print-orders h3, .print-orders h4 { margin:0 0 16px; }
.print-orders p { line-height:1.65; margin:12px 0; }
.print-orders button { min-height:44px; padding:10px 20px; }
.print-address { white-space:pre-line; }
.print-manual-check { display:flex; gap:10px; align-items:flex-start; margin:20px 0; font-size:13px; line-height:1.6; }
.print-manual-check input { margin-top:4px; flex:0 0 auto; }
.print-order-actions { display:flex; flex-wrap:wrap; gap:12px; margin-top:18px; }
.print-order-card { border:1px solid var(--line); padding:22px; margin-top:22px; }
.print-checkout { border-top:1px solid var(--line); margin-top:24px; padding-top:24px; }
.print-checkout button { margin:8px 12px 0 0; }
.print-order-id { overflow-wrap:anywhere; font-size:12px; }
@media (max-width:650px) { .print-form-grid { grid-template-columns:1fr; gap:0; } }
dialog {
  color:var(--ink);
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--paper);
  box-shadow:0 18px 80px #0004;
  padding:26px;
  width:min(500px,calc(100vw - 28px));
}
dialog::backdrop {
  background:#102e38aa;
  backdrop-filter:blur(3px);
}
#revisionForm {
  display:flex;
  flex-direction:column;
  gap:18px;
}
#revisionTitle {
  font-size:21px;
}
#revisionForm label {
  font-size:12px;
  display:flex;
  flex-direction:column;
  gap:7px;
  font-weight:550;
}
#revisionForm select,#revisionForm textarea {
  background:white;
  border:1px solid #cbbb9f;
  border-radius:4px;
  padding:10px;
  color:var(--ink);
  width:100%;
  font-size:14px;
}
#revisionText {
  resize:vertical;
  min-height:110px;
}
#revisionForm .dialog-actions {
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:5px;
}
#settings {
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  background:#102e38bb;
  backdrop-filter:blur(3px);
  z-index:90;
}
#settings.open {
  display:flex;
}
#scard {
  background:var(--paper);
  border:1px solid var(--line);
  border-radius:7px;
  padding:24px;
  width:740px;
  max-width:94vw;
  max-height:90vh;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:23px;
}
#scard .bar {
  display:flex;
  align-items:center;
  gap:10px;
}
#scard .bar strong {
  font:550 22px Lexend,sans-serif;
}
#scard .grow {
  flex:1;
}
#sclose {
  border:0;
  background:none;
  padding:6px;
  font-size:18px;
}
#scard label {
  display:flex;
  flex-direction:column;
  gap:8px;
  font-size:13px;
  color:var(--ink);
}
#scard select,#ormSearch {
  background:white;
  color:var(--ink);
  border:1px solid #cebea2;
  border-radius:4px;
  padding:9px 8px;
  font:inherit;
  font-size:12px;
  width:100%;
  min-width:0;
}
#scard h3 {
  margin-bottom:8px;
}
#scard p {
  margin:0 0 12px;
}
.settings-section+.settings-section {
  border-top:1px solid var(--line);
  padding-top:23px;
}
.settings-grid {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:15px;
}
.settings-note {
  font-size:12px;
  line-height:1.5;
  color:var(--muted);
}
.model-card {
  border:1px solid var(--line);
  background:#f6efdf;
  border-radius:5px;
  padding:15px;
  min-width:0;
}
.model-card .settings-note {
  margin:5px 0 12px!important;
  min-height:36px;
}
.effective-model {
  color:var(--green);
  font-size:11px;
  line-height:1.6;
  margin-top:10px;
  overflow-wrap:anywhere;
}
#scard details {
  margin-top:14px;
  border-top:1px solid var(--line);
  padding-top:14px;
}
#scard summary {
  font-size:13px;
  cursor:pointer;
}
#scard details[open]>summary {
  margin-bottom:15px;
}
#settingsStatus {
  font-size:11px;
  color:var(--green);
}
#settingsStatus.error {
  color:#a84732;
}
#brainCurrent {
  margin-top:10px!important;
  overflow-wrap:anywhere;
}
#ormrow {
  margin-top:10px;
}
#ormSearch {
  margin-bottom:6px;
}
#pmDefault {
  margin-bottom:12px;
}
#lightbox {
  position:fixed;
  inset:0;
  background:#102b32ed;
  z-index:80;
  display:none;
  align-items:center;
  justify-content:center;
  cursor:zoom-out;
}
#lightbox.open {
  display:flex;
}
#lightbox img {
  max-width:94vw;
  max-height:90vh;
  object-fit:contain;
  box-shadow:0 10px 70px #0005;
}
.modal-close {
  position:absolute;
  top:18px;
  right:20px;
  border:1px solid #ffffff40;
  background:#12333c;
  color:var(--cream);
  padding:9px 13px;
  z-index:2;
}
#reader {
  position:fixed;
  inset:0;
  background:#102b32f7;
  z-index:60;
  display:none;
  align-items:center;
  justify-content:center;
  --pw:min(42vw,67vh);
}
#reader.open {
  display:flex;
}
#rstage {
  perspective:2400px;
}
#rbook {
  position:relative;
  display:flex;
  box-shadow:0 24px 90px #0008;
}
.rsheet {
  width:var(--pw);
  background:var(--paper);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.rsheet img {
  width:100%;
  display:block;
}
.rsheet.blank {
  min-height:var(--pw);
  background:transparent;
}
#rflip {
  position:absolute;
  top:0;
  left:50%;
  width:var(--pw);
  height:100%;
  display:none;
  transform-style:preserve-3d;
  transform-origin:left center;
  z-index:3;
}
#rflip.left {
  left:0;
  transform-origin:right center;
}
#rflip.turning {
  display:block;
  transition:transform .75s cubic-bezier(.3,.05,.35,1);
}
#rflip .face {
  position:absolute;
  inset:0;
  backface-visibility:hidden;
  background:var(--paper);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
#rflip .face img {
  width:100%;
}
#rflip .face.back {
  transform:rotateY(180deg);
}
#rrev {
  position:absolute;
  bottom:46px;
  width:100%;
  display:flex;
  justify-content:center;
  gap:2vw;
}
.rhalf {
  width:var(--pw);
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  align-items:center;
  gap:8px;
}
.rchip {
  padding:6px 12px;
  border-radius:4px;
  font-size:12px;
  cursor:pointer;
  background:#ffffff0b;
  border:1px solid #ffffff40;
  color:var(--cream);
}
.rchip:hover {
  background:#ffffff20;
}
#rrev input {
  background:#173c46;
  color:white;
  border:1px solid #ffffff60;
  border-radius:4px;
  padding:8px;
  font:inherit;
  font-size:12px;
  width:min(260px,90%);
}
#rrestart {
  position:absolute;
  top:50%;
  left:calc(50% + var(--pw)/2);
  transform:translate(-50%,-50%);
  display:none;
  font-size:14px;
}
.rnav {
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  font-size:34px;
  width:44px;
  height:70px;
  background:#ffffff08;
  border:0;
  color:var(--cream);
}
.rnav:hover {
  background:#ffffff15!important;
}
#rprev {
  left:14px;
}
#rnext {
  right:14px;
}
#rcount {
  position:absolute;
  bottom:18px;
  width:100%;
  text-align:center;
  color:#abc0c1;
  font-size:12px;
}
#mobileBar,#libraryMask,#libraryClose {
  display:none;
}
@media(min-width:1600px) {
  body {
    grid-template-columns:230px 345px minmax(0,1fr);
  }
  .book-heading {
    padding:24px 38px 18px;
  }
  .workspace {
    padding:25px 38px;
  }
  .pitem .t {
    font-size:13px;
  }
  .project-cover {
    width:67px;
    height:82px;
  }
  .step-name {
    font-size:13px;
  }
  .spread-heading {
    margin-bottom:25px;
  }
  .page-filmstrip {
    margin-top:24px;
  }
}
@media(max-width:1150px) {
  body {
    grid-template-columns:190px 280px minmax(0,1fr);
  }
  .brand {
    font-size:20px;
    padding:0 15px;
  }
  .pitem {
    gap:8px;
    padding:10px 6px;
  }
  .project-cover {
    width:49px;
    height:64px;
  }
  .pitem .t {
    font-size:11.5px;
  }
  .step-name {
    font-size:10px;
  }
  .step-number {
    width:20px;
    height:20px;
  }
  .stage-step {
    padding-left:19px;
    gap:6px;
  }
  .workspace {
    padding:20px 20px;
  }
  .book-heading {
    padding:18px 20px 14px;
    gap:10px;
  }
  #bookTitle {
    font-size:17px;
  }
  #read {
    padding:8px;
    font-size:10px;
  }
  #read svg {
    display:none;
  }
  .asset-grid {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .asset-name {
    font-size:12px;
  }
  .asset-card .review-actions {
    flex-wrap:wrap;
  }
  .print-panel {
    grid-template-columns:1fr;
    max-width:380px;
    margin:12px auto;
  }
  .print-cover {
    max-width:230px;
    margin:auto;
  }
  .print-details h2 {
    font-size:22px;
  }
}
@media(max-width:860px) {
  body {
    grid-template-columns:280px minmax(0,1fr);
    grid-template-rows:46px 58px minmax(0,1fr);
    grid-template-areas:'mobile mobile' 'steps steps' 'chat book';
  }
  #projects {
    visibility:hidden;
    position:fixed;
    inset:0 auto 0 0;
    width:240px;
    transform:translateX(-100%);
    transition:transform .2s;
  }
  body.library-open #projects {
    visibility:visible;
    transform:translateX(0);
  }
  #libraryMask {
    display:none;
    position:fixed;
    inset:0;
    background:#102e3899;
    border:0;
    border-radius:0;
    z-index:25;
  }
  body.library-open #libraryMask {
    display:block;
  }
  #libraryClose {
    display:block;
    margin-left:auto;
    border:0;
    background:none;
    color:var(--cream);
    padding:4px;
  }
  #mobileBar {
    grid-area:mobile;
    display:flex;
    align-items:center;
    gap:12px;
    padding:0 15px;
    background:var(--teal);
    color:var(--cream);
  }
  #mobileBar>strong {
    font-family:Lexend,sans-serif;
    font-size:15px;
    font-weight:500;
  }
  #mobileBar button {
    background:none;
    border:0;
    color:var(--cream);
    padding:6px;
    font-size:12px;
  }
  #mobileViews {
    margin-left:auto;
    display:none;
    gap:5px;
  }
  #mobileViews button.active {
    background:#ffffff20;
  }
  #libraryToggle svg {
    width:19px;
    height:19px;
  }
  .brand {
    font-size:23px;
  }
  .project-cover {
    width:67px;
    height:82px;
  }
  .pitem .t {
    font-size:13px;
  }
  .step-name {
    font-size:11px;
  }
  .stage-step {
    gap:8px;
  }
  .book-heading {
    padding:17px 18px;
  }
  #bookTitle {
    font-size:16px;
  }
}
@media(max-width:700px) {
  body {
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:46px 58px minmax(0,1fr);
    grid-template-areas:'mobile' 'steps' 'book';
  }
  #mobileViews {
    display:flex;
  }
  #chat {
    grid-area:book;
    display:none;
  }
  body[data-mobile-view=chat] #chat {
    display:flex;
  }
  body[data-mobile-view=chat] #preview {
    display:none;
  }
  .step-name {
    font-size:9px;
    letter-spacing:0;
    text-transform:none;
    line-height:1.25;
  }
  .step-number {
    width:17px;
    height:17px;
    font-size:9px;
  }
  .stage-step {
    gap:4px;
    padding:0 11px 0 15px;
    flex:1;
  }
  .stage-step[data-stage=characters] {
    flex:1.4;
  }
  .stage-step:first-child {
    padding-left:5px;
  }
  .book-heading {
    padding:18px 18px 13px;
  }
  #bookTitle {
    font-size:17px;
  }
  .workspace {
    padding:20px 20px 28px;
  }
  .spread-arrow {
    font-size:29px;
    width:19px;
  }
  .spread-stage {
    gap:5px;
    margin:0 -12px;
  }
  .spread-heading {
    margin-bottom:15px;
  }
  .review-actions {
    gap:10px;
    margin-top:15px;
  }
  .review-actions button {
    font-size:12px;
    padding:11px 15px;
  }
  .page-filmstrip {
    margin-top:14px;
  }
  .page-thumb {
    min-width:68px;
  }
  .thumb-pictures {
    width:68px;
    height:40px;
  }
  .empty-state {
    min-height:330px;
  }
  .empty-state h2 {
    font-size:23px;
  }
  .story-page {
    padding:17px 14px;
    grid-template-columns:22px 1fr;
    gap:10px;
  }
  .story-page p {
    font-size:15px;
  }
  .asset-grid {
    gap:10px;
  }
  .asset-name {
    padding:9px;
    flex-wrap:wrap;
  }
  .asset-card>.review-actions {
    padding:0 8px 10px;
    gap:6px;
  }
  .asset-card>.review-actions button {
    font-size:10px;
    padding:8px 5px;
  }
  .asset-card>.review-actions .ui-icon {
    display:none;
  }
  .settings-grid {
    grid-template-columns:1fr;
  }
  #scard {
    padding:18px;
  }
  #scard .bar {
    flex-wrap:wrap;
  }
  #settingsStatus {
    order:3;
    width:100%;
  }
  .chat-heading {
    padding:14px 18px;
  }
  #log {
    padding:18px;
    gap:17px;
  }
  .msg {
    font-size:14px;
  }
  .showgrid {
    grid-template-columns:repeat(2,minmax(0,1fr));
    max-width:420px;
  }
  #input {
    min-height:65px;
  }
  #composer {
    padding:12px 17px;
  }
  #contextActions .compact {
    max-width:420px;
  }
  .context-label {
    font-size:12px;
  }
  .review-actions.compact button {
    font-size:12px;
  }
  .print-panel {
    gap:25px;
  }
  #reader {
    --pw:45vw;
  }
  .rnav {
    width:30px;
    padding:3px;
    background:#12333ca0;
  }
  #rprev {
    left:0;
  }
  #rnext {
    right:0;
  }
  #rrev {
    bottom:55px;
  }
  .rchip {
    font-size:10px;
    padding:5px 8px;
  }
  .modal-close {
    top:12px;
    right:12px;
  }
}
@media(prefers-reduced-motion:reduce) {
  * {
    scroll-behavior:auto!important;
    transition:none!important;
  }
  #rflip.turning {
    transition:none;
  }
}

/* Customer checkout: replace each stage in one compact card. */
.checkout-shell { max-width:720px; margin:12px auto 30px; border:1px solid var(--line); background:var(--paper); padding:26px; }
.checkout-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:14px; margin-bottom:22px; }
.checkout-heading h2 { font-size:24px; line-height:1.25; letter-spacing:-.7px; margin:0; }
.checkout-heading h2:focus { outline:none; }
.checkout-badge { flex-shrink:0; border:1px solid var(--line); padding:5px 8px; font-size:10px; text-transform:uppercase; letter-spacing:1px; background:var(--sand); }
.checkout-book { display:flex; align-items:center; gap:18px; padding-bottom:22px; margin-bottom:22px; border-bottom:1px solid var(--line); }
.checkout-book img { width:78px; height:78px; object-fit:cover; box-shadow:4px 4px 0 var(--sand); }
.checkout-book strong { font-size:16px; }
.checkout-book p { margin:6px 0 0; font-size:12px; line-height:1.5; }
.checkout-muted { color:var(--muted); font-size:12px; line-height:1.6; }
.checkout-shell button { min-height:42px; padding:11px 18px; }
.checkout-shell button.text-button { padding:6px 0; text-decoration:underline; text-underline-offset:3px; min-height:34px; }
.checkout-options { display:grid; grid-template-columns:minmax(0,1fr) 82px; gap:14px; margin-bottom:24px; }
.checkout-form label { display:flex; flex-direction:column; gap:6px; font-size:12px; min-width:0; }
.checkout-form input, .checkout-form select { width:100%; min-width:0; min-height:42px; padding:10px; border:1px solid var(--line); border-radius:2px; background:var(--bg); color:var(--ink); font:inherit; }
.checkout-form input:focus, .checkout-form select:focus { outline:2px solid var(--ink); outline-offset:2px; }
.checkout-form input[type=number] { font-variant-numeric:tabular-nums; }
.checkout-subheading { display:flex; justify-content:space-between; align-items:baseline; gap:10px; margin-bottom:14px; }
.checkout-subheading h3, .checkout-delivery-summary h3 { font-size:15px; margin:0; }
.checkout-fields { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.checkout-wide { grid-column:1/-1; }
.checkout-region { display:grid; grid-template-columns:1.2fr 1fr; gap:10px; }
.checkout-shipping { border:0; padding:0; margin:22px 0; display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.checkout-shipping legend { padding:0; margin-bottom:10px; font-size:12px; }
.checkout-shipping label { border:1px solid var(--line); padding:12px; display:flex; flex-direction:row; align-items:center; gap:10px; cursor:pointer; }
.checkout-shipping label:has(input:checked) { border-color:var(--ink); background:var(--sand); box-shadow:inset 0 0 0 1px var(--ink); }
.checkout-shipping input[type=radio] { width:15px; min-height:15px; height:15px; padding:0; accent-color:var(--ink); flex-shrink:0; }
.checkout-shipping strong, .checkout-shipping small { display:block; }
.checkout-shipping strong { font-size:12px; font-weight:600; }
.checkout-shipping small { margin-top:4px; color:var(--muted); font-size:11px; }
.checkout-primary { width:100%; margin-top:8px; font-size:14px; }
.checkout-footnote { text-align:center; font-size:12px; color:var(--muted); line-height:1.6; margin:12px 0 0; }
.checkout-test-note { text-align:center; font-size:10px; letter-spacing:.25px; color:var(--muted); margin:20px 0 0; }
.checkout-notice { padding:14px; background:#f3e0cf; border-left:3px solid var(--coral, #d67a59); font-size:13px; line-height:1.6; margin:16px 0; }
.checkout-progress { text-align:center; padding:25px 4px 20px; }
.checkout-progress-symbol { display:grid; place-items:center; background:var(--sand); width:66px; height:66px; margin:0 auto 22px; color:var(--ink); font-size:32px; }
.checkout-progress h3 { font-size:19px; margin:0 0 12px; }
.checkout-progress p { font-size:12px; line-height:1.6; margin:10px 0; }
.checkout-progress progress { display:block; width:100%; height:7px; border:0; border-radius:0; margin:25px 0 18px; background:var(--sand); accent-color:var(--ink); overflow:hidden; }
.checkout-progress progress::-webkit-progress-bar { background:var(--sand); }
.checkout-progress progress::-webkit-progress-value { background:var(--ink); transition:width .3s; }
.checkout-progress progress:indeterminate { background:linear-gradient(90deg,var(--sand) 0%,var(--ink) 50%,var(--sand) 100%); background-size:200% 100%; animation:checkout-wait 2s linear infinite; }
.checkout-progress progress:indeterminate::-webkit-progress-bar { background:transparent; }
@keyframes checkout-wait { to { background-position:-200% 0; } }
.checkout-progress-steps { list-style:none; padding:20px 0 0; margin:0; display:grid; grid-template-columns:repeat(3,1fr); border-top:1px solid var(--line); gap:8px; }
.checkout-progress-steps li { color:var(--muted); font-size:11px; display:flex; align-items:center; gap:7px; line-height:1.4; }
.checkout-progress-steps span { display:grid; place-items:center; border:1px solid var(--line); width:22px; height:22px; flex-shrink:0; font-size:10px; }
.checkout-progress-steps .current { color:var(--ink); font-weight:600; }
.checkout-progress-steps .current span, .checkout-progress-steps .done span { color:var(--paper); background:var(--ink); border-color:var(--ink); }
.checkout-intro { font-size:13px; line-height:1.6; margin:0 0 22px; }
.checkout-delivery-summary { padding:16px; background:var(--sand); }
.checkout-delivery-summary > div { display:flex; align-items:center; justify-content:space-between; }
.checkout-address { font-size:13px; line-height:1.6; white-space:pre-line; margin:10px 0; }
.checkout-delivery-summary > p:last-child { margin:8px 0 0; }
.checkout-price { display:grid; grid-template-columns:1fr auto; gap:12px; margin:24px 0; font-size:13px; }
.checkout-price dt { color:var(--muted); }
.checkout-price dd { text-align:right; margin:0; font-variant-numeric:tabular-nums; }
.checkout-price .checkout-total { border-top:1px solid var(--line); padding-top:16px; margin-top:4px; color:var(--ink); font-size:20px; font-weight:600; }
.checkout-proof { margin-top:24px; padding-top:18px; border-top:1px solid var(--line); font-size:12px; }
.checkout-proof summary { cursor:pointer; text-underline-offset:3px; }
.checkout-proof img { width:100%; margin-top:16px; }
.checkout-proof a { display:inline-block; margin:16px 16px 0 0; color:var(--ink); }
.checkout-success { text-align:center; margin:26px 0; }
.checkout-success > span { display:grid; place-items:center; width:48px; height:48px; margin:0 auto 16px; background:var(--ink); color:var(--paper); font-size:22px; }
.checkout-success h3 { font-size:19px; margin:0 0 10px; }
.checkout-success p { max-width:390px; margin:0 auto; font-size:13px; line-height:1.7; }
@media (prefers-reduced-motion:reduce) { .checkout-progress progress:indeterminate { animation:none; } .checkout-progress progress::-webkit-progress-value { transition:none; } }
@media (max-width:650px) {
  .checkout-shell { padding:18px; margin-top:0; }
  .checkout-heading h2 { font-size:21px; }
  .checkout-fields { grid-template-columns:1fr; }
  .checkout-wide { grid-column:auto; }
  .checkout-book { gap:14px; }
  .checkout-book img { width:65px; height:65px; }
  .checkout-progress-steps li { flex-direction:column; align-items:flex-start; }
}
.checkout-shell { container-type:inline-size; }
.checkout-review-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:24px; align-items:start; margin:22px 0; }
.checkout-review-grid .checkout-price { margin:10px 0 0; }
.checkout-shell .checkout-add-address { text-align:left; justify-self:start; min-height:24px; padding:0; margin-top:-4px; }
@container (max-width:440px) { .checkout-review-grid { grid-template-columns:1fr; gap:12px; } }
.checkout-form input, .checkout-form select { background:var(--paper); }
.checkout-form > .checkout-primary { margin-top:24px; }
.checkout-delivery-options { border:0; margin:18px 0; padding:0; display:grid; gap:12px; }
.checkout-delivery-options legend { font-size:12px; margin-bottom:12px; color:var(--muted); }
.checkout-delivery-option { display:flex; align-items:flex-start; gap:12px; border:1px solid var(--line); padding:16px; cursor:pointer; }
.checkout-delivery-option:has(input:checked) { background:var(--sand); border-color:var(--ink); box-shadow:inset 0 0 0 1px var(--ink); }
.checkout-delivery-option input { flex:0 0 auto; width:16px; height:16px; margin:3px 0 0; accent-color:var(--ink); }
.checkout-delivery-option-body { flex:1; min-width:0; display:grid; gap:7px; }
.checkout-delivery-option-heading { display:flex; justify-content:space-between; gap:16px; font-size:15px; }
.checkout-delivery-arrival { font-size:13px; }
.checkout-delivery-option small { font-size:11px; color:var(--muted); line-height:1.6; }
.checkout-delivery-eta { font-size:12px; font-weight:600; line-height:1.6; margin:14px 0 0; }
.checkout-location { display:grid; grid-template-columns:minmax(85px,.7fr) minmax(0,1.5fr) minmax(0,1.2fr); gap:12px; }
.checkout-zip-status { margin:-4px 0 0; color:var(--muted); font-size:11px; line-height:1.5; }
.checkout-shell .checkout-book-preview { flex:0 0 150px; width:150px; min-height:0; padding:0; border:1px solid var(--line); background:white; cursor:zoom-in; }
.checkout-book-preview img { display:block; width:100%; height:120px; object-fit:contain; box-shadow:none; }
.checkout-book-preview img[hidden] { display:none; }
.checkout-preview-modal { width:920px; max-width:calc(100vw - 40px); max-height:calc(100dvh - 40px); padding:20px; border:1px solid var(--line); background:var(--paper); color:var(--ink); }
.checkout-preview-modal[open] { display:flex; flex-direction:column; gap:14px; }
.checkout-preview-modal::backdrop { background:rgba(20,38,44,.7); }
.checkout-preview-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.checkout-preview-heading h2 { margin:0; font-size:22px; letter-spacing:-.5px; }
.checkout-preview-modal button { cursor:pointer; border:1px solid var(--line); background:var(--paper); color:var(--ink); min-width:38px; min-height:38px; }
.checkout-preview-modal button:focus-visible { outline:2px solid var(--ink); outline-offset:3px; }
.checkout-preview-modal figure { display:grid; place-items:center; margin:0; background:white; min-height:100px; overflow:hidden; }
.checkout-preview-modal figure > img { display:block; width:100%; height:min(54dvh,540px); object-fit:contain; }
.checkout-preview-modal figure > img[hidden] { display:none; }
.checkout-preview-error { padding:24px; font-size:13px; text-align:center; }
.checkout-preview-controls { display:flex; align-items:center; justify-content:center; gap:16px; }
.checkout-preview-controls span { min-width:170px; text-align:center; font-size:13px; }
.checkout-preview-thumbnails { display:flex; gap:8px; overflow-x:auto; padding:3px 3px 8px; }
.checkout-preview-thumbnails button { flex:0 0 66px; width:66px; height:66px; padding:2px; font-size:10px; }
.checkout-preview-thumbnails img { width:100%; height:100%; object-fit:contain; background:white; }
.checkout-preview-thumbnails button[aria-pressed=true] { outline:2px solid var(--ink); outline-offset:1px; }
.msg.agent button:disabled, .msg.agent .uiact input:disabled { opacity:.55; cursor:default; }
.render-placeholder { display:grid; place-content:center; justify-items:center; gap:10px; aspect-ratio:1; min-width:0; background:var(--sand); color:var(--muted); font-size:12px; padding:12px; text-align:center; }
.render-placeholder .ui-icon { width:32px; height:32px; opacity:.55; }
.workspace > .render-placeholder { max-height:42vh; aspect-ratio:auto; min-height:180px; border:1px dashed var(--line); }
.render-placeholder.painting { background:linear-gradient(105deg,var(--sand) 20%,var(--paper) 47%,var(--sand) 75%); background-size:220% 100%; animation:book-painting 2.8s ease-in-out infinite; }
@keyframes book-painting { from {background-position:100% 0;} to {background-position:-100% 0;} }
@media (prefers-reduced-motion:reduce) { .render-placeholder.painting { animation:none; } }
.illustration-progress { display:block; width:100%; height:5px; margin:2px 0 18px; accent-color:var(--teal); }
.version-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(min(180px, 45%), 1fr)); gap:12px; align-items:start; }
.version-card { display:grid; gap:8px; padding:10px; border:1px solid var(--line); background:var(--paper); }
.version-card.current { border-color:var(--teal); }
.version-card img { display:block; width:100%; aspect-ratio:1; object-fit:contain; }
.version-card strong { font-size:13px; }
.version-card .status-tag { justify-self:start; }
.version-link { margin:0 10px 7px; text-align:left; font-size:12px; }
@container (max-width:440px) {
  .checkout-location { grid-template-columns:1fr 1fr; }
  .checkout-location > label:first-child { grid-column:1/-1; }
  .checkout-shell .checkout-book-preview { flex-basis:105px; width:105px; }
  .checkout-book-preview img { height:105px; }
}
@media (max-width:650px) {
  .checkout-preview-modal { padding:14px; max-width:calc(100vw - 24px); max-height:calc(100dvh - 24px); }
  .checkout-preview-heading h2 { font-size:20px; }
}

body.account-page {
  display:grid; grid-template:1fr / 1fr; place-items:center; overflow:auto;
  padding:24px; background:var(--cream); height:auto; min-height:100dvh;
}
.account-card {
  width:min(100%,390px); background:var(--paper); border:1px solid var(--line);
  border-top:5px solid var(--teal); border-radius:8px; padding:30px;
}
.account-brand { display:flex; align-items:center; gap:8px; color:var(--teal); font:600 19px Lexend,sans-serif; margin-bottom:28px; }
.account-brand svg { width:24px; height:28px; }
.account-card h1 { font-size:26px; margin-bottom:4px; }
.account-card form { display:grid; gap:15px; margin:22px 0 12px; }
.account-card label { display:grid; gap:5px; font-weight:600; }
.account-card input { width:100%; background:var(--paper); color:var(--ink); border:1px solid var(--line); border-radius:5px; padding:10px; }
.account-card input[readonly] { background:var(--cream); }
.account-error { color:#973a27; }
.account-error:empty { display:none; }
.account-card .text-button { display:block; }
.account-identity { padding:8px 14px 0; color:var(--muted); overflow-wrap:anywhere; }
