:root {
    --jmd-header-h: 72px;
    --jmd-page-w: 1120px;
    --jmd-ink: #f4f1e4;
    --jmd-muted: #c5d0c2;
    --jmd-bg: #101814;
    --jmd-band: #17241c;
    --jmd-card: #1c2b22;
    --jmd-gold: #e2c56a;
    --jmd-gold-2: #f3e2a6;
    --jmd-ink-on-gold: #1a1408;
    --jmd-line: #3d5a45;
    --jmd-red: #c0392b;
    --jmd-font-head: "JetBrains Mono", ui-monospace, monospace;
    --jmd-font-body: "Courier Prime", "Courier New", serif;
}

[hidden] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }

html, body {
    max-width: 100%;
    overflow-x: clip;
    margin: 0;
}

html { scroll-padding-top: var(--jmd-header-h); }

body {
    padding-top: var(--jmd-header-h);
    background: var(--jmd-bg);
    color: var(--jmd-ink);
    font-family: var(--jmd-font-body);
    font-size: 1.05rem;
    line-height: 1.65;
}

img { max-width: 100%; height: auto; display: block; }

.jmdMosaic,
.jmdChapters,
.jmdSplit,
.jmdBoard-top,
.jmdBoard-row,
.jmdActions,
.jmdHeader-row { min-width: 0; }

.jmdMosaic > *,
.jmdChapters > *,
.jmdSplit > *,
.jmdBoard-top > *,
.jmdBoard-row > * { min-width: 0; }

h1, h2, h3 {
    font-family: var(--jmd-font-head);
    line-height: 1.25;
    margin: 0 0 0.6em;
    font-weight: 700;
}

p { margin: 0 0 1em; }

a { color: var(--jmd-gold); }

a:hover { color: var(--jmd-gold-2); }

.jmdWrap {
    width: 100%;
    max-width: var(--jmd-page-w);
    margin: 0 auto;
    padding: 0 20px;
}

.jmdNarrow { max-width: 760px; }

.jmdKicker {
    font-family: var(--jmd-font-head);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    color: var(--jmd-gold);
    margin: 0 0 0.6em;
}

.jmdMuted { color: var(--jmd-muted); }

.jmdScore {
    font-family: var(--jmd-font-head);
    font-size: 2rem;
    line-height: 1;
    color: var(--jmd-gold);
    margin: 0;
}

.jmdHeader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    min-height: var(--jmd-header-h);
    background: #101814;
    box-shadow: 0 2px 0 #3d5a45;
}

.jmdHeader-row {
    min-height: var(--jmd-header-h);
    display: flex;
    align-items: center;
    gap: 14px;
}

.jmdHeader-logo { display: flex; align-items: center; flex: 0 0 auto; color: var(--jmd-ink); text-decoration: none; }

.jmdHeader-logo svg { width: 180px; height: auto; display: block; }

.jmdNav {
    display: flex;
    flex: 1;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.jmdHeader a,
.jmdHeader a:visited { color: #f4f1e4; }

.jmdNav-link {
    font-family: var(--jmd-font-head);
    font-size: 0.78rem;
    text-decoration: none;
    white-space: nowrap;
}

.jmdNav-on { color: var(--jmd-gold) !important; box-shadow: inset 0 -2px 0 var(--jmd-gold); }

.jmdBurger,
.jmdOverlay,
.jmdDrawer { display: none; }

.jmdBurger {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0 11px;
    flex-shrink: 0;
    border: 0;
    background: transparent;
    color: #f4f1e4;
    cursor: pointer;
}

.jmdBurger span {
    display: block;
    flex: 0 0 2px;
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

.jmdBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: 2px solid transparent;
    border-radius: 2px;
    font-family: var(--jmd-font-head);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.jmdGlow {
    display: inline-flex;
    box-shadow: 0 0 0 1px #e2c56a, 0 0 16px rgba(226, 197, 106, 0.55);
    border-radius: 2px;
}

a.jmdBtn-primary,
a.jmdBtn-primary:visited,
button.jmdBtn-primary {
    color: #1a1408;
    background: #e2c56a;
}

a.jmdBtn-primary:hover,
a.jmdBtn-primary:focus-visible,
a.jmdBtn-primary:active,
button.jmdBtn-primary:hover,
button.jmdBtn-primary:focus-visible,
button.jmdBtn-primary:active {
    color: #1a1408;
    background: #f3e2a6;
}

a.jmdBtn-ghost,
a.jmdBtn-ghost:visited,
button.jmdBtn-ghost {
    color: #f4f1e4;
    background: #101814;
    border-color: #f4f1e4;
}

a.jmdBtn-ghost:hover,
a.jmdBtn-ghost:focus-visible,
button.jmdBtn-ghost:hover,
button.jmdBtn-ghost:focus-visible {
    color: #101814;
    background: #f4f1e4;
    border-color: #f4f1e4;
}

.jmdBtn-wave {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    pointer-events: none;
    animation: jmdRipple 0.45s ease-out forwards;
}

@keyframes jmdRipple {
    to { transform: scale(14); opacity: 0; }
}

.jmdActions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 1.2rem; }

.jmdHero {
    position: relative;
    background: #17241c;
    padding: 48px 0 40px;
}

.jmdHero::before,
.jmdBand::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 4px);
}

.jmdHero-inner,
.jmdBand-inner { position: relative; z-index: 1; }

.jmdMosaic {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

.jmdMosaic > :nth-child(even) { margin-top: 18px; }

button.jmdStill,
button.jmdStill:hover,
button.jmdStill:focus-visible {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 0;
    border: 2px solid #3d5a45;
    background: #1a2820;
    color: #f4f1e4;
    cursor: pointer;
    overflow: hidden;
}

.jmdStill img { width: 100%; height: auto; }

.jmdSplit {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 32px;
    align-items: stretch;
    padding-top: 36px;
    padding-bottom: 20px;
}

.jmdSplit-card {
    position: sticky;
    top: calc(var(--jmd-header-h) + 16px);
    padding: 16px;
}

.jmdSplit-card img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    background: #101814;
    margin-bottom: 10px;
}

.jmdFact { margin: 0 0 8px; font-size: 0.95rem; }

.jmdSection { padding: 28px 0; }

.jmdTicket {
    position: relative;
    background: #1c2b22;
    border-radius: 14px;
    padding: 18px 22px;
}

.jmdTicket::before,
.jmdTicket::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border-radius: 50%;
    background: #101814;
}

.jmdTicket::before { left: -8px; }
.jmdTicket::after { right: -8px; }

.jmdChapters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

a.jmdChapter {
    display: block;
    color: inherit;
    text-decoration: none;
    min-width: 0;
}

a.jmdChapter:hover { color: inherit; outline: 2px solid var(--jmd-gold); }

.jmdChapter-num {
    font-family: var(--jmd-font-head);
    font-size: 1.8rem;
    color: var(--jmd-gold);
    margin: 0;
}

.jmdTableWrap { overflow-x: auto; max-width: 100%; }

.jmdTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.98rem;
}

.jmdTable th,
.jmdTable td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #3d5a45;
    vertical-align: top;
}

.jmdTable th {
    font-family: var(--jmd-font-head);
    font-size: 0.78rem;
    color: var(--jmd-gold);
    width: 34%;
}

.jmdId { word-break: break-all; }

.jmdChips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }

.jmdChips li {
    background: #1c2b22;
    border: 1px solid #3d5a45;
    padding: 8px 10px;
    max-width: 100%;
}

.jmdChips strong { font-family: var(--jmd-font-head); display: block; color: var(--jmd-gold); }

.jmdBoard-scroll { max-width: 100%; }

.jmdBoard-top,
.jmdBoard-row {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
}

.jmdBoard-top { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.jmdBoard-row { grid-template-columns: repeat(7, minmax(0, 1fr)); }

button.jmdBoard-card,
button.jmdBoard-card:hover,
button.jmdBoard-card:focus-visible {
    min-height: 52px;
    padding: 4px;
    border: 2px solid #1a1408;
    border-radius: 2px;
    background: #f6f1de;
    color: #1a1408;
    font-family: var(--jmd-font-head);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
}

button.jmdBoard-empty,
button.jmdBoard-empty:hover,
button.jmdBoard-empty:focus-visible {
    background: #1a2820;
    color: #f4f1e4;
    border-style: dashed;
    border-color: #e2c56a;
}

.jmdBoard-red,
button.jmdBoard-card.jmdBoard-red,
button.jmdBoard-card.jmdBoard-red:hover,
button.jmdBoard-card.jmdBoard-red:focus-visible { color: #9d1c1c; }

.jmdBoard-static {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.jmdBoard-face {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f6f1de;
    color: #1a1408;
    font-family: var(--jmd-font-head);
    font-weight: 700;
    border: 2px solid #1a1408;
}

.jmdBoard-face.jmdBoard-empty {
    background: #1a2820;
    color: #f4f1e4;
    border-style: dashed;
    border-color: #e2c56a;
}

.jmdRise > * { animation: jmdSettle 0.4s ease both; }
.jmdRise > *:nth-child(2) { animation-delay: 0.05s; }
.jmdRise > *:nth-child(3) { animation-delay: 0.1s; }
.jmdRise > *:nth-child(4) { animation-delay: 0.15s; }

@keyframes jmdSettle {
    from { transform: translateY(8px); }
    to { transform: none; }
}

.jmdBand {
    position: relative;
    background: #17241c;
    padding: 36px 0;
    margin-top: 12px;
}

.jmdFooter {
    background: #0c1410;
    padding: 36px 0 28px;
    color: #f4f1e4;
}

.jmdFooter a,
.jmdFooter a:visited { color: #f4f1e4; }

.jmdFooter-card { margin-bottom: 18px; }

.jmdFooter-links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 18px;
    padding: 0;
    margin: 0 0 12px;
    list-style: none;
    align-items: center;
}

.jmdCookie { display: none; }

.jmdCookie:not([hidden]) {
    display: flex;
    position: fixed;
    z-index: 110;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100% - 32px);
    align-items: center;
    gap: 12px;
    padding: 8px 8px 8px 16px;
    border-radius: 999px;
    background: #101814;
    color: #f4f1e4;
    border: 1px solid #e2c56a;
    box-shadow: 0 0 16px rgba(226, 197, 106, 0.35);
}

.jmdCookie p { margin: 0; font-size: 0.92rem; }

.jmdCookie a,
.jmdCookie a:visited { color: #f4f1e4; }

.jmdCookie .jmdBtn {
    min-height: 36px;
    border-radius: 999px;
    box-shadow: none;
}

body.jmdCookie-open { padding-bottom: 84px; }

.jmdOverlay {
    position: fixed;
    inset: 0;
    top: var(--jmd-header-h);
    z-index: 200;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.jmdDrawer {
    position: fixed;
    z-index: 210;
    background: #101814;
    overflow-y: auto;
    visibility: hidden;
}

.jmdDrawer a {
    display: block;
    padding: 14px 20px;
    color: #f4f1e4;
    text-decoration: none;
    font-family: var(--jmd-font-head);
}

.jmdDrawer .jmdBtn { margin: 8px 20px 16px; }

.jmdDrawer-close {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: #f4f1e4;
    font-size: 1.8rem;
    cursor: pointer;
}

.jmdProse { padding: 32px 0 48px; }

.jmdProse h2 { font-size: 1.15rem; margin-top: 1.4em; }

.jmdBack { margin-top: 0; }

.jmdSeries {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 1.4rem 0;
    font-family: var(--jmd-font-head);
}

.jmdStillBox {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(8, 12, 10, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 12px;
}

.jmdStillBox[hidden] { display: none !important; }

.jmdStillBox img { max-height: calc(100dvh - 120px); width: auto; max-width: 100%; }

.jmdMiss {
    min-height: 50vh;
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 20px;
    align-items: center;
    padding-top: 40px;
    padding-bottom: 40px;
}

.jmdPixels {
    display: grid;
    grid-template-columns: repeat(4, 16px);
    gap: 4px;
}

.jmdPixels i {
    display: block;
    width: 16px;
    height: 16px;
    background: #e2c56a;
}

.jmdPixels i:nth-child(odd) { background: #3d5a45; }

.jmdSteps { counter-reset: jmdstep; padding: 0; margin: 0; list-style: none; }

.jmdSteps li {
    counter-increment: jmdstep;
    margin: 0 0 16px;
    padding-left: 52px;
    position: relative;
}

.jmdSteps li::before {
    content: counter(jmdstep, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 0;
    font-family: var(--jmd-font-head);
    color: var(--jmd-gold);
    font-size: 1.2rem;
}

.jmdCollections { display: grid; gap: 28px; }

.jmdLinkList { padding: 0; margin: 0; list-style: none; }

.jmdLinkList li { margin: 0 0 14px; }

@media (max-width: 1100px) {
    :root { --jmd-header-h: 56px; }
}

@media (max-width: 1023px) {
    .jmdNav,
    .jmdHeader .jmdGlow { display: none; }

    .jmdHeader-row { justify-content: space-between; }

    .jmdBurger { display: flex; order: 99; margin-left: auto; }

    .jmdHeader-logo svg { width: 120px; max-width: calc(100vw - 150px); }

    .jmdOverlay { display: block; }

    .jmdDrawer {
        display: block;
        top: var(--jmd-header-h);
        left: 0;
        right: 0;
        max-height: calc(100dvh - var(--jmd-header-h));
        padding: 56px 0 16px;
        transform: translateY(-16px);
        opacity: 0;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
    }

    body.jmdNav-open { overflow: hidden; }

    body.jmdNav-open .jmdOverlay {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    body.jmdNav-open .jmdDrawer {
        visibility: visible;
        transform: translateY(0);
        opacity: 1;
    }
}

@media (min-width: 1024px) {
    .jmdBurger,
    .jmdOverlay,
    .jmdDrawer { display: none !important; }
}

@media (max-width: 900px) {
    .jmdSplit { grid-template-columns: 1fr; }
    .jmdSplit-card { position: static; }
    .jmdMosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .jmdMosaic > :nth-child(even) { margin-top: 0; }
    .jmdChapters { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .jmdCookie:not([hidden]) {
        left: 12px;
        right: 12px;
        transform: none;
        width: auto;
        border-radius: 16px;
    }
    .jmdActions { flex-direction: column; align-items: stretch; }
    .jmdActions .jmdBtn { white-space: normal; }
    .jmdMiss { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    :root { --jmd-header-h: 48px; }
    .jmdWrap { padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
