/* Phone play camera. All lanes are in the unrotated board coordinate system
   even when the parent game surface rotates on portrait iPhones. */
@media (orientation:landscape) and (max-height:540px), (orientation:portrait) and (max-width:600px) {
body.immersive.royal-play-full .scene-3d {
 --rr-side-start:18%;
 --rr-side-end:32%;
 --rr-wall-start:20.9%;
 --rr-river-top:27%;
 --rr-river-end:34.9%;
 --rr-mid-inset:21.7%;
 --rr-badge-w:clamp(118px,calc(var(--game-view-w,100vw)*.167),148px);
 --rr-badge-h:clamp(19px,calc(var(--game-view-h,100dvh)*.054),23px);
 --rr-mobile-depth:3px;
}
body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) {
 top:var(--rr-side-start);
 bottom:var(--rr-side-end);
 width:23.5%;
 overflow:visible;
}
body.immersive.royal-play-full .scene-3d .bot.bot-3{left:0}
body.immersive.royal-play-full .scene-3d .bot.bot-1{right:0}

/* Equal angles and centerline origin keep decorated racks parallel to walls.
   Start at logical x 8.9% / 12.5% / 16.6% / 21.8% (mirrored at right). */
body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) :is(.backs,.opposed-open){
 transform-origin:50% 50%;
 top:0;
 bottom:0;
}
body.immersive.royal-play-full .scene-3d .bot.bot-3 .backs{
 left:max(29%,calc(var(--rr-safe) + 2%));right:auto;
}
body.immersive.royal-play-full .scene-3d .bot.bot-1 .backs{
 right:max(29%,calc(var(--rr-safe) + 2%));left:auto;
}
body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .backs{
 width:18%;overflow:visible;gap:1px;padding:1px 4px;
}
body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .backs i{
 min-height:3px;border-radius:1px;
}
body.immersive.royal-play-full .scene-3d .bot.bot-3 .opposed-open{
 left:44%;right:30%;
}
body.immersive.royal-play-full .scene-3d .bot.bot-1 .opposed-open{
 left:30%;right:44%;
}
body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .opposed-open{
 top:3%;bottom:3%;gap:2px;
}
body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .opposed-open :is(.melds,.flowers-tray){
 --unit:clamp(1.7px,calc((100cqh - 7px - var(--groups)*4px - var(--faces)*1px) / max(1,var(--faces))),24px);
}
body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .opposed-open :is(.tile,.tile-back){
 --w:min(calc(var(--unit)*1.54),75cqw);
 margin:0;
 overflow:visible;
 background:#fff7df;
 box-shadow:none;
}
body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .opposed-open .tile-back{
 background:linear-gradient(152deg,#526b9b,#2b3c61 75%);
 border-color:#a7b2c4;
}
body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .opposed-open.many-bonuses .flower-tile{
 --w:min(calc(var(--unit)*1.54),(100cqw - 7px)/var(--bonus-cols,2));
}
body.immersive.royal-play-full .scene-3d :is(.stack-1,.stack-3){
 top:18%;bottom:32%;
 transform-origin:50% 50%;
 width:3.45%;justify-content:center;
}
body.immersive.royal-play-full .scene-3d .stack-3{left:20.1%}
body.immersive.royal-play-full .scene-3d .stack-1{right:20.1%}
body.immersive.royal-play-full .scene-3d .bot.bot-3 .seat-copy:has(.royal-seat-badge){
 left:71%;right:auto;top:50%;bottom:auto;
 transform:translate(-50%,-50%) rotate(109deg);
}
body.immersive.royal-play-full .scene-3d .bot.bot-1 .seat-copy:has(.royal-seat-badge){
 right:71%;left:auto;top:50%;bottom:auto;
 transform:translate(50%,-50%) rotate(-109deg);
}
body.immersive.royal-play-full .scene-3d :is(.bot,.player-head) .royal-seat-badge{
 width:var(--rr-badge-w);height:var(--rr-badge-h);
 gap:5px;
 font-size:clamp(.61rem,calc(var(--game-view-h,100dvh)*.028),.75rem);
}
body.immersive.royal-play-full .scene-3d :is(.bot,.player-head) .royal-seat-badge>b{
 flex:1 1 auto;min-width:0;
}
body.immersive.royal-play-full .scene-3d .royal-seat-badge .seat-wind{
 flex-shrink:0;max-width:none;overflow:visible;
}
body.immersive.royal-play-full .scene-3d .royal-seat-badge .seat-wind i{
 display:inline-grid;place-items:center;
 min-width:14px;min-height:14px;margin:0;
}
body.immersive.royal-play-full .scene-3d .bot-2:has(.royal-seat-badge)>.royal-seat-badge{
 flex-basis:var(--rr-badge-w);
}
body.immersive.royal-play-full .scene-3d .bot-2{
 --rr-far-face:clamp(10px,min(calc(var(--game-view-w,100vw)*.025),4.3cqh),26px);
}
body.immersive.royal-play-full .scene-3d .stack-2{
 height:clamp(9px,5.0cqh,29px);
}
body.immersive.royal-play-full .scene-3d .player{top:65.7%}
body.immersive.royal-play-full .scene-3d .center .river{
 --river-preferred-cols:16;
 --river-face-ratio:.81;
 padding-inline:4px;
}

/* Physical tile profile: lit bevel at rear, a side extrusion behind the face
   and a dropped navy foot; none overlays the glyph or changes its clickbox. */
body.immersive.royal-play-full .scene-3d :is(.bot .backs i,.wall-stack i){
 position:relative;
 overflow:visible;
 background:linear-gradient(167deg,#6077a4 0,#40588a 11%,#27395f 91%);
 border-color:#8192b1 #425776 #2a3a58;
 border-radius:1px;
 box-shadow:0 1px #e4d9b4,0 3px #1d2c4f,0 4px 2px #06170ca3;
}
body.immersive.royal-play-full .scene-3d :is(.bot .backs i,.wall-stack i)::after{
 position:absolute;
 content:"";
 pointer-events:none;
 inset:1px auto -2px 100%;
 width:var(--rr-mobile-depth);
 clip-path:polygon(0 0,100% 22%,100% 100%,0 82%);
 background:linear-gradient(90deg,#263b61,#172641);
}
body.immersive.royal-play-full .scene-3d :is(.bot-3 .backs i,.stack-3 i)::after{
 left:auto;right:100%;
 transform:scaleX(-1);
}
body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .opposed-open :is(.tile,.tile-back){
 filter:drop-shadow(0 1px 0 #e0d7b8) drop-shadow(0 2px 0 #1b3151);
}
body.immersive.royal-play-full .scene-3d .center .river .tile::after{
 background:linear-gradient(180deg,#dfd4b7 0 21%,#567193 26%,#1c2f4c 63%);
}
}

@media (orientation:landscape) and (max-height:540px), (orientation:portrait) and (max-width:600px) {
 body.immersive.royal-play-full .scene-3d{
  --rr-badge-font:clamp(.67rem,calc(var(--game-view-h,100dvh)*.029),.85rem);
  --rr-wall-start:23%;
  --rr-mid-inset:25.7%;
 }
 body.immersive.royal-play-full .scene-3d .bot-2:has(.royal-seat-badge){--rr-rear-start:5.2%}
 body.immersive.royal-play-full .scene-3d .bot-2:has(.flowers-tray>.tile:nth-child(9)){--rr-far-face:clamp(7px,2.75cqh,17px)}
}
@media (orientation:landscape) and (max-height:540px), (orientation:portrait) and (max-width:600px) {
 body.immersive.royal-play-full .scene-3d .player:has(.actions:not(:empty)) .hand{
  top:35%;bottom:39%;
 }
}
@media (orientation:landscape) and (max-height:355px), (orientation:portrait) and (max-width:355px) {
 body.immersive.royal-play-full .scene-3d{--rr-wall-start:24.25%}
 body.immersive.royal-play-full .scene-3d .bot.bot-3 .seat-copy:has(.royal-seat-badge){left:75%}
 body.immersive.royal-play-full .scene-3d .bot.bot-1 .seat-copy:has(.royal-seat-badge){right:75%}
 body.immersive.royal-play-full .scene-3d .player:has(.actions:not(:empty)) .hand{top:38%}
}

/* Keep the phone's discard faces square to the table axes. The tile feet,
   not a shear on the faces, provide the depth cue. */
@media (orientation:landscape) and (max-height:540px), (orientation:portrait) and (max-width:600px) {
 body.immersive.royal-play-full .scene-3d{
  --rr-mid-inset:25.1%;
  --rr-river-top:28.45%;
  --rr-river-end:33.4%;
  --rr-wall-start:23.3%;
  --rr-exposed-face:clamp(12px,6.15cqh,33px);
 }
 body.immersive.royal-play-full .scene-3d .center .river{
  --river-preferred-cols:16;
  --river-face-ratio:.74;
  --river-row-gutter:2;
  grid-auto-rows:calc(var(--discard-w)*var(--river-face-ratio) + (var(--river-row-gutter)*1px));
  justify-content:center;
 }
 body.immersive.royal-play-full .scene-3d .player{top:66.8%}
 body.immersive.royal-play-full .scene-3d .player:not(:has(.actions:not(:empty))) .hand{top:37%}
 body.immersive.royal-play-full .scene-3d .center .river .tile{
  transform:none;
 }
 body.immersive.royal-play-full .scene-3d .bot-2:has(.royal-seat-badge){
  --rr-rear-start:3.8%;
  --rr-far-face:var(--rr-exposed-face);
 }
 body.immersive.royal-play-full .scene-3d .bot-2 .backs{
  padding-block-end:0;
 }
 body.immersive.royal-play-full .scene-3d .bot-2 .backs i{
  height:calc(var(--rear-w)*.98);
 }
 body.immersive.royal-play-full .scene-3d .bot-2 :is(.meld-group,.flowers-tray) :is(.tile,.tile-back){
  transform:none;
 }
 /* The far rack is wide enough for all visible groups except in bonus-heavy
    profiles. Cap faces in those hands so the row stays above the wall. */
 body.immersive.royal-play-full .scene-3d .bot-2:has(.flowers-tray>.tile:nth-child(9)){
  --rr-far-face:clamp(8px,3.7cqh,23px);
 }
}
@media (orientation:landscape) and (max-height:355px), (orientation:portrait) and (max-width:355px){
 body.immersive.royal-play-full .scene-3d{--rr-wall-start:24.25%;--rr-river-top:29.5%}
 body.immersive.royal-play-full .scene-3d .bot-2:has(.royal-seat-badge){--rr-rear-start:3.7%}
 body.immersive.royal-play-full .scene-3d .center .river{--river-preferred-cols:auto}
 body.immersive.royal-play-full .scene-3d .royal-seat-badge{--rr-badge-w:clamp(131px,calc(var(--game-view-w,100vw)*.18),148px)}
}

/* Keep the two side rows on their existing perspective rails, but rotate the
   individual tiles as rigid faces. Neutralizing the parent shear avoids
   deforming the tile glyphs or swinging the entire rail across the felt. */
@media (orientation:landscape), (orientation:portrait) and (max-width:600px) {
 body.immersive.royal-play-full .scene-3d :is(.bot-3,.stack-3){--rr-inward-angle:17deg}
 body.immersive.royal-play-full .scene-3d :is(.bot-1,.stack-1){--rr-inward-angle:-17deg}
 body.immersive.royal-play-full .scene-3d :is(.bot-1,.bot-3) .backs i,
 body.immersive.royal-play-full .scene-3d :is(.stack-1,.stack-3) i{
  transform:skewX(calc(-1 * var(--rail-direction) * var(--rr-rail-slant))) rotate(var(--rr-inward-angle));
  transform-origin:center;
 }
}
@media (orientation:landscape) and (max-height:540px), (orientation:portrait) and (max-width:600px) {
 body.immersive.royal-play-full .scene-3d{
  --rr-mid-inset:24.3%;
  --rr-river-top:28.55%;
  --rr-river-end:26.65%;
 }
 body.immersive.royal-play-full .scene-3d .stack-3{left:19.63%}
 body.immersive.royal-play-full .scene-3d .stack-1{right:19.63%}
 body.immersive.royal-play-full .scene-3d .center .river{
  --river-preferred-cols:16;
  --river-face-ratio:.87;
  --river-row-gutter:2;
  padding-inline:2px;
 }
 body.immersive.royal-play-full .scene-3d .center .river .tile{
  border-radius:2px;
 }
 body.immersive.royal-play-full .scene-3d .player{top:73.55%}
 body.immersive.royal-play-full .scene-3d .player:not(:has(.actions:not(:empty))) .hand{
  top:24%;bottom:19%;
 }
 body.immersive.royal-play-full .scene-3d .player:has(.actions:not(:empty)) .hand{
  top:29%;bottom:41%;
 }
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player .hand .tile{
  --w:clamp(9px,min(calc((100cqw - 48px)/14),8.4cqh),47px);
  height:calc(var(--w)*1.35);
  border-radius:3px;
 }
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player .hand:has(> .tile:nth-child(15)) .tile{
  --w:clamp(8px,min(calc((100cqw - 53px)/17),7.9cqh),43px);
 }
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player:has(.actions:not(:empty)) .hand .tile{
  --w:clamp(8px,min(calc((100cqw - 53px)/17),5.5cqh),40px);
 }
}
@media (orientation:landscape) and (max-height:355px), (orientation:portrait) and (max-width:355px) {
 body.immersive.royal-play-full .scene-3d{
  --rr-mid-inset:24.7%;
  --rr-river-top:29.6%;
  --rr-river-end:30.4%;
 }
 body.immersive.royal-play-full .scene-3d .player{top:70%}
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player:has(.actions:not(:empty)) .hand .tile{
  --w:clamp(8px,min(calc((100cqw - 53px)/17),5.3cqh),36px);
 }
}

@media (orientation:landscape) and (max-height:355px), (orientation:portrait) and (max-width:355px) {
 body.immersive.royal-play-full .scene-3d .center .river{--river-preferred-cols:auto}
}

/* The near seat uses real board space, not a second tile lane beside the name.
   Only the hand and action bar share a row during a claim. */
@media (orientation:landscape) and (max-height:540px), (orientation:portrait) and (max-width:600px) {
 body.immersive.royal-play-full .scene-3d{
  --rr-river-top:27.3%;
  --rr-river-end:24.5%;
  --rr-mid-inset:24.55%;
 }
 body.immersive.royal-play-full .scene-3d .center .river{
  --river-preferred-cols:auto;
  --river-face-ratio:1.17;
  --river-row-gutter:2;
 }
 body.immersive.royal-play-full .scene-3d .center .river .tile{
  border-radius:2px;
 }
 body.immersive.royal-play-full .scene-3d .player{top:75.8%;bottom:max(2.1%,var(--royal-safe-b))}
 body.immersive.royal-play-full .scene-3d .player-head{
  align-content:start;
 }
 body.immersive.royal-play-full .scene-3d .player-head:has(.royal-seat-badge){
  padding-top:calc(var(--rr-badge-h) + 2px);
  flex-wrap:nowrap;
 }
 body.immersive.royal-play-full .scene-3d .player-head .royal-seat-badge{
  position:absolute;top:0;left:50%;transform:translateX(-50%);
 }
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player-head :is(.meld-group,.flowers-tray) .tile{
  --w:clamp(10px,4.6cqh,24px);
  height:calc(var(--w)*1.16);
  transform:none;
 }
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player-head:has(.meld-group:nth-child(4),.flowers-tray>.tile:nth-child(9)) :is(.meld-group,.flowers-tray) .tile{
  --w:clamp(7px,3.55cqh,20px);
 }
 body.immersive.royal-play-full .scene-3d .player:not(:has(.actions:not(:empty))) .hand{
  top:24%;bottom:17%;
 }
 body.immersive.royal-play-full .scene-3d .player:has(.player-head :is(.melds:not(:empty),.flowers-tray:not(:empty))) .hand{
  top:56%;
 }
 body.immersive.royal-play-full .scene-3d .player:has(.actions:not(:empty)) .hand{
  top:46%;bottom:1%;left:0;right:auto;width:53%;justify-content:center;
 }
 body.immersive.royal-play-full .scene-3d .player:has(.actions:not(:empty)):has(.player-head :is(.melds:not(:empty),.flowers-tray:not(:empty))) .hand{
  top:55%;
 }
 body.immersive.royal-play-full .scene-3d .player .move:has(.actions:not(:empty)){
  left:54%;right:0;bottom:1px;max-height:none;
 }
 body.immersive.royal-play-full .scene-3d .player .move .actions .action{
  min-width:0;min-height:36px;max-width:none;padding-inline:4px;
 }
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player:has(.actions:not(:empty)) .hand .tile{
  --w:clamp(8px,min(calc((100cqw - 37px)/17),5.4cqh),36px);
 }
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player:has(.player-head :is(.melds:not(:empty),.flowers-tray:not(:empty))):not(:has(.actions:not(:empty))) .hand .tile{
  --w:clamp(10px,min(calc((100cqw - 47px)/17),7.1cqh),42px);
 }
}
@media (orientation:landscape) and (max-height:355px), (orientation:portrait) and (max-width:355px) {
 body.immersive.royal-play-full .scene-3d{--rr-river-top:29.25%;--rr-river-end:27.3%}
 body.immersive.royal-play-full .scene-3d .player{top:73%}
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player-head :is(.meld-group,.flowers-tray) .tile{
  --w:clamp(8px,3.7cqh,20px);
 }
}
@media (orientation:landscape) and (min-height:356px) and (max-height:540px), (orientation:portrait) and (min-width:356px) and (max-width:600px) {
 body.immersive.royal-play-full .scene-3d{
  --rr-wall-start:21.75%;
  --rr-river-top:25.25%;
  --rr-river-end:24.35%;
 }
 body.immersive.royal-play-full .scene-3d .stack-2{height:clamp(9px,4.15cqh,26px)}
 body.immersive.royal-play-full .scene-3d .center .river{
  --river-face-ratio:1.14;
  padding-block-start:0;
 }
}
@media (orientation:landscape) and (max-height:540px), (orientation:portrait) and (max-width:600px) {
 body.immersive.royal-play-full .scene-3d .player:not(:has(.actions:not(:empty))):has(.player-head :is(.melds:not(:empty),.flowers-tray:not(:empty))) .hand{
  top:auto;bottom:1.2%;
 }
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player:not(:has(.actions:not(:empty))):has(.player-head :is(.melds:not(:empty),.flowers-tray:not(:empty))) .hand .tile{
  --w:var(--rr-self-face,clamp(9px,min(calc((100cqw - 47px)/17),5.7cqh),39px));
 }
}
@media (orientation:landscape) and (min-height:356px) and (max-height:540px), (orientation:portrait) and (min-width:356px) and (max-width:600px) {
 body.immersive.royal-play-full .scene-3d{
  --rr-wall-start:21.75%;
  --rr-river-top:25.25%;
  --rr-river-end:24.15%;
 }
 body.immersive.royal-play-full .scene-3d .stack-3{left:19.25%}
 body.immersive.royal-play-full .scene-3d .stack-1{right:19.25%}
 body.immersive.royal-play-full .scene-3d .center .river{--river-row-gutter:1}
 body.immersive.royal-play-full .scene-3d .center .river .tile{--base:1px}
}
@media (orientation:landscape) and (max-height:540px), (orientation:portrait) and (max-width:600px) {
 body.immersive.royal-play-full .scene-3d .player .move:has(.actions:empty){
  inset:0 auto auto 0;
  width:min(32%,204px);max-height:none;
  display:grid;grid-template-areas:"status clock";
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;justify-items:start;gap:3px;
 }
 body.immersive.royal-play-full .scene-3d .player .move:has(.actions:empty) #status{
  min-width:0;max-width:100%;margin:0;overflow:hidden;text-overflow:ellipsis;
  white-space:nowrap;text-align:left;
 }
 body.immersive.royal-play-full .scene-3d .player .move:has(.actions:empty) .actions{display:none}
}

/* The active table owns the HUD. No separate grid row or colored header
   consumes playing space; lobby and setup keep their original navigation. */
body.immersive.royal-play-full{grid-template-rows:minmax(0,1fr)}
body.immersive.royal-play-full .scene-3d>.top{
 position:absolute;z-index:25;
 inset:max(4.35%,calc(var(--royal-safe-t) + 4px))
     max(10.25%,calc(var(--royal-safe-r) + 7px)) auto
     max(10.25%,calc(var(--royal-safe-l) + 7px));
 display:flex;justify-content:space-between;align-items:center;gap:4px;
 width:auto;max-width:none;height:auto;min-height:0;padding:0;margin:0;
 background:transparent;border:0;box-shadow:none;pointer-events:none;
}
body.immersive.royal-play-full .scene-3d>.top .brand .mahjong-go-crest{
 width:25px;height:25px;border-radius:6px;
}
body.immersive.royal-play-full .scene-3d>.top .mahjong-go-name{
 display:none;
}
body.immersive.royal-play-full .scene-3d>.top .nav{
 gap:4px;pointer-events:auto;
}
body.immersive.royal-play-full .scene-3d>.top .nav > #sound-toggle,
body.immersive.royal-play-full .scene-3d>.top .nav .royal-hud-more>summary{
 display:inline-grid;place-items:center;width:35px;min-height:35px;min-width:35px;padding:0;
 background:#282823e8;color:#ffe7b9;border-color:#dea86e9c;
 border-radius:7px;font-size:.68rem;font-weight:700;
}
body.immersive.royal-play-full .scene-3d>.top .nav #sound-toggle{
 font-size:0;
}
body.immersive.royal-play-full .scene-3d>.top .nav #sound-toggle::after{
 content:"🔊";font-size:.88rem;
}
body.immersive.royal-play-full .scene-3d>.top .nav #sound-toggle[aria-pressed="false"]::after{
 content:"🔇";
}
body.immersive.royal-play-full .scene-3d>.top #solo-progress-label{display:none}

/* Keep wind and player identity, but let the tiles dominate the tabletop. */
body.immersive.royal-play-full .scene-3d .royal-seat-badge>b{
 font-size:.89em;font-weight:650;
}
@media (orientation:landscape) and (max-height:540px), (orientation:portrait) and (max-width:600px) {
 body.immersive.royal-play-full .scene-3d :is(.wall-stack i,.bot .backs i){
  box-shadow:inset 0 1px #d1d8ea72,0 1px #e9dfc1,0 3px #1d2c4f,0 4px 2px #06170ca3;
 }
}

/* Near-seat view: the hand is level and sits on the near edge. Compact
   badges leave vertical room for both the public sets and taller hand tiles. */
@media (orientation:landscape) and (max-height:540px), (orientation:portrait) and (max-width:600px) {
 body.immersive.royal-play-full .scene-3d{
  --rr-rail-slant:12deg;
  --rr-badge-h:clamp(14px,4.05cqh,17px);
 }
 body.immersive.royal-play-full .scene-3d :is(.bot-3,.stack-3){--rr-inward-angle:12deg}
 body.immersive.royal-play-full .scene-3d :is(.bot-1,.stack-1){--rr-inward-angle:-12deg}
 body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .opposed-open :is(.tile,.tile-back){
  transform:skewX(calc(-1 * var(--rail-direction) * var(--rr-rail-slant))) rotate(var(--rr-inward-angle));
  transform-origin:center;
 }
 body.immersive.royal-play-full .scene-3d .bot.bot-3 .seat-copy:has(.royal-seat-badge){
  transform:translate(-50%,-50%) rotate(102deg);
 }
 body.immersive.royal-play-full .scene-3d .bot.bot-1 .seat-copy:has(.royal-seat-badge){
  transform:translate(50%,-50%) rotate(-102deg);
 }
 body.immersive.royal-play-full .scene-3d :is(.bot,.player-head) .royal-seat-badge{
  width:max-content;max-width:min(120px,92%);gap:4px;padding-inline:4px;
  font-size:clamp(.58rem,2.55cqh,.70rem);
 }
 body.immersive.royal-play-full .scene-3d .bot-2:has(.royal-seat-badge)>.royal-seat-badge{
  flex:0 0 auto;
 }
 body.immersive.royal-play-full .scene-3d :is(.bot,.player-head) .royal-seat-badge>b{
  flex:0 1 auto;max-width:13ch;font-size:.94em;
 }
 body.immersive.royal-play-full .scene-3d .royal-seat-badge .seat-wind i{
  min-width:11px;min-height:11px;
 }
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player:not(:has(.actions:not(:empty))) .hand{
  --rr-self-face:clamp(12px,min(7.5cqh,calc(var(--game-view-w,100vw)*.038)),42px);
  top:auto;bottom:1.2%;
  height:calc(var(--rr-self-face)*1.35 + 5px);
 }
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player:not(:has(.actions:not(:empty))) .hand:has(> .tile:nth-child(15)){
  --rr-self-face:clamp(10px,min(7cqh,calc(var(--game-view-w,100vw)*.034)),38px);
 }
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player:not(:has(.actions:not(:empty))):has(.player-head) .hand .tile,
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player:not(:has(.actions:not(:empty))):has(.player-head) .hand:has(> .tile:nth-child(15)) .tile{
  --w:var(--rr-self-face);transform:none;
 }
}
@media (orientation:landscape) and (max-height:355px), (orientation:portrait) and (max-width:355px) {
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player:not(:has(.actions:not(:empty))):has(.player-head :is(.melds:not(:empty),.flowers-tray:not(:empty))) .hand{
  --rr-self-face:clamp(10px,min(6.8cqh,calc(var(--game-view-w,100vw)*.034)),33px);
 }
}

/* Unlabeled game camera: the tabletop is clear; identity and winds stay
   available to scoring, rules, histories and lobby outside the playfield. */
body.immersive.royal-play-full .scene-3d :is(.royal-seat-badge,.plaque .mark){
 display:none;
}
body.immersive.royal-play-full .scene-3d .player-head:has(.royal-seat-badge){
 padding-top:0;
}
@media (orientation:landscape) and (max-height:540px), (orientation:portrait) and (max-width:600px) {
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player:not(:has(.actions:not(:empty))) .hand{
  --rr-self-face:clamp(12px,min(8.6cqh,calc(var(--game-view-w,100vw)*.041)),46px);
 }
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player:not(:has(.actions:not(:empty))) .hand:has(> .tile:nth-child(15)){
  --rr-self-face:clamp(10px,min(7.65cqh,calc(var(--game-view-w,100vw)*.036)),40px);
 }
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player-head :is(.meld-group,.flowers-tray) .tile{
  --w:clamp(10px,5.2cqh,26px);
  box-shadow:0 2px #283e62,0 3px 1px #0a1717b0;
 }
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player-head:has(.meld-group:nth-child(4),.flowers-tray>.tile:nth-child(9)) :is(.meld-group,.flowers-tray) .tile{
  --w:clamp(7px,3.55cqh,20px);
 }
 body.immersive.royal-play-full .scene-3d .player .move:has(.actions:empty){
  width:min(27%,190px);
 }
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .player:has(.actions:not(:empty)) .hand .tile{
  --w:clamp(8px,min(calc((100cqw - 30px)/17),6cqh),39px);
 }
}
@media (orientation:landscape) and (max-height:540px), (orientation:portrait) and (max-width:600px) {
 body.immersive.royal-play-full .scene-3d .player:not(:has(.actions:not(:empty))) .player-head:has(.meld-group:nth-child(4),.flowers-tray>.tile:nth-child(9)){
  padding-top:clamp(20px,5.1cqh,24px);
 }
}

/* Phone opponents use separate lanes and visible physical tile edges.
   The wall depth changes only the artwork, not the tile count or rail. */
@media (orientation:landscape) and (max-height:540px), (orientation:portrait) and (max-width:600px) {
 body.immersive.royal-play-full .scene-3d .bot-2 {
  --rr-rear-start:4.35%;
  --rr-far-face:clamp(10px,4.3cqh,22px);
  row-gap:4px;
 }
 body.immersive.royal-play-full .scene-3d .bot-2 .backs{gap:2px;padding-block-end:3px}
 .game-landscape-compact body.immersive.royal-play-full .scene-3d .bot-2 .backs i,
 .game-landscape-rotated body.immersive.royal-play-full .scene-3d .bot-2 .backs i{
  --rear-w:min(5.05cqw,6.1cqh,32px);
  height:calc(var(--rear-w)*1.15);
  border-top:2px solid #a5b6d9;
  box-shadow:inset 0 2px #b3c9ed68,0 2px #e3d7b5,0 5px #162845,0 6px 2px #051a13a3;
 }
 body.immersive.royal-play-full .scene-3d .bot-2 :is(.melds,.flowers-tray){
  column-gap:4px;
 }
 body.immersive.royal-play-full .scene-3d .bot-2 .meld-group{gap:2px}
 body.immersive.royal-play-full .scene-3d .bot-2 :is(.melds,.flowers-tray) :is(.tile,.tile-back){
  height:calc(var(--w)*.88);
  box-shadow:0 1px #ede0c3,0 3px #1b2e50,0 4px 1px #0a231d99;
 }
 body.immersive.royal-play-full .scene-3d .bot-2:has(.meld-group:nth-child(4),.flowers-tray>.tile:nth-child(9)){
  --rr-far-face:clamp(7px,2.8cqh,14px);
 }
 body.immersive.royal-play-full .scene-3d .stack-2{
  width:49%;left:25.5%;height:clamp(12px,4.8cqh,24px);gap:2px;
  padding-bottom:4px;justify-content:center;
 }
 body.immersive.royal-play-full .scene-3d .stack-2 i{
  flex-basis:7.3%;max-width:7.3%;transform:skewX(-8deg);
 }
 body.immersive.royal-play-full .scene-3d :is(.stack-1,.stack-3){width:3.7%;gap:2px}
 body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .backs{
  width:20%;gap:2px;padding-inline:2px;
 }
 body.immersive.royal-play-full .scene-3d .bot.bot-3 .backs{left:max(25%,calc(var(--rr-safe) + 2%))}
 body.immersive.royal-play-full .scene-3d .bot.bot-1 .backs{right:max(25%,calc(var(--rr-safe) + 2%))}
 body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .backs i{
  flex-basis:13%;border-block-start-color:#a5b6d9;
  box-shadow:inset 0 1px #b7cbf17d,0 1px #e5d9bb,0 2px #14243f;
 }
 body.immersive.royal-play-full .scene-3d .wall-stack i{
  background:linear-gradient(157deg,#748cb8 0%,#516b9b 14%,#2a3d68 86%);
  border-top:1px solid #9cafd2;
 }
 body.immersive.royal-play-full .scene-3d .stack-2 i{
  box-shadow:inset 0 1px #c4d2ee72,0 1px #e8dbb8,0 3px #39547b,0 4px #e7dbbe,0 7px #142641,0 8px 2px #061611a3;
 }
 body.immersive.royal-play-full .scene-3d .stack-2 i.one{
  box-shadow:inset 0 1px #c4d2ee72,0 1px #e8dbb8,0 4px #142641,0 5px 2px #061611a3;
 }
 body.immersive.royal-play-full .scene-3d .stack-3{--rr-bank:1}
 body.immersive.royal-play-full .scene-3d .stack-1{--rr-bank:-1}
 body.immersive.royal-play-full .scene-3d :is(.stack-1,.stack-3) i{
  box-shadow:inset 0 1px #c4d2ee72,calc(1px * var(--rr-bank)) 0 #ecdfc4,calc(3px * var(--rr-bank)) 0 #4a6591,calc(4px * var(--rr-bank)) 0 #e8ddc7,calc(6px * var(--rr-bank)) 0 #172945,0 1px 1px #09151e;
 }
 body.immersive.royal-play-full .scene-3d :is(.stack-1,.stack-3) i.one{
  box-shadow:inset 0 1px #c4d2ee72,calc(1px * var(--rr-bank)) 0 #e8ddc7,calc(4px * var(--rr-bank)) 0 #172945,0 1px 1px #09151e;
 }
 body.immersive.royal-play-full .scene-3d :is(.stack-1,.stack-3) i::after{display:none}
 body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .opposed-open{gap:4px}
 body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .opposed-open :is(.melds,.flowers-tray){
  --unit:clamp(1.5px,calc((100cqh - 7px - var(--groups)*5px - var(--faces)*3px) / max(1,var(--faces))),23px);
 }
 body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .opposed-open :is(.meld-group,.flowers-tray){gap:3px}
 body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .opposed-open :is(.tile,.tile-back){
  border-radius:2px;
  filter:none;
  box-shadow:inset 0 1px #fff9,0 1px #ebdfbd,0 2px #233e60;
 }
}
@media (orientation:landscape) and (max-height:355px), (orientation:portrait) and (max-width:355px) {
 body.immersive.royal-play-full .scene-3d .bot-2{--rr-rear-start:4.1%;row-gap:3px}
}

/* Draw both tiers on the front of each wall cap, not as a flat navy line. */
@media (orientation:landscape) and (max-height:540px), (orientation:portrait) and (max-width:600px) {
 body.immersive.royal-play-full .scene-3d .stack-2{
  top:calc(var(--rr-wall-start) - 7px);
 }
 body.immersive.royal-play-full .scene-3d .stack-2 i::before{
  position:absolute;content:"";pointer-events:none;
  inset:100% 0 auto;height:7px;border-radius:0 0 1px 1px;
  background:linear-gradient(to bottom,#eadfc4 0 1px,#476184 1px 3px,#e8dbc0 3px 4px,#29415f 4px 6px,#152337 6px);
 }
 body.immersive.royal-play-full .scene-3d .stack-2 i.one::before{
  height:4px;background:linear-gradient(to bottom,#eadfc4 0 1px,#365173 1px 3px,#162945 3px);
 }
 body.immersive.royal-play-full .scene-3d :is(.stack-1,.stack-3) i::after{
  display:block;inset:1px auto 0 100%;width:6px;transform:none;
  clip-path:polygon(0 0,100% 12%,100% 93%,0 100%);
  background:linear-gradient(90deg,#ebdec0 0 1px,#4a6590 1px 3px,#e7dbc2 3px 4px,#203958 4px);
 }
 body.immersive.royal-play-full .scene-3d .stack-1 i::after{
  inset:1px 100% 0 auto;transform:scaleX(-1);
 }
 body.immersive.royal-play-full .scene-3d :is(.stack-1,.stack-3) i.one::after{
  width:4px;background:linear-gradient(90deg,#ebdec0 0 1px,#365376 1px 3px,#162945 3px);
 }
 body.immersive.royal-play-full .scene-3d .bot:is(.bot-1,.bot-3) .opposed-open .melds{gap:6px}
}
