:root {
  --ink: #1a1a1a;
  --paper: #fff7ec;
  --accent: #ff7a00;
  --shadow: rgba(18, 20, 30, 0.18);
  --book-padding: 18px;
  --page-padding: 36px;
  --book-page-height: clamp(400px, 68vh, 520px);
  --adult-paper: #f6efe7;
  --adult-ink: #1f1f1f;
  --teen-paper: #eef5ff;
  --teen-ink: #0b1b2a;
  --child-paper: #fff1dd;
  --child-ink: #35131f;
  --book-font: "IBM Plex Serif", "Georgia", serif;
  --book-font-weight: 400;
  --book-font-style: normal;
  --book-page-ratio: 3 / 4;
  --shared-book-page-width: 520px;
  --viewer-text-size: 17px;
}
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #ffffff 0%, #efe7db 60%, #e1d6c6 100%);
}

main {
  flex: 1 0 auto;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-logo-image {
  display: block;
  height: 44px;
  width: auto;
  max-width: min(220px, 58vw);
}

@media (max-width: 768px) {
  .brand-logo-image {
    height: 36px;
  }
}

.glass-nav {
  --bs-navbar-padding-y: 0.25rem;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.glass-nav .navbar-brand {
  padding: 0;
  margin-top: 0;
  margin-bottom: 0;
  line-height: 1;
}

.glass-nav {
  backdrop-filter: blur(12px);
  background: rgba(245, 239, 230, 0.86);
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.nav-search {
  width: min(260px, 55vw);
}

.nav-search .form-control {
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.9);
}

.input-card {
  background: #fff7ec;
}

.builder-tabs {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.builder-tabs .nav-link {
  border: none;
  color: #6c5f52;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
}

.builder-tabs .nav-link.active {
  color: #1f1f1f;
  background: #fff3e3;
  border-radius: 12px 12px 0 0;
}

.qa-section-divider {
  border-top: 1px solid rgba(0, 0, 0, 0.18);
  opacity: 0.8;
}

.qa-section-header-row {
  min-height: 30px;
}

.qa-feature-toggle-wrap .form-check-input {
  cursor: pointer;
}

.form-control,
.form-select {
  border-radius: 12px;
}

.builder-character-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.builder-character-control-group {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: min(220px, 100%);
}

.builder-character-control-group:first-child {
  min-width: min(190px, 100%);
}

.builder-character-control-group .form-label {
  min-height: 1.5rem;
  margin-bottom: 0.5rem;
}

.print-help-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border: 1px solid rgba(107, 63, 23, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #8a4c18;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.print-help-trigger:hover,
.print-help-trigger:focus-visible {
  background: #fff3e3;
  border-color: rgba(255, 122, 0, 0.45);
  outline: none;
  transform: translateY(-1px);
}

.popover {
  --bs-popover-max-width: 280px;
  --bs-popover-border-color: rgba(107, 63, 23, 0.15);
  --bs-popover-header-bg: #fff3e3;
  --bs-popover-header-color: #6b3f17;
  --bs-popover-body-color: #45372b;
  --bs-popover-body-padding-x: 0.85rem;
  --bs-popover-body-padding-y: 0.75rem;
  box-shadow: 0 18px 40px rgba(18, 20, 30, 0.16);
  border-radius: 14px;
}


.age-select {
  border-radius: 12px;
  min-height: 42px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  background: #ffffff;
}

.age-select:focus,
.age-select:focus-visible {
  box-shadow: 0 0 0 0.2rem rgba(255, 122, 0, 0.25);
  border-color: rgba(255, 122, 0, 0.6);
}

.qa-select {
  border-radius: 12px;
  background: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.qa-select:focus,
.qa-select:focus-visible {
  box-shadow: 0 0 0 0.2rem rgba(255, 122, 0, 0.25);
  border-color: rgba(255, 122, 0, 0.6);
}

.qa-select-btn {
  border-radius: 12px;
  min-height: 42px;
  background: #ffffff;
  text-align: left;
}

.qa-select-btn:focus,
.qa-select-btn:focus-visible {
  box-shadow: 0 0 0 0.2rem rgba(255, 122, 0, 0.25);
  border-color: rgba(255, 122, 0, 0.6);
}

.qa-menu,
.age-menu,
.book-tools-bar .dropdown-menu,
.font-menu {
  border-radius: 14px;
  padding: 8px;
  margin-top: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 18px 40px rgba(18, 20, 30, 0.18);
}

.qa-menu .dropdown-item,
.age-menu .dropdown-item,
.book-tools-bar .dropdown-item,
.font-menu .dropdown-item {
  border-radius: 12px;
  padding: 8px 12px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.qa-menu .dropdown-item:hover,
.qa-menu .dropdown-item:focus,
.age-menu .dropdown-item:hover,
.age-menu .dropdown-item:focus,
.book-tools-bar .dropdown-item:hover,
.book-tools-bar .dropdown-item:focus,
.font-menu .dropdown-item:hover,
.font-menu .dropdown-item:focus {
  background-color: rgba(255, 122, 0, 0.12);
}

.qa-menu .dropdown-item.active,
.age-menu .dropdown-item.active,
.book-tools-bar .dropdown-item.active {
  color: #6b3f17;
  background-color: rgba(255, 122, 0, 0.18);
}

.btn {
  border-radius: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.book-card .card-header {
  background: rgba(255, 255, 255, 0.6);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.book-card {
  width: 100%;
}

.book-cover-preview {
  width: 100%;
  border: 0;
  padding: 28px;
  border-radius: 20px;
  text-align: left;
  background: linear-gradient(135deg, #fff3e0, #ffe6c2);
  box-shadow: 0 16px 30px rgba(18, 20, 30, 0.12);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-cover-preview:hover,
.book-cover-preview:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 22px 40px rgba(18, 20, 30, 0.16);
}

.book-cover-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.book-cover-preview-secondary {
  cursor: default;
  background: linear-gradient(135deg, #f6efe3, #f1e5d2);
}

.book-cover-preview-art {
  width: 100%;
  aspect-ratio: 1 / 1.35;
  border-radius: 16px;
  margin-bottom: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(70, 42, 22, 0.08)),
    linear-gradient(135deg, #f7e4c4, #f1c98f);
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(94, 62, 32, 0.12);
}

.book-cover-preview-art.has-image {
  background-color: #eadbc5;
}

.book-cover-label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: #9a6b3f;
  font-weight: 700;
}

.book-cover-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #3f1f14;
  margin-top: 10px;
}

.book-cover-subtitle {
  margin-top: 12px;
  color: #7a5b3c;
  font-weight: 600;
}

.book-modal-layout {
  display: flex;
  gap: 24px;
  align-items: stretch;
}

.book-panel-controls {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.book-panel-controls-group {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.book-panel-controls-group-right {
  justify-content: flex-end;
}

.book-modal-left {
  flex: 1 1 0;
  min-width: 0;
}

.book-modal-right {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
}

.book-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

.book-main {
  flex: 1 1 0;
  min-width: 0;
}

.book-preview-card {
  background: rgba(255, 255, 255, 0.65);
  border-radius: 20px;
  padding: 18px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 18px 40px rgba(18, 20, 30, 0.14);
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.book-preview-title {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #6b4e3b;
  margin-bottom: 12px;
}

.book-preview-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.book-preview-card > .book-preview-title.mb-0 {
  margin-bottom: 12px !important;
}

.book-blank-page-help {
  padding: 0;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  color: #7a4b1b;
}

.book-blank-page-help:hover,
.book-blank-page-help:focus-visible {
  color: #4e2b0b;
  text-decoration: underline;
}

.book-preview-workspace {
  display: none;
  margin-top: 18px;
}

.book-preview-workspace.is-visible {
  display: block;
}

.book-tools-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 16px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 10px 22px rgba(18, 20, 30, 0.1);
}

.builder-toolbar-status {
  color: #5f5349;
  font-size: 0.92rem;
  line-height: 1.35;
  min-height: 1.25rem;
  flex: 0 1 420px;
  margin-left: auto;
  text-align: right;
}

.book-page-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.illustration-notes-banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 248, 236, 0.9);
  border: 1px solid rgba(154, 107, 63, 0.18);
  box-shadow: 0 10px 22px rgba(18, 20, 30, 0.08);
  color: #4d3524;
}

.illustration-notes-label {
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8f6037;
}

.book-page-progress {
  width: min(240px, 100%);
  margin-left: auto;
}

.font-tools-menu {
  min-width: 220px;
}

.action-banner {
  display: none;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 24px rgba(18, 20, 30, 0.12);
  color: #3b2a1b;
  font-weight: 600;
  margin-bottom: 16px;
}

.action-banner.is-visible {
  display: block;
}

.action-banner-modal {
  margin-bottom: 18px;
}

.ai-disclosure-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 122, 0, 0.28);
  background: rgba(255, 248, 236, 0.95);
  box-shadow: 0 10px 24px rgba(18, 20, 30, 0.1);
  opacity: 1;
  transform: translateY(0);
  max-height: 180px;
  overflow: hidden;
  transition:
    opacity 200ms ease-out,
    transform 200ms ease-out,
    max-height 220ms ease-out,
    margin-bottom 220ms ease-out,
    padding-top 220ms ease-out,
    padding-bottom 220ms ease-out;
}

.ai-disclosure-banner-message {
  color: #4d3524;
  font-size: 0.92rem;
  line-height: 1.35;
}

.ai-disclosure-banner .btn-close {
  flex: 0 0 auto;
  margin-top: 2px;
}

.ai-disclosure-banner.is-dismissing {
  opacity: 0;
  transform: translateY(-6px);
  max-height: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}

.font-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.font-list-options {
  display: grid;
  gap: 6px;
}
.book-sidebar {
  flex: 0 0 260px;
  width: 260px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 16px 30px rgba(18, 20, 30, 0.12);
}

.sidebar-block + .sidebar-block {
  margin-top: 18px;
}

.sidebar-title {
  font-weight: 600;
  margin-bottom: 12px;
}

.font-select {
  border-radius: 12px;
  background: #ffffff;
}

.font-option.font-plex {
  font-family: "IBM Plex Serif", "Rockwell", "Courier New", "Georgia", serif;
}

.font-option.font-playfair {
  font-family: "Playfair Display", "Bodoni 72", "Bodoni MT", "Didot", "Times New Roman", serif;
}

.font-option.font-merriweather {
  font-family: "Merriweather", "Cambria", "Palatino Linotype", "Book Antiqua", "Georgia", serif;
}

.font-option.font-lora {
  font-family: "Lora", "Georgia", serif;
}

.font-option.font-source {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
}

.book-scene {
  width: min(var(--shared-book-page-width), 100%);
  aspect-ratio: var(--book-page-ratio);
  height: auto;
  perspective: 1500px;
  margin: 0 auto;
  min-height: 0;
}

.book-carousel {
  --builder-content-scale: 1;
  --builder-decor-scale: 1;
  width: min(var(--shared-book-page-width), 100%);
  aspect-ratio: var(--book-page-ratio);
  height: auto;
  margin: 0 auto;
}

.book-text-carousel {
  --builder-content-scale: 1;
  --builder-decor-scale: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.book-text-carousel .carousel-inner {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.book-carousel .carousel-inner,
.book-text-carousel .carousel-inner {
  height: 100%;
  border-radius: 18px;
  background: #fff7ec;
  padding: 16px;
  box-shadow: inset 0 0 0 1px rgba(122, 104, 80, 0.18);
}

.book-carousel .carousel-item {
  height: 100%;
}

.book-text-carousel .carousel-item {
  height: 100%;
  min-height: 0;
}

.carousel-page {
  background: #f3ede3;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px rgba(122, 104, 80, 0.18);
  padding: calc(14px * var(--builder-content-scale, 1));
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.carousel-control-prev,
.carousel-control-next {
  width: 12%;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background-color: rgba(35, 30, 24, 0.55);
  box-shadow: 0 10px 20px rgba(16, 14, 12, 0.18);
  background-size: 65% 65%;
}

.carousel-control-prev:hover .carousel-control-prev-icon,
.carousel-control-next:hover .carousel-control-next-icon,
.carousel-control-prev:focus-visible .carousel-control-prev-icon,
.carousel-control-next:focus-visible .carousel-control-next-icon {
  background-color: rgba(35, 30, 24, 0.78);
}

.book {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  background: #d7c7b2;
  border-radius: 18px;
  padding: var(--book-padding);
  box-shadow: 0 28px 50px var(--shadow);
  overflow: hidden;
}

.page {
  position: absolute;
  inset: var(--book-padding);
  background: var(--paper);
  border-radius: 8px 12px 12px 8px;
  box-shadow: inset 10px 0 20px rgba(0, 0, 0, 0.06),
    2px 2px 5px rgba(0, 0, 0, 0.12);
  padding: var(--page-padding);
  min-height: var(--book-page-height);
  transform-origin: left center;
  transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.page.has-image,
.carousel-page.has-image {
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.book-carousel .carousel-page.has-image {
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #f3eadc;
}

body.view-classic .page.has-image {
  background-size: contain;
}

.page.has-text-background,
.carousel-page.has-text-background {
  background-size: cover;
  background-position: center 40%;
  background-repeat: no-repeat;
}

.story-text-page.has-text-background {
  border-radius: 14px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #f3ede3;
  box-shadow: inset 0 0 0 1px rgba(122, 104, 80, 0.18);
}

.page.has-text-background::before,
.story-text-page.has-text-background::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.65);
  box-shadow: inset 0 0 80px rgba(255, 255, 255, 0.3);
  z-index: 2;
}

.page.has-image .page-text,
.carousel-page.has-image .page-text {
  background: rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

body.age-toddler .book {
  background: #ffd9b3;
}

body.age-toddler .page {
  background: #fff8ec;
  color: #5b4a3f;
  font-size: 1.2rem;
}

body.age-child .book {
  background: #ffd37d;
}

body.age-child .page {
  background: var(--child-paper);
  color: var(--child-ink);
  font-size: 1.15rem;
}

.page.flipped {
  transform: rotateY(-180deg);
}

.page-text {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #333;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: var(--book-font);
  font-weight: var(--book-font-weight);
  font-style: var(--book-font-style);
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 8px 18px rgba(18, 20, 30, 0.12);
}

.story-text-page {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  justify-content: flex-start;
  position: relative;
}

.page-art-stage {
  --art-scale: 1;
  --art-offset-x: 0%;
  --art-offset-y: 0%;
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 1;
  cursor: default;
}

.page-art-stage.has-image {
  cursor: grab;
}

.page-art-stage.is-selected {
  box-shadow: inset 0 0 0 2px rgba(255, 122, 0, 0.42);
}

.page-art-stage.is-dragging {
  cursor: grabbing;
}

.page-art-layer {
  position: absolute;
  inset: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  transform: translate(var(--art-offset-x), var(--art-offset-y)) scale(var(--art-scale));
  transform-origin: center center;
  will-change: transform;
}

.page-center-guide {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 30;
  background: rgba(255, 122, 0, 0.9);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.page-center-guide.is-visible {
  opacity: 1;
}

.page-center-guide[data-axis="vertical"] {
  top: 12px;
  bottom: 12px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
}

.page-center-guide[data-axis="horizontal"] {
  left: 12px;
  right: 12px;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
}

.story-text-layout-box {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 88%;
  height: 70%;
  transform: translate(-50%, -50%);
  z-index: 5;
  cursor: move;
  touch-action: none;
}

.story-text-layout-box .page-text {
  position: absolute;
  inset: 0;
  display: block;
  box-sizing: border-box;
}

.story-text-layout-box.is-selected {
  z-index: 6;
}

.story-text-layout-box.is-selected .page-text {
  box-shadow: 0 0 0 2px rgba(255, 122, 0, 0.35), 0 12px 24px rgba(18, 20, 30, 0.18);
}

.story-text-layout-box.is-editing {
  cursor: text;
}

.story-text-layout-box.is-editing .page-text {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  outline: none;
}

.story-text-page .page-text {
  font-size: calc(var(--builder-page-font-size, 1.05rem) * var(--builder-content-scale, 1));
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  color: var(--builder-page-font-color, #5f5349);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 10px 24px rgba(16, 14, 12, 0.12);
  backdrop-filter: blur(2px);
  padding: calc(14px * var(--builder-content-scale, 1))
    calc(16px * var(--builder-content-scale, 1));
}

.story-text-page .page-text.story-text-box-rounded {
  border-radius: 14px;
}

.story-text-page .page-text.story-text-box-square {
  border-radius: 4px;
}

.story-text-page[data-cover-spread="1"] .story-text-layout-box {
  top: 50%;
  height: 78%;
}

.story-text-page[data-cover-spread="1"] .page-text {
  padding: calc(18px * var(--builder-content-scale, 1))
    calc(20px * var(--builder-content-scale, 1));
}

.story-text-page .page-footer {
  flex: 0 0 auto;
  position: absolute;
  left: 18px;
  right: auto;
  bottom: 12px;
}

.story-text-box-resize-handle {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 13px;
  height: 13px;
  border: 0;
  border-radius: 3px;
  background: rgba(79, 63, 50, 0.14);
  cursor: nwse-resize;
  box-shadow: none;
  touch-action: none;
  z-index: 8;
}

.story-text-box-resize-handle::before {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid rgba(79, 63, 50, 0.48);
  border-bottom: 1.5px solid rgba(79, 63, 50, 0.48);
}

.page-edit-preview {
  min-height: 260px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 247, 236, 0.96), rgba(247, 236, 219, 0.96));
  border: 1px solid rgba(154, 107, 63, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.page-edit-preview-box {
  position: relative;
  min-height: 228px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(245, 236, 223, 0.98));
  border: 1px solid rgba(154, 107, 63, 0.14);
  box-shadow: 0 12px 28px rgba(18, 20, 30, 0.08);
  overflow: hidden;
}

.page-edit-preview-text {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 88%;
  height: 70%;
  transform: translate(-50%, -50%);
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 18px rgba(18, 20, 30, 0.12);
  color: #5f5349;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow: auto;
  outline: none;
}

.page-edit-preview-text.story-text-box-square {
  border-radius: 4px;
}

.page-footer {
  text-align: center;
  font-size: 0.85rem;
  color: #8b7c6c;
  margin-top: 12px;
  position: relative;
  z-index: 6;
}

.page-footer-illustration {
  position: absolute;
  left: auto;
  right: 18px;
  bottom: 12px;
  margin-top: 0;
}

.story-text-page.blank-page {
  align-items: center;
  justify-content: center;
}

.blank-page-message,
.viewer-blank-page-message {
  color: rgba(107, 78, 59, 0.55);
  font-style: italic;
  font-weight: 600;
  text-align: center;
}

.viewer-title-page-title {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 12%;
  z-index: 5;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  color: #231811;
  background: rgba(255, 248, 238, 0.82);
  box-shadow: 0 12px 26px rgba(18, 20, 30, 0.18);
  font-family: var(--book-font);
  font-size: clamp(1.25rem, 4vw, 2.3rem);
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  overflow-wrap: anywhere;
}

.title-page-text-box {
  position: absolute;
  z-index: 5;
  cursor: move;
  touch-action: none;
}

.title-page-text-box .page-text {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--book-font);
  font-weight: 700;
  line-height: 1.12;
}

.builder-cover-preview-title {
  position: absolute;
  left: 50%;
  top: 70%;
  width: 76%;
  height: 24%;
  transform: translate(-50%, -50%);
  z-index: 5;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  color: #231811;
  background: rgba(255, 248, 238, 0.84);
  box-shadow: 0 12px 26px rgba(18, 20, 30, 0.18);
  line-height: 1.12;
  text-align: center;
  overflow-wrap: anywhere;
  cursor: move;
  touch-action: none;
}

.builder-cover-preview-title .page-text {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.12;
  text-align: center;
  overflow-wrap: anywhere;
}

.back-cover-preview-copy {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: 76%;
  height: 56%;
  transform: translate(-50%, -50%);
  padding: 1rem;
  border-radius: 8px;
  color: #24170f;
  background: rgba(255, 248, 238, 0.86);
  box-shadow: 0 12px 24px rgba(18, 20, 30, 0.14);
  line-height: 1.45;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-align: left;
  cursor: move;
  touch-action: none;
}

.back-cover-preview-copy .page-text {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  line-height: 1.45;
}

.story-text-page.back-cover-preview-page {
  align-items: center;
  justify-content: center;
}

.illustration-page {
  align-items: center;
  justify-content: center;
  background: #e7dbc8;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(122, 104, 80, 0.2),
    0 6px 14px rgba(0, 0, 0, 0.1);
}

.illustration-page .illustration-placeholder {
  color: #6b4e3b;
  font-weight: 600;
  font-size: 1rem;
  position: relative;
  z-index: 2;
}

.illustration-page.has-image .illustration-placeholder {
  display: none;
}

.page-decor-layer {
  position: absolute;
  inset: 10px;
  z-index: auto;
  pointer-events: none;
}

.story-text-page .page-decor-layer[data-surface="text"] {
  z-index: auto;
}

.page-decor-item {
  --decor-stroke-width: 2px;
  --decor-stroke-color: rgba(58, 46, 34, 0.45);
  --builder-decor-font-size: 18px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 34%;
  height: 20%;
  max-width: none;
  min-width: calc(96px * var(--builder-decor-scale, 1));
  min-height: calc(42px * var(--builder-decor-scale, 1));
  padding: calc(10px * var(--builder-decor-scale, 1))
    calc(12px * var(--builder-decor-scale, 1));
  font-size: calc(var(--builder-decor-font-size, 18px) * var(--builder-decor-scale, 1));
  line-height: 1.2;
  color: #1f1b16;
  cursor: move;
  user-select: none;
  pointer-events: auto;
  box-shadow: 0 10px 20px rgba(18, 20, 30, 0.2);
  border: calc(var(--decor-stroke-width) * var(--builder-decor-scale, 1)) solid var(--decor-stroke-color);
  background: rgba(255, 252, 243, 0.95);
}

.page-decor-item.decor-has-asset {
  border: 0;
  background-color: transparent !important;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  box-shadow: none;
  padding: 7% 9% 11%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-decor-item.decor-has-fill-mask::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--decor-bg, rgba(255, 255, 255, 0.95));
  -webkit-mask-image: var(--decor-asset-mask);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 100% 100%;
  mask-image: var(--decor-asset-mask);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 100% 100%;
  z-index: 0;
}

.page-decor-item.decor-has-fill-mask::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--decor-asset-outline);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  z-index: 1;
}

.page-decor-item:active {
  cursor: grabbing;
}

.page-decor-item span {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  width: 100%;
  height: 100%;
  overflow: auto;
}

.page-decor-item.decor-has-asset span {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  text-align: center;
  line-height: 1.12;
  position: relative;
  z-index: 2;
}

.page-decor-item.decor-tail-left span {
  padding-left: 8%;
  padding-right: 2%;
}

.page-decor-item.decor-tail-right span {
  padding-left: 2%;
  padding-right: 8%;
}

.page-decor-item.decor-has-asset.decor-speech_bubble.decor-tail-left span,
.page-decor-item.decor-has-asset.decor-speech_bubble.decor-tail-right span {
  padding-left: 10%;
  padding-right: 10%;
}

.page-decor-item .decor-text-input[contenteditable="true"] {
  outline: none;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}

.page-decor-item.is-editing {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}

.page-decor-item.is-editing .decor-text-input {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  pointer-events: auto;
}

.page-decor-item.is-editing,
.page-decor-item.is-editing * {
  cursor: text !important;
}

.page-decor-item.is-selected {
  border-color: #ff7a00;
  box-shadow: 0 0 0 2px rgba(255, 122, 0, 0.35), 0 12px 24px rgba(18, 20, 30, 0.24);
}

.page-decor-item.decor-shape-square {
  border-radius: calc(4px * var(--builder-decor-scale, 1));
}

.page-decor-item.decor-shape-rounded {
  border-radius: calc(16px * var(--builder-decor-scale, 1));
}

.page-decor-item.decor-speech_bubble {
  border-radius: calc(16px * var(--builder-decor-scale, 1));
  background: rgba(255, 255, 255, 0.97);
}

.page-decor-item.decor-speech_bubble::after {
  content: "";
  position: absolute;
  left: calc(18px * var(--builder-decor-scale, 1));
  bottom: calc(-10px * var(--builder-decor-scale, 1));
  width: calc(18px * var(--builder-decor-scale, 1));
  height: calc(11px * var(--builder-decor-scale, 1));
  background: var(--decor-bg, rgba(255, 255, 255, 0.97));
  border: calc(var(--decor-stroke-width) * var(--builder-decor-scale, 1)) solid var(--decor-stroke-color);
  border-top: 0;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.page-decor-item.decor-has-asset.decor-speech_bubble::after {
  background-image: var(--decor-asset-outline);
}

.page-decor-item.decor-speech-cloud::after {
  left: calc(17px * var(--builder-decor-scale, 1));
  bottom: calc(-8px * var(--builder-decor-scale, 1));
  width: calc(14px * var(--builder-decor-scale, 1));
  height: calc(9px * var(--builder-decor-scale, 1));
  border-width: calc(1.5px * var(--builder-decor-scale, 1));
}

.page-decor-item.decor-speech-thought {
  border-radius: calc(26px * var(--builder-decor-scale, 1));
}

.page-decor-item.decor-speech-thought span {
  padding-top: 6%;
  padding-bottom: 10%;
}

.page-decor-item.decor-speech-thought.decor-tail-left span {
  padding-left: 14%;
  padding-right: 10%;
}

.page-decor-item.decor-speech-thought.decor-tail-right span {
  padding-left: 10%;
  padding-right: 14%;
}

.page-decor-item.decor-speech-thought::after {
  left: calc(14px * var(--builder-decor-scale, 1));
  bottom: calc(-14px * var(--builder-decor-scale, 1));
  width: calc(8px * var(--builder-decor-scale, 1));
  height: calc(8px * var(--builder-decor-scale, 1));
  border-radius: 999px;
  border-top: calc(var(--decor-stroke-width) * var(--builder-decor-scale, 1)) solid var(--decor-stroke-color);
  clip-path: none;
  box-shadow: calc(10px * var(--builder-decor-scale, 1))
    calc(8px * var(--builder-decor-scale, 1))
    0
    calc(-1px * var(--builder-decor-scale, 1))
    var(--decor-bg, rgba(255, 255, 255, 0.97));
}

.page-decor-resize-handle {
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: #ff7a00;
  box-shadow: 0 8px 16px rgba(18, 20, 30, 0.2);
  cursor: nwse-resize;
  display: none;
}

.page-decor-resize-handle::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}

.page-decor-item.is-selected .page-decor-resize-handle {
  display: block;
}

.decor-inline-toolbar {
  position: fixed;
  z-index: 2000;
  width: min(520px, calc(100vw - 16px));
  min-width: min(420px, calc(100vw - 16px));
  max-width: calc(100vw - 16px);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(18, 20, 30, 0.22);
  padding: 10px 12px;
}

.box-bubble-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.box-bubble-picker-card {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  background: #fff;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.box-bubble-picker-card:hover,
.box-bubble-picker-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 122, 0, 0.45);
  box-shadow: 0 14px 28px rgba(18, 20, 30, 0.12);
  outline: none;
}

.box-bubble-picker-thumb {
  width: 100%;
  aspect-ratio: 1.5 / 1;
  object-fit: contain;
}

.box-bubble-picker-thumb-inline-text {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
}

.box-bubble-picker-inline-shape {
  width: 88%;
  height: 62%;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 18px rgba(18, 20, 30, 0.12);
  border: 1px solid rgba(58, 46, 34, 0.18);
}

.box-bubble-picker-label {
  font-weight: 600;
  color: #3f352d;
  text-align: center;
}

.decor-toolbar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.decor-tool-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #5a4d42;
}

.decor-tool-field select,
.decor-tool-field input[type="number"],
.decor-tool-field input[type="range"] {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  min-height: 32px;
  padding: 4px 8px;
}

.decor-tool-field input[type="range"] {
  padding-left: 0;
  padding-right: 0;
}

.decor-size-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 6px;
  align-items: center;
}

.decor-color-field input[type="color"] {
  width: 100%;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  padding: 0;
}

.decor-toolbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

@media (max-width: 640px) {
  .decor-inline-toolbar {
    width: calc(100vw - 16px);
    min-width: calc(100vw - 16px);
  }
  .decor-toolbar-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --book-page-height: clamp(320px, 60vh, 460px);
    --page-padding: 26px;
  }
}

@media (max-width: 992px) {
  .book-layout {
    flex-direction: column;
  }

  .book-sidebar {
    width: 100%;
    flex: 0 0 auto;
  }

  .book-modal-layout {
    flex-direction: column;
  }

  .book-panel-controls {
    flex-direction: column;
    gap: 12px;
  }

  .book-modal-left,
  .book-modal-right {
    flex: 1 1 auto;
  }

  .book-panel-controls-group-right {
    justify-content: flex-start;
  }

  .book-page-progress {
    width: 100%;
    margin-left: 0;
  }
}

/* Home page */
.home-body {
  background: linear-gradient(180deg, #ffffff 0%, #efe7db 52%, #e5d8c7 100%);
}

.home-link {
  color: #5a4d42;
  font-weight: 600;
  text-decoration: none;
}

.home-link:hover,
.home-link:focus {
  color: #1f1f1f;
}

.home-hero {
  padding: 80px 0 60px;
  position: relative;
  overflow: hidden;
}

.hero-kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  font-weight: 700;
  color: #9a6b3f;
  margin-bottom: 12px;
}

.hero-title {
  font-family: "Playfair Display", "Georgia", serif;
  color: #1f1b16;
}

.hero-support {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hero-support-card {
  padding: 14px 14px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 22px rgba(20, 20, 20, 0.08);
}

.hero-support-card h3 {
  font-size: 0.95rem;
  margin: 0 0 8px;
}

.hero-support-card ul {
  margin: 0;
  padding-left: 18px;
  color: #4f443a;
}

.hero-support-card li + li {
  margin-top: 4px;
}

.hero-meta {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
}

.hero-stat {
  display: block;
  font-weight: 700;
  font-size: 1.1rem;
}

.hero-label {
  font-size: 0.85rem;
  color: #7a6b5c;
}

.library-window {
  position: relative;
  padding: 28px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 28px 60px rgba(26, 24, 20, 0.18);
  overflow: hidden;
}

.hero-collections-window {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero-collections-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8f6240;
}

.hero-collection-section {
  position: relative;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 14px 26px rgba(20, 20, 20, 0.1);
}

.hero-collection-header h3 {
  font-size: 1rem;
  margin: 0;
}

.hero-collection-header p {
  margin: 5px 0 0;
  font-size: 0.82rem;
  color: #746558;
}

.hero-collection-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.hero-collection-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hero-collection-card {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  text-align: left;
  padding: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hero-collection-card:hover,
.hero-collection-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 24px rgba(18, 20, 30, 0.16);
}

.hero-collection-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.hero-card-preview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.universal-two-book-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.universal-two-book-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  padding: 10px;
}

.hero-collection-card .universal-two-book-entry {
  background: rgba(255, 255, 255, 0.82);
}

.universal-two-book-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.universal-two-book-title {
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.2;
  color: #3d342c;
}

.universal-two-book-tags {
  gap: 5px;
}

.hero-card-thumb {
  width: 52px;
  height: 70px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.hero-card-book-title {
  font-size: 0.8rem;
  color: #3d342c;
  line-height: 1.2;
}

.hero-auth-note {
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 122, 0, 0.08);
  border: 1px dashed rgba(255, 122, 0, 0.3);
}

.hero-collection-modal-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.88);
}

.hero-collection-modal-card:hover,
.hero-collection-modal-card:focus-visible {
  box-shadow: 0 16px 24px rgba(18, 20, 30, 0.14);
}

.hero-collection-modal-card .library-title {
  margin-bottom: 4px;
}

.hero-collection-modal-meta {
  font-size: 0.78rem;
  color: #77695d;
}

.hero-collection-modal-stats {
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #5f5349;
}

.hero-collection-modal-dialog {
  max-width: min(1180px, 96vw);
}

.hero-collection-modal-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.hero-collection-modal-grid .hero-collection-modal-card {
  min-height: 170px;
  padding: 18px;
  gap: 14px;
  border-radius: 16px;
}

.hero-collection-modal-grid .hero-card-thumb {
  width: 72px;
  height: 96px;
  border-radius: 12px;
}

.hero-collection-modal-grid .hero-collection-modal-card .library-title {
  font-size: 1.02rem;
  margin-bottom: 6px;
}

.hero-collection-modal-grid .hero-collection-modal-meta {
  font-size: 0.86rem;
}

.hero-collection-modal-grid .hero-collection-modal-stats {
  font-size: 0.84rem;
}

.library-glow {
  position: absolute;
  inset: -40% 30% auto auto;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255, 122, 0, 0.35), transparent 70%);
  filter: blur(2px);
  animation: glowPulse 4s ease-in-out infinite;
}

.shelf-card {
  position: relative;
  padding: 18px 20px;
  border-radius: 20px;
  background: #fff7ec;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 30px rgba(20, 20, 20, 0.12);
  animation: floatUp 6s ease-in-out infinite;
}

.shelf-card + .shelf-card {
  margin-top: 18px;
}

.shelf-card-primary {
  background: #fff2cf;
  animation-delay: 0s;
}

.shelf-card-secondary {
  background: #eaf6ff;
  animation-delay: 0.8s;
}

.shelf-card-tertiary {
  background: #f7f0ff;
  animation-delay: 1.6s;
}

.shelf-title {
  font-weight: 700;
  margin-bottom: 12px;
}

.shelf-books {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.shelf-book {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 70px;
}

.shelf-book-title {
  font-size: 0.72rem;
  text-align: center;
  color: #6f5f52;
  line-height: 1.1;
}

.book-tile {
  width: 54px;
  height: 72px;
  border-radius: 10px;
  box-shadow: 0 12px 18px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.08);
  transform: rotate(-2deg);
}

.shelf-note {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #7a6b5c;
}

.shelf-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.tile-sunrise {
  background: linear-gradient(160deg, #ffb36b, #ff7a00);
}

.tile-forest {
  background: linear-gradient(160deg, #456b4c, #8bb174);
}

.tile-ink {
  background: linear-gradient(160deg, #2f2f35, #4a4a5c);
}

.tile-coral {
  background: linear-gradient(160deg, #ff8b7f, #f86f4f);
}

.tile-night {
  background: linear-gradient(160deg, #1f2c50, #3f5b8a);
}

.tile-mint {
  background: linear-gradient(160deg, #9be1c0, #5bbf9a);
}

.tile-paper {
  background: linear-gradient(160deg, #f5e9d8, #d9c6ae);
}

.tile-cobalt {
  background: linear-gradient(160deg, #4c6ef5, #6f9cff);
}

.home-section {
  padding: 70px 0;
}

.home-section-muted {
  background: rgba(255, 255, 255, 0.5);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.section-title {
  font-family: "Playfair Display", "Georgia", serif;
  margin-bottom: 8px;
}

.section-subtitle {
  color: #75685b;
  margin-bottom: 0;
}

.home-card {
  padding: 22px;
  border-radius: 18px;
  background: #fffdf9;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 16px 30px rgba(26, 24, 20, 0.08);
  height: 100%;
}

.home-card h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.home-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.home-tags span {
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 122, 0, 0.12);
  color: #8b4e12;
  font-weight: 600;
}

.library-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.home-book-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.library-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.06);
  text-align: left;
  color: inherit;
  text-decoration: none;
}

.home-book-grid .library-card {
  height: 100%;
  align-items: flex-start;
}

.home-book-grid .library-card > div:last-child {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 70px;
}

.recent-card {
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.06);
  transform-style: preserve-3d;
  will-change: transform;
  position: relative;
  overflow: hidden;
}

.recent-card:hover,
.recent-card:focus-visible {
  transform: translateY(-8px) translateZ(28px) scale(1.03);
  box-shadow: 0 28px 60px rgba(20, 16, 12, 0.22);
}

.home-body .home-card,
.home-body .category-card,
.home-body .quote-card,
.home-body .library-card,
.home-body .home-step {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transform-style: preserve-3d;
  will-change: transform;
  position: relative;
  overflow: hidden;
}

.home-body .home-card:hover,
.home-body .home-card:focus-visible,
.home-body .category-card:hover,
.home-body .category-card:focus-visible,
.home-body .quote-card:hover,
.home-body .quote-card:focus-visible,
.home-body .library-card:hover,
.home-body .library-card:focus-visible,
.home-body .home-step:hover,
.home-body .home-step:focus-visible {
  transform: translateY(-8px) translateZ(28px) scale(1.03);
  box-shadow: 0 28px 60px rgba(20, 16, 12, 0.22);
}


.library-cover {
  width: 52px;
  height: 70px;
  border-radius: 10px;
  box-shadow: 0 10px 16px rgba(0, 0, 0, 0.16);
}

.library-thumb {
  width: 52px;
  height: 70px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 10px 16px rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.library-title {
  font-weight: 700;
}

.library-meta {
  font-size: 0.85rem;
  color: #7c6f63;
}

.library-intro {
  font-size: 0.85rem;
  color: #5f5349;
  margin: 6px 0 10px;
  line-height: 1.5;
}

.home-book-grid .library-intro {
  min-height: 2.55em;
}

.library-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 122, 0, 0.12);
  color: #8b4e12;
  font-size: 0.75rem;
  font-weight: 600;
}

.tag-chip-button {
  border: none;
  cursor: pointer;
}

.tag-chip-button:hover,
.tag-chip-button:focus-visible {
  background: rgba(255, 122, 0, 0.2);
  outline: none;
}

.tag-icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
}

.tag-icon svg {
  width: 14px;
  height: 14px;
}

.category-card {
  padding: 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 16px 30px rgba(26, 24, 20, 0.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.printability-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.printability-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 16px 30px rgba(26, 24, 20, 0.08);
  height: 100%;
}

.printability-column-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.printability-column-head h3 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.printability-column-head p {
  margin: 0;
  color: #75685b;
  font-size: 0.9rem;
}

.printability-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 122, 0, 0.12);
  color: #8b4e12;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 992px) {
  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .printability-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .category-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.category-card-books {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-card-books.printability-books-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.category-card-books.printability-books-grid .category-library-card {
  min-width: 0;
}

@media (max-width: 576px) {
  .category-card-books.printability-books-grid {
    grid-template-columns: 1fr;
  }
}

.category-library-card {
  width: 100%;
}

.category-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.category-card-header h3 {
  font-size: 1.2rem;
  margin: 0;
}

.category-books {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-book {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.category-book:hover,
.category-book:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(20, 16, 12, 0.12);
}

.category-book-text .library-title {
  font-size: 0.95rem;
}

.category-book-text .library-meta {
  font-size: 0.78rem;
}

.recent-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  perspective: 1200px;
}

@media (max-width: 992px) {
  .home-book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recent-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 576px) {
  .home-book-grid {
    grid-template-columns: 1fr;
  }

  .recent-grid {
    grid-template-columns: 1fr;
  }
}

.recent-modal {
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 247, 236, 0.9);
  backdrop-filter: blur(10px);
}

.recent-modal .modal-header,
.recent-modal .modal-body,
.recent-modal .modal-footer {
  background: transparent;
}

@media (min-width: 1200px) {
  .recent-modal {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
  }
}

.modal.fade .modal-dialog {
  transform: translateY(32px) scale(0.965);
  opacity: 0;
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.55s ease;
}

.modal.show .modal-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-subtitle {
  margin: 0;
  color: #7c6f63;
  font-size: 0.9rem;
}

.recent-cover {
  min-height: 320px;
  border-radius: 16px;
  background: linear-gradient(160deg, #f5e9d8, #d9c6ae);
  box-shadow: 0 18px 36px rgba(26, 24, 20, 0.14);
  background-size: cover;
  background-position: center;
}

.recent-carousel .carousel-inner {
  border-radius: 16px;
  background: #fff7ec;
  padding: 18px;
  min-height: 320px;
}

.recent-carousel .carousel-item {
  transition: transform 0.6s ease;
}

.recent-carousel .carousel-control-prev,
.recent-carousel .carousel-control-next {
  width: 12%;
}

.recent-slide {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.book-detail-modal .modal-header {
  align-items: flex-start;
  gap: 16px;
}

.book-modal-rating {
  margin-left: auto;
  font-size: 0.9rem;
  color: #6f6257;
  white-space: nowrap;
}


.book-modal-user-rating {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 18px;
}

.rating-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8a7d72;
}

.rating-stars {
  display: flex;
  gap: 4px;
}

.rating-star {
  border: none;
  background: none;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  color: #d6cbbf;
  cursor: pointer;
}

.rating-star.is-active {
  color: #f2a23a;
}

.rating-star.is-disabled {
  cursor: not-allowed;
  color: #d8d1c8;
}

.rating-star:focus-visible {
  outline: 2px solid #f2a23a;
  outline-offset: 2px;
  border-radius: 6px;
}

.rating-meta {
  font-size: 0.75rem;
  color: #7a6b5c;
}

.ratings-review-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ratings-review-item {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.66);
}

.ratings-review-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.9rem;
  color: #4d3f33;
  margin-bottom: 4px;
}

.ratings-review-comment {
  margin: 0;
  white-space: pre-wrap;
  color: #5f5349;
}

.book-modal-cover {
  position: relative;
  min-height: 320px;
  border-radius: 16px;
  background: linear-gradient(160deg, #f5e9d8, #d9c6ae);
  box-shadow: 0 18px 36px rgba(26, 24, 20, 0.14);
  overflow: hidden;
}

.book-modal-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-modal-cover .library-cover {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.book-modal-intro {
  color: #5f5349;
  line-height: 1.6;
}

.book-modal-footer-author {
  font-size: 0.9rem;
  color: rgba(26, 26, 26, 0.6);
}

.book-modal-footer-author-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.book-modal-author-avatar-wrap {
  margin-top: 8px;
}

.book-modal-author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 16px rgba(26, 24, 20, 0.14);
}

.recent-slide-title {
  font-weight: 700;
}

.recent-slide-text {
  color: #5f5349;
  line-height: 1.6;
  max-height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.viewer-hero {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.viewer-page-container {
  max-width: 1080px;
}

.viewer-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr);
  align-items: start;
  gap: 16px;
}

.viewer-header-main {
  min-width: 0;
}

.viewer-header-main #viewerTitle {
  overflow-wrap: anywhere;
}

.viewer-cover {
  min-height: 0;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background: linear-gradient(160deg, #f5e9d8, #d9c6ae);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 18px 36px rgba(26, 24, 20, 0.18);
}

.viewer-carousel {
  width: min(var(--shared-book-page-width), 100%);
  aspect-ratio: var(--viewer-page-ratio, 1 / 1);
  height: auto;
  margin: 0 auto;
  --viewer-content-scale: 1;
  --viewer-decor-scale: 1;
}

.viewer-illustration-carousel .carousel-inner {
  border-radius: 18px;
  background: #f1e8da;
  padding: 16px;
  min-height: 0;
  height: 100%;
  box-shadow: inset 0 0 0 1px rgba(122, 104, 80, 0.18);
}

.viewer-illustration-slide {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: #e7dbc8;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(122, 104, 80, 0.2),
    0 6px 14px rgba(0, 0, 0, 0.1);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.viewer-illustration-placeholder {
  color: #6b4e3b;
  font-weight: 600;
}

.viewer-illustration-slide.has-image .viewer-illustration-placeholder {
  display: none;
}


.viewer-text-toolbar {
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.78);
  padding: 10px 14px;
  margin-bottom: 10px;
}

.viewer-header .viewer-text-toolbar {
  margin-bottom: 0;
  width: 100%;
  justify-self: stretch;
}

.viewer-toolbar-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.viewer-edit-toolbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.viewer-cover-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.viewer-cover-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.78);
}

.viewer-cover-art {
  width: 86px;
  aspect-ratio: 1 / 1.35;
  border-radius: 12px;
  flex: 0 0 auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(70, 42, 22, 0.08)),
    linear-gradient(135deg, #f7e4c4, #f1c98f);
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(94, 62, 32, 0.12);
}

.viewer-cover-art.has-image {
  background-color: #eadbc5;
}

.viewer-cover-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.68rem;
  color: #8d6540;
  font-weight: 700;
  margin-bottom: 4px;
}

.viewer-cover-copy {
  color: #574a3d;
  font-size: 0.92rem;
  line-height: 1.35;
}

@media (max-width: 767.98px) {
  .book-cover-preview-grid,
  .viewer-cover-strip {
    grid-template-columns: minmax(0, 1fr);
  }
}

.viewer-edit-status {
  min-height: 1.1em;
  font-size: 0.8rem;
  color: #5f5349;
  margin-left: 4px;
}

.viewer-favorite-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.viewer-favorite-btn {
  white-space: nowrap;
  padding-left: 0.8rem;
  padding-right: 0.8rem;
}

.viewer-favorite-status {
  min-height: 1.1em;
  font-size: 0.8rem;
  color: #5f5349;
}

.viewer-favorite-signin-hint {
  margin-top: 8px;
}

@media (max-width: 992px) {
  .viewer-header {
    grid-template-columns: minmax(0, 1fr);
  }
}

.viewer-carousel .carousel-inner {
  border-radius: 18px;
  background: #fff7ec;
  padding: 16px;
  min-height: 0;
  height: 100%;
}

.viewer-carousel .carousel-item {
  transition: transform 0.6s ease;
  height: 100%;
}

.viewer-carousel .carousel-control-prev,
.viewer-carousel .carousel-control-next {
  width: 2.75rem;
  height: 2.75rem;
  top: auto;
  bottom: 12px;
  opacity: 1;
  z-index: 30;
  pointer-events: auto;
}

.viewer-carousel .carousel-control-prev-icon,
.viewer-carousel .carousel-control-next-icon {
  pointer-events: none;
}

.viewer-carousel .carousel-control-prev {
  left: 10px;
}

.viewer-carousel .carousel-control-next {
  right: 10px;
}

.viewer-slide {
  height: 100%;
  display: flex;
  align-items: stretch;
  position: relative;
}

.viewer-slide-body {
  width: 100%;
  position: relative;
}

.viewer-slide.has-text-background {
  border-radius: 14px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  position: relative;
  background-color: #f3ede3;
  box-shadow: inset 0 0 0 1px rgba(122, 104, 80, 0.18);
}

.viewer-slide.has-text-background::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.68);
}

.viewer-slide.has-text-background .viewer-slide-body {
  position: relative;
  z-index: 1;
  padding: calc(14px * var(--viewer-content-scale));
}

.viewer-slide-text-wrap {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 10px 24px rgba(16, 14, 12, 0.12);
  padding: calc(14px * var(--viewer-content-scale))
    calc(16px * var(--viewer-content-scale));
  backdrop-filter: blur(2px);
  position: relative;
  z-index: 2;
}

.viewer-slide-text-wrap.viewer-layout-box {
  position: absolute;
  margin: 0;
  transform: translate(-50%, -50%);
}

.viewer-slide-text-wrap.viewer-layout-box .viewer-slide-text {
  max-height: none;
  height: 100%;
}

.viewer-slide-text-wrap.is-editable {
  cursor: move;
  touch-action: none;
}

.viewer-text-box-resize-handle {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 13px;
  height: 13px;
  border: 0;
  border-radius: 3px;
  background: rgba(79, 63, 50, 0.14);
  cursor: nwse-resize;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
}

.viewer-text-box-resize-handle::before {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid rgba(79, 63, 50, 0.48);
  border-bottom: 1.5px solid rgba(79, 63, 50, 0.48);
}

.viewer-slide-text-wrap.is-editable.is-selected .viewer-text-box-resize-handle {
  opacity: 0.75;
  pointer-events: auto;
}

.viewer-slide-text-wrap.viewer-text-box-rounded {
  border-radius: 14px;
}

.viewer-slide-text-wrap.viewer-text-box-square {
  border-radius: 4px;
}

.viewer-slide-title {
  font-family: var(--viewer-page-font-family, var(--book-font));
  font-style: var(--viewer-page-font-style, normal);
  font-weight: var(--viewer-page-font-weight, 700);
  color: var(--viewer-page-font-color, #1f1b16);
  margin-bottom: calc(8px * var(--viewer-content-scale));
  font-size: calc(1rem * var(--viewer-content-scale));
}

.viewer-slide-text {
  color: var(--viewer-page-font-color, #5f5349);
  font-size: calc(
    var(--viewer-page-font-size, var(--viewer-text-size)) * var(--viewer-content-scale)
  );
  font-family: var(--viewer-page-font-family, var(--book-font));
  font-style: var(--viewer-page-font-style, normal);
  font-weight: var(--viewer-page-font-weight, 400);
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: calc(100% - 100px);
  overflow-y: auto;
}

.viewer-slide-page-number {
  position: absolute;
  left: calc(12px * var(--viewer-content-scale));
  right: auto;
  bottom: calc(8px * var(--viewer-content-scale));
  z-index: 4;
  font-family: var(--viewer-page-font-family, var(--book-font));
  font-size: calc(0.95rem * var(--viewer-content-scale));
  font-weight: 600;
  color: rgba(74, 63, 52, 0.82);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.viewer-slide-page-number-illustration {
  left: auto;
  right: calc(12px * var(--viewer-content-scale));
}

.viewer-decor-layer {
  position: absolute;
  inset: 10px;
  z-index: auto;
  pointer-events: none;
}

.viewer-decor-layer.viewer-decor-layer-editable {
  pointer-events: none;
}

.viewer-decor-layer.viewer-decor-layer-editable .viewer-decor-item.viewer-decor-editable {
  pointer-events: auto;
}

.viewer-decor-item {
  position: absolute;
  transform: translate(-50%, -50%);
  max-width: none;
  min-width: calc(96px * var(--viewer-decor-scale));
  min-height: calc(42px * var(--viewer-decor-scale));
  padding: calc(10px * var(--viewer-decor-scale))
    calc(12px * var(--viewer-decor-scale));
  border: calc(2px * var(--viewer-decor-scale)) solid rgba(58, 46, 34, 0.42);
  box-shadow: 0 10px 20px rgba(18, 20, 30, 0.18);
  color: #1f1b16;
  background: rgba(255, 252, 243, 0.95);
  overflow: visible;
  overflow-wrap: anywhere;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer-decor-item.viewer-decor-editable {
  touch-action: none;
  cursor: move;
}

.viewer-slide-text-wrap.is-editable.is-selected {
  outline: 2px solid rgba(255, 122, 0, 0.75);
  outline-offset: 2px;
}

.viewer-decor-item span {
  display: block;
  width: 100%;
  height: 100%;
  white-space: pre-wrap;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow: auto;
}

.viewer-book-preview-workspace .viewer-decor-item.page-decor-item {
  min-width: calc(96px * var(--builder-decor-scale, 1));
  min-height: calc(42px * var(--builder-decor-scale, 1));
  padding: calc(10px * var(--builder-decor-scale, 1))
    calc(12px * var(--builder-decor-scale, 1));
  border-width: calc(var(--decor-stroke-width, 2px) * var(--builder-decor-scale, 1));
  border-color: var(--decor-stroke-color, rgba(58, 46, 34, 0.45));
  font-size: calc(var(--builder-decor-font-size, 18px) * var(--builder-decor-scale, 1));
}

.viewer-book-preview-workspace .viewer-decor-item.page-decor-item.decor-has-asset {
  border: 0;
  background-color: transparent !important;
  box-shadow: none;
  padding: 7% 9% 11%;
}

.viewer-book-preview-workspace .story-text-layout-box,
.viewer-book-preview-workspace .story-text-layout-box *,
.viewer-book-preview-workspace .viewer-decor-item.page-decor-item,
.viewer-book-preview-workspace .viewer-decor-item.page-decor-item *,
.viewer-book-preview-workspace .viewer-decor-item.page-decor-item:active {
  cursor: default !important;
}

.viewer-decor-item.viewer-decor-has-asset {
  border: 0;
  background-color: transparent !important;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  box-shadow: none;
  padding: 7% 9% 11%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer-decor-item.viewer-decor-has-fill-mask::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--viewer-decor-bg, rgba(255, 255, 255, 0.95));
  -webkit-mask-image: var(--viewer-decor-asset-mask);
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 100% 100%;
  mask-image: var(--viewer-decor-asset-mask);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 100% 100%;
  z-index: 0;
}

.viewer-decor-item.viewer-decor-has-fill-mask::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--viewer-decor-asset-outline);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  z-index: 1;
}

.viewer-decor-item.viewer-decor-has-asset span {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  text-align: center;
  line-height: 1.12;
  position: relative;
  z-index: 2;
}

.viewer-decor-item.viewer-decor-tail-left span {
  padding-left: 8%;
  padding-right: 2%;
}

.viewer-decor-item.viewer-decor-tail-right span {
  padding-left: 2%;
  padding-right: 8%;
}

.viewer-decor-item.viewer-decor-has-asset.viewer-decor-speech.viewer-decor-tail-left span,
.viewer-decor-item.viewer-decor-has-asset.viewer-decor-speech.viewer-decor-tail-right span {
  padding-left: 10%;
  padding-right: 10%;
}

.viewer-decor-item.viewer-decor-rounded {
  border-radius: calc(16px * var(--viewer-decor-scale));
}

.viewer-decor-item.viewer-decor-square {
  border-radius: calc(4px * var(--viewer-decor-scale));
}

.viewer-decor-item.viewer-decor-speech {
  border-radius: calc(16px * var(--viewer-decor-scale));
}

.viewer-decor-item.viewer-decor-speech::after {
  content: "";
  position: absolute;
  left: calc(18px * var(--viewer-decor-scale));
  bottom: calc(-10px * var(--viewer-decor-scale));
  width: calc(18px * var(--viewer-decor-scale));
  height: calc(11px * var(--viewer-decor-scale));
  background: var(--viewer-decor-bg, rgba(255, 255, 255, 0.95));
  border: calc(2px * var(--viewer-decor-scale)) solid rgba(58, 46, 34, 0.42);
  border-top: 0;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.viewer-decor-item.viewer-decor-has-asset.viewer-decor-speech::after {
  background-image: var(--viewer-decor-asset-outline);
}

.viewer-decor-resize-handle {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 3px;
  background: rgba(79, 63, 50, 0.2);
  cursor: nwse-resize;
  opacity: 0;
  pointer-events: none;
}

.viewer-decor-resize-handle::before {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid rgba(79, 63, 50, 0.55);
  border-bottom: 1.5px solid rgba(79, 63, 50, 0.55);
}

.viewer-decor-item.viewer-decor-editable.viewer-decor-selected .viewer-decor-resize-handle {
  opacity: 0.8;
  pointer-events: auto;
}

.viewer-decor-item.viewer-decor-editable.viewer-decor-selected {
  border-color: #ff7a00;
  box-shadow: 0 0 0 2px rgba(255, 122, 0, 0.32), 0 10px 20px rgba(18, 20, 30, 0.18);
}

.viewer-decor-item.viewer-decor-speech-cloud {
  border-radius: 999px;
  padding: calc(10px * var(--viewer-decor-scale))
    calc(14px * var(--viewer-decor-scale));
}

.viewer-decor-item.viewer-decor-speech-cloud::after {
  left: calc(17px * var(--viewer-decor-scale));
  bottom: calc(-8px * var(--viewer-decor-scale));
  width: calc(14px * var(--viewer-decor-scale));
  height: calc(9px * var(--viewer-decor-scale));
  border-width: calc(1.5px * var(--viewer-decor-scale));
}

.viewer-decor-item.viewer-decor-speech-thought {
  border-radius: calc(26px * var(--viewer-decor-scale));
}

.viewer-decor-item.viewer-decor-speech-thought span {
  padding-top: 6%;
  padding-bottom: 10%;
}

.viewer-decor-item.viewer-decor-speech-thought.viewer-decor-tail-left span {
  padding-left: 14%;
  padding-right: 10%;
}

.viewer-decor-item.viewer-decor-speech-thought.viewer-decor-tail-right span {
  padding-left: 10%;
  padding-right: 14%;
}

.viewer-decor-item.viewer-decor-speech-thought::after {
  display: none;
}

.viewer-decor-item.viewer-decor-speech-thought::before {
  content: "";
  position: absolute;
  left: calc(14px * var(--viewer-decor-scale));
  bottom: calc(-14px * var(--viewer-decor-scale));
  width: calc(8px * var(--viewer-decor-scale));
  height: calc(8px * var(--viewer-decor-scale));
  border-radius: 999px;
  background: var(--viewer-decor-bg, rgba(255, 255, 255, 0.95));
  border: calc(1.5px * var(--viewer-decor-scale)) solid rgba(58, 46, 34, 0.42);
  box-shadow: calc(10px * var(--viewer-decor-scale))
    calc(8px * var(--viewer-decor-scale))
    0
    calc(-1px * var(--viewer-decor-scale))
    var(--viewer-decor-bg, rgba(255, 255, 255, 0.95));
}

.viewer-image-edit-preview {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: #f6f2eb;
  padding: 10px;
}

.viewer-image-preview-canvas {
  min-height: 120px;
  border-radius: 10px;
  background: linear-gradient(160deg, #efe5d5, #e0d2be);
  position: relative;
  overflow: hidden;
}

.viewer-image-preview-item {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 160px;
  max-width: 80%;
  display: flex;
  align-items: center;
}

.viewer-image-preview-text-edit {
  display: block;
  width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.2em;
  line-height: 1.15;
  outline: none;
  cursor: text;
}

.viewer-image-preview-text-edit:empty::before {
  content: attr(data-placeholder);
  color: rgba(31, 27, 22, 0.5);
  font-style: italic;
}

.viewer-author-card {
  margin-top: 24px;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 16px 30px rgba(26, 24, 20, 0.1);
  padding: 18px 20px;
}

.viewer-author-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.viewer-author-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.viewer-author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 20px rgba(26, 24, 20, 0.16);
  flex: 0 0 auto;
}

.viewer-author-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8b4e12;
}

.viewer-author-name {
  margin: 4px 0 0;
  font-size: 1.2rem;
}

.viewer-author-rating {
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  color: #5f5349;
  background: rgba(255, 122, 0, 0.12);
  border-radius: 999px;
  padding: 6px 10px;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.viewer-author-rating:hover,
.viewer-author-rating:focus-visible {
  background: rgba(255, 122, 0, 0.22);
  transform: translateY(-1px);
  outline: none;
}

.viewer-author-about {
  margin: 12px 0;
  color: #4f443a;
  line-height: 1.6;
}

.viewer-author-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.viewer-review-card {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.viewer-review-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 992px) {
  .viewer-carousel .carousel-inner {
    min-height: 0;
  }
}

.home-step {
  padding: 20px;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff7ec;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.home-step p {
  margin: 0;
  color: #67594d;
  line-height: 1.5;
}

.home-step .btn {
  margin-top: auto;
  align-self: flex-start;
}

.how-modal .modal-body {
  padding-top: 10px;
}

.how-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.how-detail-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.07);
}

.how-detail-index {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255, 122, 0, 0.14);
  color: #a04d00;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.how-detail-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.step-number {
  font-weight: 700;
  font-size: 1.2rem;
  color: #ff7a00;
  margin-bottom: 10px;
}

.creator-panel {
  padding: 28px;
  border-radius: 22px;
  background: #fff7ec;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 40px rgba(20, 20, 20, 0.12);
}

.creator-list {
  list-style: none;
  padding-left: 0;
  margin: 18px 0 22px;
  color: #67594d;
}

.creator-list li {
  margin-bottom: 8px;
}

.creator-list li::before {
  content: "•";
  color: #ff7a00;
  margin-right: 8px;
}

.quote-card {
  padding: 22px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 12px 30px rgba(26, 24, 20, 0.1);
  margin-bottom: 16px;
}

.quote-card-alt {
  background: #eef5ff;
}

.quote-author {
  font-weight: 600;
  color: #7a6b5c;
}

.home-footer {
  margin-top: auto;
  padding: 32px 0 42px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.5);
}

/* Dashboard */
.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
  gap: 24px;
  align-items: center;
  padding: 28px 30px;
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(255, 250, 240, 0.92), rgba(236, 243, 255, 0.9));
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 24px 50px rgba(26, 24, 20, 0.14);
  margin-bottom: 36px;
}

.dashboard-action-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.viewer-retired-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  opacity: 1;
  transform: translateY(0);
  max-height: 180px;
  overflow: hidden;
  transition:
    opacity 200ms ease-out,
    transform 200ms ease-out,
    max-height 220ms ease-out,
    margin-bottom 220ms ease-out,
    padding-top 220ms ease-out,
    padding-bottom 220ms ease-out;
}

.viewer-retired-banner.is-dismissing {
  opacity: 0;
  transform: translateY(-6px);
  max-height: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}

.dashboard-hero-text .hero-title {
  margin-bottom: 10px;
}

.dashboard-hero-panel {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 16px 32px rgba(22, 18, 14, 0.12);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dashboard-stat-label {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.68rem;
  color: #8b6b4b;
  font-weight: 700;
}

.dashboard-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1f1b16;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-section {
  margin-top: 20px;
}

.dashboard-tab-card {
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 40px rgba(22, 18, 14, 0.12);
  overflow: hidden;
}

.dashboard-tabs {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding: 12px 14px 0;
  gap: 10px;
}

.dashboard-tabs .nav-link {
  border: none;
  color: #6c5f52;
  font-weight: 700;
  padding: 0.6rem 1.4rem;
  border-radius: 14px 14px 0 0;
  background: transparent;
}

.dashboard-tabs .nav-link:hover,
.dashboard-tabs .nav-link:focus-visible {
  color: #1f1f1f;
  background: rgba(255, 122, 0, 0.08);
}

.dashboard-tabs .nav-link.active {
  color: #1f1f1f;
  background: #fff3e3;
}

.dashboard-tab-content {
  padding: 24px 24px 28px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.dashboard-card {
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
  box-shadow: 0 16px 30px rgba(26, 24, 20, 0.1);
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

.dashboard-books-grid {
  margin-top: 16px;
}

.dashboard-book-card {
  align-items: flex-start;
  gap: 16px;
}

.dashboard-book-card .library-title {
  font-size: 1.05rem;
}

.dashboard-book-card .library-intro {
  min-height: 2.6em;
}

.dashboard-book-card .library-cover {
  background: linear-gradient(160deg, #f5e9d8, #d9c6ae);
}

.dashboard-saved-chip {
  background: rgba(17, 24, 39, 0.08);
  color: #3d3329;
}

.dashboard-favorite-remove-btn {
  margin-left: auto;
  padding: 0.2rem 0.55rem;
  line-height: 1.1;
}

.dashboard-characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 280px));
  gap: 18px;
  justify-content: start;
}

.dashboard-cover {
  height: 160px;
  background: linear-gradient(160deg, #f5e9d8, #d9c6ae);
  background-size: cover;
  background-position: center;
}

.dashboard-card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.dashboard-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.dashboard-card-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.dashboard-card-meta {
  font-size: 0.8rem;
  color: #7c6f63;
}

.dashboard-pill {
  background: rgba(255, 122, 0, 0.12);
  color: #8b4e12;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: capitalize;
}

.dashboard-card-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #6d5f52;
}

.dashboard-divider {
  opacity: 0.6;
}

.dashboard-card-actions {
  margin-top: auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-character-media {
  padding: 16px 16px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
}

.dashboard-character-media img {
  width: auto;
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 12px;
  background: #f4f4f6;
  display: block;
  margin: 0 auto;
}

.dashboard-character-role {
  display: inline-flex;
  align-self: flex-start;
  margin-left: auto;
}

.dashboard-character-media::after {
  content: "";
  display: block;
  height: 28px;
  width: 100%;
}

.dashboard-card-body {
  position: relative;
  z-index: 2;
  margin-top: -28px;
}

.dashboard-card-header,
.dashboard-card-info {
  background: rgba(255, 250, 244, 0.92);
  padding: 6px 10px;
  border-radius: 12px;
}

.dashboard-card-info {
  margin-top: 8px;
  width: fit-content;
}

.dashboard-character-card .dashboard-card-body {
  margin-top: 0;
}

.dashboard-character-card .dashboard-character-media::after {
  height: 0;
}

.dashboard-character-card {
  max-width: 280px;
  justify-self: stretch;
}

.dashboard-character-image-card {
  padding: 14px;
  min-height: unset;
  cursor: pointer;
  position: relative;
}

.dashboard-character-image-card .dashboard-character-media {
  padding: 0;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.dashboard-character-image-card .dashboard-character-media img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  border-radius: 16px;
  background: #f4f4f6;
}

.dashboard-character-placeholder {
  border-radius: 16px;
  background: linear-gradient(160deg, #f5e9d8, #d9c6ae);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.dashboard-character-delete-btn {
  position: absolute;
  right: 22px;
  bottom: 22px;
  z-index: 3;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
}

.character-detail-card {
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 18px 36px rgba(26, 24, 20, 0.12);
  overflow: hidden;
}

.character-detail-media {
  padding: 16px;
  background: rgba(255, 247, 236, 0.8);
}

.character-detail-media img,
.character-detail-placeholder {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 16px;
  background: #f4f4f6;
  display: block;
}

.character-detail-placeholder {
  height: 320px;
  background: linear-gradient(160deg, #f5e9d8, #d9c6ae);
}

.character-detail-media img {
  display: none;
}

.character-detail-body {
  padding: 18px 20px 22px;
}

.character-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.character-detail-name {
  font-weight: 700;
  font-size: 1.2rem;
}

.character-detail-date {
  font-size: 0.85rem;
  color: #7c6f63;
}

.dashboard-character-table {
  margin-bottom: 0;
}

.dashboard-character-table th,
.dashboard-character-table td {
  padding: 2px 6px;
  vertical-align: top;
}

.dashboard-character-table th {
  width: 38%;
  color: #6d5f52;
  font-weight: 600;
}

.dashboard-character-table tbody tr {
  border-bottom: 1px solid rgba(26, 24, 20, 0.12);
}

.dashboard-character-table tbody tr:last-child {
  border-bottom: 0;
}

.dashboard-character-table th {
  background: rgba(255, 255, 255, 0.7);
}

.dashboard-character-table td {
  background: rgba(248, 241, 232, 0.75);
}


.dashboard-empty {
  display: none;
  margin-top: 16px;
}

.dashboard-empty-card {
  padding: 28px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px dashed rgba(0, 0, 0, 0.18);
  text-align: center;
  box-shadow: 0 14px 26px rgba(26, 24, 20, 0.08);
}

.character-preview-frame {
  background: #f4f4f6;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.qa-character-card {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 18px rgba(26, 24, 20, 0.08);
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.qa-character-card:hover,
.qa-character-card:focus-visible {
  border-color: rgba(255, 122, 0, 0.5);
  box-shadow: 0 12px 24px rgba(26, 24, 20, 0.14);
  transform: translateY(-1px);
  outline: none;
}

.qa-character-card-header {
  padding: 8px 10px;
  min-height: 38px;
  display: flex;
  align-items: center;
  font-weight: 700;
  color: #2a2119;
  background: rgba(255, 243, 227, 0.9);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qa-character-card-media {
  aspect-ratio: 1 / 1;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f4f6;
}

.qa-character-card-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.qa-character-card-placeholder,
.selected-character-detail-placeholder {
  width: 100%;
  height: 100%;
  min-height: 160px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7b6d60;
  background: linear-gradient(160deg, #f5e9d8, #d9c6ae);
  font-weight: 700;
}

.selected-character-detail-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
}

.selected-character-detail-media {
  border-radius: 8px;
  padding: 12px;
  background: #f4f4f6;
}

.selected-character-detail-media img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  display: block;
}

.selected-character-detail-table {
  margin-bottom: 0;
}

.selected-character-detail-table th,
.selected-character-detail-table td {
  padding: 6px 8px;
  vertical-align: top;
  border-bottom: 1px solid rgba(26, 24, 20, 0.1);
}

.selected-character-detail-table th {
  width: 34%;
  color: #6d5f52;
  font-weight: 700;
  background: rgba(255, 247, 236, 0.72);
}

.selected-character-detail-table td {
  background: rgba(255, 255, 255, 0.68);
}

.selected-character-detail-table tr:last-child th,
.selected-character-detail-table tr:last-child td {
  border-bottom: 0;
}

.qa-character-image {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  display: block;
}

#generatedCharImage {
  max-height: 320px;
  width: 100%;
  object-fit: contain;
}

@media (max-width: 992px) {
  .dashboard-hero {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .selected-character-detail-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@keyframes floatUp {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes glowPulse {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 0.9;
  }
}

@media (max-width: 992px) {
  .home-hero {
    padding-top: 60px;
  }

  .hero-support {
    grid-template-columns: 1fr;
  }

  .hero-collection-grid {
    grid-template-columns: 1fr;
  }

  .hero-collection-modal-dialog {
    max-width: min(96vw, 980px);
  }
}

@media (max-width: 576px) {
  .hero-collection-modal-grid {
    grid-template-columns: 1fr;
  }

  .hero-collection-modal-grid .hero-collection-modal-card {
    min-height: 0;
  }
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    transition: none;
    transform: none;
    opacity: 1;
  }
  .shelf-card,
  .library-glow {
    animation: none;
  }
}

body.profile-page {
  font-family: "Manrope", "Source Sans 3", sans-serif;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 177, 108, 0.45), transparent 55%),
    radial-gradient(circle at 80% 10%, rgba(160, 200, 255, 0.35), transparent 50%),
    linear-gradient(160deg, #f8f0e6 0%, #f1e7d8 40%, #e6d8c5 100%);
}

.profile-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 24px;
  align-items: center;
  margin-bottom: 32px;
}

.profile-kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  color: rgba(26, 26, 26, 0.6);
  font-weight: 600;
}

.profile-title {
  font-family: "Fraunces", "Playfair Display", serif;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  margin: 0.4rem 0 0.6rem;
  color: #1b1511;
}

.profile-subtitle {
  max-width: 520px;
  font-size: 1.05rem;
  color: rgba(26, 26, 26, 0.7);
}

.profile-hero-card {
  background: rgba(255, 255, 255, 0.75);
  border-radius: 22px;
  padding: 22px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 40px rgba(22, 24, 32, 0.12);
  position: relative;
  overflow: hidden;
}

.profile-hero-card::after {
  content: "";
  position: absolute;
  inset: -30% -20%;
  background: radial-gradient(circle at top, rgba(255, 122, 0, 0.2), transparent 55%);
  opacity: 0.6;
  pointer-events: none;
  animation: glowPulse 3.2s ease-in-out infinite;
}

.profile-hero-label {
  font-size: 0.9rem;
  color: rgba(26, 26, 26, 0.6);
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.profile-hero-metric {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 10px 0 6px;
  position: relative;
  z-index: 1;
}

.profile-hero-number {
  font-size: 2.2rem;
  font-weight: 700;
  color: #1f1f1f;
}

.profile-hero-unit {
  color: rgba(26, 26, 26, 0.6);
  font-size: 0.95rem;
}

.profile-hero-note {
  margin: 0;
  color: rgba(26, 26, 26, 0.65);
  position: relative;
  z-index: 1;
}

.profile-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 28px;
  align-items: start;
}

.profile-form-card,
.profile-preview-card {
  background: rgba(255, 255, 255, 0.78);
  border-radius: 24px;
  padding: 26px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 22px 42px rgba(18, 20, 30, 0.12);
  position: relative;
}

.profile-form-card {
  animation: profileSlide 0.6s ease both;
}

.profile-preview-card {
  animation: profileSlide 0.6s ease both;
  animation-delay: 0.08s;
}

.profile-section-title {
  font-family: "Fraunces", "Playfair Display", serif;
  font-size: 1.6rem;
  margin-bottom: 0.2rem;
}

.profile-section-subtitle {
  color: rgba(26, 26, 26, 0.65);
  margin-bottom: 1.3rem;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.profile-status {
  margin-top: 10px;
  font-size: 0.95rem;
  color: rgba(26, 26, 26, 0.6);
  min-height: 1.2rem;
}

.profile-status[data-kind="reset"] {
  color: rgba(120, 70, 30, 0.8);
}

.profile-status[data-kind="error"] {
  color: rgba(170, 45, 45, 0.85);
}

.profile-photo-actions {
  margin-top: 10px;
}

.profile-category-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-category-pill {
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.7);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(26, 26, 26, 0.7);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.profile-category-pill:hover,
.profile-category-pill:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(18, 20, 30, 0.12);
}

.profile-category-pill.is-selected {
  background: rgba(255, 122, 0, 0.18);
  border-color: rgba(255, 122, 0, 0.4);
  color: rgba(26, 26, 26, 0.85);
}

.profile-preview-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #f5b07a, #ef6b3b);
  color: white;
  font-weight: 600;
  font-size: 1.4rem;
  box-shadow: 0 18px 32px rgba(18, 20, 30, 0.2);
  background-size: cover;
  background-position: center;
  position: relative;
}

.profile-avatar.has-image span {
  opacity: 0;
}

.profile-preview-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(26, 26, 26, 0.55);
  margin-bottom: 6px;
}

.profile-preview-name {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: #1b1511;
}

.profile-preview-meta {
  color: rgba(26, 26, 26, 0.6);
  font-size: 0.95rem;
}

.profile-preview-body {
  font-size: 1rem;
  color: rgba(26, 26, 26, 0.75);
  line-height: 1.6;
  margin-bottom: 20px;
}

.profile-preview-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 122, 0, 0.14);
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(26, 26, 26, 0.7);
}

.profile-pill.profile-pill-muted {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(26, 26, 26, 0.5);
}

.profile-pill-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(26, 26, 26, 0.1);
  color: inherit;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}

.profile-pill-remove:hover,
.profile-pill-remove:focus-visible {
  background: rgba(26, 26, 26, 0.18);
  outline: none;
}

body.admin-page {
  font-family: "Manrope", "Source Sans 3", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 160, 96, 0.3), transparent 55%),
    radial-gradient(circle at 80% 0%, rgba(140, 190, 255, 0.25), transparent 45%),
    linear-gradient(160deg, #f7efe6 0%, #efe4d3 40%, #e6d6c2 100%);
}

.admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 24px;
  align-items: center;
  margin-bottom: 28px;
}

.admin-kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  color: rgba(26, 26, 26, 0.6);
  font-weight: 600;
}

.admin-title {
  font-family: "Fraunces", "Playfair Display", serif;
  font-size: clamp(2.1rem, 3.6vw, 3rem);
  margin: 0.4rem 0 0.6rem;
  color: #1b1511;
}

.admin-subtitle {
  max-width: 520px;
  font-size: 1.05rem;
  color: rgba(26, 26, 26, 0.7);
}

.admin-hero-card {
  background: rgba(255, 255, 255, 0.78);
  border-radius: 22px;
  padding: 22px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 40px rgba(22, 24, 32, 0.12);
}

.admin-hero-card ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: rgba(26, 26, 26, 0.7);
}

.admin-section {
  margin-bottom: 28px;
}

.admin-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-section-title {
  font-family: "Fraunces", "Playfair Display", serif;
  font-size: 1.5rem;
  margin: 0;
}

.admin-section-subtitle {
  color: rgba(26, 26, 26, 0.6);
  margin: 0.2rem 0 0;
}

.admin-table-card {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  padding: 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 18px 36px rgba(18, 20, 30, 0.12);
}

.admin-table {
  display: grid;
  gap: 8px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1.6fr 1.2fr 1fr 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.admin-row-header {
  font-weight: 600;
  background: rgba(0, 0, 0, 0.04);
  border: none;
}

.admin-cell-title {
  font-weight: 600;
  color: #1b1511;
}

.admin-book-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.admin-book-cell span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-book-thumb {
  width: 40px;
  height: 54px;
  border-radius: 9px;
  object-fit: cover;
  object-position: center;
  flex: 0 0 auto;
}

.admin-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.icon-button {
  border: none;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #2d2a28;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.icon-button:hover,
.icon-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(18, 20, 30, 0.12);
}

.icon-button.danger {
  background: rgba(191, 40, 40, 0.14);
  color: #892525;
}

.admin-empty {
  text-align: center;
  color: rgba(26, 26, 26, 0.6);
  padding: 20px;
  display: none;
}

.admin-users-panel {
  display: none;
}

.admin-users-panel.is-open {
  display: block;
}

.admin-users-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-user-name {
  font-weight: 600;
}

.admin-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-user-stack {
  min-width: 0;
}

.admin-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  object-position: center;
  flex: 0 0 auto;
  background: linear-gradient(140deg, #f5b07a, #ef6b3b);
}

.admin-user-meta {
  font-size: 0.8rem;
  color: rgba(26, 26, 26, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.08);
  color: rgba(26, 26, 26, 0.7);
}

.admin-badge.is-admin {
  background: rgba(255, 122, 0, 0.18);
  color: rgba(26, 26, 26, 0.85);
}

.admin-note {
  margin-top: 12px;
  font-size: 0.85rem;
  color: rgba(26, 26, 26, 0.55);
}

@media (max-width: 992px) {
  .admin-hero {
    grid-template-columns: 1fr;
  }

  .admin-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .admin-actions {
    justify-content: flex-start;
  }
}

@keyframes profileSlide {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 992px) {
  .profile-hero,
  .profile-shell {
    grid-template-columns: 1fr;
  }

  .profile-hero-card {
    order: -1;
  }
}

.info-page-main {
  min-height: calc(100vh - 170px);
}

.info-page-section {
  padding: 42px 0 56px;
}

.info-page-card {
  max-width: 900px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 24px;
  padding: clamp(22px, 4vw, 42px);
  box-shadow: 0 20px 38px rgba(22, 24, 32, 0.08);
}

.info-page-heading {
  margin-top: 26px;
  margin-bottom: 10px;
  font-size: clamp(1.08rem, 2vw, 1.28rem);
  font-family: "IBM Plex Serif", serif;
  font-weight: 600;
}

.info-page-list {
  margin-bottom: 0;
}

.info-page-list li + li {
  margin-top: 8px;
}

