/* Regolamento, lore ed editor dello staff (public/content.js) */

/* ---------- intestazione comune ---------- */
.content-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.content-head .page-heading { margin-bottom: 18px; }
.content-head > .button { margin-bottom: 26px; }
.content-notice { margin: -6px 0 30px; padding: 12px 16px; border: 1px solid #c4c8cf33; border-radius: 6px; background: #c4c8cf0b; color: #d9c79f; font-size: 14px; max-width: 760px; }

/* ---------- testo formattato ---------- */
.md p { margin: 0 0 .7em; }
.md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: .4em 0 .8em; padding-left: 1.3em; display: grid; gap: .25em; }
.md blockquote { margin: .6em 0 .9em; padding: .5em 0 .5em 1em; border-left: 2px solid #c4c8cf88; color: #d9cfb8; font-style: italic; }
.md .md-heading, .prose.md .md-heading { margin: 1.1em 0 .4em; font: 600 22px/1.3 'Cormorant Garamond', Georgia, serif; color: #e2d2ae; }
.md a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.md a.rule-ref { text-decoration: none; border: 1px solid #c4c8cf55; border-radius: 4px; padding: 0 5px; font-size: .9em; }
.md strong { color: var(--text); }

/* ---------- regolamento per i player ---------- */
.reg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: -6px 0 28px; color: var(--muted); font-size: 14px; }
.reg-chip { display: inline-flex; align-items: center; border: 1px solid #ffffff22; border-radius: 30px; padding: 2px 11px; font: 500 12px/1.6 'DM Sans', sans-serif; white-space: nowrap; vertical-align: middle; }
.reg-chip.gold { color: var(--gold); border-color: #c4c8cf55; }
.reg-chip.new { color: #8bb9a0; border-color: #8bb9a055; background: #8bb9a011; }
.reg-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 36px; align-items: start; }
.reg-toc { position: sticky; top: 100px; display: grid; gap: 3px; }
.reg-search input { margin: 0 0 6px; padding: 11px 12px 11px 38px; font-size: 15px;
  background: #161a21 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='5' fill='none' stroke='%23929e9b' stroke-width='1.6'/%3E%3Cpath d='M11 11l3.5 3.5' stroke='%23929e9b' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 13px center; }
.reg-results { margin: 0 0 6px; min-height: 1.2em; font-size: 13px; color: var(--gold); }
.reg-results:empty { display: none; }
.reg-toc a { display: flex; justify-content: space-between; gap: 10px; padding: 9px 11px; border-radius: 5px; color: #c9d0cc; font-size: 15px; line-height: 1.35; }
.reg-toc a:hover { background: #ffffff08; }
.reg-toc a.on { background: #c4c8cf14; color: var(--gold); }
.reg-toc small { color: var(--muted); font-size: 12px; padding-top: 2px; }
.reg-list { min-width: 0; }
.reg-cat { display: grid; gap: 12px; margin-bottom: 34px; scroll-margin-top: 110px; }
.reg-cat h2 { margin: 0 0 4px; font: 600 30px/1.2 'Cormorant Garamond', Georgia, serif; display: flex; gap: 12px; align-items: baseline; }
.reg-cat h2 small { font: 600 13px 'DM Sans', sans-serif; color: var(--gold); letter-spacing: 1px; }
.reg-rule { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 4px 14px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 8px; background: #161a21; scroll-margin-top: 110px; }
.reg-rule:target { border-color: #c4c8cf99; box-shadow: 0 0 0 3px #c4c8cf22; }
.reg-rule.is-new { border-color: #8bb9a055; }
.reg-num { font: 600 23px/1.15 'Cormorant Garamond', Georgia, serif; color: var(--gold); }
.reg-text { min-width: 0; }
.reg-text h3 { margin: 0 0 6px; font: 600 17px/1.4 'DM Sans', sans-serif; }
.reg-text .md, .reg-text p, .reg-text li { color: #c6cecb; font-size: 15.5px; line-height: 1.65; overflow-wrap: anywhere; }
.reg-list mark { background: #c4c8cf44; color: var(--text); border-radius: 2px; padding: 0 1px; }

/* ---------- editor ---------- */
.ed-page { padding-top: 30px; }
.ed-bar { position: sticky; top: 86px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  padding: 12px 16px; margin-bottom: 18px; border: 1px solid #c4c8cf44; border-radius: 8px; background: #1b1a12f2; backdrop-filter: blur(6px); }
.ed-state { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #d8d2c0; }
.ed-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px #c4c8cf22; flex: none; }
.ed-dot.clean { background: #8bb9a0; box-shadow: 0 0 0 4px #8bb9a022; }
.ed-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ed-actions .button, .ed-tools .button { min-height: 40px; padding: 8px 14px; font-size: 13px; gap: 6px; }
.ed-actions .button:disabled { opacity: .45; cursor: not-allowed; }
.ed-alert { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 16px; padding: 12px 16px; border: 1px solid #d9dce155; border-radius: 8px; background: #c4c8cf10; }
.ed-alert p { margin: 0; color: #d9dce1; font-size: 14px; flex: 1 1 320px; }
.ed-alert div { display: flex; flex-wrap: wrap; gap: 8px; }
.ed-alert.soft { border-color: #ffffff1f; background: #ffffff06; }
.ed-alert.soft p { color: #c9d0cc; }
.ed-body { display: grid; grid-template-columns: 300px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 10px; background: #0f1719; min-height: 540px; }
.ed-outline { border-right: 1px solid var(--line); padding: 16px 12px; display: grid; align-content: start; gap: 4px; }
.ed-lbl { display: block; font: 600 11px 'DM Sans', sans-serif; letter-spacing: 1.8px; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.ed-group { display: grid; gap: 3px; margin-top: 6px; }
.ed-row { display: flex; align-items: center; gap: 8px; padding: 8px 9px; border-radius: 6px; font-size: 14px; color: #c9d0cc; cursor: pointer; border: 1px solid transparent; user-select: none; }
.ed-row:hover { background: #ffffff08; }
.ed-row:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.ed-row.on { background: #c4c8cf18; border-color: #c4c8cf55; color: var(--gold); }
.ed-cat, .ed-meta { font-weight: 600; color: var(--text); background: #ffffff06; }
.ed-item:not(.ed-section) { margin-left: 14px; }
.ed-grip { color: #5d6b68; font-size: 12px; letter-spacing: -2px; cursor: grab; }
.ed-n { color: var(--muted); font-size: 12px; min-width: 26px; font-variant-numeric: tabular-nums; }
.ed-row.on .ed-n { color: #c9ad74; }
.ed-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-badge { font-size: 11px; padding: 1px 7px; border-radius: 20px; white-space: nowrap; }
.ed-badge.add { color: #8bb9a0; background: #8bb9a01a; }
.ed-badge.mod { color: #9fb6e0; background: #9fb6e01a; }
.ed-add { margin: 2px 0 4px 14px; padding: 7px 10px; border: 1px dashed #c4c8cf55; border-radius: 6px; background: transparent; color: var(--gold); font: 13px 'DM Sans', sans-serif; text-align: center; }
.ed-add:hover { background: #c4c8cf0f; }
.ed-add-group { margin-left: 0; margin-top: 10px; }
.ed-row.dragging { opacity: .4; }
.drop-before { box-shadow: inset 0 2px 0 var(--gold); }
.ed-hint { margin: 10px 2px 0; font-size: 12px; color: var(--muted); }
.ed-pane { padding: 20px clamp(16px, 3vw, 30px) 28px; display: grid; align-content: start; gap: 16px; min-width: 0; }
.ed-crumbs-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.ed-crumbs { color: var(--muted); font-size: 14px; }
.ed-crumbs b { color: var(--text); font-weight: 600; }
.ed-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-tools .button:disabled { opacity: .35; cursor: not-allowed; }
.ed-field { display: grid; gap: 6px; margin: 0; font-size: 13px; color: #c0c7c4; font-weight: 500; }
.ed-field input, .ed-field textarea { margin: 0; font-size: 15px; }
.ed-field .muted { font-weight: 400; }
.ed-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 5px; border: 1px solid #ffffff1c; border-bottom: 0; border-radius: 6px 6px 0 0; background: #1a2427; }
.ed-toolbar button { min-height: 32px; padding: 0 9px; border: 0; border-radius: 4px; background: transparent; color: #c9d0cc; font: 500 13px 'DM Sans', sans-serif; }
.ed-toolbar button:hover, .ed-toolbar button:focus-visible { background: #ffffff12; color: var(--text); }
.ed-sep { width: 1px; margin: 5px 4px; background: #ffffff1c; }
.ed-toolbar + textarea { border-radius: 0 0 6px 6px; line-height: 1.65; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 14px; }
.ed-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ed-preview { border: 1px dashed #ffffff26; border-radius: 6px; padding: 12px 16px; color: #c6cecb; font-size: 15px; line-height: 1.65; min-width: 0; overflow-wrap: anywhere; }
.ed-undo { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 6px; background: #263230; border: 1px solid #c4c8cf44; font-size: 14px; }
.ed-undo button { border: 0; background: transparent; color: var(--gold); font: 600 14px 'DM Sans', sans-serif; }
#ed-publish { width: min(560px, calc(100% - 32px)); }
#ed-publish h2, #ed-exit h2 { font-size: 32px; }
.ed-diff { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.ed-diff li { padding: 7px 10px; border-radius: 5px; background: #ffffff06; border-left: 3px solid #9fb6e0; font-size: 14px; }
.ed-diff li.add { border-left-color: #8bb9a0; }
.ed-diff li.del { border-left-color: #d3988f; }
.ed-check { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 14px; color: var(--text); }
.ed-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--gold); }
.ed-previewing .ed-bar { margin-bottom: 30px; }

@media (max-width: 900px) {
  .reg-layout { grid-template-columns: 1fr; gap: 20px; }
  .reg-toc { position: static; }
  .ed-body { grid-template-columns: 1fr; }
  .ed-outline { border-right: 0; border-bottom: 1px solid var(--line); }
  .ed-split { grid-template-columns: 1fr; }
  .ed-bar { top: 76px; }
}
@media (max-width: 560px) {
  .reg-rule { grid-template-columns: 40px minmax(0, 1fr); padding: 16px; }
  .reg-num { font-size: 20px; }
  .content-head > .button { margin-bottom: 18px; }
}
