:root {
  --bg-top: #dff6f2;
  --bg-mid: #f5fbff;
  --bg-bottom: #f9f4eb;
  --text: #14223a;
  --text-muted: #51627f;
  --brand: #0f6ad9;
  --brand-dark: #0b4fa4;
  --brand-soft: #d9e9ff;
  --mint: #16a085;
  --border: #d9e2ef;
  --panel: rgba(255, 255, 255, 0.86);
  --shadow: 0 12px 35px rgba(17, 35, 66, 0.12);
  --radius-lg: 20px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  background:
    radial-gradient(1200px 520px at 5% -10%, #c9efe6 0%, transparent 60%),
    radial-gradient(950px 500px at 95% 0%, #d7e7ff 0%, transparent 52%),
    linear-gradient(165deg, var(--bg-top) 0%, var(--bg-mid) 48%, var(--bg-bottom) 100%);
}

a {
  color: var(--brand);
  text-decoration: none;
}

.page-wrap {
  width: min(1120px, 100% - 28px);
  margin: 0 auto;
  padding: 22px 0 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

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

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, #0f6ad9, #42a0ff);
  box-shadow: 0 8px 18px rgba(15, 106, 217, 0.35);
}

.brand-title {
  font-size: 22px;
  margin: 0;
}

.brand-sub {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
}

.auth-layout {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 16px;
}

.auth-visual {
  padding: 28px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-visual::before,
.auth-visual::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.auth-visual::before {
  width: 240px;
  height: 240px;
  right: -60px;
  top: -70px;
  background: radial-gradient(circle, rgba(66, 160, 255, 0.35), rgba(66, 160, 255, 0));
}

.auth-visual::after {
  width: 260px;
  height: 260px;
  left: -90px;
  bottom: -100px;
  background: radial-gradient(circle, rgba(22, 160, 133, 0.3), rgba(22, 160, 133, 0));
}

.auth-heading {
  margin: 0;
  font-size: 30px;
  line-height: 1.3;
}

.auth-text {
  margin: 10px 0 0;
  color: var(--text-muted);
  line-height: 1.7;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 106, 217, 0.09);
  border: 1px solid rgba(15, 106, 217, 0.16);
  color: #21456f;
  font-size: 13px;
}

.auth-form-card {
  padding: 28px 24px;
  min-height: 520px;
}

.section-title {
  margin: 0;
  font-size: 24px;
}

.section-sub {
  margin: 8px 0 0;
  color: var(--text-muted);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label {
  color: var(--text-muted);
  font-size: 14px;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  min-height: 44px;
  line-height: 1.4;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.textarea {
  resize: vertical;
  min-height: 76px;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: #77a7ff;
  box-shadow: 0 0 0 4px rgba(119, 167, 255, 0.2);
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background-color .2s ease;
}

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

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #2f8eff);
  box-shadow: 0 8px 20px rgba(15, 106, 217, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-dark), #1a78e8);
}

.btn-soft {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger-soft {
  border-color: #f2b7b7;
  color: #a33b3b;
  background: #fff6f6;
}

.note {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 14px;
}

.auth-switch {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 14px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.workspace-nav {
  margin: 0 0 14px;
  padding: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.workspace-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.68);
  font-weight: 600;
}

.workspace-nav a.active {
  border-color: #6ea4ff;
  background: var(--brand-soft);
  color: #19457e;
}

.panel {
  padding: 16px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 21px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--text-muted);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-select {
  min-width: 180px;
  height: auto;
  min-height: 44px;
  padding-top: 8px;
  padding-bottom: 8px;
  line-height: 1.4;
}

.inline {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.inline .field {
  flex: 1;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 12px;
  max-height: 270px;
  overflow: auto;
  padding-right: 4px;
}

.item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.76);
}

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

.item-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.item-score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #8eb8ff;
  background: #e9f2ff;
  color: #1b4f95;
  font-size: 12px;
  white-space: nowrap;
}

.item-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.item-score-line {
  margin-top: 4px;
  color: #3f5f8f;
  font-size: 12px;
}

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

.book-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.book-cover {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}

.book-cover-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
}

.book-meta {
  min-width: 0;
}

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

.section-heading-row h2 {
  margin-bottom: 0;
}

.book-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.book-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.book-detail-cover {
  width: 118px;
  height: 118px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}

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

.book-detail-actions {
  justify-content: flex-start;
}

.book-detail-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
  padding: 4px 4px 8px;
}

.book-detail-image {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  appearance: none;
  text-align: left;
}

.book-detail-image:hover {
  border-color: #8eb8ff;
  background: #f4f8ff;
}

.book-detail-image img {
  width: 100%;
  aspect-ratio: 1 / 1.25;
  object-fit: cover;
  border-radius: 10px;
  background: #fff;
}

.book-detail-image span {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.modal-open {
  overflow: hidden;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.image-modal.hidden {
  display: none;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 29, 52, 0.62);
  backdrop-filter: blur(8px);
}

.image-modal-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(92vw, 980px);
  max-height: 92vh;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(18, 38, 74, 0.28);
}

.image-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(37, 84, 150, 0.16);
}

.image-modal-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 72px;
  border: 1px solid rgba(205, 218, 238, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #17365f;
  cursor: pointer;
  font-size: 42px;
  line-height: 1;
  transform: translateY(-50%);
  box-shadow: 0 12px 28px rgba(37, 84, 150, 0.2);
}

.image-modal-nav:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.image-modal-prev {
  left: 18px;
}

.image-modal-next {
  right: 18px;
}

.image-modal-img {
  max-width: 100%;
  max-height: calc(92vh - 90px);
  object-fit: contain;
  border-radius: 14px;
  background: #fff;
}

.image-modal-caption {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

.book-select-preview {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
}

.book-select-preview-img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #fff;
}

.book-select-preview-text {
  color: var(--text-muted);
  font-size: 13px;
}

.history-grid {
  grid-template-columns: minmax(330px, 0.98fr) minmax(390px, 1.12fr) minmax(420px, 1.2fr);
  height: calc(100vh - 210px);
}

.history-panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 250px);
  overflow: hidden;
}

.history-panel-detail {
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 12px;
}

.history-panel-images {
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 16px;
}

.history-panel .list {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  padding-bottom: 10px;
}

.history-panel .story-output {
  margin-top: 10px;
  flex: 0 0 auto;
  min-height: 340px;
  max-height: 52vh;
  overflow: auto;
}

.history-panel .item {
  padding: 10px;
}

.history-panel .item-title {
  margin-bottom: 4px;
}

.history-panel .item-sub {
  line-height: 1.5;
}

.history-panel .item-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.history-panel .item-actions .btn {
  width: 100%;
  padding-left: 8px;
  padding-right: 8px;
  white-space: nowrap;
}

.story-output {
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.75);
  min-height: 200px;
  margin-top: 12px;
  padding: 12px;
  white-space: pre-wrap;
  line-height: 1.6;
}

.detail-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-heading-row h2 {
  margin: 0;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(240, 247, 255, 0.8);
}

.detail-tab {
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 9px 10px;
}

.detail-tab.active {
  background: #fff;
  color: #174a8e;
  box-shadow: 0 8px 20px rgba(37, 84, 150, 0.12);
}

.detail-tab-panel {
  display: none;
}

.detail-tab-panel.active {
  display: block;
}

.book-images-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 100%;
  margin-top: 0;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
  padding-bottom: 14px;
}

.book-images-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.book-images-header h2,
.book-images-header h3 {
  margin: 0;
  font-size: 20px;
}

.book-image-viewer {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  margin-bottom: 10px;
}

.book-image-large {
  display: block;
  width: 100%;
  max-height: 50vh;
  object-fit: contain;
  border-radius: 10px;
  background: #f7f9fc;
}

.book-image-thumbs {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 104px;
  max-height: 116px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 4px 8px 2px;
}

.book-image-thumb {
  flex: 0 0 88px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  padding: 6px;
  cursor: pointer;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.book-image-thumb.active {
  border-color: #5f9eff;
  background: #eaf3ff;
}

.book-image-thumb img {
  display: block;
  width: 100%;
  height: 68px;
  object-fit: cover;
  border-radius: 7px;
  margin-bottom: 5px;
}

.progress-wrap {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  padding: 10px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e8edf6;
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--brand));
  transition: width 0.3s ease;
}

.inline-options {
  gap: 10px;
}

.check-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 14px;
}

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

.mode-option {
  display: flex;
  align-items: stretch;
  cursor: pointer;
}

.mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-option span {
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.72);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.mode-option strong,
.mode-option small {
  display: block;
}

.mode-option strong {
  color: var(--text);
  font-size: 15px;
}

.mode-option small {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.mode-option input:checked + span {
  border-color: #5f9eff;
  background: linear-gradient(180deg, #eaf3ff, #ffffff);
  box-shadow: 0 8px 20px rgba(15, 106, 217, 0.14);
}

.mode-option input:focus-visible + span {
  box-shadow: 0 0 0 4px rgba(119, 167, 255, 0.2);
}

.mode-option:hover span {
  transform: translateY(-1px);
}

.quality-panel {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  padding: 10px 12px;
}

.quality-panel h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.quality-summary {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.quality-detail {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.76);
  padding: 10px;
  white-space: pre-wrap;
  max-height: 220px;
  overflow: auto;
  font-size: 12px;
}

.history-quality-panel {
  margin-top: 8px;
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(240, 247, 255, 0.85), rgba(255, 255, 255, 0.9));
}

.history-quality-panel .toolbar-select {
  min-height: 36px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.history-quality-panel .btn {
  padding: 8px 12px;
}

.quality-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.quality-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.quality-score-grid,
.quality-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.q-score-card,
.check-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 10px;
}

.q-score-label {
  color: var(--text-muted);
  font-size: 12px;
}

.check-label {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

.check-card strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.1;
}

.check-card small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

.quality-llm-scores {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.llm-score-card {
  border: 1px solid #a9c7f7;
  border-radius: 10px;
  background: linear-gradient(180deg, #eef6ff, #ffffff);
  padding: 8px;
  text-align: center;
}

.llm-score-card span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
}

.llm-score-card strong {
  display: block;
  margin-top: 4px;
  color: #19457e;
  font-size: 20px;
  line-height: 1;
}

.q-score-value {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.q-score-card.score-high {
  border-color: #7fd2b8;
  background: #eefaf5;
}

.q-score-card.score-mid {
  border-color: #ffd48b;
  background: #fff9ef;
}

.q-score-card.score-low {
  border-color: #ffb2aa;
  background: #fff3f1;
}

.quality-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.metric-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #c9d8ef;
  background: #f3f8ff;
  color: #37537d;
  font-size: 12px;
}

.metric-chip-wide {
  max-width: 100%;
}

.quality-judge {
  padding: 6px 8px;
  border-radius: 8px;
  background: #f8fbff;
  border: 1px dashed #c8d6ea;
  color: #3f5f8f;
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 6px;
}

.quality-raw-wrap {
  margin-top: 6px;
}

.quality-raw-wrap > summary {
  cursor: pointer;
  color: #3f5f8f;
  font-size: 13px;
  user-select: none;
  margin-bottom: 6px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  border-radius: 12px;
  padding: 10px 12px;
  color: #fff;
  background: #1f2c47;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}

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

.hidden {
  display: none;
}

.camera-layout {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 16px;
}

.camera-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.camera-stage {
  position: relative;
  margin-top: 16px;
  min-height: 320px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(20, 34, 58, 0.05), rgba(20, 34, 58, 0.12));
  border: 1px solid var(--border);
}

.camera-video {
  width: 100%;
  min-height: 320px;
  max-height: 68vh;
  object-fit: cover;
  display: block;
  background: #c7d4e7;
}

.camera-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  color: var(--text-muted);
  text-align: center;
}

.camera-page-box {
  position: absolute;
  border: 2px solid #53d3a5;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(12, 26, 49, 0.14);
  pointer-events: none;
}

.camera-page-box[data-kind="guide"] {
  border-style: dashed;
  border-color: #53d3a5;
}

.camera-page-box-label {
  position: absolute;
  top: -28px;
  left: 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(12, 26, 49, 0.88);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.camera-detected-box {
  position: absolute;
  border: 3px solid #ffb347;
  border-radius: 14px;
  box-shadow: 0 0 0 2px rgba(255, 179, 71, 0.25);
  pointer-events: none;
}

.camera-detected-box-label {
  background: rgba(163, 83, 23, 0.92);
}

.camera-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.camera-result-panel {
  min-height: 620px;
}

.camera-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 1024px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-visual,
  .auth-form-card {
    min-height: auto;
  }
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .camera-layout {
    grid-template-columns: 1fr;
  }

  .inline {
    flex-direction: column;
    align-items: stretch;
  }

  .book-detail-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .book-detail-cover {
    width: 100%;
    height: 180px;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .toolbar-select {
    min-width: 140px;
  }

  .quality-score-grid {
    grid-template-columns: 1fr;
  }

  .quality-checks,
  .quality-llm-scores {
    grid-template-columns: 1fr;
  }

  .history-grid {
    height: auto;
  }

  .history-panel {
    height: auto;
    overflow: visible;
  }

  .history-panel .list,
  .history-panel .story-output {
    max-height: 52vh;
    min-height: 220px;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
  }
}

@media (max-width: 640px) {
  .mode-switch {
    grid-template-columns: 1fr;
  }

  .camera-header-row,
  .camera-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .camera-toolbar {
    grid-template-columns: 1fr;
  }

  .history-panel .list,
  .history-panel .story-output {
    max-height: none;
    min-height: 220px;
    overflow: visible;
  }
}
