:root {
  --theme-text: #241b19;
  --theme-muted: #746560;
  --theme-background: #f7f1e7;
  --theme-background-deep: #eee2d0;
  --theme-background-glow: #fff8e9;
  --theme-panel: rgba(255, 253, 248, .92);
  --theme-panel-alt: #f4e8d4;
  --theme-accent: #6d2637;
  --theme-accent-strong: #461924;
  --theme-highlight: #b9883c;
  --theme-border: #dacbb8;
  --theme-success: #46664f;
  --theme-topbar-start: #461924;
  --theme-topbar-end: #6d2637;
  --theme-on-accent: #ffffff;
  --theme-shadow: rgba(61, 39, 29, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--theme-text);
  background: var(--theme-background);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--theme-text); background: radial-gradient(circle at 70% 0, var(--theme-background-glow) 0, var(--theme-background) 36rem); transition: color .2s ease, background .2s ease; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #ddaa54; outline-offset: 2px; }
.skip-link { position: fixed; left: 1rem; top: -6rem; z-index: 50; background: white; padding: .75rem 1rem; }
.skip-link:focus { top: 1rem; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 2rem; color: #fff; background: linear-gradient(115deg, var(--theme-topbar-start), var(--theme-topbar-end)); box-shadow: 0 4px 16px var(--theme-shadow); }
.brand { display: inline-flex; gap: .8rem; align-items: center; text-decoration: none; letter-spacing: .02em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.45); border-radius: 50%; font-family: Georgia, serif; font-size: 1.45rem; }
.brand span:last-child { display: grid; }
.brand small { opacity: .72; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; }
.user-menu { display: flex; align-items: center; gap: 1rem; }
.user-menu form { margin: 0; }
.app-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 76px); }
.sidebar { padding: 2rem 1.2rem; border-right: 1px solid var(--theme-border); background: color-mix(in srgb, var(--theme-background-deep) 78%, transparent); }
.sidebar-heading { display: flex; justify-content: space-between; align-items: center; margin: 0 .55rem 1rem; color: var(--theme-muted); text-transform: uppercase; font-size: .72rem; font-weight: 800; letter-spacing: .14em; }
.sidebar-heading a { font-size: 1.35rem; text-decoration: none; color: var(--theme-accent); }
.campaign-link { display: block; padding: .75rem .8rem; border-radius: 9px; text-decoration: none; font-weight: 650; }
.campaign-link:hover { background: var(--theme-panel); }
.main-content { padding: clamp(1.5rem, 4vw, 3.5rem); max-width: 1500px; width: 100%; }
.main-content.centered { grid-column: 1 / -1; display: grid; place-items: center; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; line-height: 1.08; }
h1 { margin: .2rem 0 .7rem; font-size: clamp(2.1rem, 4vw, 3.7rem); font-weight: 500; }
h2 { margin: .35rem 0 .6rem; font-size: 1.45rem; }
p { line-height: 1.62; }
.eyebrow { margin: 0; color: var(--theme-accent); text-transform: uppercase; letter-spacing: .16em; font-weight: 850; font-size: .72rem; }
.lede { color: var(--theme-muted); max-width: 65ch; font-size: 1.06rem; }
.muted { color: var(--theme-muted); }.small { font-size: .85rem; }
.page-header, .campaign-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; margin-bottom: 2.2rem; }
.button { display: inline-flex; justify-content: center; align-items: center; border: 1px solid transparent; border-radius: 8px; padding: .72rem 1rem; font-weight: 750; text-decoration: none; cursor: pointer; }
.button.primary { color: var(--theme-on-accent); background: var(--theme-accent); box-shadow: 0 4px 10px var(--theme-shadow); }
.button.primary:hover { background: var(--theme-accent-strong); }
.button.ghost { border-color: currentColor; color: inherit; background: transparent; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 1.2rem; }
.campaign-card, .workspace-card, .panel, .auth-card, .empty-state { border: 1px solid var(--theme-border); border-radius: 14px; background: var(--theme-panel); box-shadow: 0 16px 40px var(--theme-shadow); }
.campaign-card { padding: 1.5rem; text-decoration: none; transition: transform .16s ease, box-shadow .16s ease; }
.campaign-card:hover { transform: translateY(-2px); box-shadow: 0 18px 45px rgba(61,39,29,.16); }
.card-icon { color: var(--theme-highlight); font-size: 1.8rem; }
.card-action { color: var(--theme-accent); font-weight: 750; }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 4rem 2rem; }
.empty-icon { display: block; color: var(--theme-highlight); font-size: 3rem; }
.narrow-page { max-width: 760px; margin: 0 auto; }
.panel { padding: clamp(1.25rem, 3vw, 2rem); margin-top: 2rem; }
.stacked-form { display: grid; gap: .8rem; }
.field { display: grid; align-content: start; gap: .4rem; }
label { font-weight: 780; }
input, select, textarea { width: 100%; padding: .78rem .85rem; border: 1px solid var(--theme-border); border-radius: 8px; color: var(--theme-text); background: var(--theme-panel-alt); }
input:not([type="file"]), select { height: 2.8rem; }
textarea { resize: vertical; }
.help { margin: 0; color: var(--theme-muted); font-size: .82rem; }
.field-error, .form-error { color: #8b1f31; font-weight: 700; }
.form-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: .6rem; }
.auth-card { width: min(480px, calc(100vw - 2rem)); padding: clamp(1.5rem, 5vw, 3rem); }
.messages { margin-bottom: 1rem; }.message { border-left: 4px solid var(--theme-success); padding: .8rem 1rem; color: var(--theme-text); background: var(--theme-panel-alt); }
.mode-switcher { display: flex; gap: .3rem; padding: .3rem; border: 1px solid var(--theme-border); border-radius: 10px; background: var(--theme-panel); }
.mode-switcher button { border: 0; padding: .6rem .8rem; border-radius: 7px; color: var(--theme-muted); background: transparent; }
.mode-switcher button.active { color: var(--theme-on-accent); background: var(--theme-accent); }
.ruleset-strip { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem 1.3rem; padding: 1rem 1.2rem; border-block: 1px solid var(--theme-border); color: var(--theme-muted); }
.ruleset-strip > span { text-transform: uppercase; font-size: .68rem; letter-spacing: .13em; font-weight: 800; }
.ruleset-strip strong { color: var(--theme-text); }.ruleset-strip small { color: var(--theme-muted); font-weight: 500; }
.workspace-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 2rem; }
.workspace-card { padding: 1.4rem; }
.workspace-link { color: inherit; text-decoration: none; }
.workspace-link:hover { border-color: var(--theme-highlight); transform: translateY(-2px); }
.workspace-card.featured { grid-column: 1 / -1; padding: 2rem; background: linear-gradient(120deg, var(--theme-panel), var(--theme-panel-alt)); }
.status-chip { display: inline-block; padding: .25rem .55rem; border: 1px solid var(--theme-success); border-radius: 999px; color: var(--theme-success); background: var(--theme-panel-alt); font-size: .75rem; font-weight: 800; }
.record-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.record-card { padding: 1.4rem; border: 1px solid var(--theme-border); border-radius: 13px; color: inherit; background: var(--theme-panel); box-shadow: 0 12px 30px var(--theme-shadow); text-decoration: none; }
.record-card:hover { border-color: var(--theme-highlight); transform: translateY(-2px); }
.record-type, .visibility-chip { display: inline-block; color: var(--theme-highlight); font-size: .7rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.visibility-chip { padding: .24rem .5rem; border: 1px solid var(--theme-border); border-radius: 999px; color: var(--theme-muted); letter-spacing: .04em; text-transform: none; }
.record-editor { display: grid; grid-template-columns: minmax(0, 1fr) 330px; align-items: start; gap: 1.3rem; }
.editor-fields { display: grid; gap: 1rem; }
.editor-section { margin: 0; padding: clamp(1.1rem, 2.5vw, 1.8rem); border: 1px solid var(--theme-border); border-radius: 14px; color: var(--theme-text); background: var(--theme-panel); box-shadow: 0 10px 28px var(--theme-shadow); }
.section-heading { display: flex; gap: .9rem; align-items: flex-start; margin-bottom: 1.2rem; }
.section-heading h2, .section-heading p { margin: 0; }
.section-heading p { color: var(--theme-muted); }
.section-number { display: grid; place-items: center; flex: 0 0 2rem; width: 2rem; height: 2rem; border: 1px solid var(--theme-highlight); border-radius: 50%; color: var(--theme-highlight); font-weight: 850; }
.field-grid { display: grid; gap: 1rem; }.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.disclosure > summary { display: flex; gap: .9rem; align-items: center; cursor: pointer; list-style: none; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary span:last-child { display: grid; gap: .2rem; }
.disclosure > summary strong { font-family: Georgia, serif; font-size: 1.35rem; }
.disclosure > summary small { color: var(--theme-muted); }
.disclosure[open] > summary { margin-bottom: 1.3rem; }
.current-portrait { width: 96px; height: 96px; margin-bottom: 1rem; border: 1px solid var(--theme-border); border-radius: 12px; object-fit: cover; }
.live-preview { position: sticky; top: 1.2rem; padding: 1.4rem; border: 1px solid var(--theme-border); border-radius: 14px; background: linear-gradient(155deg, var(--theme-panel), var(--theme-panel-alt)); box-shadow: 0 16px 38px var(--theme-shadow); }
.preview-portrait { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; margin: 1rem 0; overflow: hidden; border: 1px solid var(--theme-border); border-radius: 11px; color: var(--theme-highlight); background: var(--theme-background-deep); font-size: 4rem; }
.preview-portrait img { width: 100%; height: 100%; object-fit: cover; }
.preview-byline { color: var(--theme-muted); }.preview-description { min-height: 5rem; white-space: pre-wrap; }
.preview-private { margin-top: 1rem; padding: .7rem; border: 1px dashed var(--theme-border); border-radius: 8px; color: var(--theme-muted); font-size: .76rem; }
.sticky-save { position: sticky; bottom: .8rem; display: flex; justify-content: space-between; align-items: center; z-index: 2; padding: .8rem 1rem; border: 1px solid var(--theme-border); border-radius: 11px; background: var(--theme-panel); box-shadow: 0 8px 30px var(--theme-shadow); }
.save-state { color: var(--theme-muted); font-size: .82rem; font-weight: 750; }
.header-actions { display: flex; gap: .6rem; }.header-actions form { margin: 0; }
.record-detail { display: grid; gap: 1rem; }
.record-public { display: grid; grid-template-columns: minmax(180px, 300px) minmax(0, 1fr); gap: 2rem; padding: 1.5rem; border: 1px solid var(--theme-border); border-radius: 14px; background: var(--theme-panel); }
.detail-portrait { margin: 0; }.detail-portrait img { width: 100%; aspect-ratio: 4 / 5; border-radius: 11px; object-fit: cover; }.detail-portrait figcaption { margin-top: .4rem; color: var(--theme-muted); font-size: .8rem; }
.fact-row { display: flex; flex-wrap: wrap; gap: .4rem; }.fact-row span { padding: .3rem .6rem; border: 1px solid var(--theme-border); border-radius: 999px; color: var(--theme-muted); font-size: .78rem; }
.record-prose { line-height: 1.7; white-space: pre-wrap; }
.detail-panel, .gm-panel { padding: 1.5rem; border: 1px solid var(--theme-border); border-radius: 14px; background: var(--theme-panel); }
.gm-panel { border-left: 5px solid var(--theme-highlight); }
.relationship-list { display: flex; flex-wrap: wrap; gap: .6rem; }.relationship-list a { padding: .5rem .7rem; border-radius: 8px; color: var(--theme-on-accent); background: var(--theme-accent); text-decoration: none; }
.private-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }.private-facts div { padding: .8rem; border: 1px solid var(--theme-border); border-radius: 8px; }.private-facts dt { color: var(--theme-highlight); font-weight: 800; }.private-facts dd { margin: .3rem 0 0; white-space: pre-wrap; }
.combat-summary { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-top: 1rem; padding: .8rem; border: 1px solid var(--theme-border); border-radius: 8px; }.combat-summary span { color: var(--theme-muted); }
.revision-note { color: var(--theme-muted); font-size: .76rem; }
.catalog-notice { display: flex; justify-content: space-between; gap: 1rem; margin: 0 0 1rem; padding: .9rem 1rem; border: 1px solid var(--theme-highlight); border-radius: 10px; color: var(--theme-text); background: var(--theme-panel-alt); }
.catalog-notice span { color: var(--theme-muted); }
.catalog-filters { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(130px, 1fr) minmax(160px, 1fr) 100px auto; align-items: end; gap: .8rem; padding: 1rem; border: 1px solid var(--theme-border); border-radius: 13px; background: var(--theme-panel); box-shadow: 0 10px 28px var(--theme-shadow); }
.result-count { color: var(--theme-muted); font-size: .8rem; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: .8rem; }
.catalog-card { display: flex; justify-content: space-between; gap: 1rem; min-height: 150px; padding: 1.1rem; border: 1px solid var(--theme-border); border-radius: 12px; color: inherit; background: var(--theme-panel); text-decoration: none; }
.catalog-card:hover { border-color: var(--theme-highlight); transform: translateY(-2px); }
.catalog-card h2 { margin-top: .7rem; }.catalog-card p { margin: 0; color: var(--theme-muted); }
.catalog-card dl { display: grid; align-content: start; gap: .35rem; min-width: 80px; margin: 0; }.catalog-card dl div { display: flex; justify-content: space-between; gap: .6rem; }.catalog-card dt { color: var(--theme-muted); font-size: .72rem; }.catalog-card dd { margin: 0; font-weight: 800; font-size: .82rem; }
.source-chip, .edition-badge { display: inline-block; padding: .25rem .5rem; border: 1px solid var(--theme-highlight); border-radius: 999px; color: var(--theme-accent); background: var(--theme-panel-alt); font-size: .7rem; font-weight: 850; letter-spacing: .04em; }
.source-provenance { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; margin-bottom: 1rem; }.source-provenance div { display: grid; gap: .25rem; padding: .8rem; border: 1px solid var(--theme-border); border-radius: 9px; background: var(--theme-panel); }.source-provenance span { color: var(--theme-muted); text-transform: uppercase; letter-spacing: .08em; font-size: .65rem; }
.statblock-wrap { max-width: 850px; margin: 0 auto; }
.statblock { padding: clamp(1.2rem, 3vw, 2.2rem); border: 1px solid var(--theme-highlight); border-radius: 5px 5px 18px 5px; color: var(--theme-text); background: var(--theme-panel); box-shadow: 0 18px 50px var(--theme-shadow); }
.statblock-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }.statblock-header h2 { margin-bottom: .2rem; color: var(--theme-accent); font-size: clamp(2rem, 4vw, 3rem); }.statblock-byline { margin: 0; color: var(--theme-muted); font-style: italic; }
.statblock-rule { height: 7px; margin: .8rem 0; background: linear-gradient(90deg, var(--theme-accent), var(--theme-highlight)); clip-path: polygon(0 0, 100% 0, 99% 100%, 0 100%); }.statblock-rule.thin { height: 3px; }
.statblock-core, .statblock-details { display: grid; gap: .25rem; margin: 0; }.statblock-core div, .statblock-details div { display: flex; gap: .45rem; }.statblock-core dt, .statblock-details dt { color: var(--theme-accent); font-weight: 850; }.statblock-core dd, .statblock-details dd { margin: 0; }
.ability-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .4rem; text-align: center; }.ability-grid div { display: grid; gap: .15rem; }.ability-grid strong { color: var(--theme-accent); }.ability-grid span { font-size: .86rem; }.ability-grid.compact { margin: 1rem 0; padding-block: .7rem; border-block: 2px solid var(--theme-highlight); }
.statblock-section h3, .preview-action h3 { margin: 1rem 0 .4rem; border-bottom: 2px solid var(--theme-highlight); color: var(--theme-accent); font-family: Georgia, serif; font-size: 1.55rem; }.statblock-entry { margin: 0 0 .7rem; line-height: 1.55; }
.inline-roll { display: inline; margin: 0 .08rem; padding: .02rem .2rem; border: 0; border-bottom: 1px dashed currentColor; color: var(--theme-accent); background: color-mix(in srgb, var(--theme-highlight) 15%, transparent); font-weight: 800; cursor: pointer; }.inline-roll:hover { color: var(--theme-on-accent); background: var(--theme-accent); }.roll-target { color: var(--theme-accent); font-weight: 800; }.roll-output { margin-top: 1rem; padding: .65rem .8rem; border: 1px dashed var(--theme-border); border-radius: 7px; color: var(--theme-muted); font-size: .8rem; }.roll-output.rolled { border-style: solid; border-color: var(--theme-highlight); color: var(--theme-text); background: var(--theme-panel-alt); }
.creature-detail-layout { display: grid; grid-template-columns: minmax(220px, 340px) minmax(0, 850px); justify-content: center; align-items: start; gap: 1rem; }.creature-detail-layout > .statblock-wrap:only-child { grid-column: 1 / -1; width: min(850px, 100%); }.creature-art { position: sticky; top: 1rem; margin: 0; }.creature-art img { width: 100%; max-height: 70vh; border: 1px solid var(--theme-border); border-radius: 14px; object-fit: cover; }.creature-art figcaption { color: var(--theme-muted); font-size: .8rem; }
.creature-editor { grid-template-columns: minmax(0, 1fr) 390px; }.ability-fields { display: grid; grid-template-columns: repeat(6, 1fr); gap: .6rem; }.creature-live-preview { font-family: Georgia, serif; }.creature-live-preview > h2 { color: var(--theme-accent); font-size: 2rem; }.preview-action p { max-height: 13rem; overflow: auto; white-space: pre-wrap; font-family: Inter, sans-serif; font-size: .82rem; }
.rich-source { display: none; }.rich-field { overflow: hidden; border: 1px solid var(--theme-border); border-radius: 10px; background: var(--theme-panel-alt); }.rich-field:focus-within { outline: 3px solid var(--theme-highlight); outline-offset: 2px; }
.rich-toolbar { display: flex; flex-wrap: wrap; gap: .25rem; padding: .5rem; border-bottom: 1px solid var(--theme-border); background: var(--theme-background-deep); }.rich-toolbar button { min-height: 2rem; padding: .3rem .55rem; border: 1px solid var(--theme-border); border-radius: 5px; color: var(--theme-text); background: var(--theme-panel); cursor: pointer; }.rich-toolbar button:hover, .rich-toolbar button.active { color: var(--theme-on-accent); background: var(--theme-accent); }
.rich-editor { min-height: 16rem; padding: 1rem; line-height: 1.65; outline: 0; }.rich-editor:empty::before { color: var(--theme-muted); content: "Paste or begin writing…"; pointer-events: none; }.gm-editor-section { border-left: 5px solid var(--theme-highlight); }.rich-editor table, .content-prose table, .preview-rich table { width: 100%; border-collapse: collapse; }.rich-editor th, .rich-editor td, .content-prose th, .content-prose td, .preview-rich th, .preview-rich td { padding: .45rem; border: 1px solid var(--theme-border); text-align: left; }.rich-editor img, .content-prose img, .preview-rich img { max-width: 100%; height: auto; }
.content-editor-form { grid-template-columns: minmax(0, 1fr) 360px; }.content-live-preview { max-height: calc(100vh - 2.4rem); overflow: auto; }.content-live-preview h2 { color: var(--theme-accent); font-size: 2rem; }.preview-summary { color: var(--theme-muted); font-style: italic; }.preview-rich { padding-top: .8rem; border-top: 3px solid var(--theme-highlight); line-height: 1.6; }.current-featured-image { width: min(100%, 420px); max-height: 250px; margin-bottom: 1rem; border: 1px solid var(--theme-border); border-radius: 12px; object-fit: cover; }
.content-detail { display: grid; gap: 1rem; max-width: 1050px; margin: 0 auto; }.content-hero { margin: 0; }.content-hero img { width: 100%; max-height: 520px; border: 1px solid var(--theme-border); border-radius: 16px; object-fit: cover; }.content-hero figcaption { margin-top: .4rem; color: var(--theme-muted); font-size: .8rem; }.content-prose { padding: clamp(1.2rem, 4vw, 2.5rem); border: 1px solid var(--theme-border); border-radius: 14px; background: var(--theme-panel); line-height: 1.75; }.content-prose > :first-child { margin-top: 0; }.content-prose > :last-child { margin-bottom: 0; }
@media (max-width: 1250px) { .creature-editor, .content-editor-form { grid-template-columns: 1fr; }.creature-live-preview, .content-live-preview { position: static; grid-row: 1; max-height: none; } }
@media (max-width: 850px) { .app-shell { grid-template-columns: 1fr; }.sidebar { display: none; }.workspace-grid { grid-template-columns: 1fr; }.page-header, .campaign-hero { align-items: flex-start; flex-direction: column; }.mode-switcher { width: 100%; overflow-x: auto; }.topbar { padding: 0 1rem; }.user-menu > span { display: none; } }
@media (max-width: 1050px) { .record-editor { grid-template-columns: 1fr; }.live-preview { position: static; grid-row: 1; }.field-grid.three { grid-template-columns: 1fr 1fr; }.catalog-filters { grid-template-columns: 1fr 1fr; }.source-provenance { grid-template-columns: 1fr 1fr; }.creature-detail-layout { grid-template-columns: 1fr; }.creature-art { position: static; max-width: 450px; margin: 0 auto; }.creature-detail-layout > .statblock-wrap { width: 100%; } }
@media (max-width: 650px) { .field-grid.two, .field-grid.three, .record-public, .catalog-filters, .source-provenance { grid-template-columns: 1fr; }.sticky-save { bottom: .35rem; }.ability-grid, .ability-fields { grid-template-columns: repeat(3, 1fr); }.catalog-notice { flex-direction: column; }.statblock-header { flex-direction: column-reverse; } }
