/* JulianMC V162: permanent fullscreen scoreboard/controls + TV remote focus */
html[data-jmc-theme] .game-shell:fullscreen,
html[data-jmc-theme] .game-shell:-webkit-full-screen,
html[data-jmc-theme] .game-shell.jmc-fs-active {
  box-sizing:border-box!important;
  display:flex!important;flex-direction:column!important;overflow:hidden!important;
  width:100vw!important;width:100dvw!important;height:100vh!important;height:100dvh!important;
  padding:max(5px,env(safe-area-inset-top)) max(5px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(5px,env(safe-area-inset-left))!important;
  gap:5px!important;background:#020a13!important;
}
/* The live scoreboard is detached from the canvas during fullscreen; it may never be clipped by the canvas. */
.game-shell:is(:fullscreen,.jmc-fs-active)>.jmc-self-head,
.game-shell:-webkit-full-screen>.jmc-self-head {
  flex:0 0 auto!important;box-sizing:border-box!important;position:relative!important;
  top:auto!important;left:auto!important;right:auto!important;width:100%!important;max-width:none!important;
  min-height:47px!important;max-height:20dvh!important;margin:0!important;padding:7px 13px!important;
  z-index:36!important;border-radius:9px!important;background:rgba(8,20,33,.97)!important;
}
.game-shell:is(:fullscreen,.jmc-fs-active)>.jmc-duel-grid,
.game-shell:-webkit-full-screen>.jmc-duel-grid{
  flex:1 1 0!important;min-height:0!important;height:auto!important;max-height:none!important;
  display:grid!important;overflow:hidden!important;
}
.game-shell:is(:fullscreen,.jmc-fs-active)>.canvas-wrap,
.game-shell:-webkit-full-screen>.canvas-wrap{
  flex:1 1 0!important;min-height:0!important;max-height:none!important;height:auto!important;
}
.game-shell:is(:fullscreen,.jmc-fs-active) .jmc-duel-grid>.canvas-wrap,
.game-shell:-webkit-full-screen .jmc-duel-grid>.canvas-wrap{
  min-height:0!important;max-height:100%!important;height:100%!important;aspect-ratio:auto!important;
}
/* Both the game controls and the exit/fullscreen button stay within the screen. */
.game-shell:is(:fullscreen,.jmc-fs-active)>.game-meta,
.game-shell:-webkit-full-screen>.game-meta {
  box-sizing:border-box!important;flex:0 0 auto!important;display:flex!important;align-items:center!important;
  justify-content:space-between!important;gap:7px!important;min-height:44px!important;max-height:25dvh!important;
  padding:5px 8px!important;margin:0!important;overflow-x:auto!important;overflow-y:auto!important;
  border:1px solid rgba(138,198,239,.24)!important;border-radius:9px!important;
  color:#cfe7f5!important;background:rgba(10,28,42,.96)!important;scrollbar-width:thin;
}
.game-shell:is(:fullscreen,.jmc-fs-active)>.game-meta>div:first-child,
.game-shell:-webkit-full-screen>.game-meta>div:first-child {
  display:block!important;min-width:0!important;max-width:45%!important;font-size:clamp(10px,1.05vw,13px)!important;
  line-height:1.25!important;overflow:hidden!important;
}
.game-shell:is(:fullscreen,.jmc-fs-active) .game-meta-actions,
.game-shell:-webkit-full-screen .game-meta-actions{
  flex:0 0 auto!important;display:flex!important;gap:6px!important;align-items:center!important;flex-wrap:nowrap!important;
  width:auto!important;margin:0!important;
}
.game-shell:is(:fullscreen,.jmc-fs-active) .game-meta-actions .btn,
.game-shell:-webkit-full-screen .game-meta-actions .btn{
  flex:0 0 auto!important;min-height:38px!important;padding:0 9px!important;font-size:clamp(10px,.9vw,13px)!important;
  white-space:nowrap!important;
}
.game-shell:is(:fullscreen,.jmc-fs-active)>.mobile-controls,
.game-shell:-webkit-full-screen>.mobile-controls{
  min-height:0!important;max-height:18dvh!important;flex:0 0 auto!important;margin:0!important;overflow-x:auto!important;
}
.game-shell:is(:fullscreen,.jmc-fs-active)>.jmc-room-board,
.game-shell:-webkit-full-screen>.jmc-room-board{
  flex:0 0 auto!important;max-height:20dvh!important;overflow:auto!important;margin:0!important;padding:6px 9px!important;
}
.game-shell:is(:fullscreen,.jmc-fs-active) .jmc-room-boardplayers,
.game-shell:-webkit-full-screen .jmc-room-boardplayers{grid-template-columns:repeat(auto-fit,minmax(110px,1fr))!important}
.game-shell:is(:fullscreen,.jmc-fs-active) .jmc-room-boardplayers .jmc-room-player,
.game-shell:-webkit-full-screen .jmc-room-boardplayers .jmc-room-player{padding:3px 6px;font-size:10px}
/* Televisions and remotes: sharp visible selected action. */
.jmc-tv-focus:focus-visible,.game-shell .btn:focus-visible,.game-shell a:focus-visible,
.jmc-room-shade :is(button,input,select,a):focus-visible,
.jmc-mode-dialog :is(button,input,a):focus-visible {
  outline:3px solid #ffdc72!important;outline-offset:3px!important;box-shadow:0 0 0 6px rgba(255,196,66,.25)!important;
}
.jmc-tv-cursor{position:absolute;z-index:15;left:50%;top:50%;width:29px;height:29px;
  transform:translate(-50%,-50%);pointer-events:none;display:none;
  border:2px solid #ffed96;border-radius:50%;box-shadow:0 0 0 2px #17293d,0 0 14px #ffd862;
}
.jmc-tv-cursor::before,.jmc-tv-cursor::after{content:"";position:absolute;background:#ffe68b}
.jmc-tv-cursor::before{height:2px;width:38px;top:11px;left:-7px}
.jmc-tv-cursor::after{width:2px;height:38px;left:11px;top:-7px}
.jmc-tv-cursor.is-visible{display:block}
.jmc-tv-help{display:none;align-items:center;justify-content:center;gap:10px;padding:5px 9px;
  border:1px solid rgba(128,199,237,.28);border-radius:8px;background:#0a2332;color:#c5e3f3;
  font:800 11px/1.4 system-ui,sans-serif;letter-spacing:.015em}
.jmc-tv-help.is-visible{display:flex}
.game-shell:is(:fullscreen,.jmc-fs-active)>.jmc-tv-help,
.game-shell:-webkit-full-screen>.jmc-tv-help{display:flex;flex:0 0 auto;min-height:24px;max-height:6dvh}
@media(max-width:750px), (max-height:560px){
  .game-shell:is(:fullscreen,.jmc-fs-active)>.game-meta,
  .game-shell:-webkit-full-screen>.game-meta{padding:3px 5px!important;gap:4px!important;min-height:36px!important}
  .game-shell:is(:fullscreen,.jmc-fs-active)>.game-meta>div:first-child,
  .game-shell:-webkit-full-screen>.game-meta>div:first-child{display:none!important}
  .game-shell:is(:fullscreen,.jmc-fs-active) .game-meta-actions,
  .game-shell:-webkit-full-screen .game-meta-actions{min-width:max-content!important;width:100%!important;justify-content:space-between!important}
  .game-shell:is(:fullscreen,.jmc-fs-active) .game-meta-actions .btn,
  .game-shell:-webkit-full-screen .game-meta-actions .btn{font-size:10px!important;min-height:32px!important;padding:0 6px!important}
  .game-shell:is(:fullscreen,.jmc-fs-active)>.jmc-self-head,
  .game-shell:-webkit-full-screen>.jmc-self-head{min-height:39px!important;padding:4px 7px!important}
  .game-shell:is(:fullscreen,.jmc-fs-active)>.jmc-tv-help,
  .game-shell:-webkit-full-screen>.jmc-tv-help{font-size:9px;padding:2px 4px;min-height:19px}
  .game-shell:is(:fullscreen,.jmc-fs-active)>.mobile-controls button,
  .game-shell:-webkit-full-screen>.mobile-controls button{min-height:30px!important}
}
@media(max-height:420px){
  .game-shell:is(:fullscreen,.jmc-fs-active)>.jmc-tv-help,
  .game-shell:-webkit-full-screen>.jmc-tv-help{display:none!important}
  .game-shell:is(:fullscreen,.jmc-fs-active)>.jmc-self-head,
  .game-shell:-webkit-full-screen>.jmc-self-head{min-height:34px!important}
}
/* V158 mobile correction: old mobile theme forced each footer button to 100% width. */
@media(max-width:750px) and (min-height:421px){
  html[data-jmc-theme] .game-shell:is(:fullscreen,.jmc-fs-active)>.game-meta,
  html[data-jmc-theme] .game-shell:-webkit-full-screen>.game-meta{
    flex-wrap:nowrap!important;min-height:0!important;max-height:24dvh!important;overflow-x:hidden!important;
  }
  html[data-jmc-theme] .game-shell:is(:fullscreen,.jmc-fs-active) .game-meta-actions,
  html[data-jmc-theme] .game-shell:-webkit-full-screen .game-meta-actions{
    display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;
    min-width:0!important;width:100%!important;gap:4px!important;
  }
  html[data-jmc-theme] .game-shell:is(:fullscreen,.jmc-fs-active) .game-meta-actions .btn,
  html[data-jmc-theme] .game-shell:-webkit-full-screen .game-meta-actions .btn{
    flex:none!important;min-width:0!important;width:100%!important;max-width:100%!important;
    overflow:hidden!important;text-overflow:ellipsis!important;font-size:9px!important;
    min-height:33px!important;padding:0 3px!important;
  }
}
@media(max-height:420px){
  html[data-jmc-theme] .game-shell:is(:fullscreen,.jmc-fs-active) .game-meta-actions,
  html[data-jmc-theme] .game-shell:-webkit-full-screen .game-meta-actions{
    min-width:0!important;width:auto!important;justify-content:flex-start!important;
  }
  html[data-jmc-theme] .game-shell:is(:fullscreen,.jmc-fs-active) .game-meta-actions .btn,
  html[data-jmc-theme] .game-shell:-webkit-full-screen .game-meta-actions .btn{
    width:auto!important;min-width:70px!important;
  }
}


/* V160 — fullscreen should not show harsh black side bars */
.game-shell:is(:fullscreen,.jmc-fs-active)>.canvas-wrap,
.game-shell:-webkit-full-screen>.canvas-wrap{
  justify-content:stretch!important;align-items:stretch!important;overflow:hidden!important;
  background:
    radial-gradient(circle at 50% 14%,rgba(255,255,255,.14),transparent 32%),
    linear-gradient(180deg,#a8dbff 0%,#d9eef9 48%,#a3c2cf 69%,#628568 100%)!important;
}
.game-shell:is(:fullscreen,.jmc-fs-active)>.canvas-wrap canvas,
.game-shell:-webkit-full-screen>.canvas-wrap canvas{
  width:100%;height:100%;
}


/* V162 — stronger fullscreen fill without side bars */
.game-shell:is(:fullscreen,.jmc-fs-active)>.canvas-wrap,
.game-shell:-webkit-full-screen>.canvas-wrap{
  justify-content:stretch!important;align-items:stretch!important;overflow:hidden!important;
  background:transparent!important;
}
.game-shell:is(:fullscreen,.jmc-fs-active)>.canvas-wrap canvas,
.game-shell:-webkit-full-screen>.canvas-wrap canvas{
  display:block!important;width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;object-fit:cover!important;object-position:center center!important;
}

/* V189: preserve the whole field and HUD on televisions, never crop Snake's bottom bar. */
.game-shell:is(:fullscreen,.jmc-fs-active)>.canvas-wrap,
.game-shell:-webkit-full-screen>.canvas-wrap,
.game-shell:is(:fullscreen,.jmc-fs-active) .jmc-duel-grid>.canvas-wrap,
.game-shell:-webkit-full-screen .jmc-duel-grid>.canvas-wrap{
  align-items:center!important;justify-content:center!important;
  background:#081726!important;
}
.game-shell:is(:fullscreen,.jmc-fs-active) .canvas-wrap canvas,
.game-shell:-webkit-full-screen .canvas-wrap canvas{
  flex:0 0 auto!important;object-fit:contain!important;object-position:center center!important;
  max-width:100%!important;max-height:100%!important;
}
/* Bigger UI/readable focus on 1080p and 4K TVs, without stretching gameplay. */
@media (min-width:1500px) and (min-height:740px){
 .game-shell:is(:fullscreen,.jmc-fs-active)>.game-meta,
 .game-shell:-webkit-full-screen>.game-meta{min-height:54px!important;padding:8px 14px!important}
 .game-shell:is(:fullscreen,.jmc-fs-active) .game-meta-actions .btn,
 .game-shell:-webkit-full-screen .game-meta-actions .btn{font-size:clamp(13px,.84vw,20px)!important;min-height:46px!important;padding:0 clamp(11px,.8vw,24px)!important}
 .game-shell:is(:fullscreen,.jmc-fs-active) .hud .hud-box,
 .game-shell:-webkit-full-screen .hud .hud-box,
 .game-shell:is(:fullscreen,.jmc-fs-active) .hud .score-box,
 .game-shell:-webkit-full-screen .hud .score-box,
 .game-shell:is(:fullscreen,.jmc-fs-active) .hud .best-box,
 .game-shell:-webkit-full-screen .hud .best-box{font-size:clamp(13px,.9vw,23px)!important}
 .game-shell:is(:fullscreen,.jmc-fs-active) .hud strong,
 .game-shell:-webkit-full-screen .hud strong{font-size:clamp(22px,1.35vw,38px)!important}
 .game-shell:is(:fullscreen,.jmc-fs-active) .overlay-card,
 .game-shell:-webkit-full-screen .overlay-card,
 .game-shell:is(:fullscreen,.jmc-fs-active) .esc-card,
 .game-shell:-webkit-full-screen .esc-card{max-width:min(720px,80vw)!important;padding:clamp(23px,1.5vw,46px)!important;font-size:clamp(15px,.9vw,25px)!important}
 .game-shell:is(:fullscreen,.jmc-fs-active) .overlay-card .btn,
 .game-shell:-webkit-full-screen .overlay-card .btn,
 .game-shell:is(:fullscreen,.jmc-fs-active) .esc-card .btn,
 .game-shell:-webkit-full-screen .esc-card .btn{min-height:46px!important;font-size:clamp(13px,.8vw,20px)!important}
}
/* V189: 4K television-friendly button and remote guidance sizing. */
@media(min-width:2560px) and (min-height:1300px){
 .game-shell:is(:fullscreen,.jmc-fs-active)>.game-meta,
 .game-shell:-webkit-full-screen>.game-meta{min-height:76px!important}
 .game-shell:is(:fullscreen,.jmc-fs-active) .game-meta-actions .btn,
 .game-shell:-webkit-full-screen .game-meta-actions .btn{min-height:62px!important;font-size:21px!important;padding:0 22px!important}
 .game-shell:is(:fullscreen,.jmc-fs-active)>.jmc-tv-help,
 .game-shell:-webkit-full-screen>.jmc-tv-help{font-size:20px!important;min-height:35px!important}
}
