.background-summary { display: grid; gap: 1rem; margin-block: 1.2rem; }
.background-summary dt { font-weight: 700; margin-block-end: .25rem; }
.background-summary dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
#background-preview {
  width: min(860px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 28px 30px 24px;
  overflow-y: auto;
}
#background-preview h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.7rem, 2.1vw, 2.2rem);
  letter-spacing: -.4px;
}
#preview-content { margin-bottom: 1rem; }
.background-preview-content { display: grid; gap: 1.1rem; }
.preview-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .75rem;
}
.preview-card {
  margin: 0;
  border: 1px solid #ffffff22;
  border-radius: 8px;
  background: #121a1d;
  padding: .75rem .85rem;
}
.preview-card h3 {
  margin: 0 0 .35rem;
  font-size: .8rem;
  color: #bcc4c2;
  font-weight: 600;
}
.preview-card p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
  font-weight: 600;
  color: #f0f3f2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.preview-group {
  border: 1px solid #ffffff17;
  border-radius: 8px;
  padding: .85rem .9rem;
  background: linear-gradient(180deg, #121c20, #12181b);
}
.preview-group > h2 {
  margin: 0 0 .7rem;
  font-size: .95rem;
  letter-spacing: .2px;
  text-transform: uppercase;
  color: #c9b07e;
}
.preview-section + .preview-section {
  margin-top: .7rem;
  padding-top: .7rem;
  border-top: 1px solid #ffffff1a;
}
.preview-section h3 {
  margin: 0 0 .3rem;
  font-size: .92rem;
  font-weight: 650;
}
.preview-section p {
  margin: 0;
  color: #e2e7e6;
  font-size: .93rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.revision-list { margin-block-start: 1.5rem; }
.revision-list details { border-top: 1px solid var(--line, #52483d); padding-block: .75rem; }
.revision-list summary { cursor: pointer; }
#background-preview { overscroll-behavior: contain; }
.account-page .page-heading { margin-bottom: 1rem; }
.account-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.account-card h2 { margin-bottom: .75rem; }
.account-list { margin: 0; padding-left: 1rem; display: grid; gap: .35rem; }
.account-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .7rem; }
.passport-card {
  display: grid;
  grid-template-columns: minmax(120px, 170px) 1fr;
  gap: 1rem;
  align-items: start;
}
.passport-photo {
  width: 100%;
  max-width: 170px;
  aspect-ratio: 3 / 4;
  border-radius: .6rem;
  object-fit: cover;
  border: 1px solid var(--line, #52483d);
}
.passport-photo.placeholder {
  display: grid;
  place-items: center;
  background: #ffffff08;
  color: #ccb27e;
  font: 650 1.2rem/1 'DM Sans', sans-serif;
}
.passport-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem .9rem;
}
.passport-grid dt {
  margin: 0;
  font-size: .8rem;
  color: #a9b4b0;
}
.passport-grid dd {
  margin: 0;
  color: #f0f3f2;
  font-weight: 600;
}
.passport-story h3 {
  margin: .9rem 0 .25rem;
  font-size: .98rem;
  color: #d9c189;
}
.passport-story p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.narrative-layout { display: grid; grid-template-columns: minmax(250px, .7fr) minmax(0, 1.4fr); gap: 1rem; }
.narrative-sidebar { border-right: 1px solid var(--line, #52483d); padding-right: 1rem; }
.narrative-profiles { display: grid; gap: .5rem; max-height: 520px; overflow: auto; }
.narrative-main { display: grid; gap: 1rem; }
.narrative-main > .submission { margin: 0; }
.narrative-main details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.regulation-panel { padding: 1rem; background: linear-gradient(180deg, #131c1f, #12181b); }
.regulation-category + .regulation-category { margin-top: .75rem; }
.regulation-category > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  cursor: pointer;
  list-style: none;
  padding: .75rem .9rem;
  border: 1px solid var(--line, #52483d);
  border-radius: 8px;
  background: #11191c;
}
.regulation-category > summary::-webkit-details-marker { display: none; }
.regulation-category-title {
  font: 650 1.12rem/1.3 'DM Sans', sans-serif;
  color: #ead2a0;
}
.regulation-category-count {
  font-size: .82rem;
  color: #a6b0ad;
}
.regulation-category[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.regulation-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.regulation-category .regulation-list {
  border: 1px solid var(--line, #52483d);
  border-top: 0;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  padding: .75rem;
}
.regulation-list li {
  border: 1px solid var(--line, #52483d);
  border-radius: 8px;
  padding: .95rem 1rem;
  background: #11191c;
  display: grid;
  gap: .4rem;
}
.regulation-chip {
  display: inline-flex;
  width: fit-content;
  border: 1px solid #a0a7b155;
  color: #d7be8b;
  border-radius: 999px;
  padding: .12rem .55rem;
  font-size: .72rem;
  letter-spacing: .2px;
}
.regulation-list h3 {
  margin: 0;
  font: 650 1.03rem/1.35 'DM Sans', sans-serif;
  color: #f2f4f3;
}
.regulation-list h4 {
  margin: 0;
  font: 650 1.03rem/1.35 'DM Sans', sans-serif;
  color: #f2f4f3;
}
.regulation-list p {
  margin: 0;
  color: #c2c8c6;
  line-height: 1.65;
}
.regulation-category-editor,
.regulation-rule-editor,
.lore-editor-section {
  border: 1px solid var(--line, #52483d);
  border-radius: 6px;
  padding: .8rem .9rem;
  margin: .8rem 0;
}
@media (max-width: 640px) {
  .account-grid { grid-template-columns: 1fr; }
  .passport-card { grid-template-columns: 1fr; }
  .passport-photo { max-width: 160px; }
  .passport-grid { grid-template-columns: 1fr; }
  .narrative-layout { grid-template-columns: 1fr; }
  .narrative-sidebar { border-right: 0; border-bottom: 1px solid var(--line, #52483d); padding-right: 0; padding-bottom: 1rem; }
  #background-preview { padding: 24px 16px 16px; width: min(860px, calc(100% - 18px)); }
  .preview-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .regulation-panel { padding: .8rem; }
  .regulation-list li { padding: .85rem .8rem; }
}

/* Data di nascita del background: tre tendine e l'età risultante */
.birth-field { margin-bottom: 22px; min-width: 0; }
.birth-label { display: block; font-size: 15px; line-height: 1.65; font-weight: 500; color: #c0c7c4; }
.birth-label .muted { font-weight: 400; }
.birth-picker { display: grid; grid-template-columns: minmax(74px, .8fr) minmax(0, 1.5fr) minmax(86px, 1fr); gap: 10px; }
.birth-picker label { margin: 0; min-width: 0; font-size: 0; }
.birth-picker select { margin-top: 8px; font-size: 15px; padding-right: 30px; padding-left: 12px; background-position: right 11px center; }
.birth-age { display: block; min-height: 1.6em; margin-top: 8px; font-size: 14px; font-weight: 500; color: var(--gold); }
.birth-age.error { color: #e7a8a0; }
.birth-age.error::after { content: ' · fuori dai limiti'; }

/* Fascicoli: proposte dell'IA dal background */
.ai-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin: 0 0 1rem; padding: 14px 16px;
  border: 1px solid #c4c8cf44; border-radius: 8px; background: radial-gradient(ellipse at 0% 0%, #c4c8cf14, transparent 60%), #ffffff04; }
.ai-panel > div:first-child { flex: 1 1 280px; min-width: 0; }
.ai-panel p { margin: 4px 0 0; font-size: 14px; }
.ai-panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-panel .error:empty { display: none; }
.ai-panel .error { flex-basis: 100%; margin: 0; }
.narrative-field { display: grid; gap: 6px; margin-bottom: .8rem; }
.narrative-field > label { margin-bottom: 0; }
.ai-suggestion { padding: 10px 12px; border: 1px dashed #c4c8cf66; border-radius: 6px; background: #c4c8cf0b; }
.ai-label { font: 600 11px/1.4 'DM Sans', sans-serif; letter-spacing: 1.4px; text-transform: uppercase; color: var(--gold, #c4c8cf); }
.ai-suggestion p { margin: 4px 0 8px; font-size: 14.5px; color: #dfe3df; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-actions .button { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.ai-notice { font-size: 13px; margin: 6px 0 12px; }
