.shared-book { box-sizing: border-box; width: 100%; max-width: 52rem; margin: 0 auto; padding: 1rem; color: var(--text); }
.shared-book select, .shared-book input:not(.switch), .shared-book textarea { max-width: 100%; }
.shared-book select, .shared-book input:not(.switch) { min-height: 48px; }

/* Spec 228 amendment 2026-10-26 (4): the wordmark, a link to xocana.com, on every page a relative sees. */
.shared-brand { display: inline-flex; flex: none; align-items: center; min-height: 48px; border-radius: var(--radius-sm); }
.shared-brand img { display: block; width: auto; height: 28px; }
.shared-brand:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset); }
.shared-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }

/* The quiet card while the page comes back, and the two things that can go wrong: a friend, the words, a yellow Try again. */
.shared-state { display: grid; grid-template-rows: auto 1fr; gap: var(--space-4); min-height: calc(100vh - 2rem); min-height: calc(100dvh - 2rem); }
.shared-state > .shared-state-card { align-self: center; }
.shared-state-card { align-items: center; width: min(100%, 440px); margin: var(--space-4) auto; text-align: center; }
.shared-state-friend { width: 112px; height: 112px; object-fit: contain; }
.shared-state-title { margin: 0; font-size: var(--font-lg); line-height: 1.3; }
.shared-state-words { margin: 0; color: var(--text-secondary); font-size: var(--font-md); }
.shared-state-card[aria-busy="true"] .shared-state-friend { animation: shared-breathe 1.6s ease-in-out infinite; }
@keyframes shared-breathe { 50% { scale: 0.94; opacity: 0.8; } }
@media (prefers-reduced-motion: reduce) { .shared-state-card[aria-busy="true"] .shared-state-friend { animation: none; } }
.shared-receipt-status { margin: 0; font-weight: 700; }
.shared-receipt-total { margin: 0; color: var(--text-secondary); }
.shared-receipt-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }

/* Spec 228 amendment 2026-10-26 (4) (the owner: "Reading the book in a share link is a poor experience"): the relative's
   reader is the app reader (css/books.css .reader, .sheet, .reader-controls): the wordmark, the count and the Languages
   button in the top bar; the book; ←, one ▶ and → at the foot. Only placing is here, never a new look. */
.shared-reader-bar { min-height: 48px; }
.shared-reader-bar .reader-progress { margin-inline: auto; }
.shared-reader-bar .reader-progress[hidden] { display: none; }
.shared-reader-bar .reader-tools { margin-inline-start: auto; }
.shared-reader-bar .reader-progress:not([hidden]) + .reader-tools { margin-inline-start: 0; }
.shared-reader .reader-tools .round[hidden] { display: none; }
.shared-reader .reader-controls { flex: none; }
.shared-reader .reader-controls > .is-off { visibility: hidden; }
.shared-reader .reader-controls .reader-read { justify-self: center; min-width: 0; }
.shared-reader .reader-read[data-state="stop"] { background: var(--accent); color: var(--on-accent); }
.shared-reader .round[aria-label] .icon, .shared-reader .reader-read .icon { pointer-events: none; }
/* The cover's title panel fits whole; its "A Xocana story" carries the wordmark picture. */
.shared-sheet .cover-story-mark { display: block; width: auto; height: 1.15em; }
.shared-sheet .cover-start { gap: var(--space-2); justify-items: center; }
.shared-cover-order { font-size: 1.1rem; padding-inline: 16px 22px; text-align: start; }
.shared-cover-order .icon { color: var(--accent); }
/* The End: the printed copy's card, Read again, and Xocana's quiet line as a link to the site. */
.shared-end .end-print { order: 3; }
.shared-end .end-actions { order: 4; }
.shared-end .print-offer-actions .button { gap: var(--space-2); }
.shared-end .print-offer-actions .icon { width: 1.3em; height: 1.3em; }
.shared-made { order: 5; max-width: 100%; justify-content: center; text-align: start; padding: var(--space-2) var(--space-3); border-radius: 999px; color: var(--on-paper); font-weight: 600; text-decoration: none; }
.shared-made:hover { text-decoration: underline; }
.shared-made:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset); }
.shared-made img { flex: none; width: 34px; height: auto; }
.shared-end .print-offer-actions .button { flex: 1 1 auto; padding-inline: 18px; font-size: var(--ui-font-button); }

/* A phone (the reader's own narrow rules round the play button): from 360 px "Read to me" keeps its words. */
@media (min-width: 360px) and (max-width: 640px) {
  .shared-reader .reader-controls .reader-read { display: inline-flex; width: auto; padding: 0 20px 0 14px; border-radius: 999px; }
  .shared-reader .reader-controls .reader-read span { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
}
@media (max-width: 359px) {
  .shared-brand img { height: 24px; }
  .shared-reader .reader-tools:has(> .reader-languages) > .shared-top-order { display: none; }
}
/* Sideways on a phone: the book takes the height; the turns sit at its sides and ▶ stays under it. */
@media (orientation: landscape) and (max-height: 520px) {
  .shared-reader { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto; column-gap: var(--space-2); }
  .shared-reader-bar { grid-column: 1 / -1; min-height: 44px; }
  .shared-reader .reader-stage { grid-column: 2; grid-row: 2; padding: 6px 12px 10px 8px; }
  .shared-reader .reader-controls { display: contents; }
  .shared-reader .reader-controls > [data-ref="previous"] { grid-column: 1; grid-row: 2; align-self: center; }
  .shared-reader .reader-controls > [data-ref="next"] { grid-column: 3; grid-row: 2; align-self: center; }
  .shared-reader .reader-controls > .reader-read { grid-column: 2; grid-row: 3; justify-self: center; height: 48px; min-height: 48px; }
}

/* Spec 228 amendment 2026-10-26: a relative's order page, phone first. The page is one column of cards (two on a wide
   screen, the book beside the choices); the pages are a strip that swipes sideways; a bar fixed to the foot holds the total
   and Pay, so neither Pay nor Back is ever a long scroll away. */
.shared-order {
  display: grid;
  gap: var(--space-3);
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
.shared-order > * { min-width: 0; margin: 0; }
.shared-order .card { margin: 0; padding: var(--space-4); }
/* PR #568 review: the bar is opaque, the sky's own top colour in every theme, with a soft shadow, so the formats scroll
   cleanly under it (78% with a blur let "Hardcover" show through). */
.shared-order-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); position: sticky; top: 0; z-index: 2; margin-inline: -1rem; padding: var(--space-2) 1rem; background: var(--sky-top); box-shadow: 0 6px 12px -6px var(--shadow); }
.shared-order-title { margin: 0; font-size: var(--font-lg); line-height: 1.2; }
.shared-book .shared-back { display: inline-flex; align-items: center; gap: var(--space-1); padding-inline: var(--space-3) var(--space-4); white-space: nowrap; }
.shared-back .icon { width: 20px; height: 20px; }
.shared-order-head { display: flex; align-items: center; gap: var(--space-3); }
.shared-book .shared-order-cover { flex: none; width: 72px; height: 72px; max-height: none; object-fit: cover; border-radius: var(--radius-md); box-shadow: var(--elevation-raised); }
.shared-order-words { display: grid; gap: var(--space-1); justify-items: start; min-width: 0; }
.shared-order-words h2 { margin: 0; font-size: var(--font-md); line-height: 1.25; overflow-wrap: anywhere; }
.shared-strip { --sheet-height: min(200px, 46vw); margin-inline: calc(var(--space-4) * -1); padding-inline: var(--space-4); scroll-padding-inline: var(--space-4); }
.shared-strip .print-sheet figcaption { display: none; }
.shared-strip-hint { margin: 0; font-size: var(--font-xs); }
.shared-book .shared-formats { margin: 0; }
.shared-order > h2.section { margin: var(--space-2) 0 0; font-size: var(--ui-font-section); color: var(--ink-orange); }
.shared-order-details { display: grid; gap: var(--space-3); }
.shared-order-details > .field:first-child { flex-direction: row; align-items: center; justify-content: space-between; }
.shared-order-details .print-copies { display: flex; align-items: center; gap: var(--space-3); margin: 0; }
.shared-order-details output { min-width: 2ch; text-align: center; font-size: var(--font-lg); font-weight: 700; }
.shared-book .shared-order label.field { display: grid; gap: .4rem; margin-block: 0; }
/* The two formats side by side, compact: the name, the price and the check (the parent's page has room for more). */
.shared-book .shared-formats { grid-template-columns: 1fr 1fr; grid-auto-rows: auto; gap: var(--space-2); }
.shared-formats .print-format { min-height: 0; padding: var(--space-3); }
.shared-formats .print-format .print-format-selected, .shared-formats .print-format[aria-checked="true"] .print-format-selected { display: none; }
.shared-formats .print-format-icon { width: 28px; height: 28px; }
.shared-formats .print-format[aria-checked="true"] { background: var(--accent-soft); }
.shared-gift { gap: var(--space-2); }
.shared-gift > summary { margin: calc(var(--space-2) * -1); width: auto; }
.shared-gift[open] > summary .settings-row-chevron { rotate: 90deg; }
.shared-gift textarea { width: 100%; box-sizing: border-box; }
/* Spec 228 amendment 2026-10-26 (4) (the owner: the switch "looks odd like not centered properly"): Settings' switch row, the
   switch its own 52 by 32 (the page's 48 px rule for fields no longer stretches it), centred on the row; no hover tint that
   stays after a tap on a phone. */
.shared-identity { gap: var(--space-2); }
.shared-identity > .settings-row { margin: calc(var(--space-2) * -1); width: auto; }
.shared-identity-row .settings-row-label { hyphens: manual; }
.shared-identity-row input.switch { align-self: center; margin: 0; }
@media (hover: none) { .shared-identity-row:hover { background: none; } .shared-identity-row:hover .settings-row-label { color: var(--accent); } }
.shared-terms { margin: 0; font-size: var(--font-xs); }
.shared-error { margin: 0; color: var(--danger); font-weight: 700; }
.shared-error[hidden] { display: none; }
.shared-strip[aria-busy="true"] { opacity: 0.6; transition: opacity 0.2s; }

.shared-paybar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) max(1rem, calc((100vw - 52rem) / 2 + 1rem)) calc(var(--space-3) + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: var(--ui-stroke-panel) solid var(--panel-edge);
  box-shadow: 0 -6px 18px rgb(11 24 48 / 12%);
}
.shared-paybar::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--gradient-rainbow); }
.shared-paybar-total { display: grid; line-height: 1.2; }
.shared-paybar-total span { font-size: var(--font-xs); }
.shared-paybar-total strong { font-size: var(--font-lg); }
.shared-book .shared-paybar .button { min-width: 9rem; }

@media (min-width: 900px) {
  .shared-order { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; column-gap: var(--space-5); }
  .shared-order-top, .shared-order > h2.section { grid-column: 1 / -1; }
  .shared-order-book { grid-column: 1; grid-row: 2 / span 6; position: sticky; top: 72px; }
  .shared-order > :not(.shared-order-top):not(.shared-order-book) { grid-column: 2; }
  .shared-order > h2.section { grid-column: 2; }
  .shared-strip { --sheet-height: 240px; }
}
