* {
  box-sizing: border-box;
}

@font-face {
  font-family: "TheRevolt";
  src: url("/fonts/Therevolt_regular_v3-Regular.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "TheRevoltLower";
  src: url("/fonts/Therevolt_regular_v2-Regular.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "TheRevoltJP";
  src: url("/fonts/Therevolt_japanisch-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg: #050505;
  --panel: #0d0d0d;
  --panel2: #151515;
  --text: #ffffff;
  --muted: #9a9a9a;
  --line: #ffffff;
  --softLine: rgba(255, 255, 255, 0.18);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 26px;
  background: rgba(0,0,0,0.92);
  border-bottom: 1px solid var(--softLine);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 15px;
}

.mark {
  width: 44px;
  height: 44px;
  border: 2px solid #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: -2px;
  flex: 0 0 auto;
}

h1 {
  font-size: 18px;
  margin: 0 0 3px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.brand p,
.intro p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mobile-menu-button,
.mobile-voice-button,
.mobile-voice-status,
.mobile-read-dock {
  display: none;
}

.button {
  background: transparent;
  color: #fff;
  border: 1px solid #fff;
  padding: 11px 14px;
  cursor: pointer;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.8px;
}

.button.small {
  padding: 9px 12px;
  font-size: 11px;
}

.button:hover,
.button.primary {
  background: #fff;
  color: #000;
}

.button:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 38px 0 90px;
}

.hidden {
  display: none !important;
}

.yellow-o {
  color: #ffd51d;
}

.comic-overview {
  min-height: calc(100vh - 210px);
}

.book-section,
.pipeline-section {
  min-height: calc(100vh - 210px);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 240px));
  gap: 18px;
  align-items: start;
  justify-content: start;
}

.book-card .book-thumb {
  aspect-ratio: 5.25 / 8;
}

.book-editor {
  margin-top: 34px;
  border-top: 1px solid var(--softLine);
  padding-top: 22px;
}

.book-editor-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.book-editor-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.book-title-input {
  width: min(680px, 100%);
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.45);
  background: transparent;
  color: #fff;
  font-family: "TheRevoltLower", "TheRevolt", Impact, sans-serif;
  font-size: clamp(42px, 6vw, 74px);
  line-height: 0.9;
  letter-spacing: 0;
  outline: none;
}

.book-editor-actions,
.book-output-actions,
.book-chapter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.book-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0;
  border-bottom: 1px solid rgba(255,255,255,0.18);
  padding-bottom: 10px;
}

.book-tab {
  border: 1px solid rgba(255,255,255,0.34);
  background: transparent;
  color: var(--muted);
  padding: 9px 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 11px;
  cursor: pointer;
}

.book-tab.active,
.book-tab:hover {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.book-panel {
  display: grid;
  gap: 18px;
}

.book-chat-panel {
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: min(760px, calc(100vh - 285px));
  border: 1px solid rgba(255,255,255,0.22);
  background: #050505;
}

.author-profile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 20px;
  border-right: 1px solid rgba(255,255,255,0.2);
  background: #0a0a0a;
}

.author-monogram {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid #fff;
  background: #fff;
  color: #000;
  font-family: "TheRevoltLower", "TheRevolt", Impact, sans-serif;
  font-size: 27px;
}

.author-eyebrow {
  margin: 0 0 5px;
  color: #ffd51d;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.author-profile h3 {
  margin: 0;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 500;
}

.author-profile h3 + p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.author-profile-rule {
  height: 1px;
  margin: 5px 0;
  background: rgba(255,255,255,0.18);
}

.author-profile-copy {
  margin: 0;
  color: #d0d0d0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  line-height: 1.58;
}

.author-traits {
  display: grid;
  gap: 7px;
  margin: 4px 0 0;
}

.author-traits div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.author-traits dt,
.author-traits dd {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.author-traits dt { color: var(--muted); }
.author-traits dd { color: #fff; font-weight: 800; }

.author-chat-status {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.16);
  padding-top: 13px;
  color: #bdbdbd;
  font-size: 10px;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.author-chat-status.online::before,
.author-chat-status.fallback::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #45d483;
}

.author-chat-status.fallback::before { background: #ffd51d; }

.author-playback-status {
  color: #8f8f8f;
  font-size: 9px;
  line-height: 1.45;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.author-playback-status.ready {
  color: #d9d9d9;
}

.author-playback-status.speaking {
  color: #ffd51d;
}

.author-reset-button {
  align-self: flex-start;
  margin-top: 2px;
}

.author-conversation-block {
  display: grid;
  gap: 7px;
  min-height: 0;
  border-top: 1px solid rgba(255,255,255,0.16);
  padding-top: 12px;
}

.author-conversation-block > strong {
  color: #a7a7a7;
  font-size: 9px;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}

.author-conversation-list {
  display: grid;
  gap: 5px;
  max-height: 150px;
  overflow-y: auto;
}

.author-conversation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  border: 1px solid rgba(255,255,255,0.16);
}

.author-conversation-item.current {
  grid-template-columns: minmax(0, 1fr);
}

.author-conversation-open,
.author-conversation-delete {
  min-width: 0;
  border: 0;
  background: #080808;
  color: #bdbdbd;
  cursor: pointer;
}

.author-conversation-open {
  overflow: hidden;
  padding: 7px 8px;
  font-size: 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.author-conversation-delete {
  border-left: 1px solid rgba(255,255,255,0.16);
  font-size: 16px;
}

.author-conversation-item.active .author-conversation-open,
.author-conversation-open:hover,
.author-conversation-delete:hover {
  background: #fff;
  color: #000;
}

.author-chat-workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto;
  background: #030303;
}

.author-chat-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.18);
}

.author-chat-head > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.author-chat-head strong {
  color: #fff;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.author-chat-head span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.author-chat-head .author-thinking {
  flex: 0 0 auto;
  color: #ffd51d;
  font-weight: 800;
}

.author-chat-messages {
  min-height: 380px;
  max-height: none;
  overflow: visible;
  padding: 22px 18px;
  scroll-behavior: smooth;
}

.author-message {
  width: min(760px, 88%);
  margin-bottom: 18px;
}

.author-message.user {
  margin-left: auto;
}

.author-message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: #909090;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}

.author-message.user .author-message-meta {
  justify-content: flex-end;
}

.author-message-body {
  border: 1px solid rgba(255,255,255,0.2);
  background: #0c0c0c;
  padding: 14px 16px;
  color: #ededed;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.author-message.user .author-message-body {
  border-color: rgba(255,255,255,0.72);
  background: #171717;
  color: #fff;
}

.author-consistency {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  border-left: 3px solid #8f8f8f;
  padding: 8px 11px;
  background: #090909;
  color: #bcbcbc;
  font-size: 11px;
  line-height: 1.5;
}

.author-consistency.passt { border-left-color: #45d483; }
.author-consistency.anpassen { border-left-color: #ffd51d; }
.author-consistency.widerspruch { border-left-color: #e55d5d; }

.author-consistency strong {
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.author-consistency ul {
  margin: 0 0 0 17px;
  padding: 0;
}

.author-story-proposal {
  margin-top: 12px;
  border: 1px solid #d7d7d2;
  background: #f9f9f6;
  color: #111;
  box-shadow: 0 12px 34px rgba(0,0,0,0.28);
}

.author-story-proposal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #d7d7d2;
}

.author-story-proposal-head strong {
  min-width: 0;
  overflow: hidden;
  color: #111;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.author-story-proposal-text {
  max-height: none;
  overflow: visible;
  padding: clamp(22px, 4vw, 46px);
  color: #171715;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.author-story-proposal-actions,
.author-message-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.author-story-proposal-actions {
  padding: 10px 12px;
  border-top: 1px solid #d7d7d2;
  background: #f1f1ed;
}

.author-story-proposal .button {
  border-color: #111;
  color: #111;
}

.author-story-proposal .button:hover,
.author-story-proposal .author-story-accept {
  background: #111;
  color: #fff;
}

.author-story-accept {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.author-story-accept:disabled {
  opacity: 0.62;
  cursor: default;
}

.author-chat-compose {
  border-top: 1px solid rgba(255,255,255,0.2);
  padding: 12px;
  background: #090909;
}

.author-chat-compose textarea {
  width: 100%;
  min-height: 78px;
  resize: vertical;
  border: 1px solid rgba(255,255,255,0.32);
  background: #030303;
  color: #fff;
  padding: 12px 13px;
  font: 14px/1.5 Arial, Helvetica, sans-serif;
  outline: none;
}

.author-chat-compose textarea:focus {
  border-color: #fff;
}

.author-chat-attachments {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.author-chat-attachments:not(:empty) {
  margin-bottom: 9px;
}

.author-message-attachments {
  margin-top: 8px;
}

.author-chat-attachment {
  position: relative;
  flex: 0 0 92px;
  height: 72px;
  border: 1px solid rgba(255,255,255,0.28);
  background: #111 center/cover no-repeat;
}

.author-chat-attachment span {
  position: absolute;
  inset: auto 0 0;
  overflow: hidden;
  padding: 4px 5px;
  background: rgba(0,0,0,0.82);
  color: #fff;
  font-size: 8px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.author-chat-attachment button {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  border: 1px solid #fff;
  background: #000;
  color: #fff;
  cursor: pointer;
}

.author-chat-compose-actions {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 9px;
}

.author-voice-status {
  flex: 1;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.author-send-button {
  min-width: 112px;
}

.author-icon-button {
  width: 40px;
  min-width: 40px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
}

.author-mic-icon {
  position: relative;
  width: 11px;
  height: 17px;
  display: block;
  border: 2px solid currentColor;
  border-radius: 7px;
}

.author-mic-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 14px;
  width: 17px;
  height: 9px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 10px 10px;
  transform: translateX(-50%);
}

.author-mic-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 23px;
  width: 2px;
  height: 5px;
  background: currentColor;
  transform: translateX(-50%);
}

.author-mic-button.listening {
  border-color: #ffd51d;
  background: #ffd51d;
  color: #000;
}

.author-pause-button:disabled {
  opacity: 0.28;
  cursor: default;
}

.author-pause-button.paused {
  border-color: #ffd51d;
  color: #ffd51d;
}

.author-pause-icon {
  position: relative;
  width: 14px;
  height: 16px;
  display: block;
  border-left: 4px solid currentColor;
  border-right: 4px solid currentColor;
}

.author-pause-button.paused .author-pause-icon {
  width: 0;
  height: 0;
  border: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 13px solid currentColor;
}

.author-attachment-icon {
  width: 17px;
  height: 13px;
  display: block;
  border: 2px solid currentColor;
  transform: rotate(-8deg);
}

.author-sheet-icon {
  width: 15px;
  height: 18px;
  display: block;
  border: 2px solid currentColor;
  box-shadow: 4px 4px 0 -1px #000, 4px 4px 0 0 currentColor;
}

.book-section-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.book-meta-grid {
  display: grid;
  grid-template-columns: 180px 180px minmax(260px, 1fr);
  gap: 16px;
  align-items: stretch;
}

.book-upload-slot {
  min-height: 274px;
  border: 1px dashed rgba(255,255,255,0.42);
  background: #101010 center/cover no-repeat;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  cursor: pointer;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.book-upload-slot:hover {
  border-color: #fff;
  color: #fff;
}

.book-upload-slot.has-image {
  border-style: solid;
}

.book-upload-slot span {
  font-size: 11px;
  background: rgba(0,0,0,0.72);
  padding: 4px 8px;
}

.book-upload-slot strong {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: #000;
  font-size: 36px;
  line-height: 1;
}

.book-summary-field textarea {
  min-height: 274px;
}

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

.book-section-title strong {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.book-image-pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.book-image-page {
  border: 1px solid rgba(255,255,255,0.18);
  background: #0a0a0a;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.book-image-preview {
  aspect-ratio: 5.25 / 8;
  border: 1px dashed rgba(255,255,255,0.32);
  background: #151515 center/cover no-repeat;
  color: var(--muted);
  font-size: 32px;
  cursor: pointer;
}

.book-image-page input,
.book-chapter-head input,
.book-chapter-card textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.24);
  background: #0a0a0a;
  color: #fff;
  padding: 10px;
  font-family: inherit;
  outline: none;
}

.book-chapters {
  display: grid;
  gap: 0;
}

.book-kind-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}

.book-kind-tab {
  border: 1px solid rgba(255,255,255,0.26);
  background: #070707;
  color: #d8d8d8;
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.book-kind-tab.active,
.book-kind-tab:hover {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.book-chapter-card {
  border: 1px solid rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.04);
  padding: 12px;
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.book-chapter-summary {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 0;
  background: transparent;
  color: #fff;
  padding: 4px 6px;
  cursor: pointer;
  text-align: left;
}

.book-chapter-summary-title {
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-chapter-summary-toggle {
  color: #a8a8a8;
  font-size: 20px;
  line-height: 1;
}

.book-chapter-card.collapsed {
  padding: 5px 10px;
}

.book-chapter-card.collapsed .book-chapter-editor {
  display: none;
}

.book-chapter-editor {
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.16);
}

.book-manual-editor {
  margin-bottom: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  background: #080808;
}

.book-manual-editor > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  color: #a0a0a0;
  font-size: 10px;
  letter-spacing: 0.08em;
  list-style: none;
  text-transform: uppercase;
  cursor: pointer;
}

.book-manual-editor > summary::-webkit-details-marker {
  display: none;
}

.book-manual-editor > summary::after {
  content: "+";
  color: #fff;
  font-size: 18px;
  line-height: 1;
}

.book-manual-editor[open] > summary {
  border-bottom: 1px solid rgba(255,255,255,0.16);
  color: #fff;
}

.book-manual-editor[open] > summary::after {
  content: "−";
}

.book-manual-editor-body {
  padding: 12px;
}

.book-chapter-card.dragging {
  opacity: 0.58;
}

.book-chapter-card.drag-over {
  border-color: #fff;
  background: rgba(255,255,255,0.08);
}

.book-chapter-head {
  display: grid;
  grid-template-columns: 132px 180px minmax(220px, 1fr) auto;
  gap: 10px;
  margin-bottom: 10px;
  align-items: stretch;
}

.book-chapter-meta {
  border: 1px solid rgba(255,255,255,0.24);
  background: #050505;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 8px 10px;
}

.book-chapter-number {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.book-chapter-drag {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.book-chapter-head input,
.book-chapter-kind {
  font-size: 16px;
  font-weight: 800;
}

.book-chapter-kind {
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.24);
  background: #0a0a0a;
  color: #fff;
  padding: 10px;
  font-family: inherit;
  outline: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
}

.book-chapter-card textarea {
  min-height: 320px;
  resize: vertical;
  line-height: 1.5;
}

.book-readable-wrap {
  margin-top: 12px;
  border: 1px solid #d7d7d2;
  background: #f9f9f6;
  color: #111;
}

.book-readable-wrap > strong,
.book-chapter-images-head {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid rgba(255,255,255,0.14);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.book-readable-wrap > strong {
  border-bottom-color: #d7d7d2;
  color: #111;
}

.book-readable-preview {
  padding: clamp(22px, 4vw, 46px);
  color: #171715;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.72;
}

.book-readable-preview h3,
.book-readable-preview h4 {
  margin: 6px 0 12px;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.15;
}

.book-readable-preview h3 { font-size: 18px; }
.book-readable-preview h4 { font-size: 15px; color: #111; }
.book-readable-preview p { margin: 0 0 10px; }
.book-readable-preview ul { margin: 0 0 10px 18px; padding: 0; }
.book-readable-preview li { margin: 0 0 5px; }
.book-readable-preview .muted { color: var(--muted); font-family: Arial, Helvetica, sans-serif; }

.book-readable-divider {
  margin: 18px 0;
  text-align: center;
  color: #aaa;
  letter-spacing: 0.24em;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
}

.book-home-panel {
  display: grid;
  gap: 34px;
}

.book-home-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid rgba(255,255,255,0.24);
  border-bottom: 1px solid rgba(255,255,255,0.24);
}

.book-home-status > div {
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid rgba(255,255,255,0.18);
}

.book-home-status > div:last-child {
  border-right: 0;
}

.book-home-status span,
.book-home-section-head span {
  display: block;
  margin-bottom: 5px;
  color: #858585;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.book-home-status strong {
  display: block;
  overflow: hidden;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-home-layout {
  display: grid;
  gap: 46px;
}

.book-home-draft {
  padding-top: 4px;
}

.book-home-draft .author-story-proposal {
  margin-top: 0;
}

.book-home-section {
  min-width: 0;
}

.book-home-section-head {
  min-height: 58px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.22);
  padding-bottom: 12px;
}

.book-home-section-head h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 400;
}

.book-home-toc {
  display: grid;
}

.book-home-toc-item {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 10px;
  align-items: center;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.13);
  background: transparent;
  color: #fff;
  padding: 10px 6px;
  text-align: left;
  cursor: pointer;
}

.book-home-toc-item:hover {
  background: rgba(255,255,255,0.045);
}

.book-home-toc-item > span:first-child {
  color: #707070;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
}

.book-home-toc-item > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.book-home-toc-item strong {
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-home-toc-item small {
  color: #777;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.book-home-toc-item i {
  width: 7px;
  height: 7px;
  border: 1px solid #555;
  border-radius: 50%;
}

.book-home-toc-item i.complete {
  border-color: #fff;
  background: #fff;
}

.story-tree-switch {
  display: flex;
  border: 1px solid rgba(255,255,255,0.28);
}

.story-tree-switch button {
  min-height: 32px;
  border: 0;
  border-right: 1px solid rgba(255,255,255,0.28);
  background: transparent;
  color: #858585;
  padding: 0 12px;
  font-size: 9px;
  text-transform: uppercase;
  cursor: pointer;
}

.story-tree-switch button:last-child {
  border-right: 0;
}

.story-tree-switch button.active {
  background: #fff;
  color: #000;
}

.story-tree {
  display: grid;
  gap: 10px;
}

.story-tree-branch {
  border-bottom: 1px solid rgba(255,255,255,0.14);
}

.story-tree-branch > summary {
  min-height: 66px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  list-style: none;
  cursor: pointer;
}

.story-tree-branch > summary::-webkit-details-marker {
  display: none;
}

.story-tree-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.48);
  border-radius: 50%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
}

.story-tree-branch summary > span:last-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.story-tree-branch summary strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 400;
}

.story-tree-branch summary small,
.story-tree-event small {
  color: #777;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.story-tree-timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin: 0 0 18px 22px;
  padding-left: 28px;
}

.story-tree-timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 22px;
  left: 5px;
  width: 1px;
  background: rgba(255,255,255,0.22);
}

.story-tree-event {
  position: relative;
  min-height: 78px;
  width: 100%;
  display: block;
  border: 0;
  background: transparent;
  color: #fff;
  padding: 8px 0 12px;
  text-align: left;
  cursor: pointer;
}

.story-tree-marker {
  position: absolute;
  top: 16px;
  left: -27px;
  width: 9px;
  height: 9px;
  border: 2px solid #050505;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.55);
}

.story-tree-event-content {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 4px;
}

.story-tree-event-content strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 400;
}

.story-tree-event-content > span {
  max-width: 760px;
  color: #9d9d9d;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  line-height: 1.5;
}

.story-tree-event:hover .story-tree-event-content strong {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.story-tree-plot {
  padding-top: 8px;
}

.story-tree-empty {
  margin: 0;
  padding: 22px 4px;
  color: #777;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.6;
}

.book-chapter-images {
  margin-top: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: #080808;
}

.book-chapter-image-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
}

.book-chapter-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  padding: 12px;
}

.book-chapter-image-item {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255,255,255,0.16);
  background: #0d0d0d;
  padding: 10px;
}

.book-chapter-image-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px dashed rgba(255,255,255,0.35);
  background: #151515 center/contain no-repeat;
  color: var(--muted);
  font-size: 28px;
  cursor: pointer;
}

.book-chapter-image-item input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.24);
  background: #050505;
  color: #fff;
  padding: 9px;
  font-family: inherit;
}

.book-order-btn:disabled {
  opacity: 0.28;
}

.book-chapter-insert {
  position: relative;
  height: 32px;
  display: grid;
  place-items: center;
  margin: 3px 0;
}

.book-chapter-insert-line {
  width: 100%;
  height: 1px;
  background: rgba(255,255,255,0.15);
}

.book-chapter-insert-button {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.72);
  background: #fff;
  color: #000;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.book-chapter-insert-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.18);
}

.book-output-empty,
.pipeline-card {
  border: 1px dashed rgba(255,255,255,0.28);
  color: var(--muted);
  padding: 24px;
}

.book-latex {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  border: 1px solid rgba(255,255,255,0.24);
  background: #060606;
  color: #fff;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.4;
}

.book-curl-viewer {
  min-height: calc(100vh - 260px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,0.24);
  background: radial-gradient(circle at center, #1b1b1b 0, #070707 74%);
}

.book-curl-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.18);
}

.book-curl-head span {
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.book-curl-nav {
  display: flex;
  gap: 8px;
}

.book-curl-stage {
  flex: 1;
  min-height: 520px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 14px;
  touch-action: none;
}

.book-curl-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  background: #f5eedc;
  box-shadow: 0 20px 54px rgba(0,0,0,0.56);
}

.pipeline-content {
  display: grid;
  gap: 16px;
}

.pipeline-card h3 {
  margin: 0 0 8px;
  color: #fff;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.pipeline-card p {
  margin: 0 0 14px;
  font-size: 13px;
}

.pipeline-card textarea {
  width: 100%;
  min-height: 360px;
  border: 1px solid rgba(255,255,255,0.24);
  background: #050505;
  color: #fff;
  padding: 12px;
  resize: vertical;
  line-height: 1.45;
}

.overview-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--softLine);
  padding-bottom: 18px;
}

.overview-head p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.overview-head h2 {
  margin: 0;
  font-family: "TheRevoltLower", "TheRevolt", Impact, sans-serif;
  font-size: clamp(52px, 8vw, 112px);
  line-height: 0.86;
  letter-spacing: 0;
  text-transform: none;
}

.overview-plus-button,
.comic-create-plus {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 0;
  background: #fff;
  color: #000;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.overview-plus-button::before,
.overview-plus-button::after,
.comic-create-plus::before,
.comic-create-plus::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34%;
  height: 5px;
  background: #000;
  transform: translate(-50%, -50%);
}

.overview-plus-button::after,
.comic-create-plus::after {
  width: 5px;
  height: 34%;
}

.overview-plus-button {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
}

.overview-plus-button:hover,
.comic-create-card:hover .comic-create-plus {
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px #fff, 0 16px 34px rgba(0,0,0,0.32);
}

.comic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 240px));
  gap: 18px;
  align-items: start;
  justify-content: start;
}

.comic-empty {
  border: 1px solid rgba(255,255,255,0.3);
  padding: 28px;
  color: var(--muted);
}

.comic-card {
  display: grid;
  grid-template-rows: auto 1fr;
  width: 100%;
  min-height: 0;
  border: 1px solid rgba(255,255,255,0.52);
  background: #080808;
  color: #fff;
  text-align: left;
  cursor: pointer;
  padding: 0;
}

.comic-card:hover {
  border-color: #fff;
}

.comic-create-card {
  grid-template-rows: 1fr;
  place-items: center;
  align-self: stretch;
  min-height: 360px;
  border-color: transparent;
  background: transparent;
}

.comic-create-plus {
  width: 96px;
  height: 96px;
}

.comic-create-card:hover {
  border-color: transparent;
}

.comic-thumb {
  position: relative;
  aspect-ratio: 9 / 13;
  overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,0.28);
  background: radial-gradient(circle at center, #242424, #050505 70%);
}

.comic-thumb video,
.comic-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.18);
  opacity: 0.76;
}

.comic-cover-label {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 22px;
  z-index: 1;
  font-family: "TheRevoltLower", "TheRevolt", Impact, sans-serif;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 0.9;
  color: #fff;
  text-shadow: 0 2px 12px #000, 0 0 2px #000;
  pointer-events: none;
}

.comic-thumb::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 2px solid #fff;
  pointer-events: none;
}

.comic-card-body {
  padding: 14px;
}

.comic-card h3 {
  margin: 0 0 8px;
  font-family: "TheRevoltLower", "TheRevolt", Impact, sans-serif;
  font-size: 26px;
  line-height: 0.95;
  letter-spacing: 0;
  text-transform: none;
}

.comic-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.intro {
  border: 1px solid var(--softLine);
  padding: 24px;
  margin-bottom: 28px;
  background: linear-gradient(180deg, #111, #050505);
}

.intro h2 {
  margin: 0 0 8px;
  font-family: "TheRevoltLower", "TheRevolt", Impact, sans-serif;
  font-size: clamp(32px, 7vw, 86px);
  line-height: 0.9;
  text-transform: none;
  letter-spacing: 0;
  outline: none;
}

.character-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--softLine);
  margin-top: 22px;
  padding-top: 18px;
}

.character-panel strong {
  display: block;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1.2px;
}

.character-panel span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.character-add {
  display: flex;
  gap: 8px;
}

.character-add input {
  min-width: 240px;
  background: #000;
  color: #fff;
  border: 1px solid #fff;
  padding: 10px;
  outline: none;
}

.character-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.character-pill {
  border: 1px solid #fff;
  color: #fff;
  padding: 7px 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.pages {
  display: flex;
  flex-direction: column;
  gap: 42px;
  align-items: center;
}

.page-shell {
  position: relative;
  --editor-side-left: 190px;
  --editor-side-right: 330px;
  --editor-side-gap: 58px;
  width: min(
    100%,
    calc(
      var(--editor-page-max-height, 760px) * var(--comic-aspect-number, 1.77778) +
      var(--editor-side-left) +
      var(--editor-side-right) +
      (var(--editor-side-gap) * 2)
    )
  );
  max-width: 100%;
  display: grid;
  grid-template-columns:
    minmax(150px, var(--editor-side-left))
    minmax(0, calc(var(--editor-page-max-height, 760px) * var(--comic-aspect-number, 1.77778)))
    minmax(250px, var(--editor-side-right));
  gap: var(--editor-side-gap);
  align-items: start;
}

.page-card-wrap {
  grid-column: 2;
  position: relative;
  min-width: 0;
  width: 100%;
  overflow: visible; /* let the side arrows show outside the image */
}

.page-card {
  position: relative;
  width: 100%;
  border: 1px solid var(--line);
  background: #000;
  aspect-ratio: var(--comic-aspect, 16 / 9);
  min-height: 0;
  overflow: hidden;
}

.page-side-panel {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.32);
  background: rgba(0,0,0,0.42);
  padding: 12px;
  pointer-events: auto;
}

.page-text-panel {
  grid-column: 1;
}

.page-control-panel {
  grid-column: 3;
  display: grid;
  gap: 12px;
}

.page-insert {
  position: relative;
  width: min(100%, 760px);
  height: 42px;
  display: grid;
  place-items: center;
  margin: -20px 0;
}

.page-insert-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(255,255,255,0.32);
}

.page-insert-button {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  border: 2px solid #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: #000;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}

.page-insert-button:hover {
  background: #000;
  color: #fff;
}

.page-toolbar {
  position: relative;
  z-index: 9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  pointer-events: auto;
}

.page-label {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  margin-bottom: 12px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.7);
  color: #fff;
  background: transparent;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
  pointer-events: none;
}

.page-tools {
  display: grid;
  gap: 8px;
  pointer-events: auto;
}

.tool-button {
  width: 100%;
  border: 1px solid #fff;
  background: rgba(0,0,0,0.72);
  color: #fff;
  padding: 9px 10px;
  cursor: pointer;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.tool-button:hover {
  background: #fff;
  color: #000;
}

.page-fields {
  display: grid;
  gap: 10px;
}

.page-field {
  display: grid;
  gap: 6px;
}

.page-field span {
  color: rgba(255,255,255,0.62);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.page-field-control {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.38);
  background: rgba(0,0,0,0.72);
  color: #fff;
  padding: 9px;
  outline: none;
  font-size: 12px;
  line-height: 1.35;
}

.page-field-control:focus,
.prompt-text:focus {
  border-color: #fff;
}

.page-field-textarea {
  min-height: 130px;
  resize: vertical;
}

.video-layer {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, #242424, #050505 68%);
}

.video-layer video,
.video-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.18);
  opacity: 0.78;
}

.video-layer.no-video::after {
  content: "NO VIDEO";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,0.16);
  font-size: clamp(52px, 14vw, 170px);
  font-weight: 900;
  letter-spacing: -8px;
}

.page-content {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: none;
}

.page-title,
.page-subtitle,
.editorial-text {
  outline: none;
  pointer-events: auto;
  text-shadow: 0 2px 18px #000;
}

.page-title {
  margin: 0;
  font-family: "TheRevoltLower", "TheRevolt", Impact, sans-serif;
  font-size: clamp(45px, 8vw, 120px);
  line-height: 0.85;
  text-transform: none;
  letter-spacing: 0;
}

.page-subtitle {
  margin: 12px 0 0;
  font-size: 20px;
  color: #e5e5e5;
}

.editorial-text {
  max-width: 760px;
  margin-top: 22px;
  font-size: 20px;
  line-height: 1.48;
  color: #fff;
  border-left: 5px solid #fff;
  padding-left: 18px;
}

.bubble-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: auto;
}

.bubble-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.bubble {
  position: absolute;
  min-width: 150px;
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #000;
  border: 3px solid #070707;
  border-radius: 50% 48% 46% 52% / 44% 50% 46% 52%;
  padding: 20px 18px;
  font-family: "TheRevoltLower", "TheRevolt", "TheRevoltJP", Arial, sans-serif;
  font-size: clamp(14px, 1.55vw, 22px);
  line-height: 0.96;
  font-weight: 900;
  cursor: grab;
  box-shadow: 0 0 0 2px #fff, inset 0 0 0 1px rgba(0,0,0,0.2);
  user-select: none;
  touch-action: none;
  transform: rotate(var(--bubble-tilt, -1deg));
}

.bubble::before {
  content: "";
  position: absolute;
  inset: 4px 5px 5px 4px;
  border: 1px solid rgba(0,0,0,0.7);
  border-radius: inherit;
  pointer-events: none;
}

.bubble[data-bubble-type="shout"] {
  border-radius: 0;
  clip-path: polygon(6% 1%, 15% 7%, 25% 0, 36% 8%, 48% 1%, 61% 7%, 73% 0, 85% 8%, 99% 3%, 94% 18%, 100% 31%, 93% 43%, 100% 57%, 91% 69%, 98% 84%, 84% 91%, 75% 99%, 62% 92%, 49% 100%, 37% 92%, 25% 98%, 15% 90%, 2% 96%, 8% 80%, 1% 68%, 8% 55%, 0 42%, 7% 30%, 1% 17%);
}

.bubble[data-bubble-type="caption"] {
  align-items: flex-start;
  border-radius: 0;
  padding: 16px 18px;
  transform: rotate(0deg);
}

.bubble[data-bubble-type="thought"] {
  border-style: dashed;
  border-radius: 54% 48% 52% 46% / 48% 54% 45% 52%;
}

.bubble[data-bubble-type="sound"] {
  background: transparent;
  border: 0;
  color: #fff;
  text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000;
  box-shadow: none;
  padding: 8px;
  transform: rotate(-8deg) skew(-5deg);
}

.bubble[data-bubble-type="sound"]::before {
  display: none;
}

.bubble-controls {
  position: absolute;
  left: 12px;
  right: 12px;
  top: -34px;
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
  transform: rotate(calc(var(--bubble-tilt, -1deg) * -1));
  z-index: 2;
}

.bubble:hover .bubble-controls,
.bubble:focus-within .bubble-controls {
  opacity: 1;
  pointer-events: auto;
}

.bubble-controls select,
.bubble-delete {
  width: 100%;
  background: #000;
  color: #fff;
  border: 1px solid #fff;
  padding: 5px 6px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  outline: none;
}

.bubble-controls select {
  min-width: 0;
  flex: 1 1 0;
}

.bubble-delete {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  cursor: pointer;
}

.bubble textarea {
  width: 100%;
  min-height: 1em;
  flex: 0 1 auto;
  resize: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: #000;
  font: inherit;
  line-height: 0.96;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bubble[data-bubble-type="caption"] textarea {
  width: 100%;
  text-align: left;
}

.bubble[data-bubble-type="shout"] .bubble-controls {
  top: 8px;
}

.bubble[data-bubble-type="shout"] textarea {
  width: 72%;
}

.bubble[data-bubble-type="sound"] textarea {
  width: 100%;
  color: #fff;
}

.bubble-resize {
  position: absolute;
  right: 8px;
  bottom: 7px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  border-right: 2px solid #000;
  border-bottom: 2px solid #000;
  opacity: 0;
}

.bubble:hover .bubble-resize,
.bubble:focus-within .bubble-resize {
  opacity: 0.8;
}

.target-point {
  position: absolute;
  width: 17px;
  height: 17px;
  margin-left: -8px;
  margin-top: -8px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #000;
  box-shadow: 0 0 0 2px #fff;
  cursor: crosshair;
  touch-action: none;
}

.add-page {
  position: sticky;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  margin: 38px auto 0;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  background: #fff;
  color: #000;
  font-size: 46px;
  cursor: pointer;
  line-height: 1;
}

.add-page:hover {
  background: #000;
  color: #fff;
}

.hidden-input {
  display: none;
}


.prompt-box {
  position: static;
  width: 100%;
  border: 1px solid rgba(255,255,255,0.55);
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(8px);
  padding: 12px;
  pointer-events: auto;
}

.prompt-head {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.prompt-head strong {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.copy-prompt {
  width: 100%;
  border: 1px solid #fff;
  background: #fff;
  color: #000;
  padding: 6px 9px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.prompt-text {
  width: 100%;
  min-height: 170px;
  resize: vertical;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 9px;
  outline: none;
  font-size: 12px;
  line-height: 1.35;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  padding: 12px 16px;
  background: #fff;
  color: #000;
  transform: translateY(90px);
  transition: transform 0.25s ease;
  z-index: 99;
  font-weight: 800;
}

.toast.show {
  transform: translateY(0);
}

.story-modal {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,0.86);
}

.story-modal.open {
  display: flex;
}

.story-shell {
  width: min(1280px, 100%);
  height: min(860px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,0.28);
  background: #101010;
}

.story-head {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.18);
}

.story-head strong {
  display: block;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.story-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.story-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.25fr);
  gap: 14px;
  padding: 14px;
}

.story-input-panel,
.story-output-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(0,0,0,0.34);
  padding: 12px;
}

.story-status {
  min-height: 48px;
  white-space: pre-line;
  border: 1px solid rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  padding: 10px;
  font-size: 12px;
  line-height: 1.35;
}

.story-status[data-ready="true"] {
  color: #fff;
  border-color: rgba(255,255,255,0.62);
}

.storyboard-input {
  flex: 1;
  min-height: 0;
  margin-top: 12px;
  resize: none;
  border: 1px solid rgba(255,255,255,0.38);
  background: #050505;
  color: #fff;
  padding: 12px;
  outline: none;
  font-size: 14px;
  line-height: 1.45;
}

.storyboard-input:focus,
.story-prompt-preview:focus {
  border-color: #fff;
}

.story-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 12px;
}

.story-results {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 12px;
  align-content: start;
}

.story-empty {
  border: 1px dashed rgba(255,255,255,0.28);
  color: var(--muted);
  padding: 22px;
  font-size: 13px;
}

.story-scene {
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.04);
  padding: 12px;
}

.story-scene-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.story-scene h3 {
  margin: 0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.story-scene-head span {
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.36);
  color: var(--muted);
  padding: 4px 7px;
  font-size: 10px;
  text-transform: uppercase;
}

.story-scene p {
  margin: 10px 0 0;
  color: #d8d8d8;
  font-size: 13px;
  line-height: 1.4;
}

.story-scene-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.story-prompt-preview {
  width: 100%;
  min-height: 180px;
  margin-top: 12px;
  resize: vertical;
  border: 1px solid rgba(255,255,255,0.28);
  background: #050505;
  color: #fff;
  padding: 10px;
  font-size: 12px;
  line-height: 1.38;
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,0.92);
}

.preview-modal.open {
  display: flex;
}

.preview-shell {
  width: min(1180px, 100%);
  height: min(880px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  background: #121212;
}

.preview-head {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
}

.preview-head > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.preview-head strong {
  display: block;
  max-width: 100%;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-head #previewCounter {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.preview-head .yellow-o {
  display: inline;
}

.preview-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.preview-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(circle at center, #1e1e1e 0, #090909 72%);
  overflow: hidden;
  touch-action: none;
}

.preview-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  background: #000;
  box-shadow: 0 22px 60px rgba(0,0,0,0.55);
}

@media (max-width: 820px) {
  .topbar {
    min-height: 58px;
    height: 58px;
    align-items: center;
    flex-direction: row;
    gap: 10px;
    padding: 8px 14px;
  }

  .brand {
    min-width: 0;
    gap: 10px;
  }

  .mark {
    width: 34px;
    height: 34px;
    font-size: 12px;
  }

  .brand h1 {
    overflow: hidden;
    max-width: 220px;
    margin: 0;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand p {
    display: none;
  }

  .mobile-menu-button {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-content: center;
    gap: 5px;
    margin-left: auto;
    border: 1px solid rgba(255,255,255,0.45);
    background: #050505;
    color: #fff;
  }

  .mobile-menu-button span {
    width: 18px;
    height: 2px;
    display: block;
    background: currentColor;
    transition: transform 160ms ease, opacity 160ms ease;
  }

  .topbar.menu-open .mobile-menu-button span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .topbar.menu-open .mobile-menu-button span:nth-child(2) {
    opacity: 0;
  }

  .topbar.menu-open .mobile-menu-button span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .top-actions {
    position: absolute;
    top: 58px;
    left: 0;
    right: 0;
    max-height: calc(100vh - 58px);
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
    overflow-y: auto;
    padding: 10px 14px 14px;
    background: rgba(0,0,0,0.98);
    border-bottom: 1px solid rgba(255,255,255,0.28);
    box-shadow: 0 18px 35px rgba(0,0,0,0.55);
  }

  .topbar.menu-open .top-actions {
    display: grid;
  }

  .top-actions .button {
    min-height: 42px;
    padding: 8px 7px;
    font-size: 10px;
    letter-spacing: 0;
  }

  .button {
    flex: 1;
  }

  main {
    width: min(100% - 24px, 1120px);
    padding: 22px 0 110px;
  }

  .overview-head {
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 12px;
  }

  .overview-head p {
    margin-bottom: 3px;
    font-size: 9px;
  }

  .overview-head h2 {
    font-size: 42px;
  }

  .overview-plus-button {
    width: 48px;
    height: 48px;
  }

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

  .book-editor {
    margin-top: 18px;
    padding-top: 14px;
  }

  .book-title-input {
    font-size: 44px;
  }

  .book-tabs {
    position: sticky;
    top: 58px;
    z-index: 12;
    gap: 5px;
    margin: 12px 0;
    padding: 8px 0;
    background: #050505;
  }

  .book-tab {
    flex: 1 1 auto;
    padding: 8px 7px;
    font-size: 9px;
    letter-spacing: 0;
  }

  .mobile-voice-button {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(22px, calc(env(safe-area-inset-bottom) + 12px));
    z-index: 45;
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    border: 2px solid #050505;
    border-radius: 50%;
    background: #fff;
    color: #050505;
    box-shadow: 0 8px 28px rgba(0,0,0,0.62), 0 0 0 1px rgba(255,255,255,0.35);
  }

  .mobile-read-dock {
    position: fixed;
    right: max(92px, calc(env(safe-area-inset-right) + 74px));
    bottom: max(22px, calc(env(safe-area-inset-bottom) + 12px));
    z-index: 45;
    display: none;
    align-items: center;
    gap: 7px;
  }

  .mobile-read-dock.visible {
    display: flex;
  }

  .mobile-read-dock > span {
    max-width: 132px;
    overflow: hidden;
    padding: 7px 9px;
    border: 1px solid rgba(255,255,255,0.38);
    background: rgba(5,5,5,0.94);
    color: #fff;
    font-size: 9px;
    letter-spacing: 0.04em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .mobile-read-button {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    flex: 0 0 56px;
    border: 2px solid #050505;
    border-radius: 50%;
    background: #fff;
    color: #050505;
    box-shadow: 0 8px 28px rgba(0,0,0,0.58), 0 0 0 1px rgba(255,255,255,0.35);
  }

  .mobile-read-icon {
    width: 0;
    height: 0;
    display: block;
    margin-left: 4px;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-left: 14px solid currentColor;
  }

  .mobile-read-button.reading {
    background: #050505;
    color: #fff;
    border-color: #fff;
  }

  .mobile-read-button.reading .mobile-read-icon {
    width: 14px;
    height: 14px;
    margin: 0;
    border: 0;
    background: currentColor;
  }

  .mobile-voice-button .author-mic-icon {
    transform: scale(1.2);
  }

  .mobile-voice-button.listening {
    border-color: #fff;
    background: #e33131;
    color: #fff;
    animation: mobile-mic-pulse 1.45s ease-in-out infinite;
  }

  .mobile-voice-status {
    position: fixed;
    right: max(14px, env(safe-area-inset-right));
    bottom: max(94px, calc(env(safe-area-inset-bottom) + 84px));
    z-index: 45;
    max-width: calc(100vw - 28px);
    padding: 8px 11px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(5,5,5,0.94);
    color: #fff;
    font-size: 10px;
    text-transform: uppercase;
  }

  .mobile-voice-status:empty {
    display: none;
  }

  @keyframes mobile-mic-pulse {
    0%, 100% { box-shadow: 0 8px 28px rgba(0,0,0,0.62), 0 0 0 0 rgba(227,49,49,0.45); }
    50% { box-shadow: 0 8px 28px rgba(0,0,0,0.62), 0 0 0 10px rgba(227,49,49,0); }
  }

  .book-editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .book-meta-grid,
  .book-chapter-head {
    grid-template-columns: 1fr;
  }

  .book-chat-panel {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .author-profile {
    display: none;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
  }

  .author-profile-rule,
  .author-profile-copy,
  .author-traits,
  .author-conversation-block,
  .author-chat-status,
  .author-playback-status,
  .author-reset-button {
    grid-column: 1 / -1;
  }

  .book-chapter-summary {
    grid-template-columns: 92px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .author-chat-messages {
    min-height: 44vh;
    max-height: none;
    padding: 14px 10px;
  }

  .author-message {
    width: 100%;
  }

  .author-message-body {
    padding: 12px;
    font-size: 14px;
  }

  .author-story-proposal-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .author-story-proposal-head strong {
    overflow: visible;
    white-space: normal;
  }

  .author-story-proposal-text,
  .book-readable-preview {
    padding: 22px 18px;
    font-size: 15px;
    line-height: 1.68;
  }

  .book-home-panel {
    gap: 24px;
  }

  .book-home-status {
    grid-template-columns: 1fr;
  }

  .book-home-status > div {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 11px 4px;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,0.12);
  }

  .book-home-status > div:last-child {
    border-bottom: 0;
  }

  .book-home-status span {
    margin: 0;
  }

  .book-home-status strong {
    font-size: 14px;
  }

  .book-home-layout {
    gap: 34px;
  }

  .book-home-section-head {
    align-items: center;
  }

  .book-home-section-head h3 {
    font-size: 22px;
  }

  .book-home-toc-item {
    grid-template-columns: 34px minmax(0, 1fr) 8px;
    gap: 8px;
  }

  .book-home-toc-item strong {
    font-size: 15px;
  }

  .story-tree-switch button {
    padding: 0 9px;
    font-size: 8px;
  }

  .story-tree-timeline {
    margin-left: 18px;
    padding-left: 23px;
  }

  .story-tree-event-content > span {
    max-width: none;
    font-size: 14px;
    line-height: 1.55;
  }

  .story-tree-marker {
    left: -22px;
  }

  .author-chat-compose {
    padding: 10px;
  }

  .author-chat-compose textarea {
    min-height: 92px;
    font-size: 16px;
  }

  .author-chat-compose-actions {
    flex-wrap: wrap;
  }

  .author-voice-status {
    min-width: 100%;
    order: -1;
  }

  .author-send-button {
    margin-left: auto;
  }

  .book-upload-slot {
    min-height: 360px;
  }

  .character-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .character-add {
    width: 100%;
  }

  .character-add input {
    min-width: 0;
    flex: 1;
  }

  .page-shell {
    width: min(100%, calc(var(--editor-page-max-height, 640px) * var(--comic-aspect-number, 0.6923)));
    grid-template-columns: 1fr;
  }

  .page-card {
    grid-column: 1;
    aspect-ratio: var(--comic-aspect, 9 / 13);
  }

  .page-text-panel,
  .page-control-panel {
    grid-column: 1;
  }

  .page-text-panel {
    order: 1;
  }

  .page-card {
    order: 2;
  }

  .page-control-panel {
    order: 3;
  }

  .preview-modal {
    padding: 10px;
  }

  .story-modal {
    padding: 10px;
  }

  .story-shell {
    height: calc(100vh - 20px);
  }

  .story-workspace {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .story-input-panel,
  .story-output-panel {
    min-height: 420px;
  }

  .story-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .preview-shell {
    height: calc(100vh - 20px);
  }

  .preview-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ===== Asset Library ===== */
.library-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

.library-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.library-type-btn {
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.28);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
}

.library-type-btn:hover { color: #fff; }

.library-type-btn.active {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.library-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}

.asset-card {
  border: 1px solid rgba(255,255,255,0.22);
  background: #0d0d0d;
  cursor: pointer;
  text-align: left;
  color: inherit;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 220px;
}

.asset-card:hover { border-color: rgba(255,255,255,0.6); }

.asset-thumb {
  aspect-ratio: 3 / 4;
  background: #1a1a1a center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
}

.asset-card-body { padding: 10px 12px; }
.asset-card-body h3 { margin: 0; font-size: 14px; }
.asset-card-body p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }

.asset-views-count {
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.asset-create-card {
  align-items: center;
  justify-content: center;
  border-style: dashed;
  font-size: 40px;
  color: var(--muted);
}
.asset-create-card:hover { color: #fff; }

/* Asset modal */
.asset-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,0.88);
}
.asset-modal.open { display: flex; }

.asset-shell {
  width: min(1180px, 100%);
  height: min(900px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,0.28);
  background: #101010;
}

.asset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.18);
}
.asset-head strong { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.asset-head span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.asset-head-actions { display: flex; gap: 8px; }

.asset-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
  gap: 16px;
  padding: 16px;
  overflow: auto;
}

.asset-meta { display: flex; flex-direction: column; gap: 14px; min-height: 0; }

.asset-field { display: flex; flex-direction: column; gap: 6px; }
.asset-field > span { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.asset-field input,
.asset-field textarea,
.asset-template textarea {
  width: 100%;
  background: #0a0a0a;
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff;
  padding: 10px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}

.asset-template { display: flex; flex-direction: column; gap: 8px; }
.asset-template-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.asset-template-head strong { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.asset-template-head > div { display: flex; gap: 6px; }

.asset-views-panel { min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.asset-views-head strong { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.asset-views-head span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

.asset-views {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.asset-view {
  border: 1px solid rgba(255,255,255,0.18);
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
}

.asset-view-label {
  padding: 6px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.asset-view-drop {
  aspect-ratio: 3 / 4;
  background: #161616 center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  position: relative;
}
.asset-view-drop:hover { color: #fff; }

.asset-view-clear {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(0,0,0,0.7);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.asset-view input {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: #fff;
  padding: 7px 8px;
  font-family: inherit;
  font-size: 11px;
}

.asset-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.18);
  display: flex;
  justify-content: flex-end;
}

.scene-assets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}
.scene-asset-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 8px;
  border: 1px solid rgba(255,255,255,0.3);
  color: var(--muted);
}

@media (max-width: 880px) {
  .asset-body { grid-template-columns: 1fr; }
}

/* Asset reference sheets */
.asset-sheets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.asset-sheet {
  border: 1px solid rgba(255,255,255,0.18);
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
}

.asset-sheet-img {
  aspect-ratio: 16 / 11;
  background: #161616 center/contain no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 28px;
  cursor: pointer;
  position: relative;
}
.asset-sheet-img:hover { color: #fff; }

.asset-sheet-label {
  padding: 6px 8px 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.asset-sheet input {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: #fff;
  padding: 7px 8px;
  margin-top: 6px;
  font-family: inherit;
  font-size: 11px;
}

.asset-sheet-clear {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(0,0,0,0.7);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.asset-sheet-add {
  border: 1px dashed rgba(255,255,255,0.3);
  background: #0a0a0a;
  color: var(--muted);
  font-size: 30px;
  cursor: pointer;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.asset-sheet-add:hover { color: #fff; }

.asset-views-extra { margin-top: 16px; }
.asset-views-extra summary {
  cursor: pointer;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 6px 0;
}
.asset-views-extra summary:hover { color: #fff; }

/* Story image engine selector */
.story-engine {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.story-engine label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.story-engine select {
  background: #0a0a0a;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
  padding: 7px 10px;
  font-family: inherit;
  font-size: 12px;
}
.story-engine .engine-note {
  font-size: 11px;
  color: var(--muted);
}

/* Comic delete button on overview cards */
.comic-card-wrap { position: relative; }
.comic-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(0,0,0,0.75);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}
.comic-card-wrap:hover .comic-delete-btn { opacity: 1; }
.comic-delete-btn:hover { background: #c0392b; border-color: #c0392b; }

/* Page image engine panel */
.page-engine-panel {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 0 0;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.page-engine-panel strong { display: block; font-size: 13px; }
.page-engine-panel span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.page-engine-panel select {
  background: #0a0a0a;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 12px;
}

/* Generate image button highlight */
.tool-button.generate-image-btn {
  border-color: rgba(255,255,255,0.55);
  font-weight: 600;
}
.tool-button.generate-image-btn:hover { background: #fff; color: #000; }

/* Per-page asset linking (hashtag-style) */
.asset-link-box {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.asset-link-head {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.asset-link-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.asset-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 6px 3px 8px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.06);
}
.asset-link-chip.type-character { border-color: #4aa3ff; }
.asset-link-chip.type-location  { border-color: #45c08a; }
.asset-link-chip.type-object    { border-color: #d9a441; }
.asset-link-chip.type-vehicle   { border-color: #c878e0; }
.asset-link-remove {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
}
.asset-link-remove:hover { color: #fff; }
.asset-link-empty { font-size: 11px; color: var(--muted); font-style: italic; }
.asset-link-select {
  background: #0a0a0a;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.22);
  padding: 6px 8px;
  font-family: inherit;
  font-size: 11px;
}

/* Glow on the page currently being generated */
.page-shell.generating {
  position: relative;
  outline: 2px solid #ffd400;
  outline-offset: 4px;
  animation: pageGlow 1.1s ease-in-out infinite;
}
@keyframes pageGlow {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,212,0,0.0), 0 0 24px 4px rgba(255,212,0,0.25); }
  50%     { box-shadow: 0 0 0 0 rgba(255,212,0,0.0), 0 0 46px 10px rgba(255,212,0,0.6); }
}
.page-working-badge {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  background: #ffd400;
  color: #000;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  white-space: nowrap;
  pointer-events: none;
}

/* Start/End image block */
/* --- Time-Machine version history --- */
/* Stacked "cards" peeking out behind the image (box-shadow is not clipped
   by the card's overflow:hidden, so it reads as depth without layout shift). */
.page-card.has-versions {
  box-shadow:
    8px 8px 0 -1px #000,
    8px 8px 0 0 rgba(255,255,255,0.30);
}
.page-card.has-versions[data-version-count="3"],
.page-card.has-versions[data-version-count="4"] {
  box-shadow:
    8px 8px 0 -1px #000,  8px 8px 0 0 rgba(255,255,255,0.30),
    16px 16px 0 -1px #000, 16px 16px 0 0 rgba(255,255,255,0.18);
}
.page-card.has-versions[data-version-count="4"] {
  box-shadow:
    8px 8px 0 -1px #000,   8px 8px 0 0 rgba(255,255,255,0.30),
    16px 16px 0 -1px #000, 16px 16px 0 0 rgba(255,255,255,0.20),
    24px 24px 0 -1px #000, 24px 24px 0 0 rgba(255,255,255,0.12);
}

/* Side arrows sit OUTSIDE the image (in the side gaps): left = older version,
   right = newer version — like the Finder/Time-Machine example. */
.tm-side {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  width: 38px;
  height: 60px;
  display: grid;
  place-items: center;
  font-size: 28px;
  line-height: 1;
  border: 1px solid rgba(255,255,255,0.45);
  background: rgba(20,20,20,0.92);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.6);
  transition: background 0.15s ease, opacity 0.15s ease;
}
.tm-side.tm-prev { left: -48px; border-radius: 6px; }
.tm-side.tm-next { right: -48px; border-radius: 6px; }
.tm-side:hover:not(:disabled) { background: #fff; color: #000; }
.tm-side:disabled { opacity: 0.25; cursor: default; }

.tm-count {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 8;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.62);
  border: 1px solid rgba(255,255,255,0.38);
  backdrop-filter: blur(4px);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #fff;
  text-align: center;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.tm-banner {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 8;
  padding: 4px 10px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #000;
  background: #fff;
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000;
  pointer-events: none;
}
.tm-banner.src-chatgpt { background: #10a37f; color: #fff; border-color: #053d2e; }
.tm-banner.src-banana  { background: #ffd23f; color: #000; border-color: #6b5600; }
.tm-banner.src-openai  { background: #10a37f; color: #fff; border-color: #053d2e; }
.tm-banner.src-clipboard,
.tm-banner.src-upload   { background: #ffffff; color: #000; border-color: #000; }

.startend-box {
  margin: 10px 0;
  border: 1px solid rgba(255,255,255,0.18);
  background: #0a0a0a;
}
.startend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.startend-row:last-child { border-bottom: none; }
.startend-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 72px;
}
.startend-status { font-size: 11px; flex: 1; }
.startend-status.set { color: #45c08a; }
.startend-status.empty { color: var(--muted); }
.startend-mini {
  border: 1px solid rgba(255,255,255,0.3);
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 8px;
  line-height: 1.4;
}
.startend-mini:hover:not(:disabled) { background: #fff; color: #000; }
.startend-mini:disabled { opacity: 0.35; cursor: default; }
