.editorial-heading { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.editorial-heading h1 { margin: 0; }
.editorial-heading .site-button, .guide-document .site-button, .guide-manager a { text-decoration: none; }
.editorial-back { display: inline-block; margin-bottom: 16px; text-underline-offset: .22em; }
.editorial-empty { margin-top: 24px; padding: 24px 0; border-top: 1px solid var(--border); color: var(--muted); }
.tierboard { display: grid; gap: 10px; margin-top: 28px; }
.tier-line { display: grid; grid-template-columns: minmax(50px, 80px) minmax(0, 1fr); border: 1px solid var(--border); background: var(--surface); }
.tier-mark { margin: 0; display: grid; place-items: center; padding: 12px; background: #37352a; color: var(--text); }
.tier-mark[data-rank="S"] { background: #574130; }
.tier-mark[data-rank="A"] { background: #4b422f; }
.tier-mark[data-rank="B"] { background: #3b4432; }
.tier-mark[data-rank="C"] { background: #313e42; }
.tier-entries { display: flex; align-items: stretch; flex-wrap: wrap; gap: 8px; padding: 12px; min-width: 0; }
.tier-entries li { display: grid; align-content: start; padding: 8px 12px; background: var(--background); border: 1px solid var(--border); overflow-wrap: anywhere; max-width: 100%; }
.tier-entries span { font-size: .86rem; }
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 28px; }
.guide-card { height: 100%; display: block; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); color: var(--text); text-decoration: none; }
.guide-card:hover { border-color: var(--accent); }
.guide-cover, .guide-hero { display: block; width: 100%; object-fit: cover; aspect-ratio: 16 / 9; background: #28291f; }
.guide-cover-empty { border-bottom: 1px solid var(--border); background: #2c2c21; }
.guide-card-copy { padding: 14px 16px 18px; overflow-wrap: anywhere; }
.guide-card-copy h2 { margin: 0 0 5px; font-size: 1.2rem; }
.guide-card-copy p { margin: 0 0 8px; color: var(--muted); }
.guide-byline { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.guide-document { max-width: 50rem; }
.guide-document h1 { overflow-wrap: anywhere; }
.guide-hero { margin: 24px 0; border: 1px solid var(--border); border-radius: 8px; }
.document-body { font-size: 1.05rem; line-height: 1.65; overflow-wrap: anywhere; }
.document-body ul { padding-inline-start: 1.6em; list-style: disc; }
.document-body ol { padding-inline-start: 1.6em; }
.document-body blockquote { margin-inline: 0; padding-inline-start: 18px; border-inline-start: 3px solid var(--accent); }
.document-body pre { white-space: pre-wrap; }
.guide-document:has(.guide-sections) { max-width: 68rem; }
.guide-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 24px; }
.guide-layout:has(.guide-sections) { grid-template-columns: minmax(9rem, 12rem) minmax(0, 1fr); }
.guide-sections { display: grid; align-content: start; gap: 4px; }
.guide-sections a, .sheet-tabs a { display: flex; align-items: center; min-height: 44px; padding: 6px 12px; color: var(--muted); text-decoration: none; overflow-wrap: anywhere; }
.guide-sections a[aria-current], .sheet-tabs a[aria-current] { color: var(--text); background: var(--surface); box-shadow: inset 0 -2px var(--accent); }
.document-sheet { padding: clamp(16px, 4vw, 40px); border: 1px solid var(--border); background: var(--surface); min-width: 0; }
.document-body figure { margin: 1.2em 0; }
.document-body img { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); }
.document-body figcaption { color: var(--muted); font-size: .92rem; margin-top: .45em; }
.document-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.document-body td, .document-body th { padding: 6px 8px; border: 1px solid var(--border); }
.guide-section-tools > label:nth-child(2) { flex: 1 1 12rem; }
.sheet-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin: 18px 0; }
.worksheet-create, .worksheet-form { padding: 14px 0; border-top: 1px solid var(--border); }
.worksheet-create, .sheet-tools { align-items: end; }
.worksheet-create label, .worksheet-form label { display: grid; gap: 4px; color: var(--muted); font-size: .9rem; }
.worksheet-create input, .worksheet-create select, .worksheet-form input, .worksheet-form select {
  color: var(--text); background: var(--background); border: 1px solid var(--border);
  border-radius: 4px; padding: 6px 8px; min-height: 42px; font: inherit; max-width: 100%;
}
.worksheet-form .sheet-scroll { margin-top: 12px; }
.import-form { display: grid; gap: 16px; align-items: start; max-width: 46rem; margin-top: 22px; }
.import-form .site-button { justify-self: start; }
.import-form :is(h2, p) { margin: 0; }
.import-form label.import-confirmation { display: inline; }
.worksheet-grid td { min-width: 106px; padding: 2px; }
.worksheet-grid td input { border-color: transparent; background: transparent; }
.worksheet-grid th:first-child { width: 3ch; min-width: 3ch; text-align: center; }
.worksheet-grid td[data-active-cell] { outline: 2px solid var(--accent); outline-offset: -2px; }
.worksheet-form summary { cursor: pointer; }
.worksheet-bin-action { margin-top: 12px; }
.editor-button:disabled { opacity: .5; cursor: default; }
.public-worksheet td, .public-worksheet th { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 75px; }
.public-worksheet tbody tr:nth-child(2n) { background: var(--surface); }
.public-worksheet tbody th { background: transparent; }
[data-cell-color="amber"] { background: #4d4128 !important; }
[data-cell-color="green"] { background: #33452f !important; }
[data-cell-color="blue"] { background: #293d53 !important; }
[data-cell-color="violet"] { background: #423149 !important; }
[data-cell-color="red"] { background: #51352f !important; }
[data-cell-color="gray"] { background: #43433e !important; }
@media (max-width: 680px) {
  .guide-layout:has(.guide-sections) { grid-template-columns: minmax(0, 1fr); }
  .guide-sections { display: flex; flex-wrap: wrap; }
}
.editor-table { width: 100%; min-width: 570px; border-collapse: collapse; }
.editor-table th, .editor-table td { padding: 8px; text-align: left; border: 1px solid var(--border); }
.editor-table th { background: var(--surface); }
.sheet-scroll { overflow-x: auto; }
.editor-table input, .editor-table select, .guide-edit input:not([type="checkbox"]), .guide-edit select, .guide-edit textarea {
  font: inherit; width: 100%; min-height: 42px; padding: 8px; color: var(--text); border: 1px solid var(--border); border-radius: 4px; background: var(--background);
}
.editor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.editor-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; color: var(--muted); padding: 6px 11px; background: var(--background); border: 1px solid var(--border); border-radius: 4px; font: inherit; cursor: pointer; }
.editor-button:hover { color: var(--text); border-color: var(--accent); }
.danger { color: #ffb7a3; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-grid label, .format-tools label { display: grid; gap: 4px; color: var(--muted); }
.field-grid .remove-cover { display: flex; align-items: center; gap: 8px; }
.existing-cover { display: block; margin-top: 12px; object-fit: cover; aspect-ratio: 16 / 9; }
.document-editor { margin-top: 20px; border: 1px solid var(--border); background: var(--surface); }
.format-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 10px; border-bottom: 1px solid var(--border); }
.format-tools[hidden] { display: none; }
.format-tools label { font-size: .76rem; }
.guide-edit .format-tools input[type="color"] { cursor: pointer; }
.writing-area { min-height: 360px; padding: clamp(16px, 3vw, 36px); }
.writing-area:focus, .editorial-heading a:focus-visible, .sheet-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.guide-manager { margin-top: 24px; border-top: 1px solid var(--border); }
.guide-manager > li { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 12px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.guide-manager li > div:first-child { display: grid; }
.guide-manager .editor-actions { margin: 0; }
@media (max-width: 800px) { .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) {
  .guide-grid, .field-grid { grid-template-columns: 1fr; }
  .tier-line { grid-template-columns: 48px minmax(0, 1fr); }
}
