/* Load LAST. Display-only captions/results; no caption-dependent scene geometry. */
body.presentation-ready {
  --presentation-ink:#f4ead2;
  --presentation-muted:#d0c2a3;
  --presentation-gold:#e2c17c;
  --presentation-focus:#ffe4a0;
  --presentation-edge:#89734f;
  --presentation-panel:#24271d;
  --babay-caption-space:0px;
}

/* Shared menus and conversation controls. Painted scene hotspots, card/chip art,
   rhythm positioning and the fullscreen club/apartment docks keep their own skin. */
body.presentation-ready :is(.head-actions,.yard-toolbar,#requestDock,dialog) button {
  min-width:44px;
  min-height:44px;
  touch-action:manipulation;
}
body.presentation-ready :is(.head-actions,#requestDock,dialog) button {
  border-radius:8px;
  font-weight:650;
  line-height:1.3;
  white-space:normal;
  overflow-wrap:break-word;
  transition:background-color .14s,border-color .14s,box-shadow .14s;
}
body.presentation-ready :is(.head-actions,#requestDock,dialog) button.secondary {
  border-color:#7c7352;
  color:#efe2c0;
  background:linear-gradient(155deg,#414330,#282e21);
  box-shadow:inset 0 1px #fae7b31a,inset 0 -2px #0c120a66,0 2px 0 #10160e;
}
body.presentation-ready :is(#requestDock,dialog) button.primary {
  border-color:#d4ae67;
  color:#2b2112;
  background:linear-gradient(155deg,#ead29a,#bf9756);
  box-shadow:inset 0 1px #fff3ce8c,inset 0 -2px #77532e44,0 2px 0 #654a2b;
}
body.presentation-ready :is(.head-actions,#requestDock,dialog) button:enabled:hover { filter:brightness(1.09); }
body.presentation-ready :is(.head-actions,#requestDock,dialog) button:enabled:active { box-shadow:inset 0 2px 5px #0006; }
body.presentation-ready :is(.head-actions,#requestDock,dialog) button:disabled { opacity:.45; cursor:not-allowed; }
body.presentation-ready :is(button,a,input,select,textarea,summary,[role="button"]):focus-visible {
  outline:2px solid var(--presentation-focus)!important;
  outline-offset:3px;
}
body.presentation-ready :is(input,select,textarea) { accent-color:#d8bd79; }
body.presentation-ready dialog {
  max-width:calc(100vw - 24px);
  max-height:calc(100dvh - 24px);
  color:var(--presentation-ink);
  border-color:var(--presentation-edge);
  box-shadow:0 22px 70px #000a,inset 0 1px #ffe7ae1a;
  overscroll-behavior:contain;
  scrollbar-color:#8a7956 #20231a;
}
body.presentation-ready dialog::backdrop { background:#080b06c9; }
body.presentation-ready dialog :is(p,li,label,.fineprint) { overflow-wrap:break-word; }
body.presentation-ready dialog :is(input[type="number"],input[type="text"],select) { min-height:44px; }
body.presentation-ready dialog .button-row { gap:10px; }
body.presentation-ready #modal .babay-dialog-copy .button-row button { white-space:normal; }
body.presentation-ready #modal :is(.fineprint,.muted,.intro-note) { color:#c9bfa4; }
body.presentation-ready :is(.salary-popover,.request-dock) { border-color:#8c7650; color:var(--presentation-ink); }

/* Repair small legacy table-tool hit areas without resizing the table/card art. */
body.presentation-ready.casino-redesign #bj .table-tools button {
  min-width:44px;
  width:44px;
  min-height:44px;
  height:44px;
  padding:7px;
  font-size:16px;
}
body.presentation-ready.casino-redesign #bj #dealerTaunt {
  min-height:44px;
  line-height:1.25;
  white-space:normal;
}
body.presentation-ready.casino-redesign #bj .casino-controls .casino-bet-tray__minus {
  min-width:44px;
  width:44px;
  min-height:44px;
  height:44px;
}
body.presentation-ready.casino-redesign #bj .casino-controls :is(.bj-actions button,#betAdviceBtn,#noInsurance,#insuranceBuy) {
  white-space:normal;
  overflow-wrap:break-word;
}

/* Keep game hook nodes, retire duplicate speech and the old result statement.
   None of these hidden text nodes may reserve a minimum height or margin. */
body.presentation-ready :is(#toast,#clubSubtitle,#alimonySubtitle,#quote,#casinoBabayQuote,#bjComment,#dealerLine,#betCoach,#bjResult) {
  display:none!important;
  min-height:0!important;
  margin:0!important;
  padding:0!important;
}
body.presentation-ready.casino-redesign #bj .dealer-dialogue {
  border:0;
  background:none;
  box-shadow:none;
  padding:0;
}
body.presentation-ready.casino-redesign #bj .dealer-dialogue > .eyebrow,
body.presentation-ready .speech-label > span { display:none; }
body.presentation-ready.location-shell .shell:has(#locationShell) #characterPanel .speech { display:block!important; min-height:0; padding:6px 12px; }
body.presentation-ready.location-shell .shell:has(#locationShell) #characterPanel .speech-label { display:flex; height:auto; min-height:44px; gap:8px; }
body.presentation-ready #repeatVoice { min-width:44px; min-height:44px; padding:6px 8px; white-space:normal; line-height:1.3; }
body.presentation-ready .shell:has(#locationShell) footer { height:auto; min-height:44px; }
body.presentation-ready footer button { flex:none; width:auto; height:auto; min-width:44px; min-height:44px; padding:8px 6px; line-height:1.3; }
body.presentation-ready footer > span:last-child { flex:0 1 auto; min-width:0; white-space:normal; line-height:1.4; text-align:right; }
@media(min-width:701px) {
  body.presentation-ready.location-shell .shell:has(#locationShell) #characterPanel { grid-template-rows:40px minmax(0,1fr) auto 64px 56px; }
}
@media(max-width:700px) {
  body.presentation-ready.location-shell .shell:has(#locationShell) #characterPanel { grid-template-rows:44px 42px 44px; }
  body.presentation-ready.location-shell .shell:has(#locationShell) #characterPanel .speech { padding:0 0 0 8px; }
}
body.presentation-ready:not(.dev-mode) :is(header .version,#saveStatus) { display:none!important; }
body.presentation-ready.dev-mode #saveStatus { display:inline!important; }
body.presentation-ready:not(.dev-mode) #saveStatus[data-error="true"] { display:inline!important; color:#f1bb95; }

.babay-presentation,
.babay-presentation * { box-sizing:border-box; pointer-events:none!important; }
.babay-presentation {
  --caption-x:50vw;
  --caption-y:calc(100dvh - 12px);
  --caption-width:calc(100vw - 24px);
  --result-x:50vw;
  --result-y:50dvh;
  --result-width:min(600px,calc(100vw - 24px));
  --notice-top:16px;
  --notice-right:16px;
  position:fixed;
  inset:0;
  padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  z-index:10000;
  color:#f4f4f4;
  font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
  font-variant-numeric:tabular-nums;
  isolation:isolate;
}
.babay-presentation[hidden],
.babay-presentation [hidden] { display:none!important; }
.babay-presentation :is(.presentation-subtitle,.presentation-notice,.presentation-result) { pointer-events:auto!important; }
.presentation-subtitle {
  position:fixed;
  z-index:10020;
  top:var(--caption-y);
  left:var(--caption-x);
  transform:translate(-50%,-100%);
  display:block;
  width:max-content;
  max-width:var(--caption-width);
  min-height:0;
  margin:0;
  padding:8px 12px;
  border:0;
  border-radius:0;
  background:rgba(40,40,40,.88);
  box-shadow:none;
  text-align:center;
  text-shadow:none;
}
.presentation-text {
  display:block;
  color:#f4f4f4;
  font-size:16px;
  font-weight:400;
  line-height:1.4;
  white-space:normal;
  overflow-wrap:anywhere;
  text-wrap:wrap;
}
.presentation-notices {
  position:fixed;
  z-index:10030;
  top:var(--notice-top);
  right:max(var(--notice-right),env(safe-area-inset-right));
  display:grid;
  justify-items:end;
  gap:6px;
  width:min(360px,calc(100vw - 28px));
  max-height:38dvh;
}
.presentation-notices:empty { display:none; }
/* 0.39: notices are cards in the wallet HUD finish (warm metal, olive), not subtitles. */
.presentation-notice {
  --acc:#bdc99b; --acc-soft:#bdc99b2e; --acc-line:#bdc99b59;
  position:relative;
  display:grid;
  grid-template-columns:28px minmax(0,1fr);
  align-items:center;
  gap:10px;
  width:fit-content;
  max-width:100%;
  min-height:44px;
  margin:0;
  padding:8px 15px 10px 9px;
  overflow:hidden;
  border:1px solid #766447;
  border-top-color:#ac9061;
  border-radius:11px;
  color:#eee8d7;
  background:linear-gradient(155deg,#37352af7,#20271ff7 57%,#1a211bf7);
  box-shadow:inset 3px 0 0 var(--acc-line),inset 0 1px #f9dfa622,0 4px 0 #0a110c99,0 10px 24px #0007;
  font-size:14.5px;
  font-weight:600;
  line-height:1.35;
  text-shadow:0 1px 1px #0009;
  overflow-wrap:anywhere;
  transform-origin:100% 50%;
  animation:presentationNoticeIn .34s cubic-bezier(.2,.9,.25,1.12) both;
}
.presentation-notice[data-kind="success"] { --acc:#a8d77f; --acc-soft:#a8d77f2e; --acc-line:#a8d77f66; }
.presentation-notice[data-kind="warning"] { --acc:#f2b84b; --acc-soft:#f2b84b2e; --acc-line:#f2b84b6e; }
.presentation-notice[data-kind="error"] { --acc:#ff7f69; --acc-soft:#ff7f692e; --acc-line:#ff7f6973; border-color:#7a4a3c; border-top-color:#b06a52; }
.presentation-notice[data-kind="money"] { --acc:#f5c46b; --acc-soft:#f5c46b33; --acc-line:#f5c46b73; }
.presentation-notice.is-leaving { animation:presentationNoticeOut .26s ease-in both; }
.presentation-notice-icon {
  display:grid; place-items:center; width:28px; height:28px; border-radius:8px;
  color:var(--acc); background:linear-gradient(145deg,var(--acc-soft),#0000004d);
  border:1px solid var(--acc-line); box-shadow:inset 0 1px #ffffff1a;
}
.presentation-notice-icon svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.presentation-notice-text { min-width:0; }
.presentation-notice-life {
  position:absolute; left:10px; right:10px; bottom:3px; height:2px; border-radius:2px;
  background:var(--acc); opacity:.5; transform-origin:0 50%;
  animation:presentationNoticeLife var(--notice-life,4000ms) linear both;
}
.presentation-sr { position:absolute!important; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip:rect(0 0 0 0); clip-path:inset(50%); white-space:nowrap; border:0; }
/* Salary and other incoming money: gold card, flipping coin, shine sweep, count-up amount. */
.presentation-notice[data-rich] {
  grid-template-columns:42px minmax(0,1fr); gap:12px; min-width:200px; padding:10px 20px 13px 11px;
  border-color:#a88a4c; border-top-color:#e8c77e;
  background:radial-gradient(130% 150% at 0% 0%,#f5c46b33,transparent 55%),linear-gradient(155deg,#4a3f22f7,#2c2a19f7 58%,#1d2015f7);
  box-shadow:inset 0 1px #fff0c040,inset 0 -2px #0c120a88,0 4px 0 #0a110c99,0 12px 28px -4px #000a,0 0 30px -8px #f5c46b80;
}
.presentation-notice[data-rich]::after {
  content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none;
  background:linear-gradient(105deg,transparent 38%,#fff3c45c 50%,transparent 62%) no-repeat;
  background-size:260% 100%; background-position:130% 0;
  animation:presentationNoticeShine 1.15s .28s ease-out both;
}
.presentation-notice-coin {
  position:relative; display:grid; place-items:center; width:40px; height:40px; border-radius:50%;
  background:radial-gradient(circle at 34% 30%,#fff7d2 0 10%,#ffd970 30%,#e3a83c 64%,#a26b1a 100%);
  box-shadow:inset 0 0 0 2px #fff3c080,inset 0 -3px 0 #8a5a17aa,0 2px 6px #0008,0 0 16px #f5c46b8c;
  animation:presentationCoinFlip .9s cubic-bezier(.2,.8,.3,1) both;
}
.presentation-notice-coin::before { content:"₽"; color:#7a4b0f; font:900 20px/1 system-ui,-apple-system,"Segoe UI",sans-serif; text-shadow:0 1px 0 #fff2c080; }
.presentation-notice-spark {
  position:absolute; width:10px; height:10px; background:#fff6d6; opacity:0;
  clip-path:polygon(50% 0,62% 38%,100% 50%,62% 62%,50% 100%,38% 62%,0 50%,38% 38%);
  filter:drop-shadow(0 0 3px #ffd970); animation:presentationSpark .8s .5s ease-out both;
}
.presentation-notice-spark:first-child { right:-5px; top:-3px; }
.presentation-notice-spark:last-child { left:-4px; bottom:1px; width:7px; height:7px; animation-delay:.68s; }
.presentation-notice-body { display:grid; gap:1px; min-width:0; }
.presentation-notice-title { color:#e5cca0; font-size:10.5px; font-weight:800; line-height:1.2; letter-spacing:.18em; text-transform:uppercase; }
.presentation-notice-amount {
  display:block; color:#ffd77e; font-size:24px; font-weight:850; line-height:1.08; letter-spacing:-.3px; white-space:nowrap;
  background:linear-gradient(180deg,#fff4c8,#f7c96b 55%,#dc9d34); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent;
  text-shadow:none; filter:drop-shadow(0 1px 0 #0009);
}
.presentation-notice-detail { color:#cfc7b4; font-size:11.5px; font-weight:550; line-height:1.25; }
@keyframes presentationNoticeIn { from { opacity:0; transform:translateX(26px) scale(.96); } to { opacity:1; transform:none; } }
@keyframes presentationNoticeOut { to { opacity:0; transform:translateX(18px) scale(.97); } }
@keyframes presentationNoticeLife { from { transform:scaleX(1); } to { transform:scaleX(0); } }
@keyframes presentationNoticeShine { to { background-position:-40% 0; } }
@keyframes presentationCoinFlip {
  0% { opacity:0; transform:translateY(-16px) scale(.55) rotateY(0); }
  35% { opacity:1; }
  72% { transform:translateY(2px) scale(1.06) rotateY(540deg); }
  100% { opacity:1; transform:translateY(0) scale(1) rotateY(720deg); }
}
@keyframes presentationSpark { 0% { opacity:0; transform:scale(.2) rotate(0); } 40% { opacity:1; transform:scale(1.2) rotate(45deg); } 100% { opacity:0; transform:scale(.4) rotate(90deg); } }
.presentation-result {
  position:fixed;
  z-index:10010;
  top:var(--result-y);
  left:var(--result-x);
  transform:translate(-50%,-50%);
  display:grid;
  justify-items:center;
  gap:6px;
  width:max-content;
  max-width:var(--result-width);
  min-height:0;
  margin:0;
  padding:0;
  border:0;
  border-radius:0;
  color:#fff0b3;
  background:none;
  box-shadow:none;
  text-align:center;
  text-shadow:0 2px 3px #160b00,0 0 4px #a76b0b,0 0 12px #ffc943,0 0 28px #edaa2bbf,0 0 44px #d68b2266;
  animation:presentation-winnings 2s ease-in-out both;
}
.presentation-result-title { font-size:clamp(16px,2vw,22px); font-weight:750; line-height:1.3; letter-spacing:.08em; -webkit-text-stroke:.4px #eab637; paint-order:stroke fill; }
.presentation-result-amount { color:inherit; font-size:clamp(64px,6vw,84px); font-weight:850; line-height:1.1; letter-spacing:-.02em; -webkit-text-stroke:1.4px #ffc943; paint-order:stroke fill; }
@media(max-width:700px) {
  .presentation-result-amount { font-size:clamp(44px,10vw,64px); }
}
@keyframes presentation-winnings {
  0%,100% { opacity:0; }
  12%,78% { opacity:1; }
}
@media(max-width:700px) {
  /* Keep the existing compact status rail, without the former caption footer
     or any caption-related game/workspace minimum height. */
  body.presentation-ready.casino-redesign.location-shell .shell:has(#locationShell) #characterPanel {
    height:96px; min-height:96px; padding:6px; gap:0;
    grid-template-columns:64px minmax(0,1fr); grid-template-rows:38px 44px;
  }
  body.presentation-ready.casino-redesign.location-shell .shell:has(#locationShell) #characterPanel .character-stage { grid-column:1; grid-row:1 / 3; width:64px; height:82px; }
  body.presentation-ready.casino-redesign.location-shell .shell:has(#locationShell) #characterPanel .character-stage img { height:110px; }
  body.presentation-ready.casino-redesign.location-shell .shell:has(#locationShell) #characterPanel .speech { display:none!important; }
  body.presentation-ready.casino-redesign.location-shell .shell:has(#locationShell) #characterPanel .vitals { grid-column:2; grid-row:1; padding:2px 6px 4px; }
  body.presentation-ready.casino-redesign.location-shell .shell:has(#locationShell) #characterPanel .beerbar { grid-column:2; grid-row:2; padding:0 3px 0 6px; }
  .presentation-notices { width:min(290px,calc(100vw - 24px)); gap:5px; }
  .presentation-notice { min-height:40px; padding:7px 13px 9px 8px; font-size:13.5px; gap:9px; grid-template-columns:26px minmax(0,1fr); }
  .presentation-notice-icon { width:26px; height:26px; }
  .presentation-notice[data-rich] { grid-template-columns:38px minmax(0,1fr); min-width:180px; padding:9px 16px 12px 10px; }
  .presentation-notice-coin { width:36px; height:36px; }
  .presentation-notice-amount { font-size:21px; }
  body.presentation-ready dialog .button-row > button { flex:1 1 130px; }
}
/* Existing short-landscape shell fallback, independent of speech length. */
@media(min-width:701px) and (max-height:650px) {
  body.presentation-ready.location-shell:not(.club-live):not(.alimony-live) { height:auto; min-height:100dvh; overflow-x:hidden; overflow-y:auto; }
  body.presentation-ready.location-shell .shell:has(#locationShell) { height:auto; min-height:100dvh; }
  body.presentation-ready.location-shell .shell:has(#locationShell) main { display:grid; grid-template-columns:180px minmax(0,1fr); container-type:normal; flex:none; }
  body.presentation-ready.location-shell .shell:has(#locationShell) #characterPanel { flex:none; width:180px; height:auto; grid-template-rows:40px minmax(150px,1fr) auto 64px 56px; }
  body.presentation-ready.location-shell .shell:has(#locationShell) .rightcol { display:block; width:100%; height:auto; }
  body.presentation-ready.location-shell #locationShell { height:auto; }
  body.presentation-ready.location-shell #locationStage { flex:none; min-height:340px; }
  body.presentation-ready.casino-redesign #bj .casino-visual { min-height:280px; }
}
@media(prefers-reduced-motion:reduce) {
  .babay-presentation * { animation:none!important; transition:none!important; }
  body.presentation-ready :is(.head-actions,#requestDock,dialog) button { transition:none; }
}
@media(forced-colors:active) {
  .presentation-subtitle,.presentation-notice { background:Canvas; color:CanvasText; }
  .presentation-notice { border:1px solid CanvasText; }
  .presentation-notice-amount { background:none; -webkit-text-fill-color:CanvasText; color:CanvasText; }
  .presentation-notice-life,.presentation-notice[data-rich]::after { display:none; }
  .presentation-result { color:CanvasText; text-shadow:none; }
  .presentation-text { color:CanvasText; }
}
