/* story.derekjperna.com — Story floor chrome (clean rebuild) */
body.story-app .nav-group[data-nav-group="builder"],
body.story-app .nav-group[data-nav-group="app"],
body.story-app .nav-group[data-nav-group="reference"],
body.story-app .nav-subtabs[data-nav-group="builder"],
body.story-app .nav-subtabs[data-nav-group="app"],
body.story-app .nav-subtabs[data-nav-group="reference"],
body.story-app #btn-voice-settings,
body.story-app .btn-install,
body.story-app .ui-mode-switch {
  display: none !important;
}

body.story-app .nav-group[data-nav-group="cinder"] {
  font-weight: 700;
}

body.story-app #auth-gate .auth-gate-avatar {
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(200, 140, 100, 0.35);
}

body.story-app .cinder-visit-hint {
  font-size: 0.82rem;
  color: #b8a090;
  margin: 0;
}

body.story-app .story-mode-pill.cinder-brain-pill {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(100, 140, 180, 0.18);
  border: 1px solid rgba(120, 170, 210, 0.4);
  color: #b8d4ec;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}

body.story-app .story-mode-pill.cinder-brain-pill.is-near {
  border-color: rgba(220, 170, 90, 0.55);
  color: #f0d8a8;
}

body.story-app .story-mode-pill.cinder-brain-pill.is-full {
  border-color: rgba(220, 100, 90, 0.6);
  color: #f0b0a8;
}

body.story-app .cinder-brain-meter-wrap {
  margin: 0.75rem 0 1rem;
}

body.story-app .cinder-brain-meter-label {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

body.story-app .cinder-brain-meter {
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(80, 90, 110, 0.45);
  overflow: hidden;
}

body.story-app .cinder-brain-meter-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(120, 170, 210, 0.9), rgba(180, 130, 200, 0.85));
  transition: width 0.35s ease;
}

body.story-app .cinder-brain-meter.is-near .cinder-brain-meter-fill {
  background: linear-gradient(90deg, rgba(220, 170, 90, 0.9), rgba(200, 140, 80, 0.85));
}

body.story-app .cinder-brain-meter.is-full .cinder-brain-meter-fill {
  background: linear-gradient(90deg, rgba(220, 100, 90, 0.95), rgba(180, 70, 70, 0.9));
}

body.story-app .cinder-floor-status .cinder-floor-envelope {
  margin-top: 0.35rem;
}

body.story-app .cinder-chat-chrome {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  width: 100%;
  margin-bottom: 0.15rem;
}

body.story-app .cinder-neighborhood-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  width: 100%;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.1rem;
}

body.story-app .cinder-neighborhood-label {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-right: 0.15rem;
}

body.story-app .story-mode-pill.cinder-visit-pill {
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  opacity: 0.82;
}

body.story-app .story-mode-pill.cinder-visit-pill.is-active {
  opacity: 1;
  box-shadow: 0 0 0 1px rgba(220, 160, 120, 0.55);
}

body.story-app .story-mode-pill.cinder-visit-pill.is-home {
  font-weight: 600;
  letter-spacing: 0.03em;
}

body.story-app .story-mode-pill.cinder-visit-pill.is-home.is-active {
  background: rgba(120, 150, 110, 0.28);
  box-shadow: 0 0 0 1px rgba(150, 190, 130, 0.55);
}

body.story-app .cinder-visit-pills-host {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

body.story-app .story-mode-pill.cinder-visit-pill.is-friend {
  box-shadow: 0 0 0 1px rgba(140, 180, 220, 0.45);
}

body.story-app .story-mode-pill.cinder-visit-pill.is-community {
  font-size: 0.74rem;
  opacity: 0.78;
}

body.story-app .story-mode-pill.cinder-visit-pill.is-voices {
  box-shadow: 0 0 0 1px rgba(200, 140, 160, 0.5);
  font-size: 0.74rem;
}

body.story-app.cinder-view .cinder-chat-chrome {
  display: flex;
}

body.story-app.cinder-view .cinder-chat-chrome:not([hidden]) {
  display: flex;
}

body.story-app.reader-view .cinder-chat-chrome {
  display: none !important;
}

body.story-app #panel-reader:not(.active),
body.story-app #panel-elena:not(.active),
body.story-app #panel-create:not(.active),
body.story-app #panel-community:not(.active),
body.story-app #panel-reader-setup:not(.active),
body.story-app #panel-help:not(.active) {
  display: none !important;
}

body.story-app #panel-reader.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.story-app #panel-help.active,
body.story-app #panel-reader-setup.active,
body.story-app #panel-community.active {
  display: block !important;
}

body.story-app .community-wrap {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1rem 1.1rem 2rem;
}

body.story-app .community-header {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

body.story-app .community-avatar {
  border-radius: 50%;
  flex-shrink: 0;
}

body.story-app .community-title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

body.story-app .community-lead {
  margin: 0;
  line-height: 1.45;
}

body.story-app .community-visit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.18);
  margin-bottom: 0.65rem;
}

body.story-app .community-section-label,
body.story-app .community-visit-label {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.65;
}

body.story-app .community-visit-label {
  margin-left: 0.35rem;
}

body.story-app .cinder-visit-select {
  min-width: 9.5rem;
  font-size: 0.88rem;
  padding: 0.28rem 0.5rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.35);
  color: inherit;
}

body.story-app .community-locked-line {
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

body.story-app .community-locked-note {
  opacity: 0.72;
}

body.story-app .community-scenes-panel {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.5rem;
  padding: 0.75rem 0.85rem;
  background: rgba(0, 0, 0, 0.12);
}

body.story-app .community-scenes-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-bottom: 0.45rem;
}

body.story-app .community-scenes-title {
  margin: 0;
  font-size: 1rem;
  flex: 1 1 auto;
}

body.story-app .community-scenes-hint {
  margin: 0 0 0.65rem;
}

body.story-app .community-scenes-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: min(52vh, 28rem);
  overflow-y: auto;
}

body.story-app .community-scene-card {
  padding: 0.55rem 0.65rem;
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

body.story-app .community-scene-stamp {
  display: block;
  font-size: 0.72rem;
  opacity: 0.62;
  margin-bottom: 0.35rem;
  letter-spacing: 0.03em;
}

body.story-app .cinder-visit-locked-badge {
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(220, 160, 120, 0.15);
  box-shadow: 0 0 0 1px rgba(220, 160, 120, 0.45);
  margin-right: 0.35rem;
  cursor: pointer;
}

body.story-app .cinder-visit-locked-badge.is-home {
  opacity: 0.75;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

body.story-app .chat-bubble.visitor {
  align-self: flex-start;
  border-left: 2px solid rgba(160, 200, 240, 0.55);
}

body.story-app .chat-bubble-visitor-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  opacity: 0.72;
  margin-bottom: 0.2rem;
}

/* Hard isolation — Help and Reader Setup must never show Cinder/Reader chat underneath */
body.story-app.help-view #panel-reader,
body.story-app.reader-setup-view #panel-reader,
body.story-app.help-view #panel-create,
body.story-app.reader-setup-view #panel-create,
body.story-app.help-view #panel-community,
body.story-app.reader-setup-view #panel-community,
body.story-app.help-view #panel-elena,
body.story-app.reader-setup-view #panel-elena {
  display: none !important;
}

body.story-app.help-view .reader-lens-bar-top,
body.story-app.reader-setup-view .reader-lens-bar-top {
  display: none !important;
}

/* Story floor overrides legacy style.css rule that hid Help on mobile */
body.story-app.ui-mode-mobile #panel-help.active {
  display: block !important;
}

body.story-app .reader-lens-bar-top {
  display: none;
  flex-shrink: 0;
  margin: 0 0 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius, 10px);
  border: 1px solid rgba(120, 160, 220, 0.42);
  background: rgba(120, 160, 220, 0.1);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

body.story-app.reader-view .reader-lens-bar-top {
  display: block !important;
}

body.story-app.reader-view #panel-reader .chat-wrap.story-panel-lens {
  flex: 1;
  min-height: 0;
}

body.story-app.reader-view #reader-lens-chrome,
body.story-app.reader-view #reader-attach-row:not([hidden]) {
  display: flex !important;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.75rem;
  width: 100%;
}

body.story-app.reader-view .reader-pov-toolbar {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 0.45rem;
}

body.story-app .reader-voices-panel {
  flex: 1 1 100%;
  width: 100%;
  margin: 0 0 0.35rem;
  border: 1px solid rgba(120, 160, 220, 0.35);
  border-radius: var(--radius, 10px);
  background: rgba(0, 0, 0, 0.14);
  padding: 0.45rem 0.55rem;
}

body.story-app .reader-voices-panel summary {
  cursor: pointer;
  font-weight: 600;
  color: #9ec8e8;
}

body.story-app .reader-voices-lead {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.8rem;
}

body.story-app .reader-voice-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-height: 12rem;
  overflow-y: auto;
  padding: 0.15rem 0 0.25rem;
}

body.story-app .reader-voice-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(120, 160, 220, 0.35);
  background: rgba(120, 160, 220, 0.08);
  color: #c8dce8;
  font-size: 0.76rem;
  cursor: pointer;
  line-height: 1.2;
}

body.story-app .reader-voice-pill img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

body.story-app .reader-voice-pill:hover {
  border-color: rgba(150, 190, 230, 0.55);
  background: rgba(120, 160, 220, 0.16);
}

body.story-app .reader-voice-pill.active {
  border-color: rgba(150, 200, 255, 0.75);
  background: rgba(120, 160, 220, 0.28);
  color: #e8f4ff;
  font-weight: 600;
}

body.story-app .reader-pov-select-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

body.story-app.reader-view .reader-pov-preview {
  flex: 1 1 100%;
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted, #9aa0ad);
  font-style: italic;
}

body.story-app #panel-help .help-panel {
  display: block;
}

body.story-app #panel-help .help-house-banner .btn {
  display: inline-flex;
}

body.story-app.reader-view .reader-identity-row .chat-identity-avatar,
body.story-app.reader-view #reader-compose-avatar {
  object-fit: cover;
  object-position: 50% 22%;
}

body.story-app.reader-view[data-reader-persona="woman_16_tiktok_critical"] .reader-identity-row .chat-identity-avatar,
body.story-app.reader-view[data-reader-persona="woman_16_tiktok_critical"] #reader-compose-avatar,
body.story-app.reader-view[data-reader-persona="woman_16_tiktok_critical"] .reader-voice-pill[data-reader-voice="woman_16_tiktok_critical"] img {
  object-position: 50% 18%;
  transform: scale(1.12);
  transform-origin: center center;
}

body.story-app #reader-attach-row[hidden],
body.story-app .cinder-chat-chrome[hidden] {
  display: none !important;
}

body.story-app.cinder-view .reader-lens-bar-top,
body.story-app:not(.reader-view) .reader-lens-bar-top {
  display: none !important;
}

body.story-app.reader-view .chat-wrap.story-panel-lens {
  display: flex;
  flex-direction: column;
}

body.story-app.cinder-view .chat-compose-soul {
  display: none;
}

body.story-app.cinder-view #reader-hint {
  font-style: italic;
}

/* Cinder — no thumbs, flags, or reader ticket feedback */
body.story-app.cinder-view .chat-bubble-feedback,
body.story-app.cinder-view .reader-bubble-feedback,
body.story-app.cinder-view .btn-flag-exchange {
  display: none !important;
}

/* House controls — Help panel only */
body.story-app .help-house-controls-card {
  margin-top: 0.5rem;
}

body.story-app .help-house-banner.story-action-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  padding: 0.65rem 0;
  border: none;
  margin: 0;
}

body.story-app .help-house-banner .story-action-banner-hint {
  flex: 1 1 100%;
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted, #9aa0ad);
}

body.story-app .help-house-banner .story-action-banner-hint:not([hidden]) {
  display: block;
}

body.story-app .help-house-banner .btn-banner {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.42rem 0.7rem;
  border-radius: var(--radius, 10px);
  min-height: 2rem;
  visibility: visible;
}

body.story-app .btn-banner-reconnect {
  border-color: rgba(126, 200, 227, 0.45);
  color: #9ed8f0;
}

body.story-app .btn-banner-troubleshoot {
  border-color: rgba(200, 160, 255, 0.45);
  color: #e0c8ff;
}

body.story-app .btn-banner-fix {
  border-color: rgba(255, 196, 120, 0.45);
  color: #ffd9a8;
}

body.story-app .btn-banner-turn-off-pc {
  border-color: rgba(184, 74, 74, 0.55);
  color: #f0b0a8;
  background: rgba(80, 30, 30, 0.35);
}

body.story-app .help-desktop-card {
  border-color: rgba(201, 120, 92, 0.45);
  background: linear-gradient(145deg, rgba(201, 120, 92, 0.08), transparent);
}

body.story-app .help-desktop-actions {
  margin: 0.75rem 0 0;
}

body.story-app a.btn-banner-desktop {
  display: inline-block;
  text-decoration: none;
  border-color: rgba(201, 120, 92, 0.65);
  color: #f5d4c8;
  background: rgba(92, 61, 50, 0.45);
  font-weight: 600;
}

body.story-app a.btn-banner-desktop:hover {
  background: rgba(201, 120, 92, 0.35);
  color: #fff;
}

body.story-app .btn-banner-hard-reset {
  border-color: rgba(255, 120, 100, 0.55);
  color: #ffc8b8;
}

body.story-app .btn-banner-canon {
  border-color: rgba(201, 168, 154, 0.65);
  background: rgba(201, 168, 154, 0.12);
  color: #f0ddd4;
  font-weight: 700;
}

/* Legacy floor panels — not in DOM on story site */
body.story-app #panel-chat,
body.story-app #panel-setup,
body.story-app #panel-edit,
body.story-app #panel-build,
body.story-app #panel-shutterstock,
body.story-app #panel-app-setup,
body.story-app #panel-app-builder,
body.story-app #panel-versions,
body.story-app #panel-author,
body.story-app #panel-keeps,
body.story-app #voice-panel {
  display: none !important;
}

body.story-app .chat-bubble.assistant-message .chat-bubble-body {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
}

body.story-app .chat-bubble.assistant-message .chat-bubble-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

body.story-app.cinder-create-active #panel-create {
  display: flex !important;
}

body.story-app.cinder-create-active #panel-create .create-sub-panel.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

body.story-app #panel-create .chat-identity-avatar,
body.story-app #panel-create .chat-compose-avatar,
body.story-app .chat-bubble-avatar.cinder-avatar {
  border-color: rgba(200, 140, 100, 0.55);
  animation: none;
}

/* Panel routing — Cinder Chat vs Brainstorm/Schedule vs Characters vs Readers */
body.story-app.cinder-view:not(.cinder-create-active) #panel-create {
  display: none !important;
}

body.story-app.cinder-create-active #panel-reader {
  display: none !important;
}

body.story-app.cinder-create-active #panel-elena,
body.story-app.cinder-create-active #panel-reader-setup,
body.story-app.cinder-create-active #panel-help {
  display: none !important;
}

body.story-app #panel-create.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.story-app #panel-create .create-sub-panel:not(.active) {
  display: none !important;
}

/* Auth — story floor uses victis-desktop-* (not legacy floor class names) */
body.story-app.victis-desktop-unlocked #auth-gate,
html.victis-desktop-shell body.story-app.auth-locked #auth-gate {
  display: none !important;
  pointer-events: none !important;
}

body.story-app.victis-desktop-unlocked #app-shell {
  display: block !important;
}

html.victis-desktop-shell body.story-app #btn-install-pwa {
  display: none !important;
}

/* Assistant bubbles — Cinder / Elena / Reader replies */
body.story-app .chat-bubble.assistant-message .chat-bubble-body {
  background: rgba(126, 200, 227, 0.12);
  border: 1px solid rgba(126, 200, 227, 0.35);
  border-radius: var(--radius, 10px);
  padding: 0.55rem 0.7rem;
}

body.story-app.cinder-view .chat-bubble.assistant-message .chat-bubble-body {
  background: rgba(200, 140, 100, 0.14);
  border-color: rgba(200, 140, 100, 0.4);
}

body.story-app #panel-elena .chat-bubble.assistant-message .chat-bubble-body {
  background: rgba(160, 120, 200, 0.12);
  border-color: rgba(160, 120, 200, 0.35);
}

/* Reader Setup — self-service avatar editor */
body.story-app .reader-avatars-lead {
  margin: 0.35rem 0 0.6rem;
  font-size: 0.8rem;
}

body.story-app .reader-avatar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.15rem 0 0.5rem;
}

body.story-app .reader-avatar-pick {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(120, 160, 220, 0.35);
  background: rgba(120, 160, 220, 0.08);
  color: #c8dce8;
  font-size: 0.76rem;
  cursor: pointer;
  line-height: 1.2;
}

body.story-app .reader-avatar-pick img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

body.story-app .reader-avatar-pick:hover {
  border-color: rgba(150, 190, 230, 0.55);
  background: rgba(120, 160, 220, 0.16);
}

body.story-app .reader-avatar-pick.active {
  border-color: rgba(150, 200, 255, 0.75);
  background: rgba(120, 160, 220, 0.28);
  color: #e8f4ff;
  font-weight: 600;
}

body.story-app .reader-avatar-editor {
  margin: 0.5rem 0 0.75rem;
  padding: 0.75rem;
  border: 1px solid rgba(120, 160, 220, 0.28);
  border-radius: var(--radius, 10px);
  background: rgba(8, 14, 24, 0.45);
}

body.story-app .reader-avatar-editor-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

body.story-app .reader-avatar-editor-previews {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

body.story-app .reader-avatar-editor-pill {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(150, 200, 255, 0.35);
}

body.story-app .reader-avatar-preview-note {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: #9ec8e8;
}

body.story-app .reader-avatar-preview-note.is-dirty {
  color: #ffd28a;
}

body.story-app .reader-avatar-editor-img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(150, 200, 255, 0.45);
  flex-shrink: 0;
}

body.story-app .reader-avatar-editor-title {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

body.story-app .reader-avatar-editor input[type="range"] {
  width: 100%;
  margin: 0.15rem 0 0.55rem;
}

body.story-app .reader-avatar-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

body.story-app .reader-avatar-editor-img-btn {
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  line-height: 0;
}

body.story-app .reader-avatar-editor-img-btn:hover .reader-avatar-editor-img {
  border-color: rgba(200, 230, 255, 0.85);
  box-shadow: 0 0 0 3px rgba(120, 180, 255, 0.25);
}

body.story-app .reader-avatar-advanced {
  margin-top: 0.65rem;
}

body.story-app .reader-avatar-advanced summary {
  cursor: pointer;
  margin-bottom: 0.35rem;
}

body.story-app .reader-references-panel {
  margin: 0.35rem 0 0.65rem;
  padding: 0.55rem 0.6rem 0.65rem;
  border: 1px solid rgba(120, 160, 220, 0.22);
  border-radius: var(--radius, 10px);
  background: rgba(6, 12, 22, 0.35);
}

body.story-app .reader-references-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.35rem 0 0.55rem;
}

body.story-app .reader-references-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 0.45rem;
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.1rem 0;
}

body.story-app .reader-reference-card-wrap {
  position: relative;
}

body.story-app .reader-reference-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(12, 10, 10, 0.82);
  color: #e8b4b4;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}

body.story-app .reader-reference-remove:hover {
  opacity: 1;
  background: rgba(80, 24, 24, 0.92);
  color: #fff;
}

body.story-app .reader-reference-card {
  border: 1px solid rgba(120, 160, 220, 0.28);
  border-radius: 8px;
  background: rgba(8, 14, 24, 0.55);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  color: inherit;
  font: inherit;
}

body.story-app .reader-reference-card:hover {
  border-color: rgba(150, 200, 255, 0.55);
  background: rgba(120, 160, 220, 0.12);
}

body.story-app .reader-reference-card.is-active {
  border-color: rgba(150, 200, 255, 0.85);
  box-shadow: 0 0 0 2px rgba(120, 180, 255, 0.25);
}

body.story-app .reader-reference-card.is-assigned {
  border-color: rgba(180, 220, 160, 0.45);
}

body.story-app .reader-reference-thumb-wrap {
  aspect-ratio: 1;
  background: rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

body.story-app .reader-reference-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

body.story-app .reader-reference-meta {
  padding: 0.28rem 0.35rem 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

body.story-app .reader-reference-name {
  font-size: 0.62rem;
  line-height: 1.25;
  color: #b8d4ea;
  word-break: break-all;
}

body.story-app .reader-reference-badge {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9ed4a8;
}

body.story-app .reader-crop-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

body.story-app .reader-crop-modal[hidden] {
  display: none !important;
}

body.story-app .reader-crop-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.78);
}

body.story-app .reader-crop-dialog {
  position: relative;
  width: min(100%, 22rem);
  padding: 1rem 1.1rem 1.15rem;
  border-radius: 12px;
  border: 1px solid rgba(140, 180, 230, 0.35);
  background: #0d1524;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}

body.story-app .reader-crop-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

body.story-app .reader-crop-lead {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
}

body.story-app .reader-crop-stage {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 0 auto 0.85rem;
  border-radius: 50%;
  overflow: hidden;
  background: #060a12;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

body.story-app .reader-crop-stage.is-dragging {
  cursor: grabbing;
}

body.story-app #reader-crop-canvas {
  display: block;
  width: 300px;
  height: 300px;
}

body.story-app .reader-crop-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(170, 210, 255, 0.75);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

body.story-app .reader-crop-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

body.story-app.reader-crop-open {
  overflow: hidden;
}