/* Phone portrait layout (2026-10-29). Scoped to #rotWrap.native so desktop and landscape are untouched.
   The wrapper's .rot-inner already sits inside the safe areas (app.js sizeRotWrap), so the stage simply fills it;
   the portal's round close button (.rot-exit, 34px at 7px from the top-right corner) gets a clear corner. */

/* ================= BLACKJACK ================= */
#rotWrap.native .stage.bj {
  --bjbar: 182px; /* control bar: 10 pad + 28 meters + 10 + 56 chips + 10 + 56 deal + 12 pad */
  --bjmsg: 24px;
  width: 100% !important; --stage-w: 100% !important; height: 100%; max-height: none !important;
  display: grid; grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: minmax(0, 1fr) var(--bjmsg) var(--bjbar);
  background: #052b1f;
}

/* the felt: dealer on top, the gold "Blackjack pays 3 to 2" arc from the table art, the player's hand, the bet on the rail */
#rotWrap.native .stage.bj .stage-inner {
  aspect-ratio: auto; height: auto; min-height: 0; container-type: size;
  background-image: radial-gradient(ellipse 78% 58% at 50% 36%, #0d6b50 0%, #0b5c44 38%, #084130 72%, #062c20 100%) !important;
  background-size: 100% 100% !important;
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto minmax(0, .5fr) auto;
  grid-template-areas: "dealer" "arc" "." "." "player" "." "bet";
  padding: 50px 0 0;
}
#rotWrap.native .stage.bj .stage-inner::before { /* the table art's arc, scaled to the phone width; edges fade into the felt */
  content: ""; grid-area: arc; display: block; width: 100%; aspect-ratio: 100 / 30; margin: 2px 0;
  background: url(../assets/bj-table.jpg) 50% 29.4% / 128% auto no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 80%, transparent 100%), linear-gradient(to right, transparent 0%, #000 10%, #000 90%, transparent 100%);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 80%, transparent 100%), linear-gradient(to right, transparent 0%, #000 10%, #000 90%, transparent 100%); mask-composite: intersect;
  pointer-events: none;
}
#rotWrap.native .stage.bj .stage-inner::after { /* the padded rail and chip tray along the bottom of the felt */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; aspect-ratio: 100 / 21; z-index: 0;
  background: url(../assets/bj-table.jpg) 50% 100% / 128% auto no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 34%); mask-image: linear-gradient(to bottom, transparent 0%, #000 34%);
  pointer-events: none;
}
#rotWrap.native .stage.bj .stage-inner > * { z-index: 1; }

#rotWrap.native .stage.bj .rtp-tag { left: 10px !important; top: 10px !important; right: auto !important; bottom: auto !important; font-size: 11px; padding: 4px 10px; z-index: 2; }
#rotWrap.native .stage.bj .shoe { right: 14px; top: 52px; width: 34px; box-shadow: 2px 2px 0 #123, 4px 4px 0 #0b1a14; }

#rotWrap.native .stage.bj .dealer-area {
  grid-area: dealer; position: relative; left: auto; top: auto; transform: none; justify-self: center;
  min-height: calc(min(17cqw, 11cqh) * 1.42 + 34px); justify-content: flex-start; gap: 6px;
}
#rotWrap.native .stage.bj .dealer-area .card { --card-w: min(17cqw, 11cqh); }
#rotWrap.native .stage.bj .player-area {
  grid-area: player; position: relative; left: auto; top: auto; transform: none; justify-self: center;
  min-height: calc(min(23cqw, 15cqh) * 1.42 + 50px); gap: 10px; max-width: 100%; justify-content: center;
}
#rotWrap.native .stage.bj .player-area .card { --card-w: min(23cqw, 15cqh); }
#rotWrap.native .stage.bj .player-area:has(.hand + .hand) .card { --card-w: min(14cqw, 11cqh); }
#rotWrap.native .stage.bj .player-area:has(.hand + .hand + .hand) .card { --card-w: min(11cqw, 9cqh); }
#rotWrap.native .stage.bj .player-area:has(.hand + .hand) { gap: 4px; }
#rotWrap.native .stage.bj .hand { position: relative; padding: 6px 8px 4px; gap: 6px; }
#rotWrap.native .stage.bj .hand .rib { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 3; white-space: nowrap; pointer-events: none; }
#rotWrap.native .stage.bj .ribbon { font-size: 13px; padding: 6px 16px; }
#rotWrap.native .stage.bj .total-badge { font-size: 14px; padding: 3px 12px; }
/* the hole card: the deal-in animation's end state overrides .card.down's flip, so show the back face directly until it turns over */
#rotWrap.native .stage.bj .card.down .f { visibility: hidden; }
#rotWrap.native .stage.bj .card.down .b { transform: none; }
#rotWrap.native .stage.bj .card .c { font-size: max(11px, calc(var(--card-w) * .24)); }

#rotWrap.native .stage.bj .bet-area {
  grid-area: bet; position: relative; left: auto; bottom: auto; transform: none; justify-self: center;
  margin-bottom: 8cqw; gap: 4px;
}
#rotWrap.native .stage.bj .bet-stack { width: 52px; height: 52px; }
#rotWrap.native .stage.bj .bet-stack img { width: 52px; }
#rotWrap.native .stage.bj .bet-amount { font-size: 14px; padding: 3px 14px; }

/* message line between the felt and the controls */
#rotWrap.native .stage.bj > .msg {
  grid-row: 2; padding: 0 14px !important; height: var(--bjmsg); line-height: var(--bjmsg); min-height: 0;
  font-size: 12px; text-align: center; color: rgba(255,255,255,.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: #0b0e13; border-top: 1px solid rgba(255,255,255,.06);
}
#rotWrap.native .stage.bj > .msg.err { color: #fca5a5; }

/* control bar: balance and last result in a slim row, a full chip rail with Clear, and one big Deal button */
#rotWrap.native .stage.bj .ctrl-bar {
  grid-row: 3; height: var(--bjbar); box-sizing: border-box;
  display: grid !important; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 28px 56px 56px;
  grid-template-areas: "bal bal" "chips clear" "deal deal";
  gap: 10px 10px !important; padding: 10px 12px 12px !important; background: #0b0e13; border-top: 0;
}
#rotWrap.native .stage.bj .ctrl-bar .spacer { display: none; }
#rotWrap.native .stage.bj .ctrl-bar .meter { display: flex !important; flex-direction: row; align-items: baseline; gap: 8px; min-width: 0; padding: 0 !important; }
#rotWrap.native .stage.bj .ctrl-bar .meter:has(#bjBalance) { grid-row: 1; grid-column: 1 / -1; justify-self: start; }
#rotWrap.native .stage.bj .ctrl-bar .meter:has(#bjLast) { grid-row: 1; grid-column: 1 / -1; justify-self: end; }
#rotWrap.native .stage.bj .ctrl-bar .meter label { font-size: 11px; letter-spacing: .14em; white-space: nowrap; }
#rotWrap.native .stage.bj .ctrl-bar .meter .val { font-size: 16px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#rotWrap.native .stage.bj .chips { grid-area: chips; display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; }
#rotWrap.native .stage.bj .ctrl-bar .chip {
  flex: 0 1 auto; width: clamp(44px, calc((100vw - 120px) / 5 - 4px), 56px) !important; height: auto !important; aspect-ratio: 1; font-size: 13px;
}
#rotWrap.native .stage.bj .ctrl-bar .chip:hover { transform: none; }
#rotWrap.native .stage.bj .ctrl-bar .chip:active { transform: scale(.94); }
#rotWrap.native #bjClear { grid-area: clear; min-height: 48px; align-self: center; padding: 0 14px; font-size: 12px; letter-spacing: .08em; border-radius: 12px; }
#rotWrap.native #bjDeal {
  grid-area: deal; min-width: 0 !important; width: 100%; height: 56px; padding: 0 !important; border-radius: 14px;
  font: 800 19px Cinzel, serif !important; letter-spacing: .16em !important; box-shadow: none;
}
#rotWrap.native #bjDeal:disabled { opacity: .45; }

/* in a hand the chips and Deal step aside and the actions take their place, Hit and Stand on the bottom row for the thumb */
#rotWrap.native .stage.bj:has(#bjActions .btn) .ctrl-bar .chips,
#rotWrap.native .stage.bj:has(#bjActions .btn) #bjClear,
#rotWrap.native .stage.bj:has(#bjActions .btn) #bjDeal { visibility: hidden; }
#rotWrap.native .stage.bj .bj-actions {
  position: absolute; left: 12px; right: 12px; bottom: auto; top: calc(100% + var(--bjmsg) + 48px); height: 122px; max-width: none; z-index: 5;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: 56px 56px; gap: 10px; pointer-events: none;
}
#rotWrap.native .stage.bj .bj-actions .btn {
  pointer-events: auto; grid-row: 1; grid-column: span 3; min-width: 0; height: 56px; padding: 0 6px; border-radius: 14px; box-shadow: none;
  font: 800 15px Inter, sans-serif; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#rotWrap.native .stage.bj .bj-actions:has(> :nth-child(5)) .btn { grid-column: span 2; }
#rotWrap.native .stage.bj .bj-actions:not(:has(> :nth-child(4))) .btn { grid-column: span 6; }
#rotWrap.native .stage.bj .bj-actions .btn[data-a="hit"], #rotWrap.native .stage.bj .bj-actions .btn[data-a="stand"] { grid-row: 2; grid-column: span 3; font-size: 18px; }
#rotWrap.native .stage.bj .bj-actions .btn.secondary { background: #1b2230; border-color: rgba(255,255,255,.22); }

/* ================= CRASH ================= */
#rotWrap.native .stage.crash-stage {
  width: 100% !important; --stage-w: 100% !important; height: 100%; max-height: none !important;
  display: flex; flex-direction: column; background: #05070c;
}
#rotWrap.native .crash-inner { flex: 1 1 auto; aspect-ratio: auto; min-height: 0; height: auto; }

/* scene furniture: logo top-left (the close button owns top-right), the recent multipliers as a swipeable strip under it */
#rotWrap.native .crash-logo { left: 10px; top: 8px; width: 112px; }
#rotWrap.native .crash-hist {
  position: absolute; left: 0; right: 0; top: 50px; max-width: none; padding: 0 10px; gap: 6px; z-index: 6;
  display: flex; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent);
}
#rotWrap.native .crash-hist::-webkit-scrollbar { display: none; }
#rotWrap.native .crash-hist span { flex: 0 0 auto; padding: 5px 11px; font-size: 12px; }
#rotWrap.native .crash-hist::after { content: ""; flex: 0 0 24px; }

#rotWrap.native .crash-center { top: 40%; width: 100%; }
#rotWrap.native .crash-mult { font-size: clamp(64px, 20vw, 92px); }
#rotWrap.native .crash-phase { font-size: 13px; margin-top: 8px; }
#rotWrap.native .countdown { width: 96px; margin-bottom: 34px; }
#rotWrap.native .countdown b { font-size: 40px; }
#rotWrap.native .countdown small { font-size: 11px; }

/* rocket: the scene is taller than the desktop 16:9 frame, so the drawn path climbs more steeply; tilt the nose to match */
#rotWrap.native .rocket-wrap { width: 24%; rotate: -16deg; }
#rotWrap.native .crash-expl { width: 110%; }

#rotWrap.native .crash-players { left: 10px; bottom: 10px; font-size: 12px; padding: 5px 11px; }
#rotWrap.native .crash-stage .rtp-tag { left: 10px; right: auto; top: auto; bottom: 42px; font-size: 11px; }
#rotWrap.native .route-hud { right: 10px; bottom: 26px; width: 26%; }
#rotWrap.native .route-label { font-size: 11px; bottom: -18px; left: auto; right: 0; width: max-content; max-width: 70vw; text-align: right; overflow: hidden; text-overflow: ellipsis; }
#rotWrap.native .leg-callout { bottom: 24%; width: 92%; }
#rotWrap.native .leg-callout b { font-size: 26px; }
#rotWrap.native .leg-callout span { font-size: 12px; }
#rotWrap.native .milestone { font-size: 34px; top: 58%; }
#rotWrap.native .crash-banner { top: 62%; width: max-content; max-width: 88%; padding: 12px 20px; font-size: 16px; text-align: center; line-height: 1.3; box-sizing: border-box; }
#rotWrap.native .cash-float { font-size: 24px; }

/* bet panel: credit and status, bet amount with quick chips, auto cash-out, one huge Place bet / Cash out button */
#rotWrap.native .crash-ctrl {
  flex: 0 0 auto; display: grid !important; box-sizing: border-box;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "credit msg" "betl autol" "bet auto" "quick quick" "go go";
  gap: 8px 10px !important; padding: 10px 12px 12px !important; background: #0b0e13; border-top: 1px solid rgba(255,255,255,.08);
}
#rotWrap.native .crash-ctrl > * { min-width: 0; }
#rotWrap.native .crash-ctrl .spacer { display: none; }
#rotWrap.native .crash-ctrl .meter { padding: 0 !important; min-width: 0; gap: 4px; }
#rotWrap.native .crash-ctrl .meter label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#rotWrap.native .crash-ctrl .meter:has(#crashCredit) { grid-area: credit; flex-direction: row; align-items: baseline; gap: 8px; }
#rotWrap.native #crashCredit { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#rotWrap.native .crash-ctrl .meter:has(#crashBet), #rotWrap.native .crash-ctrl .meter:has(#crashBet) > .row, #rotWrap.native .crash-ctrl .meter:has(#crashAuto) { display: contents; }
#rotWrap.native .crash-ctrl .meter:has(#crashBet) > label { grid-area: betl; }
#rotWrap.native .crash-ctrl .meter:has(#crashAuto) > label { grid-area: autol; }
#rotWrap.native #crashBet, #rotWrap.native #crashAuto {
  width: 100%; box-sizing: border-box; height: 48px; padding: 0 12px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.16); background: #151a22; color: #fff; font: 800 18px Inter, sans-serif; font-variant-numeric: tabular-nums;
}
#rotWrap.native #crashBet { grid-area: bet; }
#rotWrap.native #crashAuto { grid-area: auto; }
#rotWrap.native #crashBet:focus, #rotWrap.native #crashAuto:focus { outline: 2px solid var(--gold2, #f5c542); outline-offset: 1px; }
#rotWrap.native .crash-ctrl .quick { grid-area: quick; display: flex !important; gap: 6px; }
#rotWrap.native .crash-ctrl .quick button {
  flex: 1 1 0; min-width: 0; height: 44px; padding: 0 4px; border-radius: 10px; font-size: 14px; font-weight: 800;
  background: #1b2230; border: 1px solid rgba(255,255,255,.14); color: #fff;
}
#rotWrap.native .crash-ctrl .quick button:active { background: #2a3446; }
#rotWrap.native #crashMsg { grid-area: msg; align-self: center; text-align: right; font-size: 12px; min-height: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#rotWrap.native .crash-ctrl .launch-btn, #rotWrap.native .crash-ctrl .cashout-btn {
  grid-area: go; width: 100%; min-width: 0; height: 62px; min-height: 62px; padding: 0; border-radius: 16px; box-shadow: none;
  font: 800 21px Cinzel, serif; letter-spacing: .14em;
}
#rotWrap.native .crash-ctrl .launch-btn:disabled { opacity: .5; }
#rotWrap.native .crash-ctrl .cashout-btn:disabled { display: none; }
#rotWrap.native .crash-ctrl:has(.cashout-btn:not(:disabled)) .launch-btn { display: none; }
#rotWrap.native .crash-ctrl .cashout-btn:not(:disabled) { animation: none; box-shadow: none; outline: 3px solid rgba(74,222,128,.35); outline-offset: 2px; }
