/*
 * Fantasy Monster Fight: game theme (D-057).
 *
 * Applies to the whole page, shell included, while the route is under /fantasy-monster-fight
 * (the app sets data-game="fantasy-monster-fight" on its wrapper). It only redefines the --sc-*
 * tokens that shell-theme.css (in the Client) maps onto Radzen, so there is no runtime
 * stylesheet swapping. Blood red on near-black, in front of the gray of the zine's cover (the crowd and arena wall
 * behind the monster, D-172). White on --sc-accent is 7.5:1; --sc-accent-text on --sc-raised is 5:1.
 */
[data-game="fantasy-monster-fight"] {
    --sc-bg: #141414;
    --sc-surface: #1e1e1e;
    --sc-raised: #292929;
    --sc-border: #4d4d4d;
    --sc-muted: #666666;
    --sc-ink: #ececec;
    --sc-ink-dim: #bdbdbd;
    --sc-ink-faint: #a0a0a0;
    --sc-accent: #a8141c;
    --sc-accent-hover: #8c1016;
    --sc-accent-text: #f27272;
    --sc-on-accent: #ffffff;

    --sc-radius: 4px;
    --sc-radius-btn: 4px;
    --sc-radius-card: 6px;

    /* The cover's gray, its ink (7:1 on it) and the halftone of the printed crowd. */
    --fmf-arena: #a5a5a5;
    --fmf-arena-ink: #1a1a1a;
    --fmf-halftone: radial-gradient(rgb(0 0 0 / 0.09) 1px, transparent 1.5px) 0 0 / 5px 5px;
}

/*
 * The arena (D-172): the page behind the content is the cover's gray, and the content sits on a near-black panel in
 * front of it, as the monster sits in front of the crowd. Header and sidebar stay dark. Anything left on the gray (the
 * footer) uses the dark ink.
 */
.app-shell[data-game="fantasy-monster-fight"] .rz-body {
    background: var(--fmf-halftone), var(--fmf-arena);
}

.app-shell[data-game="fantasy-monster-fight"] .page-content {
    padding: 1rem;
    background: var(--sc-bg);
    border-radius: var(--sc-radius-card);
    box-shadow: 0 0 0 1px rgb(0 0 0 / 0.6), 0 0.5rem 1.5rem rgb(0 0 0 / 0.35);
    /* A splat near the edge must not make the page scroll sideways; clip isn't a scroll container, so sticky works. */
    overflow-x: clip;
}

.app-shell[data-game="fantasy-monster-fight"] .site-footer {
    color: var(--fmf-arena-ink);
    border-top-color: var(--fmf-arena-ink);
}

.app-shell[data-game="fantasy-monster-fight"] .site-footer a {
    color: var(--fmf-arena-ink);
}

/* On a phone the gray is a thin frame, so the panel keeps the width. */
@media (max-width: 599.98px) {
    .app-shell[data-game="fantasy-monster-fight"] .rz-body {
        padding: 0.5rem;
    }

    .app-shell[data-game="fantasy-monster-fight"] .page-content {
        padding: 0.75rem;
    }
}

/* Radzen colors outlined and text buttons with --rz-primary, which is too dark a red to read on the panel (2.4:1). */
.app-shell[data-game="fantasy-monster-fight"] .rz-button.rz-primary.rz-variant-outlined,
.app-shell[data-game="fantasy-monster-fight"] .rz-button.rz-primary.rz-variant-text {
    color: var(--sc-accent-text);
    border-color: var(--sc-accent-text);
}

/*
 * Blood splatter. Each shape is an inline SVG used as a mask and painted with --sc-accent, so it follows the theme
 * (and the sheet's black print colors). None sits behind body text: the title splat is behind the page's h1 only,
 * the corner spray keeps its drops in the card's padding or outside it, and drips hang into padding or a gap.
 */
[data-game="fantasy-monster-fight"] {
    --fmf-splat: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 120'%3E%3Cpath d='M38 62C36 48 50 40 62 44C70 34 84 38 88 46C98 42 112 46 116 54L150 50C154 50 154 54 150 55L118 60C124 66 120 76 110 76C108 86 92 90 86 82C78 90 60 88 58 80C46 82 36 74 38 62Z'/%3E%3Cpath d='M104 74L132 92C135 94 133 97 130 95L100 80Z'/%3E%3Cpath d='M70 44L66 24C66 21 70 21 70 24L76 42Z'/%3E%3Cpath d='M130 64C136 60 144 62 144 68C144 73 136 75 132 72C128 70 127 66 130 64Z'/%3E%3Ccircle cx='162' cy='52' r='3.2'/%3E%3Ccircle cx='172' cy='48' r='1.8'/%3E%3Ccircle cx='184' cy='56' r='1.2'/%3E%3Ccircle cx='190' cy='46' r='0.9'/%3E%3Ccircle cx='140' cy='84' r='2.4'/%3E%3Ccircle cx='146' cy='100' r='1.6'/%3E%3Ccircle cx='158' cy='40' r='1.4'/%3E%3Ccircle cx='96' cy='30' r='2'/%3E%3Ccircle cx='120' cy='34' r='1.3'/%3E%3Ccircle cx='28' cy='52' r='1.6'/%3E%3Ccircle cx='22' cy='74' r='1.1'/%3E%3Ccircle cx='54' cy='98' r='2.2'/%3E%3C/svg%3E");
    --fmf-spray: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cpath d='M80 0V16C75 18 70 14 72 9C66 10 64 4 69 2C68 1 68 0 68 0Z'/%3E%3Ccircle cx='62' cy='6' r='3'/%3E%3Ccircle cx='74' cy='24' r='3.5'/%3E%3Ccircle cx='52' cy='16' r='2'/%3E%3Ccircle cx='64' cy='30' r='2'/%3E%3Ccircle cx='76' cy='40' r='2'/%3E%3Ccircle cx='44' cy='6' r='1.5'/%3E%3Ccircle cx='58' cy='42' r='1.2'/%3E%3Ccircle cx='40' cy='22' r='1.2'/%3E%3Ccircle cx='78' cy='54' r='1.4'/%3E%3Ccircle cx='30' cy='10' r='1'/%3E%3Ccircle cx='68' cy='50' r='0.9'/%3E%3C/svg%3E");
    --fmf-drips: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 16' preserveAspectRatio='none'%3E%3Cpath d='M0 0H160V3C156 3 155 4 155 6V10C155 13.5 150 13.5 150 10V6C150 4 148 3 144 3H122C119 3 118 4 118 5V7C118 9.5 114 9.5 114 7V5C114 4 112 3 109 3H86C83 3 82 4 82 6V13C82 16.5 76 16.5 76 13V6C76 4 74 3 71 3H52C49 3 48 4 48 5V6C48 8 45 8 45 6V5C45 4 43 3 40 3H24C21 3 20 4 20 6V9C20 12 15 12 15 9V6C15 4 13 3 10 3H0Z'/%3E%3C/svg%3E");
    --fmf-stroke: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 12' preserveAspectRatio='none'%3E%3Cpath d='M0 6C40 4 80 3.5 140 4.2C200 5 260 3 320 4C360 4.6 385 5 400 6C380 7.5 350 8 300 7.6C240 7.2 180 9 120 8C70 7.4 30 7.6 0 6Z'/%3E%3Cpath d='M300 7C306 9 312 11 318 11C314 9 308 8 300 7Z'/%3E%3Cpath d='M60 5C54 3 48 1 42 1C46 3 52 4 60 5Z'/%3E%3C/svg%3E");
}

/* A splat behind the start of each page's title (the h1); at 75% the title still reads at 8:1 over it. */
.app-shell[data-game="fantasy-monster-fight"] .page-content h1 {
    position: relative;
    isolation: isolate;
}

.app-shell[data-game="fantasy-monster-fight"] .page-content h1::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: 0.6em;
    left: -0.75rem;
    width: 10rem;
    height: 6rem;
    translate: 0 -50%;
    background: var(--sc-accent);
    opacity: 0.75;
    -webkit-mask: var(--fmf-splat) center / contain no-repeat;
    mask: var(--fmf-splat) center / contain no-repeat;
    pointer-events: none;
}

/* The hub's title gets a second splat behind the "ter" of "Monster" (measured: 6.3em to 7.6em into the first line).
   The same shape turned and mirrored, so the two don't read as copies. */
.app-shell[data-game="fantasy-monster-fight"] .page-content h1.hub-title::after {
    content: "";
    position: absolute;
    z-index: -1;
    top: 0.6em;
    left: 6.95em;
    width: 3.4em;
    height: 2em;
    transform: translate(-50%, -50%) rotate(200deg) scaleX(-1);
    background: var(--sc-accent);
    opacity: 0.75;
    -webkit-mask: var(--fmf-splat) center / contain no-repeat;
    mask: var(--fmf-splat) center / contain no-repeat;
    pointer-events: none;
}

/* The monster sheet and the stats panel: drips under the red top edge, a spray off the top-right corner. */
.app-shell[data-game="fantasy-monster-fight"] .monster-sheet {
    position: relative;
}

.app-shell[data-game="fantasy-monster-fight"] .monster-sheet::before,
.app-shell[data-game="fantasy-monster-fight"] .stats-panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0.5rem;
    right: 0.5rem;
    height: 0.75rem;
    background: var(--sc-accent);
    -webkit-mask: var(--fmf-drips) 0 0 / 10rem 100% repeat-x;
    mask: var(--fmf-drips) 0 0 / 10rem 100% repeat-x;
    pointer-events: none;
}

.app-shell[data-game="fantasy-monster-fight"] .monster-sheet::after,
.app-shell[data-game="fantasy-monster-fight"] .stats-panel::after {
    content: "";
    position: absolute;
    top: -0.75rem;
    right: -0.75rem;
    width: 5rem;
    height: 5rem;
    background: var(--sc-accent);
    -webkit-mask: var(--fmf-spray) top right / contain no-repeat;
    mask: var(--fmf-spray) top right / contain no-repeat;
    pointer-events: none;
}

/* On a phone the stats panel is a thin bar stuck to the bottom: no room for drips or a spray. */
@media (max-width: 899.98px) {
    .app-shell[data-game="fantasy-monster-fight"] .stats-panel::before,
    .app-shell[data-game="fantasy-monster-fight"] .stats-panel::after {
        display: none;
    }
}

/* Section headings: a red rule with small drips hanging into the gap below it. */
.app-shell[data-game="fantasy-monster-fight"] .page-content h2 {
    position: relative;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid var(--sc-accent);
}

.app-shell[data-game="fantasy-monster-fight"] .page-content h2::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 0.55rem;
    background: var(--sc-accent);
    -webkit-mask: var(--fmf-drips) 0 0 / 8rem 100% repeat-x;
    mask: var(--fmf-drips) 0 0 / 8rem 100% repeat-x;
    pointer-events: none;
}

/* The list of monsters: a brush stroke between rows in place of the plain line (the heading's drips are above the first). */
.app-shell[data-game="fantasy-monster-fight"] .monster-row {
    position: relative;
    border-top: 0;
}

.app-shell[data-game="fantasy-monster-fight"] .monster-row + .monster-row::before {
    content: "";
    position: absolute;
    top: -0.375rem;
    left: 0;
    right: 0;
    height: 0.75rem;
    background: var(--sc-accent);
    -webkit-mask: var(--fmf-stroke) 0 0 / 100% 100% no-repeat;
    mask: var(--fmf-stroke) 0 0 / 100% 100% no-repeat;
    pointer-events: none;
}

@media print {
    .app-shell[data-game="fantasy-monster-fight"] .page-content h1::before,
    .app-shell[data-game="fantasy-monster-fight"] .page-content h1.hub-title::after,
    .app-shell[data-game="fantasy-monster-fight"] .page-content h2::after,
    .app-shell[data-game="fantasy-monster-fight"] .monster-sheet::before,
    .app-shell[data-game="fantasy-monster-fight"] .monster-sheet::after {
        display: none;
    }

    /* The sheet's headings keep their thin printed rule. */
    .app-shell[data-game="fantasy-monster-fight"] .page-content h2 {
        padding-bottom: 0;
        border-bottom: 1px solid var(--sc-border);
    }
}

/*
 * Printing a monster sheet: one letter page, dark text on white. Only a page that shows a sheet is touched
 * (body:has(.monster-sheet)), so no other page's print changes. The sheet sets its own sizes; this hides the
 * shell around it and lets the page flow, since Radzen's layout is a fixed-height scroll container on screen.
 */
@media print {
    @page {
        size: letter;
        margin: 0.4in;
    }

    body:has(.monster-sheet),
    body:has(.monster-sheet) .app-shell,
    body:has(.monster-sheet) .rz-layout,
    body:has(.monster-sheet) .rz-body {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        color: #000 !important;
    }

    body:has(.monster-sheet) .rz-header,
    body:has(.monster-sheet) .rz-sidebar,
    body:has(.monster-sheet) .drawer-backdrop,
    body:has(.monster-sheet) .site-footer,
    body:has(.monster-sheet) .rz-body > :not(.page-content),
    body:has(.monster-sheet) .no-print {
        display: none !important;
    }

    body:has(.monster-sheet) .page-content {
        max-width: none;
        padding: 0 !important;
        background: #fff !important;
        box-shadow: none !important;
    }
}

@media print {
    /* Paper is black and white: the sheet's accent colors would print as pale grey on a mono printer. */
    body:has(.monster-sheet) .monster-sheet,
    body:has(.monster-sheet) .monster-sheet * {
        color: #000 !important;
    }
}
