/* THE PENNY ENGINE — room styles. Every rule scoped under #screen-engine. */

#screen-engine .pe-room {
  max-width: 32rem;
  margin: 0 auto;
  padding: 0.4rem 0.4rem 2rem;
  position: relative;
  transition: filter 1.2s ease;
}

/* the grip: the whole room flinches; the third grip keeps the dark */
#screen-engine .pe-room.pe-gripping { animation: pe-grip-cut 1.6s ease-out; }
@keyframes pe-grip-cut {
  0% { filter: brightness(1); }
  6% { filter: brightness(0.4) saturate(0.8); }
  70% { filter: brightness(0.55) saturate(0.85); }
  100% { filter: brightness(0.96); }
}
#screen-engine .pe-room.pe-third { filter: brightness(0.72) saturate(0.78); }
#screen-engine .pe-room.pe-oiling { filter: brightness(0.88); }

/* ---------- head / the Winding Boy ---------- */
#screen-engine .pe-head { margin-bottom: 0.3rem; }
#screen-engine .pe-head .label { font-size: 0.8rem; letter-spacing: 0.34em; }
#screen-engine .pe-boy {
  min-height: 2.1rem;
  margin: 0.25rem auto 0;
  max-width: 26rem;
  font-size: 0.86rem;
  color: var(--bone);
  transition: opacity 0.3s ease;
}

/* ---------- HUD ---------- */
#screen-engine .pe-hud {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.3rem 0 0.5rem;
  border-bottom: 1px dashed rgba(216, 180, 90, 0.18);
  margin-bottom: 0.55rem;
}
#screen-engine .pe-tray { font-size: 1.1rem; }
#screen-engine .pe-purse { font-size: 1.1rem; color: var(--bone); }
#screen-engine .pe-flag { color: var(--gold-dim); width: 100%; font-size: 0.7rem; }

/* the mainspring — winds down a notch per pull */
#screen-engine .pe-spring {
  position: relative;
  width: 5.2rem;
  height: 0.55rem;
  border: 1px solid #4a3d22;
  background: #0d0a05;
  border-radius: 2px;
  overflow: hidden;
}
#screen-engine .pe-springfill {
  position: absolute;
  inset: 1px auto 1px 1px;
  width: 100%;
  background: repeating-linear-gradient(90deg, #6e5a28 0 4px, #8a7335 4px 6px);
  box-shadow: 0 0 8px rgba(216, 180, 90, 0.35);
  transition: width 0.7s ease;
}
#screen-engine .pe-spring.low .pe-springfill { animation: pe-spring-gutter 1.2s ease-in-out infinite; }
@keyframes pe-spring-gutter { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ---------- coach ---------- */
#screen-engine .pe-coach {
  margin: 0.2rem auto 0.5rem;
  max-width: 25rem;
  font-size: 0.78rem;
  font-style: italic;
  color: #9a937e;
}

/* ====================================================================
   THE CABINET — mahogany case, brass placard, glass, the arm
   ==================================================================== */
#screen-engine .pe-cab {
  position: relative;
  margin: 0 auto;
  max-width: 34rem;
  border-radius: 8px 8px 4px 4px;
  padding: 0.45rem 0.55rem 0.55rem;
  background:
    linear-gradient(178deg, rgba(255, 222, 150, 0.05), rgba(0, 0, 0, 0.25) 60%),
    linear-gradient(90deg, #1c0f06 0%, #4a2c12 8%, #38220e 50%, #4a2c12 92%, #190d05 100%);
  border: 1px solid #54391b;
  box-shadow:
    inset 0 1px 0 rgba(255, 230, 170, 0.12),
    inset 0 0 0 3px rgba(0, 0, 0, 0.45),
    0 16px 44px rgba(0, 0, 0, 0.75);
}
#screen-engine .pe-crest {
  font-size: 0.56rem;
  letter-spacing: 0.32em;
  color: rgba(216, 180, 90, 0.55);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
  padding: 0.1rem 0 0.35rem;
}
#screen-engine .pe-cabrow {
  display: grid;
  grid-template-columns: 7.2rem 1fr 3.6rem;
  gap: 0.5rem;
  align-items: stretch;
}

/* ---------- the brass placard (paytable + her ledger of scratches) ----- */
#screen-engine .pe-placard {
  position: relative;
  border-radius: 3px;
  padding: 0.45rem 0.4rem 1.5rem;
  background:
    linear-gradient(165deg, rgba(255, 246, 200, 0.22), rgba(0, 0, 0, 0.18) 55%),
    linear-gradient(180deg, #8a6f38 0%, #6e5526 45%, #57421d 100%);
  border: 1px solid #3a2c12;
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 210, 0.4),
    inset 0 -2px 5px rgba(0, 0, 0, 0.5),
    0 2px 6px rgba(0, 0, 0, 0.6);
  color: #241a08;
  text-shadow: 0 1px 0 rgba(255, 240, 190, 0.3);
}
#screen-engine .pe-placard.flash { animation: pe-placard-flash 0.7s ease-out; }
@keyframes pe-placard-flash {
  0% { filter: brightness(1.9); }
  100% { filter: brightness(1); }
}
#screen-engine .pe-placard-title {
  font-size: 0.5rem;
  letter-spacing: 0.22em;
  text-align: center;
  border-bottom: 1px solid rgba(36, 26, 8, 0.5);
  padding-bottom: 0.25rem;
  margin-bottom: 0.3rem;
}
#screen-engine .pe-payrow {
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  padding: 0.11rem 0.05rem;
  font-family: Georgia, serif;
}
#screen-engine .pe-payrow i {
  flex: 1;
  border-bottom: 1px dotted rgba(36, 26, 8, 0.55);
  transform: translateY(-2px);
}
#screen-engine .pe-payrow b { font-size: 0.62rem; }
#screen-engine .pe-payrow.lit { animation: pe-row-lit 1.6s ease-out; }
@keyframes pe-row-lit {
  0% { background: rgba(255, 244, 180, 0.85); box-shadow: 0 0 14px rgba(255, 232, 150, 0.8); }
  100% { background: transparent; box-shadow: none; }
}
#screen-engine .pe-placard-foot {
  font-size: 0.5rem;
  font-style: italic;
  color: rgba(36, 26, 8, 0.8);
  text-align: center;
  margin-top: 0.25rem;
}
/* her ledger: three scratches cut into the brass */
#screen-engine .pe-scratches {
  position: absolute;
  left: 0; right: 0; bottom: 0.32rem;
  display: flex;
  justify-content: center;
  gap: 0.55rem;
}
#screen-engine .pe-scratches i {
  width: 3px;
  height: 0.85rem;
  transform: rotate(14deg) scaleY(0.25);
  transform-origin: center;
  background: rgba(36, 26, 8, 0.18);
  border-radius: 1px;
  transition: none;
}
#screen-engine .pe-scratches i.cut {
  background: linear-gradient(180deg, #16100a, #050302);
  box-shadow:
    -1px 0 0 rgba(255, 246, 200, 0.5),
    1px 1px 2px rgba(0, 0, 0, 0.8);
  animation: pe-scratch-cut 0.5s cubic-bezier(0.7, 0, 0.3, 1.4) forwards;
}
@keyframes pe-scratch-cut {
  0% { transform: rotate(14deg) scaleY(0.1); }
  60% { transform: rotate(14deg) scaleY(1.25); }
  100% { transform: rotate(14deg) scaleY(1); }
}

/* ---------- the glass and the drums ---------- */
#screen-engine .pe-glasscol { min-width: 0; }
#screen-engine .pe-glasswrap {
  position: relative;
  border-radius: 4px;
  padding: 4px;
  background: linear-gradient(180deg, #6e5526, #3a2a12 30%, #241808 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 190, 0.3),
    inset 0 0 0 2px rgba(0, 0, 0, 0.6);
}
#screen-engine .pe-canvas {
  display: block;
  width: 100%;
  border-radius: 2px;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.9);
}
#screen-engine .pe-handline {
  position: absolute;
  left: 8px; right: 8px; bottom: 7px;
  font-size: 0.72rem;
  font-style: italic;
  letter-spacing: 0.06em;
  color: var(--bone);
  text-shadow: 0 1px 3px #000, 0 0 8px #000;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
#screen-engine .pe-handline.show { opacity: 1; }
#screen-engine .pe-handline[data-kind='good'] { color: var(--gold); }
#screen-engine .pe-handline[data-kind='bad'] { color: #c98e86; }

/* toast over the glass */
#screen-engine .pe-toast {
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%) translateY(-6px);
  max-width: 92%;
  padding: 0.3rem 0.7rem;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  background: rgba(8, 7, 5, 0.92);
  border: 1px solid #3a2c18;
  border-radius: 3px;
  color: var(--bone);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  z-index: 5;
}
#screen-engine .pe-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#screen-engine .pe-toast[data-kind='good'] { border-color: var(--gold-dim); color: var(--gold); }
#screen-engine .pe-toast[data-kind='bad'] { color: #c98e86; }
#screen-engine .pe-toast[data-kind='grip'] { border-color: var(--red); color: #d4a59f; }
#screen-engine .pe-toast[data-kind='oil'] { color: #9fb39a; }

/* ---------- the hold clamps — fat, brass, under each drum ---------- */
#screen-engine .pe-holdrow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-top: 5px;
}
#screen-engine .pe-hold {
  min-width: 0;
  min-height: 48px;
  padding: 0;
  border: 1px solid #3a2c12;
  border-radius: 3px;
  background: linear-gradient(180deg, #4a3a1c, #33250e 60%, #241a08);
  color: rgba(216, 180, 90, 0.8);
  font-family: Georgia, serif;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  cursor: pointer;
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 190, 0.18),
    0 2px 4px rgba(0, 0, 0, 0.55);
  transition: all 0.12s ease;
}
#screen-engine .pe-hold:disabled {
  opacity: 0.32;
  cursor: default;
}
#screen-engine .pe-hold .pe-hold-held { display: none; }
#screen-engine .pe-hold.held {
  background: linear-gradient(180deg, #8a6f38, #6e5526 55%, #57421d);
  color: #241a08;
  text-shadow: 0 1px 0 rgba(255, 240, 190, 0.4);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.45),
    0 0 10px rgba(216, 180, 90, 0.35);
  transform: translateY(1px);
}
#screen-engine .pe-hold.held .pe-hold-word { display: none; }
#screen-engine .pe-hold.held .pe-hold-held { display: inline; }
/* while the hold is owed, the clamps breathe so nobody misses the decision */
#screen-engine .pe-holding .pe-hold:not(:disabled):not(.held) {
  animation: pe-hold-breathe 1.6s ease-in-out infinite;
}
@keyframes pe-hold-breathe {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255, 240, 190, 0.18), 0 2px 4px rgba(0, 0, 0, 0.55); }
  50% { box-shadow: inset 0 1px 0 rgba(255, 240, 190, 0.18), 0 0 11px rgba(216, 180, 90, 0.4); }
}

/* ---------- THE ARM ---------- */
#screen-engine .pe-armcol {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
#screen-engine .pe-armtrack {
  --pull: 0;
  position: relative;
  width: 3.4rem;
  flex: 1;
  min-height: 13rem;
  touch-action: none;
  cursor: grab;
  border-radius: 4px;
}
#screen-engine .pe-armtrack.held { cursor: grabbing; }
#screen-engine .pe-armslot {
  position: absolute;
  left: 50%; top: 6%;
  bottom: 8%;
  width: 9px;
  transform: translateX(-50%);
  border-radius: 5px;
  background: linear-gradient(90deg, #000, #1c1208 50%, #000);
  box-shadow:
    inset 0 0 6px #000,
    0 1px 0 rgba(255, 240, 190, 0.08);
}
#screen-engine .pe-armrod {
  position: absolute;
  left: 50%;
  top: 7%;
  width: 7px;
  height: calc(8% + (var(--pull) * 72%));
  transform: translateX(-50%);
  border-radius: 4px;
  background: linear-gradient(90deg, #241606, #6e5226 45%, #c8a86a 52%, #6e5226 60%, #241606);
  transition: height 0.28s cubic-bezier(0.25, 1.6, 0.45, 1);
}
#screen-engine .pe-armknob {
  position: absolute;
  left: 50%;
  top: calc(8% + (var(--pull) * 72%));
  width: 2.4rem;
  height: 2.4rem;
  transform: translate(-50%, -25%);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #f0d9a0, #c8a86a 35%, #6e5226 75%, #241606);
  box-shadow:
    0 4px 9px rgba(0, 0, 0, 0.7),
    inset 0 -2px 4px rgba(0, 0, 0, 0.45);
  transition: top 0.28s cubic-bezier(0.25, 1.6, 0.45, 1);
}
#screen-engine .pe-armtrack.held .pe-armrod,
#screen-engine .pe-armtrack.held .pe-armknob { transition: none; }
#screen-engine .pe-armtrack.snap .pe-armrod,
#screen-engine .pe-armtrack.snap .pe-armknob { transition: none; }
#screen-engine .pe-armtrack.armed .pe-armknob { animation: pe-knob-glint 3.4s ease-in-out infinite; }
@keyframes pe-knob-glint {
  0%, 86%, 100% { filter: brightness(1); }
  92% { filter: brightness(1.28); }
}
/* THE GRIP: the arm climbs against the hand and shudders */
#screen-engine .pe-armtrack.gripped .pe-armrod,
#screen-engine .pe-armtrack.gripped .pe-armknob {
  transition: top 1.1s cubic-bezier(0.6, 0, 0.2, 1), height 1.1s cubic-bezier(0.6, 0, 0.2, 1);
}
#screen-engine .pe-armtrack.gripped .pe-armknob { animation: pe-knob-shudder 0.22s linear infinite; }
@keyframes pe-knob-shudder {
  0%, 100% { margin-left: 0; }
  25% { margin-left: -1.5px; }
  75% { margin-left: 1.5px; }
}
#screen-engine .pe-armhint {
  width: 100%;
  font-size: 0.56rem;
  line-height: 1.5;
  text-align: center;
  letter-spacing: 0.12em;
  color: var(--gold-dim);
  pointer-events: none;
}

/* ---------- the base: slot, coins, take, bank ---------- */
#screen-engine .pe-base {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.5);
  box-shadow: 0 -1px 0 rgba(255, 240, 190, 0.07);
}
#screen-engine .pe-slotwrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
#screen-engine .pe-slotword { font-size: 0.62rem; letter-spacing: 0.14em; }
#screen-engine .pe-coins { display: flex; gap: 0.4rem; }
#screen-engine .pe-coin {
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  border: 1px solid #4a3d22;
  background: radial-gradient(circle at 36% 30%, #3c3018, #241a08 70%);
  color: var(--bone);
  font-family: Georgia, serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
#screen-engine .pe-coin .pe-coinface { display: block; font-size: 0.7rem; color: var(--gold-dim); }
#screen-engine .pe-coin.sel {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 10px rgba(216, 180, 90, 0.35);
}
#screen-engine .pe-coin.sel .pe-coinface { color: var(--gold); }
#screen-engine .pe-coin:disabled { opacity: 0.35; cursor: default; }
#screen-engine .pe-slotmouth {
  width: 1.7rem;
  height: 0.5rem;
  border-radius: 2px;
  background: #000;
  box-shadow:
    inset 0 0 5px #000,
    0 0 0 2px #57421d,
    0 0 0 3px #241808;
}
#screen-engine .pe-slotmouth.feeding {
  animation: pe-slot-feed 0.26s linear infinite;
  box-shadow:
    inset 0 0 7px rgba(168, 54, 46, 0.8),
    0 0 0 2px #57421d,
    0 0 8px rgba(168, 54, 46, 0.5);
}
@keyframes pe-slot-feed {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(1px); }
}
#screen-engine .pe-take,
#screen-engine .pe-bank {
  min-height: 48px;
  padding: 0 0.9rem;
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  background: rgba(20, 15, 6, 0.8);
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: all 0.15s ease;
}
#screen-engine .pe-take:hover,
#screen-engine .pe-bank:hover:not(:disabled) { box-shadow: 0 0 10px rgba(216, 180, 90, 0.3); }
#screen-engine .pe-bank:disabled { opacity: 0.35; cursor: default; box-shadow: none; }
#screen-engine .pe-take.hidden { visibility: hidden; }   /* keeps its seat — the base never reflows */

/* ---------- footer ---------- */
#screen-engine .pe-footer {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin-top: 0.6rem;
}

/* ---------- explainer (the vestibule) ---------- */
#screen-engine .pe-explainer {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(4, 5, 6, 0.94);
  overflow-y: auto;
  padding: 1.6rem 0.8rem 2.4rem;
  text-align: center;
}
#screen-engine .pe-explainer-house {
  font-style: italic;
  color: var(--bone);
  max-width: 28rem;
  margin: 1.2rem auto 1rem;
}
#screen-engine .pe-dismiss { min-height: 48px; letter-spacing: 0.2em; }
#screen-engine .pe-howto {
  text-align: left;
  margin: 0.2rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--bone);
}
#screen-engine .pe-howto li { margin-bottom: 0.3rem; }
#screen-engine .pe-howto li::marker { color: var(--gold-dim); }

/* vestibule demos */
#screen-engine .pe-demo {
  position: relative;
  height: 3.2rem;
  margin: 0.4rem auto 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}
#screen-engine .pe-demo-card {
  display: inline-block;
  width: 1.7rem;
  height: 2.3rem;
  line-height: 2.3rem;
  border-radius: 3px;
  background: #d8d0b8;
  color: #241e16;
  font-family: Georgia, serif;
  font-size: 0.78rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}
#screen-engine .pe-demo-pays { color: var(--gold); font-family: Georgia, serif; letter-spacing: 0.1em; }
#screen-engine .pe-demo-drum {
  width: 2.1rem;
  height: 2.8rem;
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.85)),
    repeating-linear-gradient(180deg, #d8d0b8 0 0.62rem, #241a10 0.62rem 0.78rem);
  animation: pe-demo-hitch 2.2s ease-in-out infinite;
  background-position-y: 0, 0;
}
@keyframes pe-demo-hitch {
  0%, 55% { background-position-y: 0, 0; }
  68% { background-position-y: 0, 0.5rem; }
  76% { background-position-y: 0, 0.42rem; }
  84%, 100% { background-position-y: 0, 0.78rem; }
}
#screen-engine .pe-demo-stutter { color: var(--gold-dim); font-size: 0.9rem; letter-spacing: 0.2em; animation: pe-spring-gutter 1.1s ease-in-out infinite; }
#screen-engine .pe-demo-arm {
  width: 0.5rem;
  height: 2.6rem;
  border-radius: 3px;
  background: linear-gradient(90deg, #241606, #c8a86a 50%, #241606);
  transform-origin: bottom center;
  animation: pe-demo-pullback 2.6s ease-in-out infinite;
}
@keyframes pe-demo-pullback {
  0%, 30% { transform: rotate(0deg); }
  45% { transform: rotate(26deg); }
  58% { transform: rotate(22deg); }
  72%, 100% { transform: rotate(0deg); }
}
#screen-engine .pe-demo-tally { display: flex; gap: 0.3rem; }
#screen-engine .pe-demo-tally i {
  width: 3px;
  height: 1rem;
  background: var(--red);
  transform: rotate(14deg);
  opacity: 0.3;
}
#screen-engine .pe-demo-tally i:nth-child(1) { opacity: 0.95; }
#screen-engine .pe-demo-tally i:nth-child(2) { opacity: 0.7; animation: pe-spring-gutter 1.6s ease-in-out infinite; }

/* ---------- end panel: THE LEDGER PLATE ---------- */
#screen-engine .pe-end {
  position: fixed;
  inset: 0;
  z-index: 38;
  background: rgba(4, 5, 6, 0.95);
  padding: 0;
  text-align: center;
}
#screen-engine .pe-end-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 2.2rem 0.8rem 2.4rem;
}
#screen-engine .pe-end h3 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(216, 180, 90, 0.35);
}
#screen-engine .pe-end h3.pe-down { color: var(--red); text-shadow: 0 0 18px rgba(168, 54, 46, 0.45); }
#screen-engine .pe-end-detail { margin: 0.4rem 0; color: var(--bone); letter-spacing: 0.04em; }
#screen-engine .pe-ledger {
  max-width: 26rem;
  margin: 1rem auto;
  border: 1px solid #4a3d22;
  border-radius: 4px;
  background:
    linear-gradient(168deg, rgba(255, 246, 200, 0.07), rgba(0, 0, 0, 0.2) 55%),
    rgba(16, 12, 6, 0.9);
  padding: 0.6rem 0.45rem 0.7rem;
  box-shadow: inset 0 1px 0 rgba(255, 240, 190, 0.1);
}
#screen-engine .pe-ledger-label {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.3em;
  color: var(--gold-dim);
  margin-bottom: 0.2rem;
}
#screen-engine .pe-ledger-key { font-size: 0.62rem; margin: 0 0 0.5rem; }
#screen-engine .pe-lg-row {
  display: grid;
  grid-template-columns: 1.1rem 2rem 1fr minmax(3.2rem, auto);
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  padding: 0.18rem 0.2rem;
  color: var(--bone);
  text-align: left;
}
#screen-engine .pe-lg-row[data-kind='grip'] { display: flex; }
#screen-engine .pe-lg-row:nth-child(odd) { background: rgba(255, 250, 235, 0.025); }
#screen-engine .pe-lg-stake { color: var(--gold-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
#screen-engine .pe-lg-cards { display: flex; align-items: center; flex-wrap: wrap; gap: 1px; }
#screen-engine .pe-lg-arrow { color: var(--gold-dim); margin: 0 2px; }
#screen-engine .pe-lg-hitch { letter-spacing: 0; margin-left: 3px; }
#screen-engine .pe-lg-res { text-align: right; font-size: 0.62rem; letter-spacing: 0.03em; }
#screen-engine .pe-lg-row[data-kind='win'] .pe-lg-res { color: var(--gold); }
#screen-engine .pe-lg-row[data-kind='lose'] .pe-lg-res { color: #8c8775; }
#screen-engine .pe-lg-row[data-kind='grip'] { color: #d4a59f; }
#screen-engine .pe-lg-grip { color: var(--red); letter-spacing: 0.04em; }
#screen-engine .pe-lc {
  display: inline-block;
  min-width: 1.18rem;
  padding: 0.04rem 0.08rem;
  margin-right: 1px;
  border-radius: 2px;
  background: #d8d0b8;
  color: #241e16;
  font-family: Georgia, serif;
  font-size: 0.62rem;
  text-align: center;
  line-height: 1.25;
}
#screen-engine .pe-lc.red { color: #8e2f26; }
#screen-engine .pe-lc.held { box-shadow: 0 0 0 1.5px var(--gold); }
#screen-engine .pe-end-house {
  font-style: italic;
  color: #9a937e;
  max-width: 24rem;
  margin: 0.6rem auto 1rem;
}
#screen-engine .pe-end-leave { min-height: 48px; letter-spacing: 0.18em; }

/* ---------- mobile: thumb-fair at ≤600px, no horizontal scroll ---------- */
@media (max-width: 600px) {
  #screen-engine .pe-room { padding: 0.2rem 0.2rem 1.4rem; }
  #screen-engine .pe-hud { gap: 0.55rem; }
  #screen-engine .pe-cab { padding: 0.35rem 0.35rem 0.45rem; }
  #screen-engine .pe-cabrow {
    grid-template-columns: 1fr 3.2rem;
    grid-template-areas:
      'placard placard'
      'glass arm';
  }
  #screen-engine .pe-placard {
    grid-area: placard;
    display: grid;
    grid-template-columns: 1fr;
    padding: 0.3rem 0.4rem 1.3rem;
  }
  #screen-engine .pe-payrows {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 0.7rem;
  }
  #screen-engine .pe-glasscol { grid-area: glass; }
  #screen-engine .pe-armcol { grid-area: arm; }
  #screen-engine .pe-armtrack { width: 3rem; min-height: 11rem; }
  #screen-engine .pe-armhint { display: none; }
  #screen-engine .pe-hold { min-height: 50px; font-size: 0.56rem; }
  #screen-engine .pe-base { gap: 0.45rem; }
  #screen-engine .pe-take, #screen-engine .pe-bank { padding: 0 0.6rem; font-size: 0.68rem; }
  #screen-engine .pe-end h3 { font-size: 1.25rem; letter-spacing: 0.16em; }
  #screen-engine .pe-lg-row { font-size: 0.66rem; }
}
