:root {
  color-scheme: dark;
  --background: #222222;
  --panel: #252525;
  --ink: #dfded7;
  --muted: #b8b6ae;
  --line: #41403c;
  --burgundy: #762631;
  --accent: #ed8e88;
  --gold: #d1b06a;
  font-family: Arial, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; }
button, select, summary { cursor: pointer; }
button, select, input { min-height: 44px; }
button { color: var(--ink); }
a { color: var(--accent); text-underline-offset: 4px; }
a:hover { color: #ffbab3; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; line-height: 1.2; }
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
.masthead { background: var(--burgundy); min-height: 112px; padding: 24px max(24px, calc((100vw - 1120px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; flex-direction: column; line-height: 1.3; color: var(--gold); }
.brand strong { font: 1.75rem Georgia, "Times New Roman", serif; font-weight: 400; }
.brand > span { font-size: .85rem; color: #e3c895; margin-top: 2px; }
.header-context { display: flex; flex-direction: column; text-align: right; font-size: .8rem; color: #e3c895; }
.demo { font-size: .7rem; margin-top: 3px; color: #e9d6c7; }
.tabs { background: linear-gradient(#1c1c1c, #111111); position: sticky; top: 0; z-index: 2; }
.tabs-inner { max-width: 1120px; margin: auto; display: grid; grid-template-columns: repeat(3, 1fr); }
.tabs button { font-size: 1rem; background: transparent; border: 0; border-left: 1px solid #252525; border-bottom: 3px solid transparent; padding: 18px 12px; min-height: 68px; }
.tabs button:last-child { border-right: 1px solid #252525; }
.tabs button[aria-pressed=true] { color: #f4e3c4; border-bottom-color: #a44d59; background: #ffffff05; }
.tabs button:hover { background: #ffffff08; }
.tabs span { font-size: .72rem; color: var(--muted); margin-left: 5px; }
main { max-width: 1168px; margin: auto; padding: 46px 24px 0; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .65rem; font-weight: 400; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 16px 0 28px; border-bottom: 1px solid var(--line); }
.page-heading p { color: var(--muted); margin-top: 12px; font-size: .9rem; }
.outline { border: 1px solid #65544d; background: transparent; color: #edc5bd; padding: 8px 18px; flex-shrink: 0; }
.outline:hover { background: #76263135; border-color: #ad6a70; }
.notice { margin: 22px 0 30px; border-left: 2px solid #9b4e5a; padding: 3px 0 3px 15px; font-size: .77rem; color: var(--muted); }
.notice strong { color: var(--ink); font-weight: 400; }
.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 48px; align-items: start; }
.profile { background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.profile-banner { display: flex; align-items: center; gap: 18px; padding: 22px 24px; border-bottom: 1px solid var(--line); background: #1d1d1d; }
.unit-mark { font: 3rem Georgia, serif; color: var(--gold); border-right: 1px solid #6d4646; line-height: 1; padding-right: 18px; }
.unit-title { display: block; color: var(--gold); font: .75rem Georgia, serif; letter-spacing: .05em; }
.tag { color: #dfc3a0; font-size: .72rem; display: block; margin-top: 4px; }
.profile-body { padding: 24px; }
.identity-label { color: var(--muted); font-size: .65rem; letter-spacing: .09em; text-transform: uppercase; }
.profile h2 { font-size: 1.85rem; margin: 10px 0 22px; overflow-wrap: anywhere; }
.real-identity { border-top: 1px solid var(--line); padding-top: 18px; }
#character-real-name { font-size: 1rem; color: var(--ink); margin-top: 7px; overflow-wrap: anywhere; }
.profile-note { font-size: .78rem; color: var(--muted); margin-top: 8px; }
dl { margin: 24px 0 16px; }
dl > div { border-top: 1px solid var(--line); padding: 12px 0; }
dt { font-size: .7rem; color: var(--muted); }
dd { font-size: .86rem; margin: 4px 0 0; overflow-wrap: anywhere; }
.profile-footer { border-top: 1px solid var(--line); padding-top: 16px; font-size: .7rem; color: var(--muted); }
.profile-footer a { display: inline-block; margin-bottom: 8px; font-size: .78rem; }
.workspace { min-width: 0; }
.view h2 { scroll-margin-top: 94px; }
.section-title { border-bottom: 1px solid var(--line); margin-bottom: 26px; padding: 0 0 20px; }
.section-title h2 { margin: 8px 0 12px; }
.section-title p { color: var(--muted); font-size: .87rem; }
.paper { border-left: 2px solid #9b4e5a; padding: 0 0 0 20px; margin-bottom: 30px; }
.paper.history { border-left-color: #776b52; }
.card-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .65rem; letter-spacing: .09em; text-transform: uppercase; }
.dot { width: 6px; height: 6px; border: 1px solid var(--gold); display: inline-block; flex-shrink: 0; }
.dot.ochre { background: #ba7a78; border-color: #ba7a78; }
.paper h3 { margin: 12px 0 16px; }
.paper p { color: #cccac2; font-size: .92rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.paper p.bio-attribution { color: var(--muted); font-size: .74rem; margin-top: 18px; line-height: 1.7; }
.text-link { background: none; border: 0; color: var(--accent); padding: 8px 0; font-size: .9rem; }
.text-link span { margin-left: 20px; }
.filter-row { display: flex; gap: 16px; align-items: center; font-size: .8rem; }
.filter-row label { color: var(--muted); }
select { border: 1px solid #53504a; border-radius: 0; background: #262626; color: var(--ink); padding: 8px 12px; max-width: 100%; }
.muted { color: var(--muted); font-size: .78rem; }
#result-count { margin: 16px 0; }
.item { border: 1px solid var(--line); margin-bottom: 12px; background: #242424; }
.item summary { list-style: none; padding: 18px; min-height: 86px; display: flex; align-items: center; gap: 16px; }
.item summary::-webkit-details-marker { display: none; }
.item summary::after { content: '+'; color: var(--accent); margin-left: auto; font-size: 1.5rem; }
.item[open] summary::after { content: '−'; }
.item summary:hover { background: #ffffff03; }
.item-number { font: 1.25rem Georgia, serif; color: var(--gold); flex-shrink: 0; }
.item-title { color: var(--accent); font-size: .95rem; }
.item-subtitle { display: block; color: var(--muted); font-size: .7rem; margin-top: 3px; }
.item-content { border-top: 1px solid var(--line); padding: 20px; font-size: .84rem; color: #cccac2; }
.item-content p { margin: 14px 0; }
.badge { display: inline-block; color: #e5cfa5; border: 1px solid #766044; background: #372d22; padding: 3px 8px; font-size: .68rem; }
.source-link { display: block; font-size: .85rem; margin: 12px 0; overflow-wrap: anywhere; }
.source-link small { display: block; color: var(--muted); font-size: .72rem; margin-top: 5px; }
.photo-placeholder { border: 1px dashed #58544a; color: var(--muted); padding: 15px; text-align: center; font-size: .75rem; margin-top: 20px; }
.source-card { border-left: 2px solid #9b4e5a; padding-left: 20px; margin-bottom: 30px; }
.source-card .eyebrow { font-size: .6rem; letter-spacing: .04em; }
.source-card h3 { margin: 10px 0; font-size: 1.45rem; overflow-wrap: anywhere; }
.source-card p { color: var(--muted); font-size: .82rem; }
.source-note { color: var(--muted); font-size: .8rem; padding-top: 18px; border-top: 1px solid var(--line); }
footer { margin-top: 44px; padding: 22px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .7rem; }
dialog { background: #242424; color: var(--ink); border: 1px solid #8b5257; border-radius: 0; padding: 28px; width: min(560px, calc(100% - 32px)); max-height: 90dvh; }
dialog::backdrop { background: #000c; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.dialog-head h2 { font-size: 1.8rem; }
.close { border: 0; background: transparent; font-size: 1.7rem; min-width: 44px; color: var(--accent); }
form label { display: block; font-size: .8rem; color: #d3cfc5; margin: 14px 0; }
form input, form textarea { width: 100%; display: block; margin-top: 6px; color: var(--ink); background: #1a1a1a; border: 1px solid #56514a; border-radius: 0; padding: 10px; }
form textarea { resize: vertical; }
.dialog-actions { margin-top: 24px; display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.primary { background: var(--burgundy); color: #fff0e7; border: 1px solid #a04e59; padding: 10px 16px; }
.primary:hover { background: #8b3440; }
.toast:not(:empty) { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 12px 20px; background: #762631; color: #fff0e7; border: 1px solid #b66c76; font-size: .8rem; }
.skip { position: absolute; top: -100px; left: 16px; background: #222; padding: 10px; z-index: 5; }
.skip:focus { top: 8px; }
@media (max-width: 760px) {
  .masthead { min-height: 96px; padding: 20px; gap: 15px; }
  .brand strong { font-size: 1.45rem; }
  .brand > span { font-size: .75rem; }
  .header-context { font-size: .65rem; max-width: 110px; }
  .demo { font-size: .6rem; }
  .tabs button { font-size: .85rem; min-height: 60px; padding: 14px 7px; }
  .tabs span { font-size: .65rem; margin-left: 2px; }
  main { padding: 30px 20px 0; }
  .page-heading { flex-direction: column; align-items: flex-start; gap: 20px; padding-bottom: 24px; }
  .page-heading p { font-size: .8rem; }
  .notice { margin: 22px 0 26px; }
  .layout { grid-template-columns: 1fr; gap: 32px; }
  .profile-banner { padding: 18px 22px; }
  .profile-body { padding: 22px; }
  .profile h2 { font-size: 1.8rem; }
  .profile dl { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
  .profile dl > div:last-child { grid-column: 1 / -1; }
  .section-title h2 { font-size: 1.8rem; }
  .paper, .source-card { padding-left: 16px; }
  .paper h3 { font-size: 1.4rem; }
  .filter-row { flex-direction: column; align-items: stretch; gap: 8px; }
  footer { flex-direction: column; gap: 5px; margin-top: 32px; }
  dialog { padding: 22px; }
}
@media (max-width: 380px) {
  .masthead { padding: 18px; gap: 12px; }
  .brand strong { font-size: 1.25rem; }
  .brand > span { font-size: .65rem; }
  .header-context { max-width: 92px; font-size: .6rem; }
  .tabs button { font-size: .76rem; padding: 12px 5px; }
  main { padding: 26px 18px 0; }
  .profile dl { grid-template-columns: 1fr; }
  .profile dl > div:last-child { grid-column: auto; }
  .profile h2 { font-size: 1.65rem; }
}
/* Personal workspace: local draft and gallery. */
.tabs-inner { grid-template-columns: repeat(4, 1fr); }
.storage-bar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: -10px 0 26px; }
.storage-bar .text-link { flex-shrink: 0; font-size: .75rem; }
.action-error:empty { display: none; }
.action-error { border: 1px solid #a75b65; padding: 12px 16px; background: #3a2528; color: #ffd0ca; font-size: .85rem; margin-bottom: 24px; }
button:disabled, input:disabled, textarea:disabled { opacity: .5; cursor: not-allowed; }
.photo-form { border: 1px solid var(--line); padding: 20px; margin-bottom: 20px; }
.photo-form label { margin-top: 0; }
.photo-form input { margin-bottom: 16px; }
input[type=file] { padding: 8px; font-size: .78rem; }
input[type=file]::file-selector-button { min-height: 38px; border: 1px solid #6f514f; margin-right: 10px; padding: 6px 12px; background: #762631; color: #fff0e7; font: inherit; cursor: pointer; }
.gallery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.gallery-card { margin: 0; min-width: 0; border: 1px solid var(--line); background: var(--panel); }
.gallery-open { display: block; width: 100%; padding: 0; border: 0; background: #161616; }
.gallery-open img { display: block; width: 100%; height: 180px; object-fit: contain; }
.gallery-card figcaption { overflow-wrap: anywhere; padding: 12px 14px 0; font-size: .85rem; }
.gallery-remove { padding: 8px 14px; font-size: .75rem; }
.empty-state { border-left: 2px solid #9b4e5a; padding: 16px 20px; color: var(--muted); font-size: .85rem; }
.photo-viewer { width: min(1000px, calc(100% - 32px)); }
.photo-viewer img { display: block; max-width: 100%; max-height: 62dvh; margin: auto; object-fit: contain; }
#photo-viewer-caption { color: var(--muted); margin-top: 18px; overflow-wrap: anywhere; }
@media(max-width:760px) {
  .tabs button { font-size: .74rem; padding: 12px 3px; }
  .tabs span { font-size: .6rem; margin-left: 1px; }
  .storage-bar { flex-direction: column; align-items: flex-start; gap: 0; }
  .photo-form { padding: 16px; }
}
@media(max-width:480px) { .gallery-grid { grid-template-columns: 1fr; } }
@media(max-width:380px) { .tabs button { font-size: .65rem; } }
.release-version { color: var(--gold); margin-bottom: 14px; }
.release-section { margin: 24px 0; padding-top: 20px; border-top: 1px solid var(--line); }
.release-section h3 { margin-bottom: 12px; font-size: 1.4rem; }
.release-section p, .release-section li { font-size: .85rem; }
.release-section p { margin-top: 12px; }
.release-section ul { margin: 0; padding-left: 20px; color: var(--muted); }
.release-section li { margin: 8px 0; }
footer .text-link { font-size: .75rem; padding: 0; min-height: 32px; }
