/* ═══════════════════════════════════════════════════════════════
   CLOTO FEATURES — Characters, Locations, AI, Feedback,
   Scheda, Export, Template Manager, Extract
   ═══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════
   SHARED MODAL (large feature modals)
   ══════════════════════════════════════════════════════════════ */

.fbw-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--cloto-z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cloto-void-a60);
  padding: var(--space-12);
}

.fbw-modal {
  background: var(--cloto-elevated-bg);
  border: 1px solid var(--cloto-glass-border-hover);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 700px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.fbw-modal .fbw-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-8) var(--space-12);
  border-bottom: 1px solid var(--cloto-glass-border);
  flex-shrink: 0;
}

.fbw-modal-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.fbw-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--cloto-text-60);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
}

.fbw-modal-close:hover {
  background: var(--cloto-teal-a6);
  color: var(--cloto-text-70);
}

.fbw-modal .fbw-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--space-12);
}

.fbw-modal .fbw-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4);
  padding: var(--space-7) var(--space-12);
  border-top: 1px solid var(--cloto-glass-border);
  flex-shrink: 0;
}

.fbw-modal-tabs-wrapper {
  display: flex;
  border-bottom: 1px solid var(--cloto-glass-border);
  padding: 0 var(--space-12);
  flex-shrink: 0;
}

/* Form Group (shared) */
.fbw-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
}

.fbw-field-hint {
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-50);
  font-style: italic;
}

.fbw-error-msg {
  color: var(--cloto-danger);
  font-size: var(--cloto-fs-sm);
  margin-top: var(--space-2);
}

/* ══════════════════════════════════════════════════════════════
   CHARACTERS
   ══════════════════════════════════════════════════════════════ */

.fbw-characters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) 0;
  margin-bottom: var(--space-6);
}

.fbw-characters-info {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.fbw-characters-count {
  font-size: var(--cloto-fs-sm);
  color: var(--cloto-text-70);
  font-family: var(--cloto-font-mono);
}

.fbw-characters-actions {
  display: flex;
  gap: var(--space-4);
}

.fbw-characters-empty {
  text-align: center;
  padding: var(--space-20) var(--space-12);
  color: var(--cloto-text-50);
  font-style: italic;
}

.fbw-characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-6);
}

/* Character Card */
.fbw-character-card {
  background: var(--cloto-surface);
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
}

.fbw-character-card:hover {
  border-color: var(--cloto-glass-border-hover);
  box-shadow: var(--shadow-md);
}

.fbw-character-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.fbw-character-photo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--cloto-glass-border);
}

.fbw-character-photo-empty {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--cloto-teal-a6);
  border: 1px solid var(--cloto-glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fbw-character-initial {
  font-family: var(--cloto-font-display);
  font-size: 20px;
  color: var(--cloto-teal);
  font-weight: 400;
}

.fbw-character-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.fbw-character-name {
  font-size: var(--cloto-fs-md);
  font-weight: 600;
  color: var(--cloto-text-100);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.fbw-character-role {
  font-size: var(--cloto-fs-xs);
  padding: 1px var(--space-4);
  border-radius: var(--radius-full);
  display: inline-flex;
  width: fit-content;
}

/* Role colors */
  .fbw-role-protagonista { color: var(--cloto-teal);
  background: var(--cloto-teal-a8); }
  .fbw-role-antagonista  { color: var(--cloto-danger);
  background: var(--cloto-danger-a8); }
  .fbw-role-mentore      { color: var(--cloto-gold);
  background: var(--cloto-gold-a8); }
  .fbw-role-alleato      { color: var(--cloto-success);
  background: var(--cloto-success-a8); }
  .fbw-role-oppositore   { color: var(--cloto-warning);
  background: var(--cloto-warning-a8); }

.fbw-character-meta {
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-25);
}

.fbw-character-brief {
  font-size: var(--cloto-fs-sm);
  color: var(--cloto-text-40);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fbw-character-card-actions {
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
}
.fbw-character-card-actions button {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-sm);
  color: var(--cloto-text-25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-spring);
}
.fbw-character-card-actions button:hover {
  background: var(--cloto-teal-a8);
  color: var(--cloto-text-70);
}
.fbw-character-card-actions .fbw-char-wizard:hover {
  background: var(--cloto-gold-a10);
  color: var(--cloto-gold);
}
.fbw-character-card-actions .fbw-char-delete:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.fbw-character-card-actions button svg {
  display: block;
}

.fbw-character-completeness {
  margin-top: var(--space-4);
}

.fbw-character-quick {
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-25);
}

/* Completeness Bar (shared) */
.fbw-completeness-bar {
  height: 4px;
  background: var(--cloto-teal-a10);
  border-radius: var(--radius-xs);
  overflow: hidden;
}

.fbw-completeness-fill {
  height: 100%;
  border-radius: var(--radius-xs);
  background: var(--cloto-teal);
  transition: width var(--duration-slow) var(--ease-spring);
}

.fbw-completeness-text,
.fbw-char-completeness-header,
.fbw-loc-completeness-header {
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-25);
  margin-bottom: var(--space-2);
}

/* Character Tabs */
.fbw-char-tabs,
.fbw-loc-tabs {
  display: flex;
  gap: var(--space-1);
  padding: 0;
}

.fbw-char-tab,
.fbw-loc-tab {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-8);
  font-size: var(--cloto-fs-sm);
  font-weight: 500;
  color: var(--cloto-text-40);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
}

.fbw-char-tab:hover,
.fbw-loc-tab:hover {
  color: var(--cloto-text-70);
}

.fbw-char-tab.is-active,
.fbw-loc-tab.is-active {
  color: var(--cloto-teal);
  border-bottom-color: var(--cloto-teal);
}

.fbw-char-tab-icon,
.fbw-loc-tab-icon {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
}
.fbw-char-tab-icon svg,
.fbw-loc-tab-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.fbw-char-tab-label,
.fbw-loc-tab-label {}

.fbw-char-panel,
.fbw-loc-panel {
  padding: var(--space-10) 0;
}

.fbw-char-panel-title,
.fbw-loc-panel-title {
  font-size: var(--cloto-fs-lg);
  font-weight: 600;
  color: var(--cloto-text-100);
  margin-bottom: var(--space-8);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.fbw-char-panel-title svg,
.fbw-loc-panel-title svg {
  flex-shrink: 0;
}

/* Photo Upload */
.fbw-photo-upload-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
}

.fbw-photo-preview,
.fbw-loc-photo-preview {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-xl);
  object-fit: cover;
  border: 2px solid var(--cloto-glass-border);
}

.fbw-photo-placeholder {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-xl);
  border: 2px dashed var(--cloto-glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cloto-text-25);
  font-size: 36px;
  background: var(--cloto-teal-a3);
}

.fbw-photo-buttons {
  display: flex;
  gap: var(--space-4);
}

/* Character/Location Wizard (modal section, not the card button) */
.fbw-wizard-modal .fbw-wizard-content {
  padding: var(--space-8) 0;
}

/* Evolution */
.fbw-evolution-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.fbw-evolution-timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.fbw-evolution-card {
  background: var(--cloto-surface-a40);
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.fbw-evolution-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-7);
  border-bottom: 1px solid var(--cloto-glass-border);
}

.fbw-evolution-card-id {
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-25);
  font-family: var(--cloto-font-mono);
}

.fbw-evolution-card-body {
  padding: var(--space-6) var(--space-7);
}

.fbw-evolution-section {
  margin-bottom: var(--space-6);
}

.fbw-evolution-content {
  font-size: var(--cloto-fs-sm);
  color: var(--cloto-text-70);
  line-height: 1.6;
}

.fbw-evolution-empty {
  text-align: center;
  padding: var(--space-12);
  color: var(--cloto-text-25);
  font-style: italic;
}

.fbw-evolution-row {
  display: flex;
  gap: var(--space-6);
  align-items: baseline;
}

.fbw-evolution-label {
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-40);
  flex-shrink: 0;
  min-width: 80px;
}

.fbw-evolution-value {
  font-size: var(--cloto-fs-sm);
  color: var(--cloto-text-70);
}

.fbw-evolution-meta {
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-25);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.fbw-evolution-meta svg {
  flex-shrink: 0;
}
.fbw-evolution-card-header svg {
  vertical-align: middle;
}

.fbw-evolution-badge {
  display: inline-flex;
  padding: 1px var(--space-3);
  font-size: var(--cloto-fs-2xs);
  border-radius: var(--radius-full);
  color: var(--cloto-gold);
  background: var(--cloto-gold-a8);
  border: 1px solid var(--cloto-gold-a12);
}

.fbw-evolution-toggle {
  cursor: pointer;
  color: var(--cloto-teal);
  font-size: var(--cloto-fs-xs);
}

/* ══════════════════════════════════════════════════════════════
   LOCATIONS
   ══════════════════════════════════════════════════════════════ */

.fbw-locations-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) 0;
  margin-bottom: var(--space-6);
}

.fbw-locations-info {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.fbw-locations-count {
  font-size: var(--cloto-fs-sm);
  color: var(--cloto-text-40);
  font-family: var(--cloto-font-mono);
}

.fbw-locations-actions {
  display: flex;
  gap: var(--space-4);
}

.fbw-locations-empty {
  text-align: center;
  padding: var(--space-20) var(--space-12);
  color: var(--cloto-text-25);
  font-style: italic;
}

.fbw-locations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-6);
}

/* Location Card */
.fbw-location-card {
  background: var(--cloto-surface);
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
}

.fbw-location-card:hover {
  border-color: var(--cloto-glass-border-hover);
  box-shadow: var(--shadow-md);
}

.fbw-location-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.fbw-location-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--cloto-teal-a6);
  border: 1px solid var(--cloto-glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.fbw-location-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.fbw-location-name {
  font-size: var(--cloto-fs-md);
  font-weight: 600;
  color: var(--cloto-text-100);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.fbw-location-type {
  font-size: var(--cloto-fs-xs);
  padding: 1px var(--space-4);
  border-radius: var(--radius-full);
  display: inline-flex;
  width: fit-content;
}

/* Location type colors */
  .fbw-tipo-interno    { color: var(--cloto-teal);
  background: var(--cloto-teal-a8); }
  .fbw-tipo-esterno    { color: var(--cloto-success);
  background: var(--cloto-success-a8); }
  .fbw-tipo-immaginario { color: var(--cloto-purple);
  background: var(--cloto-purple-a8); }
  .fbw-tipo-ibrido     { color: var(--cloto-warning);
  background: var(--cloto-warning-a8); }
  .fbw-tipo-virtuale   { color: var(--cloto-info);
  background: var(--cloto-info-a8); }

.fbw-location-photo {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
}

.fbw-location-photo-empty {
  display: none;
}

.fbw-location-brief {
  font-size: var(--cloto-fs-sm);
  color: var(--cloto-text-40);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fbw-location-meta {
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-25);
}

  .fbw-location-position { font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-25); }
  .fbw-location-emotion  { font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-25);
  font-style: italic; }

.fbw-location-card-actions {
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
}
.fbw-location-card-actions button {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-sm);
  color: var(--cloto-text-25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-spring);
}
.fbw-location-card-actions button:hover {
  background: var(--cloto-teal-a8);
  color: var(--cloto-text-70);
}
.fbw-location-card-actions .fbw-loc-wizard:hover {
  background: var(--cloto-gold-a10);
  color: var(--cloto-gold);
}
.fbw-location-card-actions .fbw-loc-delete:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.fbw-location-card-actions button svg {
  display: block;
}

.fbw-location-completeness {
  margin-top: var(--space-4);
}


/* ══════════════════════════════════════════════════════════════
   SCHEDA
   ══════════════════════════════════════════════════════════════ */

.fbw-scheda-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--cloto-z-modal);
  background: var(--cloto-void-a60);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
}

.fbw-scheda-modal {
  background: var(--cloto-surface);
  border: 1px solid var(--cloto-glass-border-hover);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: var(--space-12);
}

.fbw-scheda-empty {
  text-align: center;
  color: var(--cloto-text-25);
  font-style: italic;
}



/* ══════════════════════════════════════════════════════════════
   PROMPT TEMPLATE MANAGER (pm-*)
   ══════════════════════════════════════════════════════════════ */

.pm-layout {
  display: flex;
  height: 100%;
  min-height: 500px;
}

.pm-sidebar {
  flex: 0 0 240px;
  border-right: 1px solid var(--cloto-glass-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pm-sidebar-header {
  padding: var(--space-6) var(--space-8);
  border-bottom: 1px solid var(--cloto-glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.pm-sidebar-list {
  flex: 1 1 auto;
  overflow-y: auto;
}

.pm-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-8);
  cursor: pointer;
  border-bottom: 1px solid var(--cloto-glass-border);
  transition: background var(--duration-normal) var(--ease-spring);
}

.pm-item:hover {
  background: var(--cloto-teal-a4);
}

.pm-item.is-active {
  background: var(--cloto-teal-a8);
  border-left: 3px solid var(--cloto-teal);
}

.pm-item-name {
  font-size: var(--cloto-fs-sm);
  color: var(--cloto-text-100);
  font-weight: 500;
}

.pm-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pm-main {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--space-10);
}

.pm-edit-panel {
  padding: var(--space-8);
}

.pm-tabs {
  display: flex;
  border-bottom: 1px solid var(--cloto-glass-border);
  padding: 0 var(--space-10);
  flex-shrink: 0;
}

.pm-tab {
  padding: var(--space-5) var(--space-8);
  font-size: var(--cloto-fs-sm);
  font-weight: 500;
  color: var(--cloto-text-40);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
}

.pm-tab:hover { color: var(--cloto-text-70); }
  .pm-tab.is-active { color: var(--cloto-teal);
  border-bottom-color: var(--cloto-teal); }

.pm-editor {
  width: 100%;
  min-height: 300px;
  padding: var(--space-8);
  font-family: var(--cloto-font-mono);
  font-size: var(--cloto-fs-sm);
  line-height: 1.7;
  color: var(--cloto-text-100);
  background: var(--cloto-void-a60);
  border: 1px solid var(--cloto-teal-a12);
  border-radius: var(--radius-md);
  resize: vertical;
}

.pm-preview {
  padding: var(--space-8);
  line-height: 1.7;
  color: var(--cloto-text-70);
}

.pm-preview-section {
  margin-bottom: var(--space-8);
}

.pm-code,
.pm-code-dark,
.pm-code-light {
  font-family: var(--cloto-font-mono);
  font-size: var(--cloto-fs-sm);
  padding: var(--space-1) var(--space-3);
  background: var(--cloto-teal-a6);
  border-radius: var(--radius-xs);
  color: var(--cloto-teal);
}

.pm-footer {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-7) var(--space-10);
  border-top: 1px solid var(--cloto-glass-border);
  flex-shrink: 0;
}

/* PM Buttons */
.pm-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-7);
  font-size: var(--cloto-fs-sm);
  font-weight: 500;
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--cloto-text-70);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
}

.pm-btn:hover { border-color: var(--cloto-glass-border-hover); }

.pm-btn-primary {
  color: var(--cloto-teal);
  background: var(--cloto-teal-a8);
  border-color: var(--cloto-teal-a25);
}

.pm-btn-secondary {
  color: var(--cloto-text-40);
}

.pm-badge {
  display: inline-flex;
  padding: 1px var(--space-3);
  font-size: var(--cloto-fs-2xs);
  border-radius: var(--radius-full);
  background: var(--cloto-teal-a8);
  color: var(--cloto-teal);
}
.pm-badge-default {
  background: rgba(76, 175, 80, 0.12);
  color: #4caf50;
}
.pm-badge-custom {
  background: rgba(255, 193, 7, 0.15);
  color: #f9a825;
}
.pm-item-date {
  display: block;
  font-size: var(--cloto-fs-2xs);
  color: var(--cloto-text-30);
  margin-top: 2px;
}

/* PM Variables Panel */
.pm-vars-panel {
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: var(--space-6);
}

.pm-vars-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--cloto-surface-a40);
  cursor: pointer;
}

  .pm-vars-title { font-size: var(--cloto-fs-sm);
  font-weight: 600;
  color: var(--cloto-text-100); }
.pm-vars-icon { color: var(--cloto-text-40); }
  .pm-vars-hint { font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-25);
  font-style: italic;
  padding: var(--space-4) var(--space-6); }

.pm-vars-list {
  display: flex;
  flex-direction: column;
}

.pm-var-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--cloto-glass-border);
  cursor: pointer;
  transition: background var(--duration-normal) var(--ease-spring);
}

.pm-var-item:hover { background: var(--cloto-teal-a4); }
  .pm-var-name { font-family: var(--cloto-font-mono);
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-teal); }
  .pm-var-desc { font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-25); }
  .pm-no-vars { padding: var(--space-6);
  text-align: center;
  color: var(--cloto-text-25);
  font-style: italic; }

/* PM Modal */
.pm-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--cloto-z-modal);
  background: var(--cloto-void-a60);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm-modal-box {
  background: var(--cloto-surface);
  border: 1px solid var(--cloto-glass-border-hover);
  border-radius: var(--radius-xl);
  padding: var(--space-12);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.pm-modal {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.pm-modal-close {
  align-self: flex-end;
  background: transparent;
  border: none;
  color: var(--cloto-text-40);
  cursor: pointer;
  font-size: 18px;
}

.pm-placeholder {
  text-align: center;
  padding: var(--space-20);
  color: var(--cloto-text-25);
  font-style: italic;
}

.pm-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-20);
  color: var(--cloto-text-40);
}

.pm-error {
  color: var(--cloto-danger);
  padding: var(--space-8);
}

/* PM Test Panel */
.pm-test-panel {
  padding: var(--space-8);
  background: var(--cloto-surface-a40);
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-md);
  margin-top: var(--space-6);
}

.pm-test-result {
  padding: var(--space-6);
  background: var(--cloto-void-a60);
  border-radius: var(--radius-md);
  font-family: var(--cloto-font-mono);
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-70);
  white-space: pre-wrap;
  overflow-x: auto;
  margin-top: var(--space-4);
}




/* ══════════════════════════════════════════════════════════════
   EXPORT MODAL (MVP)
   ══════════════════════════════════════════════════════════════ */

.cloto-export-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--cloto-z-modal, 9000);
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--duration-normal, 0.2s) ease;
}
.cloto-export-overlay.is-open {
  opacity: 1;
}

.cloto-export-modal {
  background: var(--cloto-surface);
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
  width: 380px;
  max-width: 90vw;
  overflow: hidden;
  transform: translateY(8px);
  transition: transform var(--duration-normal, 0.2s) var(--ease-spring, ease);
}
.cloto-export-overlay.is-open .cloto-export-modal {
  transform: translateY(0);
}

.cloto-export-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6, 16px) var(--space-8, 20px);
  border-bottom: 1px solid var(--cloto-glass-border);
}

.cloto-export-title {
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-md, 14px);
  font-weight: 600;
  color: var(--cloto-text-100);
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloto-export-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--cloto-text-40);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--duration-fast, 0.1s) ease;
}
.cloto-export-close:hover {
  color: var(--cloto-text-70);
  background: var(--cloto-teal-a6);
}

.cloto-export-body {
  padding: var(--space-4, 12px) var(--space-6, 16px);
  display: flex;
  flex-direction: column;
  gap: var(--space-3, 8px);
}

/* ── Export card (v2 layout) ── */
.cloto-export-card {
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-md, 8px);
  padding: var(--space-5, 14px) var(--space-6, 16px);
  transition: border-color var(--duration-fast, 0.1s) ease;
}
.cloto-export-card:hover {
  border-color: var(--cloto-teal-a25);
}

.cloto-export-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-4, 12px);
  margin-bottom: var(--space-4, 12px);
}

.cloto-export-card-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}

.cloto-export-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cloto-export-card-title {
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-sm, 13px);
  font-weight: 600;
  color: var(--cloto-text-100);
}

.cloto-export-card-desc {
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-xs, 11px);
  color: var(--cloto-text-40);
}

.cloto-export-card-actions {
  display: flex;
  gap: var(--space-2, 6px);
}

.cloto-export-fmt-btn {
  flex: 1;
  padding: 8px 0;
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: var(--cloto-text-70);
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-sm, 13px);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast, 0.1s) ease;
}
.cloto-export-fmt-btn:hover:not(:disabled) {
  background: var(--cloto-teal-a6);
  border-color: var(--cloto-teal-a25);
  color: var(--cloto-text-100);
}
.cloto-export-fmt-btn:active:not(:disabled) {
  transform: scale(0.97);
}
.cloto-export-fmt-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* ── Legacy format buttons (kept for backward compat) ── */
.cloto-export-format {
  display: flex;
  align-items: center;
  gap: var(--space-5, 14px);
  padding: var(--space-5, 14px) var(--space-6, 16px);
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-md, 8px);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: all var(--duration-fast, 0.1s) ease;
  width: 100%;
}
.cloto-export-format:hover:not(:disabled) {
  background: var(--cloto-teal-a6);
  border-color: var(--cloto-teal-a25);
}
.cloto-export-format:active:not(:disabled) {
  transform: scale(0.98);
}

.cloto-export-format.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.cloto-export-format-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}

.cloto-export-format-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cloto-export-format-label {
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-sm, 13px);
  font-weight: 600;
  color: var(--cloto-text-100);
}

.cloto-export-format-desc {
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-xs, 11px);
  color: var(--cloto-text-40);
}

/* Light mode */
body.fd-light .cloto-export-modal {
  background: var(--cloto-surface);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}

/* ══════════════════════════════════════════════════════════════
   FEEDBACK MODAL (post-infusion)
   ══════════════════════════════════════════════════════════════ */

.cloto-feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--cloto-z-modal, 9000);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cloto-void-a60, rgba(0,0,0,0.6));
  opacity: 0;
  transition: opacity var(--duration-normal, 0.2s) ease;
}
.cloto-feedback-overlay.is-open {
  opacity: 1;
}

.cloto-feedback-modal {
  background: var(--cloto-surface);
  border: 1px solid var(--cloto-glass-border-hover);
  border-radius: var(--radius-xl, 16px);
  width: 92%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(12px);
  transition: transform var(--duration-normal, 0.2s) ease;
}
.cloto-feedback-overlay.is-open .cloto-feedback-modal {
  transform: translateY(0);
}

.cloto-feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6, 16px) var(--space-8, 20px);
  border-bottom: 1px solid var(--cloto-glass-border);
}

.cloto-feedback-title {
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-md, 14px);
  font-weight: 600;
  color: var(--cloto-text-100);
  margin: 0;
}

.cloto-feedback-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--cloto-text-40);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--duration-fast, 0.1s) ease;
}
.cloto-feedback-close:hover {
  color: var(--cloto-text-70);
  background: var(--cloto-teal-a6);
}

.cloto-feedback-body {
  padding: var(--space-6, 16px) var(--space-8, 20px);
  display: flex;
  flex-direction: column;
  gap: var(--space-4, 12px);
}

.cloto-feedback-question {
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-sm, 13px);
  color: var(--cloto-text-70);
  margin: 0;
  text-align: center;
}

.cloto-feedback-ratings {
  display: flex;
  justify-content: center;
  gap: var(--space-4, 12px);
}

.cloto-feedback-rating {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--space-3, 8px) var(--space-5, 14px);
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-md, 8px);
  background: transparent;
  cursor: pointer;
  transition: all var(--duration-fast, 0.1s) ease;
}
.cloto-feedback-rating:hover {
  background: var(--cloto-teal-a6);
  border-color: var(--cloto-teal-a25);
}
.cloto-feedback-rating.is-selected {
  background: var(--cloto-teal-a12, rgba(0,200,180,0.12));
  border-color: var(--cloto-teal, #00c8b4);
}

.cloto-feedback-rating-icon {
  font-size: 24px;
  line-height: 1;
}

.cloto-feedback-rating-label {
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-xs, 11px);
  color: var(--cloto-text-70);
}

.cloto-feedback-comment {
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-sm, 13px);
  color: var(--cloto-text-100);
  background: var(--cloto-surface-raised, var(--cloto-surface));
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-md, 8px);
  padding: var(--space-3, 8px) var(--space-4, 12px);
  resize: vertical;
  min-height: 60px;
  outline: none;
  transition: border-color var(--duration-fast, 0.1s) ease;
}
.cloto-feedback-comment:focus {
  border-color: var(--cloto-teal-a25);
}
.cloto-feedback-comment::placeholder {
  color: var(--cloto-text-50);
}

.cloto-feedback-email-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-xs, 11px);
  color: var(--cloto-text-40);
}

.cloto-feedback-email {
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-sm, 13px);
  color: var(--cloto-text-100);
  background: var(--cloto-surface-raised, var(--cloto-surface));
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-md, 8px);
  padding: var(--space-2, 6px) var(--space-4, 12px);
  outline: none;
  transition: border-color var(--duration-fast, 0.1s) ease;
}
.cloto-feedback-email:focus {
  border-color: var(--cloto-teal-a25);
}
.cloto-feedback-email::placeholder {
  color: var(--cloto-text-50);
}

.cloto-feedback-submit {
  align-self: flex-end;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--cloto-teal, #00c8b4);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: all var(--duration-fast, 0.1s) ease;
}
.cloto-feedback-submit:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.cloto-feedback-submit:hover:not(:disabled) {
  filter: brightness(1.1);
}

.cloto-feedback-thanks {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3, 8px);
  padding: var(--space-8, 20px) 0;
  text-align: center;
}

.cloto-feedback-thanks-icon {
  font-size: 32px;
}

.cloto-feedback-thanks-text {
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-sm, 13px);
  color: var(--cloto-text-70);
  margin: 0;
}

/* Light mode */
body.fd-light .cloto-feedback-modal {
  background: var(--cloto-surface);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}

/* ══════════════════════════════════════════
   Bible Modal
   ══════════════════════════════════════════ */
.cloto-bible-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 48px;
  opacity: 0;
  transition: opacity 0.2s ease;
  overflow-y: auto;
}
.cloto-bible-overlay.is-visible { opacity: 1; }

.cloto-bible-modal {
  background: #14121e;
  border: 1px solid var(--cloto-glass-border, rgba(255,255,255,0.08));
  border-radius: 12px;
  max-width: 720px;
  width: 95%;
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  transform: translateY(10px);
  transition: transform 0.2s ease;
  position: relative;
}
.cloto-bible-overlay.is-visible .cloto-bible-modal { transform: translateY(0); }

/* Header bar for bible modal */
.cloto-bible-modal__header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
  flex-shrink: 0;
}

.cloto-bible-modal__close {
  background: none;
  border: none;
  color: var(--cloto-text-40);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
  margin-left: 4px;
}
.cloto-bible-modal__close:hover {
  color: var(--cloto-text-70);
  background: rgba(255,255,255,0.06);
}

.cloto-bible-modal__share,
.cloto-bible-modal__export {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  font-family: var(--cloto-font-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.cloto-bible-modal__share svg,
.cloto-bible-modal__export svg { stroke: currentColor; width: 14px; height: 14px; }

.cloto-bible-modal__export {
  border: 1px solid var(--cloto-gold, #c9a84c);
  color: var(--cloto-gold, #c9a84c);
}
.cloto-bible-modal__export:hover {
  color: #d4af5c;
  border-color: #d4af5c;
  background: rgba(201, 168, 76, 0.1);
}
body.fd-light .cloto-bible-modal__export {
  color: #8a6d2b;
  border-color: #8a6d2b;
}
body.fd-light .cloto-bible-modal__export:hover {
  color: rgba(0,0,0,0.6);
  border-color: rgba(0,0,0,0.2);
  background: rgba(0,0,0,0.03);
}

.cloto-bible-modal__share {
  border: 1px solid var(--cloto-teal, #5ec6c6);
  color: var(--cloto-teal, #5ec6c6);
}
.cloto-bible-modal__share:hover {
  background: var(--cloto-teal-a12, rgba(0,210,190,0.12));
}
body.fd-light .cloto-bible-modal__share {
  color: #1D9E75;
  border-color: #1D9E75;
}

/* Share details panel */
.cloto-bible-share-details {
  padding: 12px 24px;
  border-bottom: 1px solid var(--cloto-glass-border, rgba(94,198,198,0.08));
}
.cloto-bible-share-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.cloto-bible-share-label {
  font-size: 13px;
  color: var(--cloto-text-70);
}
.cloto-bible-share-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.cloto-bible-share-switch input { opacity: 0; width: 0; height: 0; }
.cloto-bible-share-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--cloto-text-20, #333);
  border-radius: 10px;
  transition: background 0.2s;
}
.cloto-bible-share-slider::before {
  content: '';
  position: absolute;
  height: 14px; width: 14px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.cloto-bible-share-switch input:checked + .cloto-bible-share-slider {
  background: var(--cloto-teal, #5ec6c6);
}
.cloto-bible-share-switch input:checked + .cloto-bible-share-slider::before {
  transform: translateX(16px);
}
.cloto-bible-share-link {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.cloto-bible-share-url {
  flex: 1;
  background: var(--cloto-surface, #161a24);
  border: 1px solid var(--cloto-glass-border, rgba(94,198,198,0.08));
  color: var(--cloto-text-70);
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 4px;
  outline: none;
}
.cloto-bible-share-copy {
  background: var(--cloto-teal, #5ec6c6);
  color: var(--cloto-void, #0b0e15);
  border: none;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
}
.cloto-bible-share-disclaimer {
  font-size: 10px;
  color: var(--cloto-text-30, #4d5564);
  margin: 0;
  line-height: 1.4;
}
body.fd-light .cloto-bible-share-url {
  background: #f5f3ef;
  border-color: rgba(0,0,0,0.1);
  color: #333;
}
body.fd-light .cloto-bible-share-copy {
  background: #1D9E75;
  color: #fff;
}

.cloto-bible-modal__body {
  overflow-y: auto;
  padding: 20px 24px 24px;
  flex: 1;
  background: var(--fc-bg, #0d0f17);
  border-radius: 12px;
}

/* ── Dietro le quinte: minimal entity style (same as drawer) ── */
.cloto-bible-modal__body .cloto-wp__section { margin-bottom: 24px; }
.cloto-bible-modal__body .cloto-wp__label {
  font-size: 11px;
  font-family: var(--cloto-font-ui, system-ui, sans-serif);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cloto-text-40, #5c5f68);
  margin-bottom: 10px;
}
.cloto-bible-modal__body .cloto-wp__char {
  margin-bottom: 12px;
}
.cloto-bible-modal__body .cloto-wp__char-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.cloto-bible-modal__body .cloto-wp__char-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--cloto-editor-text, rgba(224,220,214,0.92));
}
body.fd-light .cloto-bible-modal__body .cloto-wp__char-name { color: #333; }
.cloto-bible-modal__body .cloto-wp__char-role {
  font-size: 12px;
  color: var(--cloto-text-40, #5c5f68);
  font-style: italic;
}
.cloto-bible-modal__body .cloto-wp__char-desc {
  font-size: 13px;
  line-height: 1.65;
  color: var(--cloto-text-60, #8a8d95);
  margin-top: 3px;
}
body.fd-light .cloto-bible-modal__body .cloto-wp__char-desc { color: #666; }
.cloto-bible-modal__body .cloto-wp__empty {
  font-size: 13px;
  color: var(--cloto-text-30, rgba(255,255,255,0.2));
  font-style: italic;
  padding: 24px 0;
  text-align: center;
}

/* ── Bible modal tabs ── */
.cw-modal-tabs {
  display: flex;
  gap: 0;
  padding: 16px 24px 0;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.cw-modal-tab {
  padding: 10px 20px;
  font-family: var(--cloto-font-ui, system-ui, sans-serif);
  font-size: 13px;
  font-weight: 500;
  color: var(--cloto-text-40, #5c5f68);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.cw-modal-tab:hover {
  color: var(--cloto-text-70, #8b949e);
}
.cw-modal-tab.is-active {
  color: var(--cloto-teal, #5ec6c6);
  border-bottom-color: var(--cloto-teal, #5ec6c6);
}

body.fd-light .cw-modal-tabs {
  border-bottom-color: rgba(0,0,0,0.1);
}
body.fd-light .cw-modal-tab {
  color: #999;
}
body.fd-light .cw-modal-tab:hover {
  color: #555;
}
body.fd-light .cw-modal-tab.is-active {
  color: #1a8a8a;
  border-bottom-color: #1a8a8a;
}

body.fd-light .cloto-bible-modal {
  background: #f8f5fa;
  border-color: var(--cloto-surface-a8, rgba(0,0,0,0.08));
}
body.fd-light .cloto-bible-modal__body {
  background: var(--fc-bg, #f2efe9);
}
body.fd-light .cloto-bible-modal__close:hover {
  background: rgba(0,0,0,0.06);
}
body.fd-light .cloto-bible-overlay {
  background: rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
  .cloto-bible-modal {
    width: 100%;
    max-width: 100%;
    border-radius: 12px 12px 0 0;
    max-height: 85vh;
  }
  .cloto-bible-modal__body {
    border-radius: 0;
  }
  .cloto-bible-overlay {
    align-items: flex-end;
    padding-top: 0;
  }
}

@media (max-width: 480px) {
  .cloto-register-gate {
    padding: 16px;
  }
  .cloto-register-gate__dialog {
    padding: 28px 20px 24px;
    max-width: 100%;
  }
}

/* ═══════════════════════════════════════════════════
   REGISTRATION GATE (anonymous → signup popup)
   ═══════════════════════════════════════════════════ */

.cloto-register-gate {
  position: fixed;
  inset: 0;
  z-index: var(--cloto-z-modal, 9000);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cloto-void-a60, rgba(0,0,0,0.6));
  padding: var(--space-8, 24px);
  overflow: hidden;
}

.cloto-register-gate__dialog {
  position: relative;
  background: var(--cloto-surface, #161822);
  border: 1px solid var(--cloto-glass-border-hover, rgba(255,255,255,0.12));
  border-radius: var(--radius-xl, 16px);
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg, 0 12px 40px rgba(0,0,0,0.4));
  text-align: center;
}

/* Celebration inside registration gate */
.cloto-register-gate__celeb-title {
  font-family: 'Cardo', Georgia, serif;
  font-size: 26px;
  font-weight: 400;
  color: var(--cloto-gold, #c9a84c);
  margin: 0 0 12px;
  line-height: 1.3;
}
.cloto-register-gate__celeb-logline {
  font-family: 'Cardo', Georgia, serif;
  font-size: 17px;
  font-style: italic;
  color: var(--cloto-text-50, #6c6f78);
  line-height: 1.6;
  margin: 0 0 24px;
  padding: 0 8px;
}
body.fd-light .cloto-register-gate__celeb-title { color: #BA7517; }
body.fd-light .cloto-register-gate__celeb-logline { color: #888; }

/* Screen 2: small story title reminder */
.cloto-register-gate__reminder {
  font-family: 'Cardo', Georgia, serif;
  font-size: 18px;
  font-style: italic;
  color: var(--cloto-gold, #c9a84c);
  margin: 0 0 16px;
  line-height: 1.3;
}
body.fd-light .cloto-register-gate__reminder { color: #BA7517; }

.cloto-register-promise {
  margin-top: 16px;
  margin-bottom: 8px;
  padding: 0 4px;
  text-align: center;
}
.cloto-register-promise__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--cloto-text-80, rgba(255,255,255,0.65));
  display: block;
  margin-bottom: 6px;
}
body.fd-light .cloto-register-promise__title { color: #555; }
.cloto-register-promise__list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
  color: var(--cloto-text-40, rgba(255,255,255,0.35));
  line-height: 1.7;
}
body.fd-light .cloto-register-promise__list { color: #888; }

.cloto-register-legal {
  font-size: 10px;
  color: var(--cloto-text-30, #4d5564);
  margin-top: 12px;
}
.cloto-register-legal a {
  color: var(--cloto-text-40, #5a6370);
}
body.fd-light .cloto-register-legal { color: #aaa; }
body.fd-light .cloto-register-legal a { color: #999; }

.cloto-register-safety {
  font-size: 9px;
  color: var(--cloto-text-20, #3d4450);
  margin-top: 8px;
  line-height: 1.4;
}
.cloto-register-safety a {
  color: var(--cloto-text-30, #4d5564);
}
body.fd-light .cloto-register-safety { color: #bbb; }
body.fd-light .cloto-register-safety a { color: #aaa; }

.cloto-register-gate__credits-hint {
  font-size: 12px;
  color: var(--cloto-gold, #c9a84c);
  text-align: center;
  margin-top: 10px;
  line-height: 1.4;
  opacity: 0.8;
}
body.fd-light .cloto-register-gate__credits-hint { color: #8a6d2b; }

.cloto-register-gate__subtitle {
  color: var(--cloto-text-2, #999);
  font-size: 14px;
  margin: 0 0 24px;
}

.cloto-register-gate__google {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  width: 100%;
}
.cloto-register-gate__google > div {
  width: 100%;
}
.cloto-register-gate__google iframe {
  border-radius: 8px;
}

.cloto-register-gate__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  color: var(--cloto-text-3, #666);
  font-size: 12px;
}
.cloto-register-gate__divider::before,
.cloto-register-gate__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--cloto-glass-border, rgba(255,255,255,0.06));
}

.cloto-register-gate__form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cloto-register-gate__form input {
  background: var(--cloto-bg, #0d0f17);
  border: 1px solid var(--cloto-glass-border, rgba(255,255,255,0.08));
  border-radius: var(--radius-md, 8px);
  padding: 10px 14px;
  color: var(--cloto-text-1, #e8e6e1);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.cloto-register-gate__form input:focus {
  border-color: var(--cloto-primary, #5ec6c6);
}
.cloto-register-gate__form input::placeholder {
  color: var(--cloto-text-50);
  font-style: normal;
}

.cloto-register-gate__error {
  color: var(--cloto-danger, #e74c3c);
  font-size: 13px;
  text-align: left;
}

.cloto-register-gate__submit {
  background: var(--cloto-primary, #5ec6c6);
  color: var(--cloto-bg, #0d0f17);
  border: none;
  border-radius: var(--radius-md, 8px);
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-top: 4px;
}
.cloto-register-gate__submit:hover { opacity: 0.85; }
.cloto-register-gate__submit:disabled { opacity: 0.5; cursor: not-allowed; }

.cloto-register-gate__close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--cloto-text-3, #666);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.cloto-register-gate__close:hover {
  color: var(--cloto-text-1, #e8e6e1);
}

.cloto-register-gate__success {
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(94, 198, 198, 0.1);
  border: 1px solid rgba(94, 198, 198, 0.2);
  border-radius: var(--radius-md, 8px);
  color: var(--cloto-primary, #5ec6c6);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.cloto-register-gate__login {
  margin-top: 16px;
  font-size: 13px;
  color: var(--cloto-text-3, #666);
}
.cloto-register-gate__login a {
  color: var(--cloto-primary, #5ec6c6);
  text-decoration: none;
}
.cloto-register-gate__login a:hover {
  text-decoration: underline;
}

/* Light theme overrides */
body.fd-light .cloto-register-gate__dialog {
  background: #fff;
  border-color: rgba(0,0,0,0.1);
}
body.fd-light .cloto-register-gate__form input {
  background: #f5f3ef;
  border-color: rgba(0,0,0,0.12);
  color: #333;
}
body.fd-light .cloto-register-gate__submit {
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   BUG REPORT MODAL
   ═══════════════════════════════════════════════════════════════ */

.cloto-bugreport-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000a;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.cloto-bugreport-overlay.is-open { opacity: 1; }

.cloto-bugreport-modal {
  background: var(--cloto-surface, #1a1c28);
  border: 1px solid var(--cloto-glass-border-hover, #2a2e3a);
  border-radius: 16px;
  width: 92%;
  max-width: 440px;
  box-shadow: 0 8px 32px #0006;
  overflow: hidden;
  transform: translateY(12px);
  transition: transform 0.2s ease;
}
.cloto-bugreport-overlay.is-open .cloto-bugreport-modal {
  transform: translateY(0);
}
body.fd-light .cloto-bugreport-modal {
  background: #fff;
  border-color: #e0e0e0;
  box-shadow: 0 8px 32px #0002;
}

.cloto-bugreport-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--cloto-glass-border, #252d3a);
}
body.fd-light .cloto-bugreport-header { border-bottom-color: #eee; }

.cloto-bugreport-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--cloto-text-100);
  margin: 0;
}

.cloto-bugreport-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--cloto-text-40);
  font-size: 18px;
  line-height: 28px;
  text-align: center;
  cursor: pointer;
}
.cloto-bugreport-close:hover { color: var(--cloto-text-70); }

.cloto-bugreport-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cloto-bugreport-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1px solid var(--cloto-text-15, #252d3a);
  border-radius: 8px;
  background: var(--cloto-glass, #12141e);
  color: var(--cloto-text-100);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}
.cloto-bugreport-textarea:focus {
  outline: none;
  border-color: var(--cloto-teal, #5ec6c6);
}
body.fd-light .cloto-bugreport-textarea {
  background: #f8f8f8;
  border-color: #ddd;
  color: #1a1c24;
}

.cloto-bugreport-context {
  padding: 10px 12px;
  background: var(--cloto-glass, #12141e);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--cloto-text-40);
  white-space: pre-line;
}
body.fd-light .cloto-bugreport-context {
  background: #f4f4f4;
  color: #888;
}

.cloto-bugreport-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.cloto-bugreport-btn {
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
}
.cloto-bugreport-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.cloto-bugreport-btn--cancel {
  background: transparent;
  border: 1px solid var(--cloto-text-25, #404858);
  color: var(--cloto-text-70);
}
.cloto-bugreport-btn--cancel:hover { border-color: var(--cloto-text-40); }
body.fd-light .cloto-bugreport-btn--cancel {
  border-color: #ccc;
  color: #555;
}

.cloto-bugreport-btn--submit {
  background: var(--cloto-teal, #5ec6c6);
  color: #0a0c14;
  font-weight: 600;
}
.cloto-bugreport-btn--submit:hover:not(:disabled) { background: #6dd6d6; }
body.fd-light .cloto-bugreport-btn--submit { color: #fff; background: #2ba8a8; }
body.fd-light .cloto-bugreport-btn--submit:hover:not(:disabled) { background: #249e9e; }

/* ── Thanks state ── */
.cloto-bugreport-thanks {
  text-align: center;
  padding: 32px 0;
}
.cloto-bugreport-thanks-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 12px;
  color: var(--cloto-teal, #5ec6c6);
}
.cloto-bugreport-thanks-text {
  font-size: 15px;
  color: var(--cloto-text-70);
  margin: 0;
}

/* ── Mobile bottom sheet ── */
.cloto-bugreport--mobile {
  align-items: flex-end;
}
.cloto-bugreport--mobile .cloto-bugreport-modal {
  width: 100%;
  max-width: 100%;
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
}
.cloto-bugreport--mobile.is-open .cloto-bugreport-modal {
  transform: translateY(0);
}
.cloto-bugreport-handle {
  display: flex;
  justify-content: center;
  padding: 10px 0 2px;
}
.cloto-bugreport-handle span {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--cloto-text-25, #404858);
}
body.fd-light .cloto-bugreport-handle span { background: #ccc; }

.cloto-bugreport--mobile .cloto-bugreport-actions {
  flex-direction: column;
}
.cloto-bugreport--mobile .cloto-bugreport-btn--submit {
  width: 100%;
  padding: 12px;
  font-size: 15px;
}
.cloto-bugreport--mobile .cloto-bugreport-btn--cancel {
  width: 100%;
  padding: 10px;
}
