/* =====================================================================
   SAFE BOX (7 Nov 2026): every phone, loaded last. Whatever a player reads or taps stays inside the safe box from style.css
   (--safeT/R/B/L: camera, Dynamic Island, curved edge, home bar). Only background art or colour fills the whole screen.
   Measured on each phone by tools/screen-check/devices.py.
   ===================================================================== */

/* story map, story book, comics */
html body .stx{padding:calc(8px + var(--safeT)) var(--safeR) calc(10px + var(--safeB)) var(--safeL)}
html body .cskip{top:calc(8px + var(--safeT)); right:var(--safeR)}
html body .ctap{bottom:calc(7px + var(--safeB)); left:var(--safeL); right:var(--safeR)}

/* the table stays inside the safe box and shrinks to fit it */
@media (orientation:landscape) and (max-height:540px){
  html body .scores{max-width:calc(100% - 276px); gap:4px}            /* every score stays on screen, between the game name and the buttons */
  html body .scores .chip{padding-inline:8px}
}
@media (orientation:landscape) and (max-height:540px) and (max-width:760px){
  html body .center{gap:10px}
  html body .piles{gap:12px}
  html body .center>.msg{flex:0 1 auto; width:auto; min-width:0}      /* the message gives way before the piles reach the seats */
  html body .deadpill{left:auto; right:0}                             /* the taller hand here: clear of the stock and pile labels */
  html body.lefty .deadpill{right:auto; left:0}
}

/* finger-sized buttons (at least 44pt / 48dp): the picture stays the same size, an invisible edge around it takes the touch */
html body :is(#newBtn,#sndBtn,#emoBtn,#lAutoBtn,.opt,#stNext,#stPrev,#storyBookBtn,#storyGo,.ctabs button,.aside-p,.mini-btn,.playbuy,#photoPick,#slotRand,
  #homeBack,#homeEnd,#homeRules,#tradeClose,#albumTrade,#albumPearl,#shareBtn,#setSignOut,#collToShop,.wallet span,#hubStore,#tradeClose,.gpanel .btn,#dealBtn,[class*="af-"]){position:relative}
html body :is(.xback,.cskip,#newBtn,#sndBtn,#emoBtn,#lAutoBtn,.opt,#stNext,#stPrev,#storyBookBtn,#storyGo,.ctabs button,.aside-p,.mini-btn,.playbuy,#photoPick,#slotRand,
  #homeBack,#homeEnd,#homeRules,#tradeClose,#albumTrade,#albumPearl,#shareBtn,#setSignOut,#collToShop,.wallet span,#hubStore,#tradeClose,.gpanel .btn,#dealBtn,.lgback,[class*="af-"])::after{content:""; position:absolute; inset:-11px -6px; border-radius:inherit}
html body .xback::after{inset:-11px !important; border-radius:0 !important}
/* an X in a header bar must be the box for its own tap ring: without this the ring stretched over the whole window and took every touch */
html body :is(.lgbar,.stbar,#albumOv .atop)>button.xback.xback.xback{position:relative !important}
html body [class*="af-"]::after{inset:-12px -6px !important}
html body .gpanel select{min-height:44px !important}
html body #helpOv .gpanel a:not(.btn){display:inline-block; padding-block:9px; margin-block:-9px}

/* a table of six: five seats share the top row, so each one is shorter and narrower */
@media (orientation:landscape) and (max-height:540px){
  html body .bseats:has(.bseat:nth-child(5)){gap:2px}
  html body .bseats:has(.bseat:nth-child(5)) .tag{display:none}
  html body .bseats:has(.bseat:nth-child(5)) .bseat{flex:1 1 0; min-width:0}
  html body .bseats:has(.bseat:nth-child(5)) .who{width:100%; max-width:100%; min-width:0; gap:3px}
  html body .bseats:has(.bseat:nth-child(5)) .brow{flex-wrap:wrap; justify-content:center; column-gap:4px; row-gap:0; max-width:100%}
  html body .bseats:has(.bseat:nth-child(5)) .who>span:not(.av){flex:1 1 0; min-width:0; overflow:hidden}
  html body .bseats:has(.bseat:nth-child(5)) .who>.av{flex:none}
  html body .bseats:has(.bseat:nth-child(5)) .cleft small{display:none}
  html body .bseats:has(.bseat:nth-child(5)) .nm{display:block; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
  html body .bseats:has(.bseat:nth-child(5)) .cnt{font-size:10px}
}

/* the invisible box popups placed from code use to stay on screen (safeX, safeY in game.js) */
#safeBox{position:fixed; top:var(--safeT); right:var(--safeR); bottom:var(--safeB); left:var(--safeL); visibility:hidden; pointer-events:none}

/* the table's thin gold line sits just outside the content, inside the safe box's side margin */
html body::after{inset:calc(var(--safeT) + 6px) calc(var(--safeR) - 9px) calc(var(--safeB) + 6px) calc(var(--safeL) - 9px)}

/* messages along the top */
html body #storyTip{top:calc(10px + var(--safeT)); max-width:min(520px, var(--safeW))}
html body .toast{top:calc(12px + var(--safeT)); width:min(440px, var(--safeW))}
html body .achtoast{top:calc(14px + var(--safeT)); max-width:var(--safeW)}
html body .gnote{top:calc(14px + var(--safeT)); max-width:min(520px, var(--safeW))}
html body .smash-text{max-width:var(--safeW)}

/* the smallest labels in the Google Play price list */
html body .playpacks small{font-size:9px}

/* the two round X buttons that sit on the screen itself, not in a frame */
html body #hubOv button.xback.hubback{right:var(--safeR) !important}

/* the home cards share the width as well as the height on a squarer screen (tablets) */
@media (min-height:480px) and (max-height:540px){ html body #hubOv .gcard{--cw:min(140px, 15vw) !important} }
/* scores along the top stay below anything the phone reports there */
@media (orientation:landscape) and (max-height:540px){ html body .scores{top:calc(8px + var(--safeT))} }

/* the setup choices keep a finger's height on the smallest phones; six-player badges are not clipped */
html body #setupOv .opt{min-height:36px}
html body .bseats{overflow:visible}

/* iPhones on iOS 15.0-15.3 have no dvh: the safe box falls back to the full height */
@supports not (height:1dvh){ :root{--safeH:calc(100vh - var(--safeT) - var(--safeB))} }

/* the setup window keeps its pickers finger-sized and still fits without scrolling */
html body #setupOv select{min-height:42px !important}
html body #setupOv .opt{min-height:38px}
html body #setupOv .gpanel h3{margin-top:2px !important}

/* someone else's Digu: a plain word, no celebration (game.js diguCallout) */
html body .dcall.other .cword.plain{font-size:clamp(32px,6vw,44px); line-height:1.1; color:#ecd3ac; -webkit-text-fill-color:#ecd3ac; text-shadow:none}

/* SMOOTH AND COOL (7 Nov 2026): during play nothing on the table runs by itself. The table's light layers updated the whole screen in small jumps a few
   times a second (seen as the screen "refreshing", and they kept the phone working); the same soft light now stays still. */
html body.in-game #tableFx i{animation:none !important}
/* the computer's "thinking" dots: revealed, not resized, so the page is not measured again three times a second */
@keyframes think{0%{clip-path:inset(0 16px 0 0)}50%{clip-path:inset(0 8px 0 0)}100%{clip-path:inset(0 0 0 0)}}
/* the Digu button's glow fades (cheap) instead of repainting its shadow every frame */
html body .btn.digu{animation:none; position:relative}
html body .btn.digu::before{content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none; box-shadow:0 0 0 5px rgba(240,165,58,.55); opacity:0; animation:beckonO 1.2s ease-in-out infinite}
@media (prefers-reduced-motion:reduce){ html body .btn.digu::before{animation:none} }

/* the smallest phones: four scores in a row, and the X of the game menu inside the side margin */
@media (orientation:landscape) and (max-height:540px) and (max-width:700px){
  html body .scores{max-width:calc(100% - 248px); gap:3px}
  html body .scores .chip{padding-inline:6px; gap:3px; font-size:12px}
  html body .scores .chip b{font-size:13px}
  html body .scores .target{display:none}
}
/* (Fix Round 3 item 6) back buttons are always top left: the old right-side rules for #toHub and #newBtn are gone */

/* story map clouds: moved by the graphics chip alone, so the page is not measured again every frame */
html body .stcloud{left:-12%; animation-name:stcloudT}
html body .stcloud.c2{animation-name:stcloudT2}
@keyframes stcloudT{from{transform:translateX(0)}to{transform:translateX(564%)}}
@keyframes stcloudT2{from{transform:translateX(0)}to{transform:translateX(775%)}}

/* the League window: the title bar stays, only the page under it scrolls */
html body #leagueOv>.panel.league{display:flex !important; flex-direction:column; overflow:hidden !important}
html body #leagueOv #lgBody{flex:1; min-height:0; display:flex; flex-direction:column}
html body #leagueOv .lgbar{flex:none}
html body #leagueOv .lgscroll{flex:1; min-height:0; overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; -webkit-overflow-scrolling:touch}
html body #leagueOv .lgtabs{position:sticky; top:0; z-index:3; background:#1a110c}
html body #leagueOv #lgErr:empty{display:none}

/* close the game? */
html body #closeOv,html body #meritOv{z-index:95}
html body .closebox{max-width:min(420px, var(--safeW)); padding:20px 22px; text-align:center; background:linear-gradient(180deg,#2a1d18,#0e0a09); border:1.5px solid #b07a48; border-radius:18px}
html body .closebox h2{margin:0 0 6px; color:#e6ac70; font-size:24px}
html body .closebox p{margin:0 0 16px; color:#f3dfc0; font-size:14px}
html body .closebtns{display:grid; grid-template-columns:1fr 1fr; gap:10px}
html body .closebtns button{min-height:46px; width:100%}

/* in a game the back button sits top left (shell.css .xback rule), the logo moves over (shell.css .bar .logo) */

/* FIX ROUND 2 D27: ONE fade for every scrolling part (js/fade.js sets data-sf and --sfl/--sfr/--sft/--sfb = 26px on an edge that has more to scroll to, else 0).
   Same on both sides: left+right for sideways lists, top+bottom for tall ones. Replaces the old right-only masks. */
html body [data-sf]:not(#_):not(#_){
  -webkit-mask-image:linear-gradient(90deg, transparent 0, #000 var(--sfl,0px), #000 calc(100% - var(--sfr,0px)), transparent 100%), linear-gradient(180deg, transparent 0, #000 var(--sft,0px), #000 calc(100% - var(--sfb,0px)), transparent 100%);
  mask-image:linear-gradient(90deg, transparent 0, #000 var(--sfl,0px), #000 calc(100% - var(--sfr,0px)), transparent 100%), linear-gradient(180deg, transparent 0, #000 var(--sft,0px), #000 calc(100% - var(--sfb,0px)), transparent 100%);
  -webkit-mask-composite:source-in; mask-composite:intersect; -webkit-mask-size:100% 100%; mask-size:100% 100%; -webkit-mask-repeat:no-repeat; mask-repeat:no-repeat}

/* FIX ROUND 2 D6: text boxes and drop-downs get their OWN clean input look (not the glass button picture): a dark inset box, thin gold-cream line,
   gold line when you type. One rule for every input, search box, select and text area in the game. */
html body :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]):not([type=button]):not([type=submit]):not([type=color]), select, textarea):not(#_):not(#_):not(#_):not(#_):not(#_):not(#_){
  box-sizing:border-box; min-height:44px; height:auto; padding:0 14px !important; border:1.5px solid rgba(240,214,150,.4) !important; border-image:none !important; border-radius:12px !important;
  background:rgba(3,22,18,.72) !important; color:#fff4dc !important; box-shadow:inset 0 2px 6px rgba(0,0,0,.5) !important; font:inherit; font-size:16px; font-weight:600; text-shadow:none !important; filter:none !important;
  -webkit-appearance:none; appearance:none; outline:none; width:100%; max-width:100%; min-width:0;
}
html body :is(input,textarea):not(#_):not(#_):not(#_):not(#_):not(#_):not(#_)::placeholder{ color:rgba(255,244,220,.5) }
html body :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]):not([type=button]):not([type=submit]), select, textarea):focus:not(#_):not(#_):not(#_):not(#_):not(#_):not(#_){ border-color:#f0c060 !important }
html body select:not(#_):not(#_):not(#_):not(#_):not(#_):not(#_):not(#_){
  padding:0 40px 0 14px !important; text-overflow:ellipsis; white-space:nowrap; cursor:pointer;
  background:rgba(3,22,18,.72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M4 7l6 6 6-6' fill='none' stroke='%23f0c060' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center/18px 18px no-repeat !important;
}
html body select:not(#_):not(#_):not(#_):not(#_):not(#_):not(#_) option{ background:#0b2a24; color:#fff4dc }
/* the picker list that opens when a select is tapped (js/picker.js) */
.pkov{position:fixed; inset:0; z-index:99999; display:flex; align-items:center; justify-content:center; padding:calc(10px + var(--safeT,0px)) calc(10px + var(--safeR,0px)) calc(10px + var(--safeB,0px)) calc(10px + var(--safeL,0px)); background:rgba(0,0,0,.6)}
.pkbox{display:flex; flex-direction:column; width:min(420px,100%); max-height:100%; border-radius:16px; background:#0b2a24; padding:10px 10px 8px; box-sizing:border-box}
.pkt{flex:none; padding:2px 8px 8px; font-size:14px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:#f0c060}
.pklist{flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain; display:grid; gap:6px; align-content:start; padding:2px}
.pkopt{display:block; width:100%; min-height:46px; padding:8px 14px; text-align:start; font:inherit; font-size:17px; font-weight:700; color:#fff4dc; background:rgba(255,244,220,.09); border:0; border-radius:10px}
.pkopt.on{background:linear-gradient(180deg,#f6d27a,#d89a2f); color:#3b1d02}
.pkopt:disabled{opacity:.4}
