/* The same paper stock and ink; game information gets its own fixed tracks. */
.game-toggle { border: 0; padding: 0; min-height: 44px; margin-block: -5px; color: inherit; background: none; font: inherit; text-transform: inherit; display: inline-flex; align-items: center; gap: 12px; }
.game-toggle > span { font: 700 .8em/1 sans-serif; }
.game-toggle:disabled > span { visibility: hidden; }
.game-menu { position: fixed; z-index: 20; display: grid; padding: 12px; gap: 8px; max-width: calc(100vw - 24px); background: #221f25 var(--xerox) 0 0 / 600px; box-shadow: 3px 5px 0 #19191b55; }
.game-menu button { border: 0; min-height: 48px; text-align: left; padding: 10px 18px; background: #efe7d2 var(--stock) 0 0 / 560px; color: #241b2c; font: 900 25px/1 "Nachtzine Word", sans-serif; text-transform: uppercase; }
.game-menu button[aria-pressed="true"] { text-decoration: underline; text-underline-offset: 5px; }
/* Royale has a compact host strip and one central bout, not four stretched
   Woordstroom rows. These overrides never change the other game's geometry. */
.royale-stage { grid-template-columns: minmax(170px, 20%) minmax(0, 1fr); gap: 32px; }
.royale-stage .zine-logo { top: 12%; left: 20px; right: 4px; }
.royale-stage .zine-character { width: 91%; left: 15px; top: 48%; }
.royale-game { grid-template-rows: 48px minmax(0, 1fr) 64px; gap: 16px; }
.royale-session { display: contents; }
.royale-heading .ink-label { font-size: clamp(24px, 2.4vw, 36px); }
.royale-stage .zine-controls { width: min(100%, 700px); padding-inline: 8px; gap: 18px; }
.royale-stage .main-action { font-size: clamp(28px, 3vw, 42px); }
.royale-stage .stop-action { flex-basis: 24%; font-size: clamp(24px, 2.2vw, 32px); }
.royale-setup { grid-area: 2 / 1; isolation: isolate; position: relative; min-height: 0; min-width: 0; display: grid; }
.royale-setup-scroll { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; min-height: 0; padding: clamp(24px, 3.6vw, 52px); display: flex; flex-direction: column; gap: 18px; }
.royale-setup h2 { margin: 0; font: 900 clamp(35px, 4.3vw, 68px)/1 "Nachtzine Word", sans-serif; text-transform: uppercase; }
.royale-player-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 22px; }
.royale-player-field { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; align-items: end; min-width: 0; }
.royale-player-field label { display: grid; gap: 4px; min-width: 0; font: 650 16px/1.2 "Nachtzine Word", sans-serif; }
.royale-player-field input { width: 100%; min-width: 0; min-height: 44px; padding: 5px 3px; border: 0; border-bottom: 3px solid var(--ink); border-radius: 0; background: transparent; color: var(--ink); font: 900 clamp(24px, 2.4vw, 34px)/1 "Nachtzine Word", sans-serif; }
.royale-player-field input:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.royale-remove { min-height: 44px; border: 0; background: none; color: var(--ink); font-size: 27px; }
.royale-add { align-self: flex-start; border: 0; padding: 5px 10px; min-height: 44px; color: var(--paper); background: var(--dark) var(--xerox) 0 0 / 500px; font: 900 24px/1 "Nachtzine Word", sans-serif; }
.royale-setup-hint, .royale-error { margin: 0; font: 650 clamp(18px, 1.7vw, 24px)/1.25 "Nachtzine Word", sans-serif; }
.royale-error { border-left: 4px solid var(--ink); padding-left: 12px; font-weight: 900; }
.royale-board { --score-columns: 3; --score-rows: 1; --score-mobile-rows: 2; grid-area: 2 / 1; position: relative; isolation: isolate; min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 28%; grid-template-rows: minmax(0, min(38vh, 380px)) calc(var(--score-rows) * 76px); align-content: center; gap: 24px 18px; }
.royale-turn { grid-area: 1 / 1; min-width: 0; min-height: 0; display: grid; grid-template-rows: 60px minmax(0, 1fr); gap: 8px; }
.royale-player { margin: 0; padding: 4px clamp(28px, 2.5vw, 48px); min-width: 0; align-self: center; color: var(--paper); font: 900 var(--royale-size, 52px)/1 "Nachtzine Word", sans-serif; text-transform: uppercase; white-space: nowrap; }
.royale-words { isolation: isolate; position: relative; display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 18px 0; min-height: 0; min-width: 0; }
.royale-words > .paper-surface { z-index: -1; filter: none; }
/* One fixed paper bill, not two strips and an unexplained empty slot. Only
   text composes differently; paper, name, bomb and score tracks never move. */
.royale-word-slot { grid-column: 1; grid-row: 1; position: relative; display: flex; align-items: flex-end; min-width: 0; min-height: 0; padding: 0 clamp(28px, 2.5vw, 48px); }
.royale-word-slot ~ .royale-word-slot { grid-row: 2; align-items: flex-start; }
.royale-words[data-word-count="1"] > .royale-word-slot { grid-row: 1 / -1; align-items: center; }
.royale-word-slot[data-empty="true"] { visibility: hidden; }
.royale-word-text { max-width: 100%; font: 900 var(--royale-size, 58px)/.95 "Nachtzine Word", sans-serif; color: var(--ink); letter-spacing: -.018em; text-transform: uppercase; white-space: nowrap; padding-block: .12em; margin-block: -.12em; }
/* Ink clipped to text still stops at the span's painting box. Extend that box
   for capitals with accents (Ë/Ï/É); matching negative margins keep the .95em
   occupied line height, the baseline and the fixed one/two-word tracks intact. */
@supports (background-clip: text) { .royale-word-text { background: linear-gradient(#19151bbd, #19151bbd), var(--xerox) 0 0 / 430px; background-clip: text; color: transparent; } }
.royale-word-slot[data-cleared="true"] .royale-word-text { opacity: .38; text-decoration: line-through; text-decoration-thickness: 3px; }
.royale-scores { grid-area: 2 / 1 / 3 / -1; min-width: 0; width: min(100%, calc(var(--score-columns) * 250px)); display: grid; grid-template-columns: repeat(var(--score-columns), minmax(0, 1fr)); grid-template-rows: repeat(var(--score-rows), minmax(0, 1fr)); gap: 10px 18px; padding: 0 18px; }
.royale-score { position: relative; isolation: isolate; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 8px 10px; color: var(--paper); font-family: "Nachtzine Word", sans-serif; }
.royale-score::before { content: ""; position: absolute; inset: -1px 0; z-index: -1; background: var(--dark) var(--xerox) 45% 20% / 620px; clip-path: polygon(1% 5%, 96% 0, 100% 92%, 3% 100%, 0 51%); visibility: hidden; }
.royale-score[data-active="true"]::before { visibility: visible; }
.royale-score-name { font: 900 var(--royale-size, 23px)/1 "Nachtzine Word", sans-serif; text-transform: uppercase; white-space: nowrap; min-width: 0; width: 100%; }
.royale-score[data-active="true"] .royale-score-name { color: var(--paper); }
.royale-score[data-eliminated="true"] { opacity: .5; }
.royale-score[data-eliminated="true"] .royale-score-name { text-decoration: line-through; }
.royale-hearts { display: flex; gap: 3px; flex: 0 0 auto; }
.paper-heart { width: 22px; height: 23px; display: inline-block; background: var(--action) var(--stock) 30px 15px / 160px; background-blend-mode: multiply; clip-path: polygon(0 16%, 16% 0, 35% 2%, 50% 19%, 68% 0, 86% 3%, 100% 22%, 95% 48%, 51% 100%, 8% 49%); }
.paper-heart[data-empty="true"] { opacity: var(--empty-heart, .17); }
.paper-heart[data-losing="true"] { animation: heart-cut 1.2s steps(1, end) both; }
@keyframes heart-cut { 0%, 30%, 60% { opacity: 1; } 15%, 45%, 75%, 100% { opacity: var(--empty-heart, .17); } }
.royale-bomb { grid-area: 1 / 2; align-self: center; justify-self: center; width: min(100%, 320px); aspect-ratio: 1; position: relative; --spark-x: 64%; --spark-y: 17%; }
.royale-result { grid-area: 1 / 1; position: relative; z-index: 1; align-self: stretch; min-width: 0; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 14px 18px; color: var(--paper); }
.royale-result-label { margin: 0; font: 900 clamp(26px, 3vw, 46px)/1 "Nachtzine Word", sans-serif; text-transform: uppercase; }
#royaleResultName { margin: 0; white-space: nowrap; font: 900 var(--royale-size, 70px)/1 "Nachtzine Word", sans-serif; text-transform: uppercase; }
.royale-result-hearts { --empty-heart: 0; display: flex; gap: 8px; }
.royale-result-hearts .paper-heart { width: 44px; height: 46px; }
.royale-stage:is([data-phase="exploding"], [data-phase="roundEnd"], [data-phase="matchEnd"]) .royale-turn { visibility: hidden; }
.royale-stage[data-phase="matchEnd"] .royale-result { grid-column: 1 / -1; padding-top: 70px; }
.royale-stage[data-phase="matchEnd"] .royale-result::before { content: ""; position: absolute; top: 2%; width: 115px; height: 72px; background: var(--action) var(--stock) 0 0 / 230px; clip-path: polygon(0 4%, 25% 43%, 49% 0, 76% 43%, 100% 4%, 87% 100%, 13% 96%); transform: rotate(-6deg); }
.royale-stage[data-phase="setup"] .main-action { flex: 0 1 75%; }
.royale-stage[data-phase="exploding"] .main-action { opacity: .6; }
@media (min-width: 1600px) { .royale-turn { grid-template-rows: 72px minmax(0, 1fr); } }
@media (max-width: 1050px) { .royale-stage { grid-template-columns: minmax(150px, 19%) minmax(0, 1fr); gap: 22px; } .royale-board { grid-template-columns: minmax(0, 1fr) 26%; } .royale-turn { grid-template-rows: 54px minmax(0, 1fr); } .royale-scores { gap: 8px; padding: 0; } .royale-score-name { max-width: 100%; } }
@media (min-width: 901px) and (max-height: 800px) {
  .royale-setup-scroll { display: grid; grid-template-columns: 1.35fr 1fr; align-content: start; gap: 12px 28px; padding: 24px 32px; }
  .royale-setup h2 { grid-column: 1 / -1; font-size: 40px; }
  .royale-player-fields { grid-area: 2 / 1; grid-template-columns: 1fr; gap: 8px; }
  .royale-player-field input { font-size: 26px; }
  .royale-setup .settings-group { grid-area: 2 / 2; align-self: start; }
  .royale-setup .difficulty-choices { grid-template-columns: 1fr; max-width: none; }
  .royale-setup .settings-group legend { font-size: 25px; }
  .royale-add { grid-area: 3 / 1; justify-self: start; }
  .royale-setup-hint { grid-area: 3 / 2; align-self: center; }
  .royale-error { grid-column: 1 / -1; }
}
@media (max-width: 900px) and (orientation: portrait) {
  .royale-stage { padding-top: 94px; }
  .royale-stage .zine-poster { height: 86px; }
  .royale-stage .zine-logo { left: 14px; right: auto; top: -3px; width: 146px; }
  .royale-stage .zine-character { left: auto; right: 10px; top: -7px; width: 91px; }
  .royale-game { grid-template-rows: 44px minmax(0, 1fr) 54px; gap: 12px; }
  .royale-heading .ink-label { font-size: 23px; padding-inline: 10px; }
  .royale-setup-scroll { padding: 23px; gap: 17px; }
  .royale-setup h2 { font-size: 36px; }
  .royale-player-fields { grid-template-columns: 1fr; gap: 12px; }
  .royale-player-field input { font-size: 25px; }
  .royale-board { grid-template-columns: minmax(0, 1fr) 25%; grid-template-rows: minmax(0, min(40vh, 320px)) calc(var(--score-mobile-rows) * 42px); gap: 16px 6px; }
  .royale-turn { grid-template-rows: 49px minmax(0, 1fr); gap: 8px; }
  .royale-player { padding-inline: 8px; }
  .royale-words { padding-block: 14px; }
  .royale-word-slot { padding: 0 16px; }
  .royale-scores { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(var(--score-mobile-rows), minmax(0, 1fr)); gap: 4px 8px; }
  .royale-score { flex-direction: row; align-items: center; gap: 5px; padding: 4px; }
  .royale-score-name { flex: 1; font-size: var(--royale-size, 14px); white-space: normal; overflow-wrap: anywhere; }
  .royale-score .paper-heart { width: 17px; height: 19px; }
  .royale-result { padding: 12px 8px; gap: 13px; }
  .royale-result-label { font-size: 24px; }
  .royale-result-hearts .paper-heart { width: 31px; height: 34px; }
  .royale-stage .zine-controls { padding: 0; gap: 13px; }
  .royale-stage .main-action { font-size: 25px; white-space: normal; }
  .royale-stage .stop-action { font-size: 23px; }
  .royale-stage[data-phase="setup"] .main-action { flex-basis: 100%; }
}
@media (min-width: 701px) and (max-width: 900px) and (orientation: portrait) {
  .royale-stage { padding-top: 106px; }
  .royale-stage .zine-poster { height: 96px; }
  .royale-stage .zine-logo { width: 164px; }
  .royale-stage .zine-character { width: 104px; }
  .royale-player-fields { grid-template-columns: 1fr 1fr; }
  .royale-board { grid-template-rows: minmax(0, min(40vh, 360px)) calc(var(--score-rows) * 82px); }
  .royale-turn { grid-template-rows: 66px minmax(0, 1fr); }
  .royale-scores { grid-template-columns: repeat(var(--score-columns), minmax(0, 1fr)); grid-template-rows: repeat(var(--score-rows), minmax(0, 1fr)); }
  .royale-score { flex-direction: column; align-items: flex-start; gap: 8px; }
  .royale-score-name { flex: 0 0 auto; white-space: nowrap; }
  .royale-score .paper-heart { width: 22px; height: 23px; }
  .royale-stage .main-action { font-size: 32px; }
}
@media (max-width: 360px) and (orientation: portrait) { .royale-heading .ink-label { font-size: 20px; } .royale-board { grid-template-columns: minmax(0, 1fr) 23%; } .royale-stage .main-action { font-size: 23px; } .royale-setup-scroll { padding: 20px; } .royale-scores { gap: 5px; } .royale-score .paper-heart { width: 14px; height: 16px; } }
@media (orientation: landscape) and (max-height: 560px) {
  .royale-stage { grid-template-columns: 17% minmax(0, 1fr); gap: 18px; }
  .royale-stage .zine-logo { top: 12%; left: 22px; right: -3px; }
  .royale-stage .zine-character { top: 49%; width: 98%; left: 12px; }
  .royale-game { grid-template-rows: 44px minmax(0, 1fr) 44px; gap: 6px; }
  .royale-heading .ink-label { font-size: 22px; }
  .royale-board { grid-template-columns: minmax(0, 1fr) 24%; grid-template-rows: minmax(0, 1fr) calc(var(--score-rows) * 38px); gap: 8px 10px; }
  .royale-turn { grid-template-rows: 32px minmax(0, 1fr); gap: 4px; }
  .royale-player { padding: 0 12px; }
  .royale-words { gap: 4px; padding-block: 6px; }
  .royale-word-slot { padding: 0 15px; }
  .royale-scores { grid-template-columns: repeat(var(--score-columns), minmax(0, 1fr)); grid-template-rows: repeat(var(--score-rows), minmax(0, 1fr)); gap: 4px 6px; }
  .royale-score { flex-direction: column; align-items: flex-start; gap: 3px; padding: 2px 3px; }
  .royale-score-name { min-width: 0; flex: 0 0 auto; font-size: min(var(--royale-size, 16px), 16px); }
  .royale-score .paper-heart { width: 12px; height: 14px; }
  .royale-hearts { gap: 2px; }
  .royale-stage .zine-controls { padding: 0 4px; gap: 13px; }
  .royale-stage .main-action { font-size: 26px; }
  .royale-stage .stop-action { font-size: 23px; }
  .royale-setup-scroll { padding: 16px 22px; gap: 12px; }
  .royale-setup h2 { font-size: 29px; }
  .royale-player-fields { gap: 9px 15px; }
  .royale-player-field input { font-size: 23px; }
  .royale-result { gap: 6px; padding: 4px 12px; }
  .royale-result-label { font-size: 22px; }
  .royale-result-hearts .paper-heart { width: 23px; height: 24px; }
  .royale-stage[data-phase="matchEnd"] .royale-result { padding-top: 0; padding-left: 110px; }
  .royale-stage[data-phase="matchEnd"] .royale-result::before { left: 10px; top: 20%; width: 75px; height: 49px; }
}
/* Desktop: one bout, including its controls. Free height stays around this
   group rather than opening a gap between lives and the action. Setup and
   the existing phone/tablet composition keep their original layout. */
@media (min-width: 901px) and (min-height: 561px) {
  .royale-session { --bout-bomb-share: 28%; --bout-word-share: .72; --bout-column-gap: 18px; }
  .royale-stage:not([data-phase="setup"], [data-phase="loading"]) .royale-game { grid-template-rows: 48px minmax(0, 1fr); }
  .royale-stage:not([data-phase="setup"], [data-phase="loading"]) .royale-session {
    grid-area: 2 / 1; display: flex; flex-direction: column; justify-content: center;
    min-width: 0; min-height: 0; gap: 20px;
  }
  .royale-stage:not([data-phase="setup"], [data-phase="loading"]) .royale-board {
    flex: 0 1 auto; align-content: start;
    grid-template-columns: minmax(0, 1fr) var(--bout-bomb-share);
    grid-template-rows: minmax(0, min(38vh, 380px)) calc(var(--score-rows) * 76px);
    gap: 20px var(--bout-column-gap);
  }
  /* Percentages here are relative to the word column, not the whole board:
     (word width + column gap) / word share = the full assignment width. */
  .royale-words > .paper-surface { right: auto; width: calc((100% + var(--bout-column-gap)) / var(--bout-word-share)); }
  .royale-bomb { align-self: end; }
  .royale-stage:not([data-phase="setup"], [data-phase="loading"]) .zine-controls {
    flex: 0 0 64px; width: 100%; padding: 0; display: grid;
    grid-template-columns: minmax(0, 1fr) var(--bout-bomb-share); gap: var(--bout-column-gap);
  }
  .royale-stage:not([data-phase="setup"], [data-phase="loading"]) .main-action { grid-area: 1 / 1; min-width: 0; }
  .royale-stage:not([data-phase="setup"], [data-phase="loading"]) .stop-action { grid-area: 1 / 2; justify-self: start; width: min(100%, 160px); }
}
@media (min-width: 901px) and (max-width: 1050px) and (min-height: 561px) {
  .royale-session { --bout-bomb-share: 26%; --bout-word-share: .74; }
}
@media (prefers-reduced-motion: reduce) { .paper-heart[data-losing="true"] { animation: none !important; } }
@media (forced-colors: active) { .royale-player, .royale-result, .royale-score, .royale-player-field input { color: CanvasText; } .royale-word-text { background: none; color: CanvasText; } .paper-heart { background: Highlight; } .royale-word-slot, .royale-add, .game-menu button { border: 1px solid ButtonText; } .royale-score::before { background: Canvas; } .royale-score[data-active="true"] { outline: 2px solid Highlight; } .royale-score[data-active="true"] .royale-score-name { color: CanvasText; } .game-menu { background: Canvas; } .game-menu button { background: ButtonFace; color: ButtonText; } }
