html[data-design="red"] {
    color-scheme: dark;
    background: #100609;
    --bg: #b7051e;
    --text: #efd8ce;
    --text-soft: #efd8ce;
    --text-dim: #efd8ce;
    --title: #efd8ce;
    --accent: #efd8ce;
    --accent-bright: #efd8ce;
    --accent-dim: #efd8ce;
    --meta: #efd8ce;
    --rule: #efd8ce66;
    --rule-soft: #efd8ce33;
    --link-rule: #efd8ce66;
    --code-bg: #97071c;
    --panel-bg: #97071c;
    --danger: #efd8ce;
    --red-pad: clamp(1.25rem, 4vw, 4rem);
}

[data-design="red"] body { overflow-wrap: anywhere; }
[data-design="red"] ::selection { color: #b7051e; background: #efd8ce; }
[data-design="red"] :focus-visible { outline: 2px solid #efd8ce; outline-offset: 4px; }
[data-design-toggle], [data-theme-toggle], .design-toolbar, .home-toolbar, .home-object, .home-design-switch { display: none !important; }

/* Every content page uses the same shell, navigation and heading. */
html[data-design="red"]:has(body > #main) {
    --frame: 16px;
    --page-pad: clamp(1.25rem, 3vw, 3rem);
    --page-width: 46rem;
    scrollbar-gutter: stable;
    overflow-x: clip;
    scroll-padding-block: calc(var(--frame) + 1rem);
}
[data-design="red"] body:has(> #main) {
    max-width: none;
    min-height: 100svh;
    margin: 0;
    padding: calc(var(--frame) + var(--page-pad));
    background: #b7051e;
}
[data-design="red"] body:has(> #main)::after {
    content: "";
    position: fixed;
    inset: 0;
    width: 100vw;
    box-sizing: border-box;
    z-index: 100;
    border: var(--frame) solid #100609;
    pointer-events: none;
}
[data-design="red"] #main,
[data-design="red"] body:has(> #main) > .site-footer {
    width: 100%;
    max-width: var(--page-width);
    margin-inline: auto;
}
[data-design="red"] #main :is(a, [id]) { scroll-margin-block: calc(var(--frame) + 1rem); }
[data-design="red"] .site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 2rem;
    margin: 0;
    font-size: .8rem;
    line-height: 1.5;
}
[data-design="red"] .site-nav a { display: inline-flex; align-items: center; min-height: 2rem; border: 0; }
[data-design="red"] .section-links { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; }
[data-design="red"] .site-nav a:hover,
[data-design="red"] .site-nav [aria-current] { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .3em; }
[data-design="red"] .page-heading { margin: 3rem 0; }
[data-design="red"] .page-heading h1 {
    margin: 0;
    color: var(--text);
    font: 400 clamp(1.8rem, 3.2vw, 3rem)/1.3 'Typewriter', monospace;
    letter-spacing: -.04em;
    overflow-wrap: anywhere;
    text-wrap: balance;
}
[data-design="red"] .page-heading > p { margin: .75rem 0 0; font-size: .86rem; line-height: 1.6; }
[data-design="red"] .page-heading + hr { display: none; }
[data-design="red"] .home-alias { display: inline-block; margin-left: .7rem; font-size: .9rem; letter-spacing: 0; }
[data-design="red"] #main > hr { border: 0; margin: 2.5rem 0; }
[data-design="red"] #main > .index-group { display: block; margin: 2.5rem 0 0; }
[data-design="red"] .page-heading + .index-group { margin-top: 0 !important; }
[data-design="red"] .index-group > .section-title { margin: 0 0 1rem; }
[data-design="red"] .index-entries { min-width: 0; }
[data-design="red"] .index-entries > :last-child { margin-bottom: 0; }
[data-design="red"] :is(.index-entries, .project-list, .home-nav) > :is(.post, .game) { margin: 0; padding: 0 0 1.8rem; }
[data-design="red"] :is(.index-entries, .project-list, .home-nav) > :last-child { padding-bottom: 0; }
[data-design="red"] #main :is(.post-title, .game-title) {
    display: block;
    width: fit-content;
    max-width: 100%;
    border: 0;
    font-size: clamp(1.3rem, 2.1vw, 1.65rem);
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: -.04em;
    text-decoration: none;
}
[data-design="red"] #main :is(.post-title, .game-title):hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
[data-design="red"] .index-entries :is(.game-meta, .post-meta) { display: block; margin-top: .3rem; font-size: .78rem; }
[data-design="red"] #main :is(.game-desc, .post-desc) { display: block; font-size: .92rem; line-height: 1.6; margin: .45rem 0 0; }
[data-design="red"] .project-list { margin: 0; }
[data-design="red"] .index-aside { margin-top: 1.8rem; font-size: .86rem; }
[data-design="red"] .page-about .index-entries ul { margin: 0; }
[data-design="red"] .page-post strong { font-weight: 700; }
[data-design="red"] .archive-list { columns: 2; column-gap: 3rem; }
[data-design="red"] .archive-list > li { break-inside: avoid; }
[data-design="red"] .site-footer { margin-top: 3rem !important; }
[data-design="red"] .site-footer:not(:has(.footer)) { display: none; }

[data-design="red"] body.page-home { background: linear-gradient(180deg, #b7051e 0%, #b7051e 78%, #b1051e 86%, #9e001a 100%); }
[data-design="red"] .page-home #main { display: flex; flex-direction: column; min-height: calc(100svh - (var(--frame) + var(--page-pad)) * 2); }
[data-design="red"] .page-home .home-nav { display: block; flex: none; margin: 0; padding: 0; }
[data-design="red"] .page-home .home-contact { margin-top: auto; padding-top: 4rem; }
[data-design="red"] .page-home .home-contact ul { display: flex; flex-wrap: wrap; gap: .3rem 2rem; margin: 0; padding: 0; list-style: none; font-size: .8rem; }
[data-design="red"] .page-home .home-contact li { margin: 0; }
[data-design="red"] .page-home .home-contact li:first-child { flex-basis: 100%; }
[data-design="red"] .page-home .home-contact li::before { content: none; }
[data-design="red"] .page-home #main > hr,
[data-design="red"] .page-home .site-footer,
[data-design="red"] .page-home .home-nav .section-title,
[data-design="red"] .page-home .home-contact .section-title { display: none; }
@media (max-width: 700px) {
    html[data-design="red"]:has(body > #main) { --frame: 8px; scrollbar-gutter: auto; }
    [data-design="red"] .page-heading { margin-block: 2rem; }
    [data-design="red"] .archive-list { columns: 1; }
    [data-design="red"] .page-home .home-contact ul { flex-direction: column; }
}

/* The table retains its betting colours and all game controls. */
[data-design="red"]:has(.page-craps) {
    --surface: #97071c;
    --surface-2: #97071c;
    --surface-3: #790719;
    --muted: #efd8ce;
    --soft: #efd8ce;
    --line: #efd8ce33;
    --line-2: #efd8ce66;
}
[data-design="red"] .page-craps { background: #b7051e; }
html:not([data-design="red"]) .page-craps .design-red { color: #fa8a95; }

/* Forgejo keeps its own layouts and semantic status colours. */
html[data-design="red"]:has([data-korze-code]) {
  color-scheme: dark;
  --bg: #b7051e;
  --text: #efd8ce;
  --text-soft: #efd8ce;
  --text-dim: #efd8ce;
  --title: #efd8ce;
  --accent: #efd8ce;
  --accent-bright: #efd8ce;
  --accent-dim: #efd8ce;
  --meta: #efd8ce;
  --rule: #efd8ce66;
  --rule-soft: #efd8ce2e;
  --link-rule: #efd8ce66;
  --code-bg: #191010;
  --panel-bg: #97071c;
  --korze-bg: #b7051e;
  --korze-text: #efd8ce;
  --korze-soft: #efd8ce;
  --korze-dim: #efd8ce;
  --korze-title: #efd8ce;
  --korze-accent: #efd8ce;
  --korze-bright: #efd8ce;
  --korze-rule: #efd8ce66;
  --korze-rule-soft: #efd8ce2e;
  --korze-code: #191010;
  --korze-panel: #97071c;
  --color-primary: #efd8ce !important;
  --color-primary-hover: #efd8ce !important;
  --color-primary-active: #efd8ce !important;
  --color-primary-contrast: #191010 !important;
  --color-primary-alpha-10: #efd8ce1a !important;
  --color-primary-alpha-20: #efd8ce33 !important;
  --color-accent: #efd8ce !important;
  --color-body: #b7051e !important;
  --color-box-header: #97071c !important;
  --color-box-body: #b7051e !important;
  --color-box-body-highlight: #97071c !important;
  --color-text: #efd8ce !important;
  --color-text-dark: #efd8ce !important;
  --color-text-light: #efd8ce !important;
  --color-text-light-1: #efd8ce !important;
  --color-text-light-2: #efd8ce !important;
  --color-text-light-3: #efd8ce !important;
  --color-nav-bg: #b7051e !important;
  --color-secondary-nav-bg: #b7051e !important;
  --color-nav-hover-bg: #97071c !important;
  --color-menu: #97071c !important;
  --color-card: #b7051e !important;
  --color-input-background: #97071c !important;
  --color-input-text: #efd8ce !important;
  --color-input-border: #efd8ce66 !important;
  --color-input-border-hover: #efd8ce !important;
  --color-placeholder-text: #efd8ce !important;
  --color-button: #97071c !important;
  --color-secondary: #efd8ce66 !important;
  --color-secondary-bg: #97071c !important;
  --color-secondary-hover: #efd8ce !important;
  --color-secondary-active: #efd8ce !important;
  --color-light: #97071c !important;
  --color-light-border: #efd8ce66 !important;
  --color-hover: #97071c !important;
  --color-active: #790719 !important;
  --color-header-wrapper: #97071c !important;
  --color-header-wrapper-transparent: #97071ce6 !important;
  --color-label-bg: #97071c !important;
  --color-label-bg-alt: #97071c !important;
  --color-label-hover-bg: #790719 !important;
  --color-label-active-bg: #790719 !important;
  --color-label-text: #efd8ce !important;
  --color-markup-code-block: #191010 !important;
  --color-markup-code-inline: #191010 !important;
  --color-markup-table-row: #97071c !important;
  --color-code-bg: #191010 !important;
  --color-editor-line-highlight: #392323 !important;
  --color-highlight-bg: #5c4415 !important;
  --color-highlight-fg: #efd8ce !important;
  --color-selection-bg: #efd8ce !important;
  --color-selection-fg: #191010 !important;
  --color-small-accent: #efd8ce66 !important;
  --color-timeline: #efd8ce66 !important;
  --color-shadow: transparent !important;
  --color-tooltip-bg: #191010 !important;
  --color-tooltip-text: #efd8ce !important;
  --color-success-bg: #17291b !important;
  --color-success-border: #72a780 !important;
  --color-success-text: #c3e1c2 !important;
  --color-info-bg: #15282c !important;
  --color-info-border: #73a9b2 !important;
  --color-info-text: #c1e2e7 !important;
  --color-warning-bg: #332713 !important;
  --color-warning-border: #b79a5f !important;
  --color-warning-text: #eedba7 !important;
  --color-error-bg: #361b1b !important;
  --color-error-border: #c08787 !important;
  --color-error-text: #f7c1bb !important;
  --color-danger-bg: #361b1b !important;
  --color-diff-added-row-bg: #17291b !important;
  --color-diff-added-row-border: #72a780 !important;
  --color-diff-added-word-bg: #26452c !important;
  --color-diff-removed-row-bg: #361b1b !important;
  --color-diff-removed-row-border: #c08787 !important;
  --color-diff-removed-word-bg: #683737 !important;
  --color-diff-moved-row-bg: #332713 !important;
  --color-diff-moved-row-border: #b79a5f !important;
}

html[data-design="red"] [data-korze-code] {
  align-items: center;
  flex-wrap: wrap;
  padding: 1.25rem clamp(1rem, 4vw, 3rem) 2.5rem;
}

html[data-design="red"]:has([data-korze-code]) body {
  font-family: Typewriter, ui-monospace, monospace !important;
}

html[data-design="red"]:has([data-korze-code]) .page-content {
  padding-bottom: 4rem;
}

html[data-design="red"]:has([data-korze-code]) .page-content h1,
html[data-design="red"]:has([data-korze-code]) .page-content h2,
html[data-design="red"]:has([data-korze-code]) .page-content h3,
html[data-design="red"]:has([data-korze-code]) .page-content h4 {
  letter-spacing: 0 !important;
}

html[data-design="red"]:has([data-korze-code]) .repository .repo-header {
  padding-block: 1rem;
}

html[data-design="red"]:has([data-korze-code]) .profile .flex-item-title .name {
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

html[data-design="red"]:has([data-korze-code]) .profile .flex-item {
  padding-block: 1.5rem;
}

html[data-design="red"]:has([data-korze-code]) .ui.label {
  border-radius: 0;
}

html[data-design="red"]:has([data-korze-code]) :is(.ui.button, .ui.menu .item, .ui.dropdown .text) {
  transition: none !important;
}

html[data-design="red"]:has([data-korze-code]) .sha.label {
  background: #97071c !important;
  color: #efd8ce !important;
}

html[data-design="red"]:has([data-korze-code]) .sha.label .shortsha {
  color: inherit;
}

html[data-design="red"]:has([data-korze-code]) #diff-content-container {
  min-width: 0;
}

html[data-design="red"]:has([data-korze-code]) .diff-file-body {
  max-width: 100%;
  overflow-x: auto;
}

html[data-design="red"]:has([data-korze-code]) .diff-file-name .tw-whitespace-nowrap {
  white-space: normal !important;
}

html[data-design="red"]:has([data-korze-code]) .diff-file-name .file {
  min-width: 0;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  html[data-design="red"]:has([data-korze-code]) .diff-file-name .file {
    flex-basis: 100%;
  }
}

html[data-design="red"]:has([data-korze-code]) .commit-header-row .author {
  min-width: 0;
  flex-wrap: wrap;
  gap: .25rem;
}

html[data-design="red"]:has([data-korze-code]) .commit-header-row .ui.avatar {
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
  margin: 0 .25rem 0 0;
}

html[data-design="red"]:has([data-korze-code]) .issue-list-toolbar-left {
  min-width: 0;
  max-width: 100%;
}

html[data-design="red"]:has([data-korze-code]) .issue-list-toolbar-left .switch {
  display: flex;
  flex-wrap: wrap;
}

html[data-design="red"]:has([data-korze-code]) :is(.code-view, .code-diff, .file-code) code {
  padding: 0;
  border: 0;
  background: transparent !important;
}

html[data-design="red"]:has([data-korze-code]) .code-diff td {
  background: #191010;
}

html[data-design="red"]:has([data-korze-code]) .code-diff .tag-code td {
  background: #392323 !important;
}

html[data-design="red"]:has([data-korze-code]) .code-diff .add-code td {
  background: var(--color-diff-added-row-bg) !important;
}

html[data-design="red"]:has([data-korze-code]) .code-diff .del-code td {
  background: var(--color-diff-removed-row-bg) !important;
}

html[data-design="red"]:has([data-korze-code]) :focus-visible {
  outline: 2px solid #efd8ce;
  outline-offset: 3px;
}

/* Code is a stable dark surface, independent of the saved original theme. */
html[data-design="red"]:has([data-korze-code]) .chroma span {
  color: #efd8ce;
}

html[data-design="red"]:has([data-korze-code]) .chroma :is(.c, .c1, .ch, .cm, .cs, .go, .w) {
  color: #b4aaa3;
}

html[data-design="red"]:has([data-korze-code]) .chroma :is(.k, .kc, .kd, .kn, .kp, .kr, .kt, .na, .ne, .nl, .nt, .o, .ow) {
  color: #f8a09f;
}

html[data-design="red"]:has([data-korze-code]) .chroma :is(.cp, .cpf, .nd, .nf, .no, .nv, .vc, .vg, .vi) {
  color: #9fc9bd;
}

html[data-design="red"]:has([data-korze-code]) .chroma :is(.s, .s1, .s2, .sa, .sb, .sc, .sd, .se, .sh, .si, .sr, .ss, .sx, .dl, .bp, .nb, .nc, .ni) {
  color: #efc48d;
}

html[data-design="red"]:has([data-korze-code]) .chroma :is(.m, .mb, .mf, .mh, .mi, .mo, .il) {
  color: #c5b4e9;
}

html[data-design="red"]:has([data-korze-code]) .chroma .gd {
  color: #f7c1bb;
  background: #361b1b;
}

html[data-design="red"]:has([data-korze-code]) .chroma .gi {
  color: #c3e1c2;
  background: #17291b;
}

