/* Material pass: physical cuts instead of mirrored copies of one PNG.
   Only the decorative leaf is cut. Text, focus, hitboxes and motion owners
   are untouched. Photography remains on books, folders, machines and props. */
.royale-lobby-paper, .royale-result-paper { display: none; }
@media (forced-colors: none) {
  html body :is(.zine-stage, #zineGameMenu, #zineUtilities, .session-dialog) [data-paper-kind][data-paper-cut-before]::before {
    clip-path: var(--paper-cut-before, none) !important;
    mask: none !important;
  }
  html body :is(.zine-stage, #zineGameMenu, #zineUtilities, .session-dialog) [data-paper-kind][data-paper-cut-after]::after {
    clip-path: var(--paper-cut-after, none) !important;
    mask: none !important;
  }
  html body :is(.zine-stage, #zineGameMenu) [data-paper-kind][data-paper-cut-self] {
    clip-path: var(--paper-cut-self, none) !important;
    mask: none !important;
  }

  /* Continuous stock: same physical fibre scale, not stretched photographic
     cards with their own second border and baked shadow under a new cut. */
  html body :is(.zine-stage, #zineGameMenu, .session-dialog) [data-paper-kind]::before,
  html body .zine-stage [data-paper-cut-self] {
    background-image: var(--stock);
    background-size: 470px auto;
    background-repeat: repeat;
    background-position: 71px 133px;
  }

  /* Stable, distinct player slips. Tint follows its own paper edge exactly;
     the complete carrier, not its mirrored stock, owns the world-space shadow. */
  html #zineRoyaleApp.bomtafel .royale-score[data-paper-kind]::before {
    background: var(--paper) var(--stock) 41px 83px / 470px;
    background-blend-mode: multiply; scale: 1; transform: none;
  }
  html #zineRoyaleApp.bomtafel .royale-score[data-paper-kind]::after {
    background: var(--table-active-tint); scale: 1; transform: none;
  }
  html #royaleSessionRoster > span[data-paper-kind] {
    position: relative; isolation: isolate; background: none; clip-path: none;
    filter: var(--wp-shadow-slip);
  }
  html #zineRoyaleApp #royaleSessionRoster { filter: none; }
  #royaleSessionRoster > span[data-paper-kind]::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: #f5e8cd var(--stock) 71px 133px / 470px;
    background-blend-mode: multiply;
  }
  /* The main-action ID also outranks the old count-specific photo margins:
     those included transparent pixels which the new stock does not have. */
  html #zineRoyaleApp :is(#royaleMainAction, .zine-button)[data-paper-kind]::before {
    inset: -4px -5px;
    filter: none;
    background: var(--paper) var(--stock) 71px 133px / 470px;
    background-blend-mode: multiply;
  }
  html #zineRoyaleApp .zine-button[data-paper-kind] { filter: var(--wp-shadow-slip); }
  html #zineRoyaleApp .zine-button[data-paper-kind]:not(:disabled):active { filter: var(--wp-shadow-rest); }
  html #zineRoyaleApp .main-action[data-paper-kind]::before { background-color: var(--table-active-tint, #96d9af); }
  html #zineRoyaleApp .difficulty-choices button[data-paper-kind]::before {
    background: var(--paper) var(--stock) 71px 133px / 470px;
    background-blend-mode: multiply;
  }
  html #zineRoyaleApp .difficulty-choices button[aria-pressed="true"][data-paper-kind]::before { background-color: #96d9af; }

  /* Royale's large reading papers used a different, stretched photographic
     edge. Use the same cutting table, without clipping the shadow or words. */
  html #zineRoyaleApp #royaleWords > .paper-surface {
    inset: -8px -3%;
    background: none; clip-path: none; mask: none; overflow: visible;
  }
  #zineRoyaleApp #royaleWords > .paper-surface::before,
  #zineRoyaleApp :is(.royale-lobby-paper, .royale-result-paper)::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: var(--paper) var(--stock) 43px 27px / 720px;
    background-blend-mode: normal;
  }
  html #zineRoyaleApp #royaleError[data-paper-kind]::before {
    background: var(--paper) var(--stock) 71px 133px / 470px;
    background-blend-mode: normal;
  }
  @media (max-width: 900px), (max-height: 560px) {
    /* These compact labels retain light ink. Opaque stock must be dyed dark,
       not merely laid over the old dark background colour. */
    html #zineRoyaleApp :is(.royale-heading .ink-label, #royaleResultName)[data-paper-kind]::before {
      background: var(--ink) var(--stock) 71px 133px / 470px;
      background-blend-mode: multiply;
    }
  }

  @media (min-width: 901px) and (min-height: 561px) {
    /* The standalone leaf casts the shadow. A filter on the complete lobby
       would double every child card's shadow and shadow the printed ink. */
    html #zineRoyaleApp.bomtafel:is([data-phase="setup"], [data-phase="loading"]) .royale-flow::before,
    html #zineRoyaleApp.bomtafel .royale-result::after { display: none; }
    #zineRoyaleApp.bomtafel:is([data-phase="setup"], [data-phase="loading"]) .royale-lobby-paper,
    #zineRoyaleApp.bomtafel .royale-result-paper {
      display: block; position: absolute; inset: 0; z-index: -1;
      pointer-events: none; filter: var(--wp-shadow-paper);
    }
    #zineRoyaleApp.bomtafel .royale-result-paper { inset: -16px -28px; }
    #zineRoyaleApp.bomtafel[data-phase="matchEnd"] .royale-result-paper {
      inset: -22px -28px; rotate: -1deg;
    }
    #zineRoyaleApp.bomtafel[data-phase="matchEnd"] .royale-result-paper::before {
      background-color: #cee5cc; background-blend-mode: multiply;
    }
  }

  html .zine-stage .cohesion-back[data-paper-kind]::before,
  html #zineApp #wordstreamScore[data-paper-kind]::before {
    background: var(--paper, #f1e6cc) var(--stock) 71px 133px / 470px;
    background-blend-mode: multiply;
  }

  /* The note texture does not get squeezed along with its outline. The real
     dossier and its moving 3-D cover keep their photographic construction. */
  html #zineCaseApp :is(.case-note-paper, .case-choice-paper, .case-file-edges span)[data-paper-kind] {
    background: var(--paper) var(--stock) 37px 97px / 620px;
    background-blend-mode: normal;
  }
  html #zineCaseApp .case-levels button[aria-pressed="true"] .case-choice-paper[data-paper-kind] { background-color: var(--ink); background-blend-mode: multiply; }

  html #zineStoryApp .story-paper-surface[data-paper-kind] {
    background: var(--paper) var(--stock) 43px 27px / 720px;
    background-blend-mode: normal;
  }

  html #zineEstafetteApp .fs-letter[data-paper-kind]::before {
    background: var(--paper) var(--stock) 53px 29px / 720px;
    background-blend-mode: normal;
  }
  html #zineEstafetteApp .fs-letter[data-paper-kind]::after { display: none; }

  /* Front, backing and echo imprints are different cuts of the same stock.
     A departing leaf retains the front's shape; its backing is already hidden
     by the existing turn animation. No new stacked transformation is added. */
  html #zineEchoApp .echo-word-carrier[data-paper-kind]::before,
  html #zineEchoApp .echo-word-carrier[data-paper-kind]::after {
    background: var(--paper) var(--stock) 23px 47px / 720px;
    background-blend-mode: normal;
  }
  /* Native stock fills its entire box (unlike the old photo's transparent
     perimeter). Keep the roster instruction clear of both physical leaves. */
  html #zineEchoApp .echo-word-carrier[data-paper-kind]::before { bottom: 12px; }
  html #zineEchoApp .echo-word-carrier[data-paper-kind]::after { bottom: 9px; }
  html #zineEchoApp .echo-player[data-paper-kind]::before {
    border: 0; box-shadow: inset 0 1px #fff3;
    background: var(--paper) var(--stock) 71px 133px / 470px;
    background-blend-mode: multiply;
  }
  html #zineEchoApp .echo-imprint[data-paper-kind] { background: none; isolation: isolate; }
  #zineEchoApp .echo-imprint[data-paper-kind]::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: var(--paper) var(--stock) 29px 113px / 470px;
    background-blend-mode: multiply;
  }

  /* Seven distinct menu cuts, with a separate backing cut for each poster.
     Keep the existing paper pigment filters, ink masks and finite movement. */
  html #zineGameMenu .poster-stock[data-paper-kind]::before {
    border: 0; border-image: none;
    background: var(--poster-field) var(--stock) 71px 133px / 470px;
    background-blend-mode: multiply;
  }
  html #zineGameMenu[data-menu-material="ready"] .poster-stock[data-paper-kind]::before {
    background-color: #f3e7cc; background-blend-mode: normal;
  }
  html #zineGameMenu .game-poster[data-paper-kind]::after {
    border: 0; border-image: none;
    background: var(--menu-paper) var(--stock) 173px 43px / 470px;
    background-blend-mode: multiply;
  }
}

@media (min-width: 901px) and (min-height: 561px) {
  /* Opaque hand-cut stock no longer has the photograph's invisible margin.
     Give the upper extra seats real clearance under the shared game title. */
  #zineRoyaleApp.bomtafel .royale-score:nth-child(n + 5) { margin-top: 24px; }
}
