:root {
  --paper: #fff;
  --surface: #f5f5f3;
  --ink: #1d1d1f;
  --muted: #626462;
  --line: #e5e5e1;
  --green: #214f45;
  --focus: #437d6c;
  --radius: 12px;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }

/* Form fields across the shop (outside the configurator preview): text
   fields, text areas, select boxes and colour wells share one look. 16px
   text keeps phones from zooming in on focus. */
:root {
  --field-border: #c9d3cb;
  --field-border-hover: #a6b6ac;
  --field-ring: 0 0 0 3px #214f4524;
}
:is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]), textarea, select, .select-button):not(.preview *) {
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.35;
  transition: border-color .15s, box-shadow .15s;
}
/* Text areas grow with their text, so no scrollbar runs over the rounded
   corner; app.js does the same where field-sizing is not supported. */
textarea:not(.preview *) { min-height: 72px; overflow: hidden; resize: none; field-sizing: content; }
:is(input, textarea, select, .select-button):not(.preview *)::placeholder { color: #8a958d; opacity: 1; }
:is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"]), textarea, select, .select-button):not(.preview *):hover:not(:disabled, :focus) { border-color: var(--field-border-hover); }
:is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"]), textarea, select):not(.preview *):focus,
.select-button:not(.preview *):is(:focus-visible, [aria-expanded="true"]) {
  outline: none;
  border-color: var(--green);
  box-shadow: var(--field-ring);
}
:is(input, textarea):not(.preview *):is([aria-invalid="true"], :user-invalid) { border-color: #a24737; }
:is(input, textarea):not(.preview *):is([aria-invalid="true"], :user-invalid):focus { box-shadow: 0 0 0 3px #a2473724; }
:is(input, textarea, select, .select-button):not(.preview *):disabled { background: #f3f4f0; color: var(--muted); cursor: not-allowed; }
input[readonly]:not(.preview *) { background: #f6f7f3; }
input[type="color"]:not(.preview *) {
  width: 44px;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
}
/* The shade fills the well; the well's own border and focus ring are the
   ones every field has, without the browser's dark frame inside. */
input[type="color"]:not(.preview *)::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]:not(.preview *)::-webkit-color-swatch { border: 0; border-radius: 5px; box-shadow: inset 0 0 0 1px #0000001f; }
input[type="color"]:not(.preview *)::-moz-color-swatch { border: 0; border-radius: 5px; box-shadow: inset 0 0 0 1px #0000001f; }
:is(input[type="checkbox"], input[type="radio"], input[type="range"]):not(.choices input) { accent-color: var(--green); }
/* Select boxes (select.js): a button showing the choice and a list of options. */
.select { position: relative; display: inline-flex; min-width: 0; vertical-align: middle; }
.select-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
}
.select-button::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 1.6px solid var(--green);
  border-bottom: 1.6px solid var(--green);
  transform: translateY(-2px) rotate(45deg);
  transition: transform .15s;
}
.select-button[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
.select-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-list {
  position: fixed;
  inset: auto;
  width: max-content;
  max-width: min(320px, calc(100vw - 16px));
  max-height: min(280px, 60vh);
  margin: 0;
  padding: 4px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  box-shadow: 0 12px 28px #20382b29, 0 2px 6px #20382b14;
  list-style: none;
}
.select-list li {
  position: relative;
  padding: 7px 32px 7px 10px;
  border-radius: 6px;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}
.select-list li.active { background: var(--surface); }
.select-list li[aria-selected="true"] { color: var(--green); font-weight: 650; }
.select-list li[aria-selected="true"]::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 5px;
  height: 10px;
  border-right: 2px solid var(--green);
  border-bottom: 2px solid var(--green);
  transform: translateY(-65%) rotate(45deg);
}
.select-list li[aria-disabled="true"] { opacity: .45; cursor: default; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

header {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 65px;
  padding: 10px max(24px, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -.05em;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark { width: 32px; height: 32px; }
.product-link { color: var(--muted); font-size: 13px; text-decoration: none; }
.product-link:hover { text-decoration: underline; }
header .primary { margin-left: auto; }
.primary, .secondary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 17px;
  font-size: 13px;
  font-weight: 650;
}
.primary { background: var(--green); color: white; }
.primary:hover:not(:disabled) { background: #183d35; }
/* Secondary buttons are outlined at rest, so their shape never depends on a hover. */
.secondary { border-color: #b5c8bd; background: white; color: var(--green); }
.secondary:hover:not(:disabled) { background: var(--surface); }
/* A button that shows only an icon: square, the icon centred. Its name is in
   aria-label and, for a pointer, in title. */
.icon-button { display: inline-grid; place-items: center; flex: none; padding: 0; }
.icon-button .icon { width: 18px; height: 18px; }
#previous-step { width: 44px; min-height: 44px; }

main { max-width: 1296px; margin: auto; padding: 38px 28px 56px; }
.intro { margin-bottom: 28px; }
.eyebrow {
  color: var(--green);
  font-weight: 720;
  font-size: 11px;
  letter-spacing: .10em;
}
.intro h1 {
  margin: 5px 0 8px;
  font-size: clamp(39px, 5vw, 66px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -.062em;
}
.intro p, .step-panel p { margin: 0; color: var(--muted); }
.intro p { font-size: clamp(14px, 1.5vw, 17px); }
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 385px);
  gap: clamp(28px, 4vw, 58px);
  align-items: start;
}

.preview {
  position: sticky;
  top: 16px;
  min-width: 0;
  overflow: hidden;
  border-radius: 24px;
  background: #f4f3ef;
}
.viewbar, .viewfoot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 9px;
  min-height: 50px;
  padding: 10px 17px;
}
.views, .layout-mode, .tools { display: flex; align-items: center; gap: 3px; }
:is(.views, .layout-mode)[hidden] { display: none; }
.views, .layout-mode { padding: 3px; background: #e8e8e3; border-radius: 999px; }
.views { margin-left: auto; }
.views button, .layout-mode button, .tools button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
:is(.views, .layout-mode) button[aria-pressed="true"] { background: white; box-shadow: 0 1px 3px #171a1520; }
.layout-mode button { display: inline-flex; align-items: center; gap: 5px; }
.layout-mode svg { flex: none; }
/* Next to the room/bookcase switch (book step) only the icons fit. */
.viewbar:has(.views:not([hidden])) .layout-mode span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.tools button { min-width: 33px; font-size: 17px; }
.tools button:hover, :is(.views, .layout-mode) button:hover:not([aria-pressed="true"]) { background: #deded7; }
#viewport {
  position: relative;
  width: 100%;
  height: clamp(320px, 48vw, 515px);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 43%, #fdfcf8 5%, #f4f3ef 73%);
}
#viewport[data-room="true"] { cursor: grab; touch-action: none; }
#viewport.dragging { cursor: grabbing; }
#viewport:focus-visible { outline-offset: -3px; }
#scene { position: absolute; inset: 0; display: block; width: 100%; height: 100%; user-select: none; pointer-events: none; }
#preview-fallback { position: absolute; inset: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; margin: 0; padding: 8px; }
#preview-fallback img { display: block; width: 100%; height: 100%; object-fit: contain; }
#preview-fallback figcaption { color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; }
.config { min-width: 0; }
.steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(min-content, 1fr));
  border-bottom: 1px solid var(--line);
}
.steps button {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 56px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 4px 1px 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.steps button span { font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; }
.steps button:hover { color: var(--ink); }
.steps button[aria-current="step"] {
  border-bottom-color: var(--green);
  color: var(--green);
  font-weight: 720;
}
.step-panel { padding: 23px 0 20px; }
.step-panel h2 {
  margin: 0 0 16px;
  font-size: clamp(22px, 2.2vw, 27px);
  font-weight: 690;
  line-height: 1.1;
  letter-spacing: -.05em;
}
.step-panel > p { font-size: 14px; }
.step-panel h3 { font-size: 16px; font-weight: 680; line-height: 1.3; }
.step-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}
#next-step { margin-left: auto; }
.option-title { margin: 24px 0 10px; }
/* One rhythm in every step: 16px under the step title, sections 24px apart
   and their content 10px under the section heading. */
.step-panel h2 + :is(.option-title, .furniture-heading) { margin-top: 0; }
.step-panel :is(.option-title, .furniture-heading) + * { margin-top: 0; }

.choices { display: grid; margin-top: 12px; }
.choices label {
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  cursor: pointer;
}
.choices label:last-child { border-bottom: 0; }
.choices input {
  appearance: none;
  width: 35px;
  height: 20px;
  margin: 0;
  border-radius: 999px;
  background: #deded9;
  cursor: pointer;
}
.choices input::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  margin: 2px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px #0003;
}
.choices input:checked { background: var(--green); }
.choices input:checked::before { transform: translateX(15px); }

#slots { margin: 12px 0; }
.slot { border-bottom: 1px solid var(--line); }
.slot:last-child { border-bottom: 0; }
.slot-row { display: flex; align-items: center; gap: 8px; min-height: 54px; }
.thumb {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex: none;
  overflow: hidden;
  border-radius: 7px;
  background: #eeeee9;
  color: var(--muted);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.slot-title { flex: 1; min-width: 0; font-size: 13px; font-weight: 680; }
.upload, .minor {
  min-height: 33px;
  border: 0;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--surface);
  color: var(--green);
  font-size: 12px;
  font-weight: 620;
}
.upload:hover, .minor:hover:not(:disabled) { background: #e8ece7; }
.slot-row .icon-button { width: 36px; height: 36px; min-height: 36px; }
.slot-row .crop-toggle[aria-expanded="true"] { background: var(--green); color: white; }
.slot-controls { display: grid; gap: 7px; padding: 3px 0 11px; }
.slot-controls .crop-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.crop-preview {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  background: #29332f;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.crop-preview:active { cursor: grabbing; }
.crop-zoom { display: flex; align-items: center; gap: 7px; }
.crop-zoom .minor { width: 34px; min-height: 34px; }
.crop-zoom .icon { width: 16px; height: 16px; }
.crop-zoom input { flex: 1; min-width: 0; accent-color: var(--green); }
.crop-zoom output { min-width: 43px; text-align: right; }
/* Fit, centre and remove float in the corner of the photo. */
.crop-stage { position: relative; }
.crop-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: #ffffffe6;
  box-shadow: 0 1px 4px #0000002e;
}
.crop-actions button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--green);
}
.crop-actions button:hover { background: var(--surface); }
.crop-actions .remove:hover { background: #fbf0ed; color: #a24737; }
.slot-controls .crop-tip, .crop-zoom output { font-size: 11px; color: var(--muted); }
.slot-controls .crop-tip:empty { display: none; }
.slot .slot-error:not(:empty) { padding-bottom: 7px; color: #8d3325; font-size: 12px; }

.book-editor { display: grid; gap: 11px; margin-top: 15px; }
.book-editor > label, #book-content > label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 650;
}
.book-editor select, .book-editor input[type="text"], .book-editor textarea { width: 100%; }
.book-editor textarea { min-height: 72px; }
.book-editor input[type="range"] { width: 100%; margin: 0; }
.book-editor output { font-size: 11px; font-weight: 500; color: var(--muted); }
#book-reset { justify-self: start; }
#book-content > label + label { margin-top: 8px; }

.export-card .primary { width: 100%; margin-top: 15px; }
#draft-status { margin: 0; }
#status:not(:empty), #draft-status:not(:empty) {
  margin-top: 10px;
  padding: 8px 11px;
  border-radius: 8px;
  background: #eff4ef;
  color: var(--green);
  font-size: 13px;
}
#draft-status:not(:empty) { margin-bottom: 16px; }
/* An example link that opens the customer's own earlier version says so. */
.example-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 16px; padding: 9px 12px; border-radius: 8px; background: #f6efe1; color: #5b4a32; font-size: 13px; }
.example-note[hidden] { display: none; }
.example-note p { flex: 1 1 260px; margin: 0; }
.example-note button { font-weight: 650; }
/* A note floats in a corner, so it is in view whichever step shows it. */
.config-page #status:not(:empty) { position: fixed; right: 24px; bottom: 24px; z-index: 41; max-width: 400px; margin: 0; box-shadow: 0 6px 18px #20382b29; }
.step-panel > .kit-legal { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 18px 0 0; font-size: 12px; }
.kit-legal a, .kit-legal .analytics-settings { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 800px) {
  header { gap: 13px; min-height: 56px; padding: 8px 16px; }
  .brand { font-size: 20px; }
  .brand-mark { width: 29px; height: 29px; }
  .product-link { font-size: 12px; }
  main { padding: 24px 16px 32px; }
  .intro { margin-bottom: 17px; }
  .workspace { grid-template-columns: 1fr; gap: 15px; }
  .preview { position: static; border-radius: 17px; }
  .viewbar, .viewfoot { min-height: 40px; padding: 4px 10px; }
  #viewport { height: clamp(144px, 30svh, 226px); }
  #viewport[data-room="true"] { touch-action: pan-y; }
  .config { scroll-margin-top: 12px; }
  .step-panel { padding-block: 18px; }
  .step-panel h2 { font-size: 24px; }
}
@media (max-width: 375px) {
  .product-link { display: none; }
  .hint { font-size: 11px; }
  header .primary { padding-inline: 12px; font-size: 12px; }
}

.room-styles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 15px;
}
.room-styles button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px 3px 8px;
  text-align: left;
  background: white;
}
.room-styles button:hover { background: var(--surface); }
.room-styles button[aria-pressed="true"] { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.room-styles .style-swatches {
  display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 2px;
  width: 100%; height: clamp(34px,6vw,60px); margin: 0;
  overflow: hidden; border: 1px solid var(--line); border-radius: 7px;
}
.style-swatches i { background: var(--surface) center / cover no-repeat; }
.room-styles small { margin: 3px 5px 0; font-size: 11px; line-height: 1.2; color: var(--muted, #556257); }
.room-styles:not(.is-expanded) > :nth-child(n+10) { display: none; }
.styles-toggle { width: 100%; margin-top: 12px; gap: .35em; }
.styles-toggle[aria-expanded="true"] .icon { --icon: var(--icon-up); }
@media (max-width: 800px) {
  .room-styles:not(.is-expanded) > :nth-child(n+7) { display: none; }
}
.room-styles strong { margin: 6px 5px 0; font-size: 13px; }
.choices label { flex-direction: row; min-height: 61px; padding-block: 5px; }
.choices input { flex: none; }
.furniture-name { flex: 1; }
.furniture-thumb {
  display: grid;
  flex: none;
  place-items: center;
  width: 54px;
  height: 46px;
  border-radius: 8px;
  background: var(--surface);
}

.layout-tools { display: flex; align-items: center; gap: 6px; padding: 10px; }
.layout-tools .select { flex: 0 1 auto; min-width: 70px; max-width: 45%; }
.layout-tools button { flex: none; white-space: nowrap; }
#layout-rotate { display: inline-flex; align-items: center; gap: 4px; }
#layout-reset { margin-left: auto; }
#viewport[data-layout="true"] { touch-action: none; }
#viewport[data-layout="true"] [data-piece] { pointer-events: visiblePainted; cursor: grab; }
#viewport[data-layout="true"].dragging [data-piece] { cursor: grabbing; }
.room-plans { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.room-plans button {
  display: grid; justify-items: center; align-content: start; gap: 4px;
  padding: 5px 3px 9px; min-width: 0; text-align: center;
  border: 1px solid var(--line); border-radius: var(--radius); background: white;
}
.room-plans button:hover { background: var(--surface); }
.room-plans button[aria-pressed="true"] { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); color: var(--green); }
.room-plans svg { display: block; width: 100%; height: 78px; }
.room-plans strong { font-size: 12px; line-height: 1.2; }
.room-plans small { font-size: 10px; color: var(--muted); }

.step-panel .preview-key { margin: 0 0 8px; font-size: 12px; }


@media (max-height: 500px) {
  .crop-stage { width: fit-content; max-width: 100%; margin-inline: auto; }
  .crop-preview { width: auto; max-width: 100%; height: 45svh; }
}

.config-header .cart-link, header .cart-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 12px;
  margin-left: auto;
  border: 1px solid #bacac1;
  border-radius: 999px;
  background: white;
  color: var(--green);
  font-weight: 650;
  text-decoration: none;
}
header .cart-link:hover { background: #eef4ef; }
header .cart-icon { flex: none; }

#bookcase {
  display: grid;
  gap: 8px;
  width: fit-content;
  max-width: calc(100% - 24px);
  margin: 18px auto 0;
  padding: 12px 12px 10px;
  border-radius: 10px;
  background: linear-gradient(#7d5539, #6a4630);
  box-shadow: inset 0 0 0 5px #8d6343, 0 14px 26px -18px #3b2a1f;
  scroll-margin-top: 12px;
}
/* Spines keep their printed 6 : 20 proportions, so the preview shows how much text really fits. */
.book-shelf {
  display: grid;
  grid-template-columns: repeat(8, 27px);
  align-items: end;
  gap: 4px;
  padding: 10px 10px 0;
  border-bottom: 6px solid #a77b52;
  background: linear-gradient(#3b291f, #4b3429);
  box-shadow: inset 0 8px 10px -6px #0007;
}
.book-shelf button {
  position: relative;
  width: 27px;
  aspect-ratio: 6 / 20;
  padding: 0;
  border: 0;
  border-radius: 2px 2px 0 0;
  background: transparent;
  box-shadow: 1px 0 0 #00000040;
  transition: transform .15s ease;
}
.book-shelf button:hover { transform: translateY(-3px); }
.book-shelf img { display: block; width: 100%; height: 100%; border-radius: 2px 2px 0 0; }
.book-shelf button[aria-pressed="true"] { transform: translateY(-7px); outline: 2px solid #ffe7a8; outline-offset: 2px; }
.book-shelf button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; z-index: 1; }
.book-shelf button[data-edited="true"]::after {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border: 1px solid #4f4328;
  border-radius: 50%;
  background: #ffd979;
  content: '';
}
.book-shelf button[data-edited="true"]::after { top: -3px; right: -3px; }
@media (prefers-reduced-motion: reduce) { .book-shelf button { transition: none; } }
#viewport[data-book="true"] { position: relative; height: clamp(210px, 33vh, 320px); }
#viewport[data-book="true"] #scene { display: none; }
/* The book sits on the same surface as the bookcase, without a seam. */
#viewport[data-book="true"] { background: transparent; }
#viewport[data-book="true"]:focus-visible { outline: none; }
#book-edit-title, .book-fit-note { margin: 0; }
.book-fit-note:empty { display: none; }
.book-fit-note { color: var(--muted); font-size: 13px; }
.book-limit-note { margin: 0; color: #9a4a2f; font-size: 13px; font-weight: 600; }
.book-limit-note:empty { display: none; }
.order-review { padding: 14px; border: 1px solid #dfc693; border-radius: 12px; background: #fff8e9; }
.order-review h3 { margin: 0; }
.order-review ul { display: grid; gap: 4px; padding-left: 20px; }
.order-review li .minor { margin-left: 6px; }
.order-review .minor { margin-top: 4px; }

@media (max-width: 370px) {
  .book-shelf { grid-template-columns: repeat(8, 24px); gap: 3px; padding-inline: 6px; }
  .book-shelf button { width: 24px; }
}

.config-page .preview {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  scroll-margin-top: 16px;
}
.config-page :is(.views, .layout-mode) {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
}
.config-page :is(.views, .layout-mode, .tools) button {
  min-height: 36px;
  border-radius: 6px;
}
.config-page :is(.views, .layout-mode) button[aria-pressed="true"] {
  background: var(--green);
  color: white;
  box-shadow: none;
}
.config-page .tools button { min-width: 40px; }
/* The hint and the zoom buttons sit in the bottom corners of the model
   instead of taking a bar under it: they share the model's grid row. */
.config-page .preview { display: grid; grid-template-columns: minmax(0, 1fr); }
.config-page .preview > * { grid-column: 1; }
.config-page .preview > .viewbar { grid-row: 1; }
.config-page .preview > #bookcase { grid-row: 2; }
.config-page .preview > :is(#viewport, .viewfoot) { grid-row: 3; }
.config-page .preview > #book-preview-nav { grid-row: 4; }
.config-page .preview > .layout-tools { grid-row: 5; }
.config-page .preview > .config-jump { grid-row: 6; }
.config-page .preview > .viewfoot {
  z-index: 1;
  align-self: end;
  /* The hint sits on the bottom edge like the zoom tools, as far from it as
     from the side. */
  align-items: flex-end;
  min-height: 0;
  padding: 10px;
  background: none;
  pointer-events: none;
}
.config-page .preview > .viewfoot > * { pointer-events: auto; }
.config-page .preview > .viewfoot .hint {
  max-width: calc(100% - 160px);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 3px 9px;
  border-radius: 999px;
  background: #ffffffd9;
  line-height: 1.3;
  pointer-events: none;
}
.config-page .preview > .viewfoot .tools {
  margin-left: auto;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: #ffffffd9;
  box-shadow: 0 1px 4px #20382b1f;
}
/* Over the room the bar on top floats too: the switch between rotating the
   room and moving its furniture sits in the top corner. In the book view the
   bar stays above the book. */
.config-page .preview:has(#viewport[data-room="true"]) > .viewbar {
  grid-row: 3;
  z-index: 1;
  align-self: start;
  min-height: 0;
  padding: 10px;
  background: none;
  pointer-events: none;
}
.config-page .preview > .viewbar > * { pointer-events: auto; }
.config-page .preview > .viewbar :is(.views, .layout-mode) { padding: 2px; box-shadow: 0 1px 4px #20382b1f; }
/* Moving furniture: the piece, turning and reset in the bottom corners. */
.config-page .preview > .layout-tools {
  grid-row: 3;
  z-index: 1;
  align-self: end;
  pointer-events: none;
}
.config-page .preview > .layout-tools > .select { pointer-events: auto; }
.config-page .preview > .layout-tools > button,
.config-page .preview > .layout-tools .select-button {
  min-height: 36px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffffff0;
  box-shadow: 0 1px 4px #20382b1f;
  color: var(--green);
  font-size: 12px;
  font-weight: 650;
  pointer-events: auto;
}
.config-page .preview > .layout-tools > button:hover:not(:disabled) { background: var(--surface); }
.config-page .preview > .layout-tools > .icon-button { width: 36px; padding: 0; }
.config-page .steps button span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  font-size: 11px;
}
.config-page .steps button[aria-current="step"] span {
  background: var(--green);
  color: white;
}
.config-page .step-panel h2 {
  font-family: var(--display-font, Georgia, serif);
  font-weight: 400;
  letter-spacing: -.035em;
}
.config-page :is(.room-plans, .room-styles) button[aria-pressed="true"] {
  background-color: var(--surface);
}
.config-page .step-actions { padding-block: 14px 4px; }
.config-page .kit-delivery {
  display: grid;
  gap: 4px;
}
.config-page .kit-delivery strong { color: var(--green); }
.config-jump { display: none; }

@media (max-width: 800px) {
  .config-jump {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    color: var(--green);
    font-size: 13px;
    font-weight: 650;
    padding: 0;
    border: 0;
    background: transparent;
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  .preview > .config-jump { width: 100%; border-top: 1px solid var(--line); }
  .config > .config-jump { justify-content: flex-start; }
  .config-page .step-panel { padding-top: 6px; }
  .config-page .step-actions #next-step { flex: 1; }
}

/* Guided configurator */
.option-title { display: flex; align-items: center; gap: 8px; }
.config-page .steps button[data-done="true"] span {
  background: #dce9e2;
  color: var(--green);
  font-size: 0;
}
.config-page .steps button[data-done="true"] span::before { content: "✓"; font-size: 12px; font-weight: 750; }
.config-page .steps button[data-done="true"][aria-current="step"] span { background: var(--green); color: white; }
/* Furniture that cannot be built marks its step with "!" instead of a tick. */
.config-page .steps button[data-fix="true"] span { background: #f3d9cf; color: #8d3325; font-size: 0; }
.config-page .steps button[data-fix="true"] span::before { content: "!"; font-size: 13px; font-weight: 800; }


.step-panel .guide-note {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: #eff4ef;
  color: var(--green);
  font-size: 13px;
}
.step-panel .guide-note:empty { display: none; }


.personal-details h3 { margin: 0; }
/* The cushion with initials: one tick box styled as a small gift. */
.book-editor > .gift-check { display: flex; align-items: flex-start; gap: 11px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius); background: white; font-weight: 400; cursor: pointer; }
.gift-check:has(input:checked) { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); background: var(--surface); }
.gift-check input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--green); }
.gift-check > span { display: grid; gap: 3px; }
.gift-check strong { font-size: 14px; line-height: 1.35; }
.gift-check em { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: #f3d79a; color: #1d3f37; font-size: 10px; font-style: normal; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; vertical-align: 1px; white-space: nowrap; }
.gift-check small { color: var(--muted); font-size: 12px; }
/* The animal: one of two 3D-printed figures, each a tile with a checkbox.
   Ticking one unticks the other; with none ticked the kit has no animal. */
.pets-heading { margin-top: 22px; }
.pet-price[data-free="true"] { background: #f3d79a; color: #1d3f37; }
.pet-grid .furniture-item.pet-item { grid-template-columns: 42px minmax(0, 1fr) 22px; border-color: var(--line); box-shadow: none; cursor: pointer; }
.pet-grid .furniture-item.pet-item:has(input:checked) { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); background: var(--surface); }
.pet-item small { grid-column: 2; color: var(--muted); font-size: 11px; }
.pet-item input { grid-column: 3; grid-row: 1 / span 2; width: 20px; height: 20px; margin: 0; accent-color: var(--green); cursor: pointer; }
.pet-item .pet-thumb { display: grid; place-items: center; grid-row: 1 / span 2; width: 42px; height: 42px; border-radius: 8px; background: var(--surface); }
.pet-item:has(input:checked) .pet-thumb { background: white; }
.pet-thumb svg { width: 100%; height: 100%; }
.gift-title { margin-top: 22px; }
#cushion-fields { display: grid; gap: 11px; }
#cushion-fields > label { display: grid; gap: 4px; font-size: 13px; font-weight: 650; }

.slot-title small { display: block; color: var(--muted); font-size: 11px; font-weight: 450; }

.book-more summary { color: var(--green); font-size: 12px; font-weight: 650; cursor: pointer; }
.book-more[open] { display: grid; gap: 11px; }
.book-more > label { display: grid; gap: 4px; font-size: 13px; font-weight: 650; }

.order-review p { margin: 6px 0 10px; }
.order-review-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.export-card .order-review .primary { width: auto; margin-top: 0; }
.export-card .order-review p { font-size: 14px; }

/* Photo step: one place at a time, pointed out in the preview */
#viewport[data-photos="true"] [data-slot] { pointer-events: all; cursor: pointer; }
#scene .slot-hit, #mini-scene .slot-hit { fill: transparent; stroke: #f4f1e8; stroke-width: .6; stroke-opacity: 0; }
#viewport[data-photos="true"] #scene .slot-hit:hover { stroke-opacity: .95; }
#scene .slot-focus, #mini-scene .slot-focus {
  fill: none;
  stroke: #e9a93c;
  stroke-width: .9;
  animation: slot-pulse 1.6s ease-in-out infinite;
}
@keyframes slot-pulse { 50% { stroke-opacity: .3; } }
@media (prefers-reduced-motion: reduce) { #scene .slot-focus, #mini-scene .slot-focus { animation: none; } }

.photo-places { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 16px; }
.photo-places button {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 7px 2px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--muted);
  font-size: 11px;
}
.photo-places button:hover { background: var(--surface); }
.photo-places .thumb { width: 38px; height: 38px; font-size: 13px; font-weight: 700; color: var(--green); }
.photo-places button[data-filled="true"] .thumb { background: #dce9e2; }
.photo-places button[aria-pressed="true"] {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
  color: var(--green);
  font-weight: 650;
}
.photo-place {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}
/* Photo or message: a small segmented switch. */
.frame-mode { display: inline-flex; justify-self: start; gap: 2px; padding: 2px; border-radius: 999px; background: var(--surface); }
.frame-mode button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 3px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.frame-mode button:hover:not([aria-pressed="true"]) { color: var(--green); }
.frame-mode button[aria-pressed="true"] { background: white; color: var(--green); box-shadow: 0 1px 3px #20382b29; }
.photo-drop {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 26px 12px;
  border: 1.5px dashed #a9bfb4;
  border-radius: 12px;
  background: #f6f9f6;
  color: var(--green);
}
.photo-drop:hover, .photo-drop.dragging { background: #eaf2ec; border-color: var(--green); }
.photo-drop strong { font-size: 15px; }
.photo-drop .icon { width: 28px; height: 28px; margin-bottom: 4px; color: var(--green); }
.photo-drop span { color: var(--muted); font-size: 12px; }
#slots.is-empty .slot-row { display: none; }
#slots .slot { border-bottom: 0; }
/* The frame tiles above already name the place and the hint its shape; the
   title only keeps the buttons to the right. */
#slots .slot-title { visibility: hidden; }
#frame-message-block { margin-top: 0; }
#frame-message-block p { margin: 0; font-size: 12px; }
/* After trying to move on without all photos: what is left, and the empty frames marked. */
.step-panel .photo-required:not(:empty) {
  margin-top: 10px;
  padding: 8px 11px;
  border: 1px solid #dfc693;
  border-radius: 8px;
  background: #fff8e9;
  color: #624500;
  font-size: 13px;
}
.photo-places[data-required="true"] button[data-filled="false"]:not([aria-pressed="true"]) { border-color: #d9a441; }
@media (max-width: 800px) {
  .photo-place > .config-jump { justify-content: flex-start; min-height: 32px; }
}
#slots.is-empty:has(.slot-error:empty):not(:has(.slot-loading:not([hidden]))) { display: none; }
.book-fit-note[data-state="small"], .book-fit-note[data-state="over"] {
  padding: 8px 11px;
  border-radius: 9px;
  background: #fff4dd;
  color: #7a4b12;
}
.book-fit-note[data-state="over"] { background: #fbe9e4; color: #8d3325; }
@media (max-width: 800px) {
  .book-shelf { grid-template-columns: repeat(8, 23px); gap: 4px; padding-inline: 8px; }
  .book-shelf button { width: 23px; }
}

/* Free-shipping promotion bar, shown only while the promotion runs */
.promo-bar{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:6px 10px;padding:7px 16px;background:#214f45;color:#fff;font-size:13px;font-weight:600;line-height:1.35;text-align:center}
.promo-pill{padding:2px 9px;border-radius:999px;background:#f3d79a;color:#1d3f37;font-size:11px;font-weight:750;letter-spacing:.05em;text-transform:uppercase}
/* The last step: a one-line recap, the price and how the kit arrives. */
.config-page .kit-recap { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.config-page .kit-price { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 14px 0 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--green); font-size: 17px; font-weight: 720; }
.config-page .kit-price span { color: var(--ink); font-size: 14px; font-weight: 600; }
.config-page .kit-delivery { font-size: 13px; color: var(--muted); }
.config-page .kit-delivery:not(:has(:not([hidden]))) { display: none; }

/* Phones: a fixed action bar with a live miniature, and denser option lists */
.mini-preview { display: none; }
@media (min-width: 801px) {
  #next-step[data-final="true"] { display: none; }
}
@media (max-width: 800px) {
  .config-page .config > .config-jump { display: none; }

  .config-page { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  .config-page .step-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    gap: 8px;
    padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(252,250,245,.97);
    box-shadow: 0 -6px 18px #20382b14;
  }
  .config-page.typing .step-actions { display: none; }
  /* A note shows just above the fixed buttons, where it is always in view. */
  .config-page #status:not(:empty) { left: 12px; right: 12px; bottom: calc(78px + env(safe-area-inset-bottom)); max-width: none; }
  .config-page.typing #status { display: none; }
  .config-page .step-actions #previous-step { flex: none; width: 48px; min-height: 48px; }
  .config-page .step-actions #next-step { flex: 1; }
  .config-page :is(.step-actions #next-step, .styles-toggle) { min-height: 48px; font-size: 14px; }
  .mini-preview {
    display: block;
    flex: none;
    width: 84px;
    height: 56px;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
  }
  .mini-preview svg { display: block; width: 100%; height: 100%; pointer-events: none; }
  .preview-visible .mini-preview { display: none; }

  /* Room plans scroll sideways instead of stacking. */
  .config-page .room-plans {
    display: flex;
    gap: 8px;
    margin-inline: -16px;
    padding: 2px 16px 6px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .config-page .room-plans::-webkit-scrollbar { display: none; }
  .config-page .room-plans button { flex: 0 0 112px; scroll-snap-align: start; }
  .config-page .room-plans svg { height: 58px; }

  /* Smaller spines keep the bookcase within one screen. */
  .book-shelf { grid-template-columns: repeat(8, 20px); gap: 4px; }
  .book-shelf button { width: 20px; }
}

@media (max-width: 800px) {
  .config-page .export-card > [data-add-to-cart] { display: none; }
}

/* Book reader: the selected book opens in the preview and turns its pages. */
.book-reader { position: absolute; inset: 0; container-type: size; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.reader-stage {
  --u: min(calc(100cqw / 33), calc(100cqh / 25.5));
  --book-color: #844334;
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--u) * 30);
  height: calc(var(--u) * 20);
  transform: translate(-50%, -50%);
}
.reader-stage button { padding: 0; border: 0; border-radius: 0; background: none; }
.reader-stage img { display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }
/* The closed book is a solid block: both boards, the spine and the page
   block seen from slightly above, turned so the spine faces the viewer. */
.reader-closed {
  --depth: calc(var(--u) * 6);
  position: absolute;
  left: calc(var(--u) * 9);
  top: 0;
  width: calc(var(--u) * 15);
  height: calc(var(--u) * 20);
  perspective: calc(var(--u) * 140);
  perspective-origin: 40% 0%;
  cursor: pointer;
}
.reader-box {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(-9deg) rotateY(30deg);
  transition: transform .25s ease;
}
.reader-closed:hover .reader-box { transform: translateY(calc(var(--u) * -.3)) rotateX(-9deg) rotateY(24deg); }
.reader-closed.is-flat .reader-box { transform: translateZ(calc(var(--depth) / -2)); }
.book-face { position: absolute; display: block; }
.reader-closed .reader-front {
  inset: 0;
  border-radius: 0 calc(var(--u) * .3) calc(var(--u) * .3) 0;
  transform: translateZ(calc(var(--depth) / 2));
}
.book-back {
  inset: 0;
  border-radius: calc(var(--u) * .3) 0 0 calc(var(--u) * .3);
  background: var(--book-color);
  transform: rotateY(180deg) translateZ(calc(var(--depth) / 2));
}
.reader-closed .reader-spine {
  top: 0;
  left: calc(50% - var(--depth) / 2);
  width: var(--depth);
  height: 100%;
  border-radius: calc(var(--u) * .4);
  transform: rotateY(-90deg) translateZ(calc(var(--u) * 7.5));
  filter: brightness(.9);
}
/* Fore edge and top: the covers overhang the cream page block a little. */
.book-fore, .book-top { background: var(--book-color); }
.book-fore {
  top: 0;
  left: calc(50% - var(--depth) / 2);
  width: var(--depth);
  height: 100%;
  transform: rotateY(90deg) translateZ(calc(var(--u) * 7.5));
}
.book-top {
  left: 0;
  top: calc(50% - var(--depth) / 2);
  width: 100%;
  height: var(--depth);
  transform: rotateX(90deg) translateZ(calc(var(--u) * 10));
}
.book-top i {
  position: absolute;
  inset: calc(var(--u) * .3) calc(var(--u) * .45) calc(var(--u) * .3) calc(var(--u) * .2);
  background: repeating-linear-gradient(0deg, #f7f0e1 0 calc(var(--u) * .28), #ddd1b9 calc(var(--u) * .28) calc(var(--u) * .34));
  box-shadow: inset 0 0 calc(var(--u) * .4) #00000026;
}
.reader-floor {
  position: absolute;
  left: calc(var(--u) * -4);
  right: calc(var(--u) * -1);
  bottom: calc(var(--u) * -1.6);
  height: calc(var(--u) * 2.2);
  border-radius: 50%;
  background: radial-gradient(closest-side, #3b2a1f4d, transparent);
  transition: opacity .25s ease;
}
.reader-closed.is-flat .reader-floor { opacity: .5; }
.reader-closed:focus-visible { outline: 3px solid var(--green); outline-offset: 6px; }
/* Writing on the cover: the book turns to face the viewer, its spine beside
   it, and a field lies over the printed title area (11 x 8.6 mm, or the band
   under a cover photo), lettered in the cover's ink. */
.reader-stage .reader-spine-flat { position: absolute; left: calc(var(--u) * -7.5); top: 0; display: none; width: calc(var(--u) * 6); height: calc(var(--u) * 20); border-radius: calc(var(--u) * .4); filter: brightness(.95); }
.reader-closed[data-edit="true"] { cursor: text; }
.reader-closed[data-edit="true"] .reader-box, .reader-closed[data-edit="true"]:hover .reader-box { transform: translateZ(calc(var(--depth) / -2)); }
.reader-stage .reader-closed[data-edit="true"] .reader-spine-flat { display: block; }
.cover-editor { position: absolute; left: calc(var(--u) * 9); top: 0; z-index: 2; width: calc(var(--u) * 15); height: calc(var(--u) * 20); }
.cover-editor[hidden] { display: none; }
.cover-field { position: absolute; left: calc(var(--u) * 2); top: calc(var(--u) * 3.3); display: flex; flex-direction: column; justify-content: center; width: calc(var(--u) * 11); height: calc(var(--u) * 8.6); }
.cover-editor[data-photo="true"] .cover-field { left: calc(var(--u) * 1.8); top: calc(var(--u) * 13.2); width: calc(var(--u) * 11.4); height: calc(var(--u) * 5); }
.cover-text {
  width: 100%;
  max-height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  font: 600 max(16px, calc(var(--u) * 2.55))/1.23 Georgia, "Times New Roman", serif;
  text-align: center;
  resize: none;
  overflow: hidden;
  outline: none;
}
/* An empty cover or page invites the customer to write; the hint gives way
   as soon as the field is tapped. */
.field-hint {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 0 calc(var(--u) * .5);
  font: 600 max(11px, calc(var(--u) * 1.5))/1.3 system-ui, sans-serif;
  text-align: center;
  pointer-events: none;
}
:is(.cover-field, .page-editor):has(textarea:placeholder-shown):not(:focus-within) .field-hint { display: grid; }
.cover-field .field-hint { color: #fff1d0; opacity: .85; }
.page-editor .field-hint { color: #9a917f; }
.page-editor:not([data-photo="true"]) .field-hint { bottom: calc(var(--u) * 2.2); }
.reader-stage :is(.cover-photo, .page-photo) {
  position: absolute;
  display: grid;
  place-items: center;
  width: max(32px, calc(var(--u) * 3.4));
  height: max(32px, calc(var(--u) * 3.4));
  padding: 0;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 1px 4px #20382b33;
  cursor: pointer;
}
.reader-stage :is(.cover-photo, .page-photo) svg { width: 58%; height: 58%; }
.reader-stage .cover-photo {
  left: 50%;
  top: calc(var(--u) * 15.4);
  background: #fffffff0;
  color: var(--green);
  transform: translateX(-50%);
}
.cover-editor[data-photo="true"] .cover-photo { top: calc(var(--u) * 1.9); left: auto; right: calc(var(--u) * 1.9); transform: none; }
.reader-stage .cover-photo:disabled { opacity: .85; cursor: progress; }
.reader-open {
  --shift: 0;
  position: absolute;
  inset: 0;
  transform: translateX(calc(var(--shift) * var(--u) * -6));
}
.reader-open::after {
  position: absolute;
  left: calc(var(--u) * 1);
  right: calc(var(--u) * 1);
  bottom: calc(var(--u) * -1.2);
  height: calc(var(--u) * 1.6);
  border-radius: 50%;
  background: radial-gradient(closest-side, #3b2a1f40, transparent);
  content: '';
  z-index: -1;
}
.reader-board {
  position: absolute;
  top: 0;
  width: calc(var(--u) * 15);
  height: calc(var(--u) * 20);
  background: var(--book-color);
  box-shadow: inset 0 0 0 9999px #0000001a;
}
.reader-left { left: 0; border-radius: calc(var(--u) * .35) 0 0 calc(var(--u) * .35); }
.reader-right { left: calc(var(--u) * 15); border-radius: 0 calc(var(--u) * .35) calc(var(--u) * .35) 0; }
.reader-page, .face-page {
  position: absolute;
  top: calc(var(--u) * 2);
  width: calc(var(--u) * 13);
  height: calc(var(--u) * 16);
  overflow: hidden;
  background: #f8f2e7 !important;
}
.reader-left .reader-page { right: calc(var(--u) * .5); box-shadow: calc(var(--u) * -.12) calc(var(--u) * .1) 0 #e2d7c3, calc(var(--u) * -.24) calc(var(--u) * .2) 0 #d3c6ae; }
.reader-right .reader-page { left: calc(var(--u) * .5); box-shadow: calc(var(--u) * .12) calc(var(--u) * .1) 0 #e2d7c3, calc(var(--u) * .24) calc(var(--u) * .2) 0 #d3c6ae; }
/* The fold in the middle of each spread. */
.reader-page::before {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30%;
  content: '';
  pointer-events: none;
  z-index: 1;
}
.reader-left .reader-page::before { right: 0; background: linear-gradient(90deg, transparent, #00000024); }
.reader-right .reader-page::before { left: 0; background: linear-gradient(270deg, transparent, #00000024); }
.reader-page:not(:disabled) { cursor: pointer; }
.reader-page:not(:disabled):hover { filter: brightness(1.03); }
.reader-page:disabled { opacity: 1; }
.reader-page[data-blank="true"] { background: #efe7d6 !important; }
.reader-page[data-empty="true"]::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #9a917f;
  font-size: max(10px, calc(var(--u) * .95));
  font-weight: 600;
  content: '+ vzkaz nebo fotka';
}
.reader-page[aria-pressed="true"] { outline: max(2px, calc(var(--u) * .22)) solid #e3b75a; outline-offset: max(2px, calc(var(--u) * .2)); }
.reader-page:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
/* Writing on the page: a field laid over the selected page, sized and
   lettered like the print (2.35 mm text on a 13 x 16 mm page). With a photo
   the text takes the band below it, as in print. */
.reader-page[aria-pressed="true"]::after { content: none; }
.page-editor {
  position: absolute;
  top: calc(var(--u) * 2);
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: calc(var(--u) * 13);
  height: calc(var(--u) * 16);
  padding: calc(var(--u) * .3) calc(var(--u) * .6);
}
.page-editor[hidden] { display: none; }
.reader-left .page-editor { right: calc(var(--u) * .5); }
.reader-right .page-editor { left: calc(var(--u) * .5); }
.page-editor[data-photo="true"] { top: calc(var(--u) * 12.5); height: calc(var(--u) * 5.5); }
.page-text {
  width: 100%;
  max-height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #302a23;
  font: 400 max(16px, calc(var(--u) * 2.35))/1.23 system-ui, sans-serif;
  text-align: center;
  resize: none;
  overflow: hidden;
  outline: none;
}

.reader-stage .page-photo {
  top: calc(var(--u) * .5);
  right: calc(var(--u) * .5);
  background: #214f45e6;
  color: white;
}
/* Without a photo the button sits on the bottom edge of the page, below the
   text; with one it sits on the photo, above the text band. */
.page-editor:not([data-photo="true"]) { padding-bottom: calc(var(--u) * 2.2); }
.page-editor:not([data-photo="true"]) .page-photo { top: auto; right: 50%; bottom: calc(var(--u) * -.8); transform: translateX(50%); }
.page-editor[data-photo="true"] .page-photo { top: calc(var(--u) * -10); }
.reader-leaf {
  --angle: 0deg;
  --shade: 0;
  position: absolute;
  z-index: 3;
  transform: perspective(calc(var(--u) * 90)) rotateY(calc(var(--angle) * -1));
  pointer-events: none;
}
.reader-leaf.is-cover { left: calc(var(--u) * 15); top: 0; width: calc(var(--u) * 15); height: calc(var(--u) * 20); transform-origin: left center; }
.reader-leaf.is-page { left: calc(var(--u) * 15.5); top: calc(var(--u) * 2); width: calc(var(--u) * 13); height: calc(var(--u) * 16); transform-origin: calc(var(--u) * -.5) center; }
.leaf-front, .leaf-back { position: absolute; inset: 0; overflow: hidden; background: #f8f2e7; }
.is-cover .leaf-front, .is-cover .leaf-back { background: transparent; }
.leaf-back { transform: scaleX(-1); }
.reader-leaf[data-side="front"] .leaf-back, .reader-leaf[data-side="back"] .leaf-front { display: none; }
.reader-leaf { filter: drop-shadow(0 calc(var(--u) * .4) calc(var(--u) * .5) rgb(40 28 20 / calc(var(--shade) * .35))); }
.leaf-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #0000004d, transparent 60%);
  opacity: var(--shade);
  pointer-events: none;
}
.reader-leaf[data-side="back"] .leaf-shade { background: linear-gradient(270deg, #0000004d, transparent 60%); }
.face-board { position: absolute; inset: 0; box-shadow: inset 0 0 0 9999px #0000001a; }
.face-board .face-page { right: calc(var(--u) * .5); }

#book-preview-nav { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 16px; padding: 4px 10px 12px; }
.reader-nav { display: flex; align-items: center; gap: 8px; }
.reader-nav button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--green);
  font-size: 24px;
  line-height: 1;
}
.reader-nav button:disabled { opacity: .35; }
#reader-label { min-width: 92px; color: var(--ink, #23281f); font-size: 13px; font-weight: 650; text-align: center; }
/* Until the first page turn the label also says how to turn pages; the
   smallest phones keep just the page name. */
#book-preview-nav[data-hint="true"] #reader-label::after { content: " · otoč stránku šipkou"; color: var(--muted); font-weight: 500; }
@media (max-width: 359px) { #book-preview-nav[data-hint="true"] #reader-label::after { content: none; } }
/* The way inside the book stands out from the cover settings around it. */
.book-inside { display: flex; align-items: center; gap: 12px; width: 100%; margin: 2px 0; padding: 11px 12px; border: 1.5px solid var(--green); border-radius: 12px; background: #f3f8f4; color: var(--green); text-align: left; cursor: pointer; }
.book-inside:hover { background: #e7f0e9; }
.book-inside-icon { display: grid; flex: none; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--green); color: #fff; }
.book-inside-copy { display: grid; flex: 1; gap: 1px; min-width: 0; }
.book-inside-copy strong { font-size: 15px; font-weight: 700; }
.book-inside-copy small { color: var(--muted); font-size: 12px; font-weight: 500; }
.book-inside-arrow { flex: none; }

/* Books step, overview: the look of the whole bookcase as two rows of chips,
   then the customer's own books and a button for another one. */
#book-overview > .option-title:first-child { margin-top: 0; }
.option-note { color: var(--muted); font-size: 13px; font-weight: 400; }
.look-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.look-chips button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  font-size: 13px;
  font-weight: 600;
}
.look-chips button:hover { background: var(--surface); }
.look-chips button[aria-pressed="true"] { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); background: #eef5f0; color: var(--green); }
.look-chips .look-spines { gap: 1.5px; height: 20px; margin: 0; padding: 0 2px 1px; border-bottom-width: 2px; }
.look-chips .look-spines i { width: 5px; }
.book-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.book-row { display: flex; align-items: center; gap: 6px; }
.book-row-open {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 58px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  text-align: left;
}
.book-row-open:hover { border-color: #b4c4ba; background: #fbfcfa; }
.book-row-spine { flex: none; width: 13px; height: 42px; border-radius: 2px 2px 0 0; box-shadow: 1px 0 0 #00000030; }
.book-row-text { display: grid; flex: 1; gap: 1px; min-width: 0; }
.book-row-text strong { font-size: 14px; overflow-wrap: anywhere; }
.book-row-text small { color: var(--muted); font-size: 12px; }
.book-row-open > .icon { color: var(--muted); }
.book-row-reset { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--muted); }
.book-row-reset:hover { background: #fbf0ed; color: #a24737; }
.book-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1.5px dashed #a9bfb4;
  border-radius: 12px;
  background: #f6f9f6;
  color: var(--green);
  font-size: 14px;
  font-weight: 650;
}
.book-add:hover { border-color: var(--green); background: #eaf2ec; }

/* Books step, editor: the book's name with the way back, the cover or the
   six pages as two tabs, and the fields of the part shown. */
.book-card { gap: 12px; margin-top: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.book-tabs { display: inline-flex; justify-self: start; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); }
.book-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.book-tabs button:hover:not([aria-pressed="true"]) { color: var(--green); }
.book-tabs button[aria-pressed="true"] { background: white; color: var(--green); box-shadow: 0 1px 3px #20382b29; }
.book-tab-count { color: var(--green); font-size: 11px; font-weight: 700; }
.book-tab-count:empty { display: none; }
.book-pages { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.book-pages button {
  position: relative;
  height: 52px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbf7ee;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.book-pages button:hover { border-color: #b4c4ba; }
.book-pages button[data-filled="true"] { background: #eef5f0; color: var(--green); }
.book-pages button[data-filled="true"]::after { position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--green); content: ''; }
.book-pages button[aria-pressed="true"] { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); color: var(--green); }
#book-page-label { margin-bottom: -7px; font-size: 13px; font-weight: 650; }
.book-card-head { display: flex; align-items: center; gap: 6px; }
/* A title typed without spaces wraps instead of stretching the card. */
.book-card-head h3 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.book-tool { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--green); }
.book-tool:hover { background: var(--surface); }
.book-tool[hidden] { display: none; }
#book-back { margin-left: -4px; }
.book-pane { display: grid; gap: 11px; }
.book-pane[hidden] { display: none; }
.book-pane > label { display: grid; gap: 4px; font-size: 13px; font-weight: 650; }
#book-content { display: grid; gap: 11px; }
.book-text-size[hidden] { display: none; }
.text-button { justify-self: start; padding: 2px 0; border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.text-button:hover { color: var(--green); }
.text-button[hidden] { display: none; }
.book-card #slots .slot, .book-card .slot { border-bottom: 0; }

@media (max-width: 800px) {
  #viewport[data-book="true"] { height: clamp(200px, 30svh, 260px); }
  .book-card { padding: 12px; }
}

/* Accessories: grouped tiles with a stepper and a running count against the limit. */
.furniture-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.furniture-heading > .option-title { margin: 0; }
.furniture-tally {
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef5f0;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.furniture-tally[data-full="true"] { background: #fff4dd; color: #7a4b12; }
#furniture.choices { gap: 14px; }
.furniture-group h4 { margin: 0 0 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.furniture-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.furniture-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 3px 9px;
  min-height: 64px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
}
.furniture-item:hover { background: #fbfcfa; }
.furniture-item:not([data-count="0"]) { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); cursor: default; }
.furniture-item .furniture-thumb { grid-row: 1 / span 2; width: 42px; height: 42px; }
.furniture-item .furniture-name { grid-column: 2; font-weight: 600; }
.stepper { grid-column: 2; display: inline-flex; align-items: center; justify-self: start; gap: 2px; }
.stepper button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--green);
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
}
/* The signs are drawn as bars, so they sit exactly in the middle of the
   circle whatever font the browser uses. The text stays for screen readers. */
.stepper button { position: relative; font-size: 0; }
.stepper button::before, .stepper button::after {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transform: translate(-50%, -50%);
  content: '';
}
.stepper button:last-child::after { transform: translate(-50%, -50%) rotate(90deg); }
.stepper button:first-child::after { display: none; }
.stepper button:hover:not(:disabled) { background: var(--surface); }
.stepper button:disabled { opacity: .35; pointer-events: none; }
.stepper output { min-width: 22px; font-size: 14px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.furniture-item[data-count="0"] .stepper output { color: var(--muted); font-weight: 500; }
@media (max-width: 800px) {
  .stepper button { width: 32px; height: 32px; }
}
/* Headings that only receive focus programmatically show no focus ring. */
.step-panel h2:focus, #book-edit-title:focus { outline: none; }

/* Ready-made looks for the whole bookcase. */
.look-spines { display: flex; align-items: flex-end; gap: 2px; height: 30px; margin-bottom: 5px; padding: 0 3px 2px; border-bottom: 3px solid #a77b52; }
.look-spines i { position: relative; display: block; width: 9px; height: 100%; border-radius: 1.5px 1.5px 0 0; }
.look-spines i:nth-child(2n) { height: 88%; }
.look-spines i:nth-child(3n) { height: 94%; }
.look-spines b { position: absolute; left: 3.5px; top: 25%; bottom: 25%; width: 2px; border-radius: 1px; opacity: .75; }


/* Photo loading: an indeterminate bar that keeps moving even while the
   browser is busy decoding, because it only animates a transform. */
.slot-loading {
  display: grid;
  gap: 8px;
  margin: 6px 0 4px;
  padding: 14px 16px;
  border: 1px dashed #b9c9be;
  border-radius: 12px;
  background: #f4f8f5;
  color: var(--green);
  font-size: 14px;
  font-weight: 650;
  text-align: center;
  animation: slot-loading-in .2s ease .12s both;
}
.slot-loading[hidden] { display: none; }
.slot-loading-bar { position: relative; display: block; height: 6px; overflow: hidden; border-radius: 999px; background: #dfe9e2; }
.slot-loading-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  border-radius: inherit;
  background: var(--green);
  animation: slot-loading-run 1.1s ease-in-out infinite;
  will-change: transform;
}
.slot-loading-cancel { justify-self: center; width: 34px; min-height: 34px; }
/* The same work shown over the preview, where the customer is looking. */
.preview-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  /* Narrow enough to leave the page arrows at the sides free. */
  max-width: calc(100% - 104px);
  padding: 9px 14px;
  border-radius: 14px;
  background: #fffffff2;
  box-shadow: 0 4px 18px #20382b33;
  color: var(--green);
  font-size: 14px;
  font-weight: 650;
  transform: translate(-50%, -50%);
  animation: slot-loading-in .2s ease .12s both;
}
.preview-loading[hidden] { display: none; }
.preview-loading-copy { display: grid; gap: 1px; }
.preview-loading-hint { color: var(--muted); font-size: 11px; font-weight: 500; }
.preview-loading-hint:empty { display: none; }
.preview-loading-cancel { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--green); }
.preview-loading-cancel:hover { background: var(--surface); }
.preview-loading[data-notice] { color: #8d3325; }
.preview-loading[data-notice] .preview-spinner { display: none; }
.preview-spinner {
  flex: none;
  width: 20px;
  height: 20px;
  border: 3px solid #dfe9e2;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: preview-spin .8s linear infinite;
}
@keyframes preview-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .preview-spinner { animation: slot-loading-pulse 1.4s ease-in-out infinite alternate; } }
.reader-stage .page-photo:disabled { opacity: .85; cursor: progress; }
.is-loading .upload, .is-loading .crop-toggle { pointer-events: none; opacity: .5; }
@keyframes slot-loading-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slot-loading-run { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) {
  .slot-loading-bar i { width: 100%; animation: slot-loading-pulse 1.4s ease-in-out infinite alternate; }
  @keyframes slot-loading-pulse { from { opacity: .35; } to { opacity: 1; } }
}


/* Saving a design to the cart: a determinate bar with the current stage. */
.cart-progress { display: grid; gap: 7px; margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: #eef5f0; }
.cart-progress[hidden] { display: none; }
.cart-progress-text { color: var(--green); font-size: 14px; font-weight: 650; }
.cart-progress-bar { position: relative; display: block; height: 8px; overflow: hidden; border-radius: 999px; background: #d6e4da; }
.cart-progress-bar i {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--green);
  transform: scaleX(var(--progress, 0));
  transform-origin: left center;
  transition: transform .35s ease;
}
/* A light sheen keeps moving even while the browser is busy drawing. */
.cart-progress-bar::after {
  position: absolute;
  inset: 0;
  width: 30%;
  background: linear-gradient(90deg, transparent, #ffffff73, transparent);
  animation: cart-progress-sheen 1.2s linear infinite;
  content: '';
}
@keyframes cart-progress-sheen { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) { .cart-progress-bar::after { display: none; } .cart-progress-bar i { transition: none; } }
@media (max-width: 800px) {
  .config-page .cart-progress {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    z-index: 41;
    box-shadow: 0 6px 20px #20382b2e;
  }
}

/* Phones: while the customer shapes the room or a book, the preview stays
   pinned to the top of the screen and the options scroll underneath, so every
   change shows right next to the option that made it. The bars around the
   model fold into small overlays to leave room for the options. In the book
   step the preview shows just the selected book: the bookcase moves into the
   step and opens on demand. While typing the preview stays pinned too: the
   initials, the frame message and the book title show in it as they are
   written. Very short screens (a phone on its side) keep the normal flow. */
@media (max-width: 800px) and (min-height: 560px) {
  :root {
    --stage-view: clamp(144px, 30svh, 226px);
    /* The pinned preview covers the top of the screen; jumps to a step or an
       option land below it instead of underneath. */
    --stage-cover: calc(var(--stage-view) + 22px);
  }
  :root:has(body.config-page #viewport:is([data-room="true"],[data-book="true"])) { scroll-padding-top: var(--stage-cover); }
  .config-page .preview:has(#viewport:is([data-room="true"],[data-book="true"])) {
    position: sticky;
    top: 8px;
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    /* A page-coloured band around the card hides options scrolling past it,
       above and in the side margins too, where the sideways option rows reach
       the screen edge. The soft shadow separates the preview from them. */
    box-shadow: 0 12px 18px -14px #20382b70, 0 -14px 0 24px var(--paper);
  }
  /* The band reaches 38px above the card. The header stays on top of it, so
     its cart is never cut off when the promotion bar pushes the header down. */
  .config-page > header { position: relative; z-index: 31; }
  .config-page .preview:has(#viewport:is([data-room="true"],[data-book="true"])) > * { grid-column: 1; }
  /* Notes above the preview keep clear of its band. */
  .config-page:has(#viewport:is([data-room="true"],[data-book="true"])) :is(.example-note, #draft-status:not(:empty)) { margin-bottom: 46px; }
  .config-page .preview:has(#viewport:is([data-room="true"],[data-book="true"])) > #viewport { grid-row: 2; height: var(--stage-view); }
  .config-page .preview:has(#viewport:is([data-room="true"],[data-book="true"])) > :is(.config-jump, #bookcase) { display: none; }
  /* With the preview always in sight, "show in the preview" links have nothing to do. */
  .config-page:has(#viewport:is([data-room="true"],[data-book="true"])) .config [data-config-jump="nahled"] { display: none; }
  /* Overlays: the room/bookcase switch at the top (book step only), the hint
     and zoom buttons or the page turning at the bottom of the model. */
  .config-page .preview:has(#viewport:is([data-room="true"],[data-book="true"])) > :is(.viewbar, .viewfoot, #book-preview-nav, .layout-tools) {
    grid-row: 2;
    z-index: 1;
    min-height: 0;
    padding: 6px;
    background: none;
    pointer-events: none;
  }
  .config-page .preview:has(#viewport:is([data-room="true"],[data-book="true"])) > :is(.viewbar, .viewfoot, #book-preview-nav, .layout-tools) > * { pointer-events: auto; }
  .config-page .preview > .viewbar { align-self: start; justify-content: flex-start; }
  .config-page .preview > .viewbar:not(:has(:is(.views, .layout-mode):not([hidden]))) { display: none; }
  .config-page .preview > .viewbar :is(.views, .layout-mode) button { min-height: 28px; padding: 3px 8px; font-size: 11px; }
  .config-page .preview > .layout-tools { align-self: end; }
  .config-page .preview > .layout-tools > button,
  .config-page .preview > .layout-tools .select-button { min-height: 34px; padding-inline: 9px; font-size: 11px; }
  .config-page .preview > .viewfoot .hint { max-width: calc(100% - 136px); padding-inline: 8px; font-size: 11px; }
  /* Zoomed onto a photo frame, the hint would cover the wall around it; on
     the narrowest phones it would cover the room. */
  .config-page .preview:has(#viewport[data-photos="true"]) .hint { display: none; }
  @media (max-width: 380px) { .config-page .preview:has(#viewport[data-room="true"]) .hint { display: none; } }
  .config-page .preview:has(#viewport[data-room="true"]) .tools button { min-width: 36px; min-height: 34px; font-size: 16px; }
  /* Turning the book's pages: arrows at the sides, the part shown below. */
  .config-page .preview > #book-preview-nav { position: relative; align-self: stretch; display: flex; align-items: center; padding: 0 6px; }
  .config-page .preview > #book-preview-nav .reader-nav { flex: 1; justify-content: space-between; }
  /* The arrow bar spans the book; taps between the arrows reach the pages. */
  .config-page .preview:has(#viewport:is([data-room="true"],[data-book="true"])) > #book-preview-nav > .reader-nav { pointer-events: none; }
  .config-page .preview:has(#viewport:is([data-room="true"],[data-book="true"])) > #book-preview-nav > .reader-nav > button { pointer-events: auto; }
  .config-page .preview > #book-preview-nav .reader-nav button { width: 36px; height: 36px; box-shadow: 0 1px 4px #20382b1f; }
  .config-page .preview > #book-preview-nav .reader-nav button svg { width: 18px; height: 18px; }
  .config-page .preview > #book-preview-nav #reader-label {
    position: absolute;
    bottom: 6px;
    left: 50%;
    min-width: 0;
    padding: 2px 9px;
    border-radius: 999px;
    background: #ffffffd9;
    font-size: 11px;
    transform: translateX(-50%);
    pointer-events: none;
  }
}

/* Phones, books overview: the whole bookcase is the pinned preview, so the
   look shows on all the spines at once and a book is picked there. */
@media (max-width: 800px) and (min-height: 560px) {
  .config-page[data-book-stage]:not([data-book-stage="edit"]) .preview:has(#viewport[data-book="true"]) > #bookcase { display: grid; grid-row: 2; margin: 10px auto; }
  .config-page[data-book-stage]:not([data-book-stage="edit"]) .preview:has(#viewport[data-book="true"]) > :is(#viewport, #book-preview-nav, .viewbar) { display: none; }
  /* On shorter phones smaller spines leave room for the options. */
  @media (max-height: 720px) {
    .config-page[data-book-stage]:not([data-book-stage="edit"]) .preview > #bookcase { gap: 5px; margin-block: 6px; padding: 8px 8px 6px; }
    .config-page[data-book-stage]:not([data-book-stage="edit"]) .preview > #bookcase .book-shelf { grid-template-columns: repeat(8, 16px); gap: 4px; padding: 7px 8px 0; }
    .config-page[data-book-stage]:not([data-book-stage="edit"]) .preview > #bookcase .book-shelf button { width: 16px; }
  }
  /* The bookcase is in sight, so the bar needs no miniature. */
  .config-page[data-book-stage]:not([data-book-stage="edit"]):has(#viewport[data-book="true"]) .mini-preview { display: none; }
}

/* The chosen frame in the preview takes the photo or message itself. The
   layer lies on the frame's photo window (placed from script), like paper. */
.frame-editor { position: absolute; left: 0; top: 0; z-index: 3; transform-origin: 0 0; font-family: system-ui, sans-serif; }
.frame-editor[hidden] { display: none; }
.frame-editor[data-state="pick"], .frame-editor[data-state="message"] { background: #fbf5e9; box-shadow: inset 0 0 0 1px #c5a47c; }
.frame-editor .frame-pick { position: absolute; inset: 0; display: none; place-items: center; padding: 6px; border: 0; border-radius: 0; background: transparent; color: #8a7d68; font: 600 max(11px, min(15px, calc(var(--frame-width) * .085)))/1.3 system-ui, sans-serif; text-align: center; cursor: pointer; }
.frame-editor[data-state="pick"] .frame-pick { display: grid; }
.frame-editor .frame-pick span { max-width: 13em; }
.frame-field { position: absolute; inset: 22% 8% 22%; display: none; flex-direction: column; justify-content: center; align-items: center; }
.frame-editor[data-state="message"] .frame-field { display: flex; }
.frame-field .field-hint { position: absolute; inset: -20% -6%; display: none; place-items: center; font: 600 max(10px, min(15px, calc(var(--frame-width) * .1)))/1.25 system-ui, sans-serif; color: #9a917f; text-align: center; pointer-events: none; }
.frame-field:has(textarea:placeholder-shown):not(:focus-within) .field-hint { display: grid; }
.frame-text { flex: none; padding: 0; transform-origin: 50% 50%; border: 0; background: transparent; color: #4b5c50; font: 600 16px/1.23 system-ui, sans-serif; text-align: center; resize: none; overflow: hidden; outline: none; }
/* A written message shows as it will be printed; the field takes over again when tapped. */
.frame-editor[data-state="message"][data-filled="true"]:not(:focus-within) { background: transparent; box-shadow: none; }
.frame-editor[data-state="message"][data-filled="true"]:not(:focus-within) .frame-text { color: transparent; }
.frame-editor .frame-photo { position: absolute; left: 50%; bottom: 7%; padding: 3px 8px; border: 0; border-radius: 999px; background: #fffffff0; color: var(--green); font-size: 11px; font-weight: 650; line-height: 1.2; white-space: nowrap; transform: translateX(-50%); box-shadow: 0 1px 4px #20382b26; cursor: pointer; }
.frame-editor[data-state="photo"] .frame-photo { left: auto; right: 6px; bottom: auto; top: 6px; transform: none; }
.frame-editor .frame-photo[hidden] { display: none; }

/* Last step: the room or a finished book in the preview, one tap away. */
.kit-views { margin: 4px 0 14px; }
.kit-views p { margin: 0 0 7px; color: var(--muted); font-size: 13px; }
.kit-views-list { display: flex; flex-wrap: wrap; gap: 6px; }
.kit-views-list button { max-width: 100%; padding: 7px 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--green); font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.kit-views-list button:hover { border-color: var(--green); }
.kit-views-list button[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: #fff; }
.kit-views-list button:first-child::before { content: "⌂ "; }
/* A book only looked at shows no invitations to write. */
.config-page:not([data-book-stage]) .reader-page[data-empty="true"]::after { content: none; }
.config-page:not([data-book-stage]) .reader-page { cursor: default; }
.config-page:not([data-book-stage]) .reader-page[aria-pressed="true"] { outline: none; }

/* With a custom wall shade the picked colour only tunes the furniture. */
#classic-palette[data-custom="true"] [data-theme][aria-pressed="true"] { border-style: dashed; background: #fff; box-shadow: none; }
#wall-custom-note { margin: 8px 0 0; }

/* A long title without spaces wraps instead of widening the card. */
.book-card-head { min-width: 0; }
#book-edit-title { min-width: 0; overflow-wrap: anywhere; }

/* The finished page and frame balance their lines ("Večery / ve dvou");
   the fields balance them too, so writing shows the same wrap. */
.page-text, .frame-text, #cover-text { text-wrap: balance; }
/* The page and the cover fields are sized like the printed lettering (see
   letterField); scaled down, they stay centred on their place. */
.page-text, #cover-text { flex: none; align-self: center; max-height: none; transform-origin: 50% 50%; }
/* The page is printed in semibold; the field writes in it too. */
.page-editor .page-text { font-weight: 600; }
.checkout-legal .payment-logos{display:flex;flex-basis:100%;flex-wrap:wrap;align-items:center;justify-content:center;gap:10px 22px;margin-top:6px}
.checkout-legal .payment-logos a{display:block;line-height:0}
.checkout-legal .payment-logos img{display:block;width:auto;max-width:none}
.checkout-legal .logo-comgate{height:22px}
.checkout-legal .logo-visa{height:16px}
.checkout-legal .logo-mastercard{height:24px}
/* Administration: Comgate mode choice and launch steps */
.admin-modes{display:grid;gap:8px;margin:4px 0 0;padding:0;border:0;min-width:0}
.admin-modes legend{margin-bottom:6px;padding:0;font-weight:650}
.shop-form .admin-mode{display:flex;align-items:flex-start;gap:10px;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:#fff;cursor:pointer;font-weight:400}
.shop-form .admin-mode:has(input:checked){border-color:var(--green);background:#f1f6f2}
.shop-form .admin-mode input{flex:none;width:18px;height:18px;min-height:18px;margin:2px 0 0;padding:0;accent-color:var(--green)}
.shop-form .admin-mode span{display:grid;gap:2px;font-size:13px;color:var(--muted);line-height:1.45}
.shop-form .admin-mode strong{color:var(--ink);font-size:14px}
.admin-comgate-urls h4{margin:8px 0 0;font-size:14px}
.admin-steps{margin:0;padding-left:20px;font-size:13px;color:var(--muted);line-height:1.5}
.admin-steps li + li{margin-top:3px}
.payment-test-note{margin:8px 0 0;padding:8px 10px;border-radius:8px;background:#fff0c9;color:#624500;font-size:13px}

/* Larger screens: a book being edited fills the preview, its cover first,
   like on a phone; the bookcase comes back with the books overview. */
@media (min-width: 801px) {
  .config-page[data-book-stage="edit"] .preview > #bookcase { display: none; }
  .config-page[data-book-stage="edit"] #viewport[data-book="true"] { height: clamp(320px, 58vh, 560px); }
}
.book-page-hint { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
#book-title { resize: none; }
/* Books the customer edited can be dragged to another place on the shelves. */
.config-page[data-book-stage] #bookcase .book-shelf button[data-edited="true"] { cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.book-shelf img { -webkit-user-drag: none; -webkit-touch-callout: none; }
.book-shelf button.is-dragged { opacity: .35; }
.book-shelf button[data-drop] { outline: 2px dashed #ffe7a8; outline-offset: 2px; transform: translateY(-4px); }
.shelf-ghost { position: fixed; left: 0; top: 0; z-index: 100; border-radius: 2px; box-shadow: 0 8px 18px #0006; pointer-events: none; }
#book-move-hint { margin: -2px 0 10px; }
.reader-page img[hidden] { display: none; }

/* In the room step the hint stays clear of the selectable surfaces. */
.config-page .preview:has(#viewport[data-color-edit="true"]) > .viewfoot {
  grid-row: 4;
  align-items: center;
  padding: 4px 8px;
  border-top: 1px solid var(--line);
}
.config-page .preview:has(#viewport[data-color-edit="true"]) > .viewfoot .hint {
  display: block;
  max-width: none;
  padding: 2px 0 2px 2px;
  white-space: normal;
  background: none;
}
#viewport[data-color-edit="true"] :is([data-piece], .piece-obstacle) { pointer-events: visiblePainted; }
#viewport[data-color-edit="true"] [data-color-piece] { pointer-events: visibleFill; cursor: pointer; }
#viewport[data-color-edit="true"] .piece-hit { fill: transparent; }
#viewport[data-color-edit="true"].dragging [data-color-piece] { cursor: grabbing; }
#viewport[data-color-edit="true"] .piece-hovered:is(.piece-face,.piece-hit) {
  stroke: #f8e3b8;
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
}
.piece-material select {
  min-width: 0;
  max-width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  background: white;
  color: var(--ink);
  font-size: 16px;
}
.config-page .preview > .piece-editor {
  grid-row: 4;
  display: grid;
  gap: 7px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 16px 16px;
  background: var(--paper);
}
.config-page .preview > .piece-editor[hidden] { display: none; }
.piece-editor-top, .piece-editor-colors, .piece-material {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}
.piece-editor-top { flex-wrap: wrap; }
.piece-editor-top h2 { margin: 0; font-size: 18px; color: var(--ink); }
.piece-editor button { cursor: pointer; }
#piece-editor-close, #piece-color-reset {
  min-height: 40px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--green);
  font-weight: 650;
  font-size: 13px;
}
#piece-editor-close { flex: none; margin-inline-start: auto; }
#piece-color-reset { justify-self: start; }
#piece-color-reset:disabled { opacity: .52; cursor: default; }
.piece-material { justify-content: flex-start; font-size: 13px; font-weight: 650; }
.piece-material select { flex: 1; }
.piece-editor-colors { flex-wrap: wrap; justify-content: flex-start; }
.piece-swatches { display: flex; flex-wrap: wrap; }
.piece-swatches button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
}
.piece-swatches button::before {
  content: "";
  width: 27px;
  height: 27px;
  border: 1px solid #0002;
  border-radius: 50%;
  background: var(--swatch);
}
.piece-swatches button[aria-pressed="true"]::before {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.piece-custom {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.piece-custom input { width: 36px; height: 44px; padding: 4px 1px; cursor: pointer; }
@media (max-width: 380px) {
  .piece-swatches button { width: 36px; }
}
@media (max-width: 800px) {
  :root { --room-stage-view: clamp(205px, min(62vw, 38svh), 280px); }
  .config-page .preview:has(#viewport[data-fit-room="true"]) > #viewport { height: var(--room-stage-view); }
  .config-page .preview:has(#viewport[data-fit-room="true"]) > .viewbar:has(#layout-mode:not([hidden])) {
    grid-row: 1;
    padding: 6px;
  }
  .config-page .preview:has(#viewport[data-fit-room="true"]) > :is(.viewfoot, #layout-tools) {
    grid-row: 4;
    align-items: center;
    padding: 4px 8px;
    border-top: 1px solid var(--line);
  }
  .config-page:has(#piece-editor:not([hidden])) .step-actions { visibility: hidden; }
}
@media (max-width: 800px) and (min-height: 560px) {
  .config-page .preview:has(#viewport[data-fit-room="true"]) > :is(.viewfoot, #piece-editor, #layout-tools) { grid-row: 3; }
  :root:has(.config-page #viewport[data-fit-room="true"]) { scroll-padding-top: calc(var(--room-stage-view) + 67px); }
  :root:has(.config-page #viewport[data-fit-room="true"]):has(.config-page #layout-mode:not([hidden])) {
    scroll-padding-top: calc(var(--room-stage-view) + 108px);
  }
}
@media (max-width: 330px) {
  .config-header { gap: 7px; padding-inline: 9px; }
  .config-header .brand { gap: 5px; font-size: 17px; }
  .config-header .brand-mark { width: 25px; height: 25px; }
  .room-styles strong { overflow-wrap: anywhere; }
}
