html[data-ludik-theme="comic"] #dialog[data-variant="crash-rules"]:has(.crash-rules) {
  --rule-ink: #160d10;
  --rule-paper: #fff5db;
  --rule-yellow: #ffeb0b;
  --rule-pink: #f90080;
  --rule-mint: #80f8bb;
  --rule-grain: url("/redesign-art/paper.webp") center / 360px auto;
  --rule-edge: polygon(
    1% 2%, 8% .2%, 14% 1.3%, 22% 0, 30% 1.4%, 37% .2%, 44% 1.1%, 52% .3%,
    59% 1.2%, 66% .1%, 74% 1.4%, 81% .4%, 89% 1.3%, 97% .4%, 99% 2%,
    98.9% 13%, 100% 21%, 99% 29%, 99.8% 38%, 98.8% 48%, 100% 57%, 99% 65%,
    99.9% 74%, 99% 82%, 100% 91%, 98.8% 98%, 93% 99.3%, 85% 98.5%, 77% 99.9%,
    70% 98.7%, 62% 100%, 54% 98.8%, 47% 100%, 39% 98.6%, 31% 100%, 24% 98.9%,
    17% 100%, 10% 98.5%, 3% 99.7%, .5% 97%, 1% 88%, 0 79%, .9% 71%, 0 62%,
    .8% 54%, 0 45%, .8% 36%, 0 27%, .9% 18%, .1% 10%
  );
  --rule-label: polygon(0 8%, 7% 5%, 12% 1%, 23% 4%, 33% 0, 44% 5%, 57% 1%,
    66% 4%, 75% 0, 83% 5%, 99% 0, 98% 22%, 100% 44%, 97% 60%, 100% 78%, 97% 97%,
    86% 96%, 77% 100%, 65% 96%, 53% 99%, 45% 95%, 32% 100%, 23% 96%, 11% 100%,
    1% 96%, 0 76%, 2% 59%, 0 47%, 2% 27%);
  width: min(760px, calc(100% - 22px));
  max-block-size: calc(100dvh - 24px);
  overflow: visible;
  margin: auto;
  padding: 0;
  color: var(--rule-ink);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color-scheme: light;

  &::backdrop { background: #1b080ee9; }

  & #dialog-content {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    max-block-size: min(850px, calc(100dvh - 28px));
    padding: clamp(12px, 2.9vw, 27px);
    gap: clamp(9px, 2vw, 16px);
  }

  & #dialog-content::before,
  & #dialog-content::after {
    position: absolute;
    z-index: -2;
    inset: 0 -3px -5px;
    background: var(--rule-ink);
    clip-path: var(--rule-edge);
    pointer-events: none;
    content: "";
  }

  & #dialog-content::after {
    z-index: -1;
    inset: 3px 0 0;
    background: var(--rule-grain), var(--rule-paper);
  }

  & .dialog-head {
    align-items: center;
    margin: 0;
  }

  & .dialog-head h2 {
    position: relative;
    margin: 0;
    color: var(--rule-ink);
    font: italic 900 clamp(23px, 4vw, 42px)/1.04 var(--ld-display, Impact, sans-serif);
    font-synthesis: style;
    overflow-wrap: normal;
  }

  & .dialog-head .icon-button,
  & .crash-rules .button {
    color: var(--rule-ink);
    border: 2px solid var(--rule-ink);
    border-radius: 4px 3px 3px 5px;
    background: var(--rule-yellow) var(--rule-grain);
    background-blend-mode: soft-light;
    box-shadow: 2px 3px var(--rule-ink);
  }

  & .dialog-head .icon-button {
    flex: none;
    inline-size: 44px;
    block-size: 44px;
    margin: 0 3px 3px 0;
    font: 850 25px/1 var(--font-interface, system-ui, sans-serif);
  }

  & .crash-rules {
    min-inline-size: 0;
    min-block-size: 0;
    padding: 2px 7px 8px 2px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-gutter: stable;
    scrollbar-color: var(--rule-ink) transparent;
    gap: clamp(11px, 2vw, 20px);
    color: var(--rule-ink);
    font: 540 clamp(13px, 1.8vw, 15px)/1.46 var(--font-interface, system-ui, sans-serif);
  }

  & .crash-rules-hero {
    position: relative;
    isolation: isolate;
    display: grid;
    align-items: center;
    min-block-size: clamp(117px, 24vw, 185px);
    overflow: hidden;
    border: 3px solid var(--rule-ink);
    border-radius: 6px 3px 5px 3px;
    background: #fc0739 url("/redesign-art/plinko-pf01-paper.webp") 4px 1px / 301px 313px repeat;
    box-shadow: 2px 3px var(--rule-ink);
  }

  & .crash-rules-hero img {
    position: absolute;
    inline-size: 44%;
    block-size: 111%;
    inset-block-end: -12%;
    inset-inline-end: -1%;
    object-fit: contain;
    object-position: center bottom;
    pointer-events: none;
  }

  & .crash-rules-hero p {
    position: relative;
    z-index: 1;
    isolation: isolate;
    inline-size: 66%;
    margin-inline-start: 3%;
    padding: .44em .5em .52em;
    transform: rotate(-3deg);
    font: italic 900 clamp(25px, 6.25vw, 47px)/.94 var(--ld-display, Impact, sans-serif);
    font-synthesis: style;
    letter-spacing: -.02em;
  }

  & .crash-rules-hero p::before,
  & .crash-rules-hero p::after {
    position: absolute;
    z-index: -2;
    inset: 0;
    background: var(--rule-ink);
    clip-path: var(--rule-label);
    content: "";
  }

  & .crash-rules-hero p::after {
    z-index: -1;
    inset: 2px;
    background: var(--rule-yellow) var(--rule-grain);
    background-blend-mode: soft-light;
  }

  & .crash-rules-hero p span {
    display: block;
    overflow-wrap: normal;
  }

  & .crash-rules-hero p span:last-child::after {
    display: block;
    inline-size: min(7em, 91%);
    block-size: .16em;
    margin-block-start: .07em;
    transform: rotate(-3deg);
    transform-origin: left;
    background: var(--rule-pink);
    clip-path: polygon(0 40%, 100% 0, 94% 55%, 0 100%);
    content: "";
  }

  & .crash-rules-section {
    gap: 11px;
    margin: 0;
    padding: clamp(10px, 2.4vw, 18px);
    border: 2px solid var(--rule-ink);
    border-radius: 4px 7px 4px 5px;
    background: linear-gradient(#fff8e6d9, #fff8e6d9), var(--rule-grain), var(--rule-paper);
    box-shadow: 2px 3px var(--rule-ink);
  }

  & .crash-rules-section h3 {
    align-self: start;
    justify-self: start;
    color: var(--rule-ink);
    box-shadow: inset 0 -.24em var(--rule-pink);
    font: italic 900 clamp(19px, 3.7vw, 30px)/1.05 var(--ld-display, Impact, sans-serif);
    font-synthesis: style;
    padding: 0 .13em .07em;
  }

  & .crash-rules h4 {
    margin: 0 0 .24em;
    color: var(--rule-ink);
    font-size: 1.02em;
    font-weight: 850;
    line-height: 1.16;
  }

  & .crash-rules-flow {
    counter-reset: crash-rule;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 11px;
    padding: 0;
    list-style: none;
  }

  & .crash-rules-flow li {
    position: relative;
    counter-increment: crash-rule;
    min-inline-size: 0;
    padding: 8px 7px 0 41px;
  }

  & .crash-rules-flow li::before {
    position: absolute;
    inset: 7px auto auto 1px;
    display: grid;
    place-content: center;
    inline-size: 30px;
    block-size: 30px;
    transform: rotate(-8deg);
    color: var(--rule-ink);
    border: 2px solid var(--rule-ink);
    border-radius: 45% 47% 42% 47%;
    background: var(--rule-mint);
    box-shadow: 2px 2px var(--rule-ink);
    font: italic 900 17px/1 var(--font-interface, system-ui, sans-serif);
    content: counter(crash-rule);
  }

  & .crash-rules-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    gap: 8px;
  }

  & .crash-rules-methods > div {
    min-inline-size: 0;
    padding: 10px;
    border: 1.5px solid var(--rule-ink);
    border-radius: 3px 4px 4px 3px;
    background: #e5fff1;
  }

  & .crash-rules-methods > div:last-child { background: #fff2ad; }

  & .crash-rules-formula {
    border-inline-start: 4px solid var(--rule-pink);
    padding: 6px 0 6px 10px;
  }

  & .crash-rules-formula strong {
    font: italic 900 clamp(18px, 3vw, 25px)/1.12 var(--ld-display, Impact, sans-serif);
    font-synthesis: style;
  }

  & .crash-rules-formula p { margin-block-start: 3px; }

  & .crash-rules-series {
    padding-block-start: 9px;
    border-block-start: 1px dashed #160d1080;
  }

  & .crash-rules-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 5px 10px;
  }

  & .crash-rules-section-head p {
    color: #5f4132;
    font-size: .83em;
    font-weight: 740;
  }

  & .crash-rules-terms {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    overflow: visible;
    border-radius: 0;
    background: none;
  }

  & .crash-rules-terms > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    padding: 8px;
    border: 1.5px solid var(--rule-ink);
    border-radius: 3px 4px 4px 3px;
    background: #deffed;
  }

  & .crash-rules-terms dt { font-size: .79em; font-weight: 790; }
  & .crash-rules-terms dd {
    color: var(--rule-ink);
    font-size: 1.03em;
    font-weight: 840;
    text-align: start;
  }

  & .crash-rules .button {
    justify-self: start;
    min-block-size: 44px;
    max-inline-size: 100%;
    padding-inline: .72em;
    white-space: normal;
    text-align: center;
    font-weight: 850;
  }

  & .crash-rules-proof .button { background: var(--rule-mint) var(--rule-grain); }
  & .crash-rules-footer .button {
    font: italic 900 clamp(19px, 3vw, 26px)/1 var(--ld-display, Impact, sans-serif);
    font-synthesis: style;
  }

  & .crash-rules-footer {
    display: flex;
    justify-content: end;
    padding: 1px 3px 3px 1px;
  }

  & :is(.icon-button, .button):hover { background-color: #ffb8d8; }
  & :is(.icon-button, .button):focus-visible { outline: 3px solid #b80055; outline-offset: 2px; }

  @media (max-width: 570px) {
    & .crash-rules-flow {
      grid-template-columns: minmax(0, 1fr);
      gap: 5px;
    }
    & .crash-rules-flow li { padding-block-end: 5px; }
    & .crash-rules-terms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }

  @media (max-width: 380px) {
    & .dialog-head h2 { font-size: 22px; }
    & .crash-rules-hero img {
      inline-size: 43%;
      inset-inline-end: -3%;
    }
    & .crash-rules-hero p { inline-size: 69%; padding-inline: .38em; }
    & .crash-rules-terms > div:nth-child(-n+2) { grid-column: 1 / -1; }
  }
}
