/* Hessa Play — game page wrapper (games/<name>.html). Tokens come from base.css, header from top.css. */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--f);font-size:17px;line-height:1.6;min-height:100vh;overflow-x:hidden}
button{font:inherit;color:inherit;cursor:pointer}
a{color:inherit}
:focus-visible{outline:3px solid var(--v);outline-offset:2px}
[hidden]{display:none!important}
.pl{--gut:clamp(16px,4vw,56px);--cw:max(480px,calc((100vh - 244px)*16/9));padding:16px 0 56px;visibility:hidden}
@supports (height:100dvh){.pl{--cw:max(480px,calc((100dvh - 244px)*16/9))}}
html.pl-on .pl{visibility:visible}
.pl-wrap{width:min(100% - 2*var(--gut),var(--cw));margin-inline:auto}
.pl-head{display:flex;align-items:center;gap:8px 14px;flex-wrap:wrap;margin-bottom:12px;min-height:48px}
.pl-head h1{margin:0;font-family:var(--fh);font-weight:800;font-size:clamp(1.35rem,2.4vw,1.9rem);line-height:1.3;letter-spacing:0;min-width:0;overflow-wrap:anywhere}
.pl-chip{display:inline-flex;align-items:center;gap:8px;min-height:32px;padding:2px 14px;border-radius:999px;background:var(--v-soft);color:var(--v);font-weight:700;font-size:.9rem;max-width:100%;min-width:0}
.pl-chip span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.pl-chip svg{width:16px;height:16px;flex:none;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round}
.pl-back{margin-inline-start:auto;display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 16px;border-radius:var(--r-sm);border:1px solid var(--line);background:var(--surface);font-weight:700;color:var(--ink);text-decoration:none;white-space:nowrap}
.pl-back:hover{border-color:var(--v);color:var(--v)}
.pl-back svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
[dir=rtl] .pl-back svg{transform:scaleX(-1)}
/* stage + themes: the themes panel sits on the physical right in both languages */
.pl-main{display:flex;flex-direction:column;gap:16px;direction:ltr}
.pl-card{min-width:0;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-card);box-shadow:var(--sh-card);overflow:hidden}
.pl-stage{position:relative;aspect-ratio:16/9;background:#12102a;overflow:hidden}
.pl-stage iframe{position:absolute;top:0;left:0;width:100%;height:100%;border:0;display:block;background:#12102a}
.pl-load{position:absolute;inset:0;display:grid;place-items:center;color:#fff;font-weight:700;opacity:.8;pointer-events:none}
.pl-x{display:none;position:absolute;top:max(10px,env(safe-area-inset-top));inset-inline-end:max(10px,env(safe-area-inset-right));z-index:3;min-height:48px;padding:0 16px;border:0;border-radius:999px;background:rgba(14,18,40,.72);color:#fff;font-weight:700;align-items:center;gap:8px}
.pl-x svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.pl-bar{display:flex;justify-content:center;gap:8px;padding:8px 12px;border-top:1px solid var(--line)}
.pl-btn{flex:0 1 190px;min-width:0;min-height:48px;display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:4px 14px;border-radius:var(--r-sm);border:1px solid var(--line);background:var(--surface);font-weight:700;line-height:1.25}
.pl-btn:hover{border-color:var(--v);color:var(--v)}
.pl-btn[aria-pressed=true]{background:var(--v);border-color:var(--v);color:#fff}
.pl-btn svg{width:22px;height:22px;flex:none;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.pl-btn span{min-width:0;overflow-wrap:anywhere;text-align:center}
.pl-themes{min-width:0;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-card);box-shadow:var(--sh-card);padding:16px;display:flex;flex-direction:column;gap:12px}
.pl-themes h2{margin:0;font-family:var(--fh);font-weight:700;font-size:1.1rem;line-height:1.4}
/* picture tiles: screenshot of the game in that theme / mode, small name under it */
.pl-tl{display:flex;gap:12px;overflow-x:auto;padding:4px;margin:-4px;scroll-snap-type:x proximity;scrollbar-width:thin}
.pl-t{all:unset;box-sizing:border-box;flex:0 0 min(44%,220px);min-width:0;display:flex;flex-direction:column;gap:6px;cursor:pointer;scroll-snap-align:start;-webkit-tap-highlight-color:transparent}
.pl-t .ph{position:relative;display:block;aspect-ratio:16/9;border-radius:14px;overflow:hidden;background:var(--v-soft);box-shadow:0 0 0 1px var(--line);transition:box-shadow .15s,transform .15s}
.pl-t img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block}
.pl-t .sw{position:absolute;inset:0;display:flex}
.pl-t .sw b{flex:1}
.pl-t .sw:empty{background:linear-gradient(135deg,var(--v),var(--v-2))}
.pl-t .ck{position:absolute;top:8px;inset-inline-end:8px;width:28px;height:28px;border-radius:50%;background:var(--v);color:#fff;display:none;place-items:center;box-shadow:0 0 0 3px #fff}
.pl-t .ck svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.pl-t .nm{display:block;height:22px;line-height:22px;font-size:.9rem;font-weight:700;color:var(--muted);text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
button.pl-t:hover .ph{box-shadow:0 0 0 3px var(--v-2)}
button.pl-t:focus-visible{outline:none}
button.pl-t:focus-visible .ph{box-shadow:0 0 0 3px var(--v),0 0 0 6px var(--v-soft)}
.pl-t.on .ph{box-shadow:0 0 0 3px var(--v)}
.pl-t.on .ck{display:grid}
.pl-t.on .nm{color:var(--v)}
.pl-one .pl-t{cursor:default}
.pl-sk .ph{background:linear-gradient(100deg,var(--line) 30%,var(--bg) 50%,var(--line) 70%);background-size:300% 100%;animation:plsk 1.4s linear infinite}
@keyframes plsk{from{background-position:100% 0}to{background-position:0 0}}
.pl-none{margin:10px 0 0;color:var(--muted);font-size:.9rem;line-height:1.5;text-align:center}
@media (min-width:600px) and (max-width:1099.98px){
  .pl-tl{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;overflow:visible}
  .pl-none{text-align:start}
}
@media (max-width:1099.98px){
  .pl-one .pl-sc{display:flex;align-items:center;gap:16px}
  .pl-one .pl-tl{flex:0 0 min(46%,260px);display:block;overflow:visible}
  .pl-one .pl-none{margin:0;text-align:start;min-width:0}
  .pl-one .pl-t{display:flex;width:100%}
}
/* wide: panel on the physical right, as tall as the stage card; sized so three tiles fill it exactly:
   panel = 25% of the row - 32px  =>  heading 56 + 3 x ((panel-32) x 9/16 + 28) + 2 x 12 + 12  =  stage height + toolbar 65 */
@media (min-width:1100px){
  .pl-wrap{width:min(100% - 2*var(--gut),calc((var(--cw) - 16px)/.75))}
  .pl-main{flex-direction:row;align-items:stretch}
  .pl-card{flex:1 1 0}
  .pl-themes{flex:0 0 calc(25% - 32px);position:relative}
  .pl-themes .pl-sc{position:absolute;inset:52px 0 0;overflow-y:auto;padding:4px 16px 12px;scrollbar-width:thin}
  .pl-tl{flex-direction:column;overflow:visible;padding:0;margin:0}
  .pl-t{flex:none}
}
/* other games */
.pl-more{width:min(100% - 2*var(--gut),1440px);margin:40px auto 0}
.pl-more h2{margin:0 0 16px;font-family:var(--fh);font-weight:800;font-size:clamp(1.25rem,2.2vw,1.6rem);letter-spacing:0}
.pl-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:16px}
@media (min-width:480px){.pl-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (min-width:760px){.pl-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (min-width:1100px){.pl-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:20px}}
.pl-g{display:flex;flex-direction:column;min-width:0;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-card);overflow:hidden;text-decoration:none;color:var(--ink);box-shadow:var(--sh-card);transition:transform .15s,border-color .15s}
.pl-g:hover{transform:translateY(-3px);border-color:var(--v)}
.pl-g .im{aspect-ratio:16/9;background:linear-gradient(135deg,var(--v),var(--v-2));overflow:hidden}
.pl-g img{width:100%;height:100%;object-fit:cover;display:block}
.pl-g .tx{padding:12px 16px 16px;display:flex;flex-direction:column;gap:2px}
.pl-g b{font-family:var(--fh);font-weight:700;font-size:1.08rem;line-height:1.4}
.pl-g small{color:var(--muted);font-size:.92rem;line-height:1.5;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
@media (max-width:479px){
  .pl-g{flex-direction:row;align-items:center}
  .pl-g .im{flex:0 0 38%;align-self:stretch;aspect-ratio:auto;min-height:84px}
  .pl-g .tx{padding:10px 14px}
  .pl-btn{padding:4px 6px;font-size:.88rem;gap:6px}
  .pl-bar{padding:8px;gap:6px}
  .pl-btn{flex:1 1 0}
}
/* CSS full screen (devices without the Fullscreen API, e.g. iPhone) */
html.pl-lock,html.pl-lock body{overflow:hidden!important}
html.pl-lock #hpTop{z-index:0}
.pl-stage.pl-pseudo{position:fixed;inset:0;z-index:1000;aspect-ratio:auto;width:100%;height:100%;border-radius:0}
/* the game shows its own exit control once it is ready; this one covers the time before that */
.pl-stage.pl-pseudo:not(.pl-ready) .pl-x{display:inline-flex}
@media (prefers-reduced-motion:reduce){.pl-g,.pl-t .ph{transition:none}.pl-sk .ph{animation:none}}

.pl-more{font:inherit;font-family:var(--fh);font-weight:700;font-size:1rem;min-height:48px;border-radius:var(--r-sm);border:1px solid var(--line);background:var(--v-soft);color:var(--v);cursor:pointer;width:100%;flex:none}
.pl-more:hover{background:var(--v);color:#fff}
