/* Limbo, Plinko and War share one frame: a title row, a stage that takes what is left, and the bet dock under it */
#game:has(.ar){background:radial-gradient(ellipse at 50% 0,rgba(232,180,34,.14),transparent 55%),linear-gradient(#140b18,#07040a)}
.ar{display:flex;flex-direction:column;gap:8px;width:100%;max-width:820px;margin:0 auto;user-select:none}
.ar-top{flex:none;display:flex;align-items:center;justify-content:space-between;gap:8px}
.ar-title{flex:1;text-align:center;font-family:var(--display);font-size:24px;letter-spacing:5px;color:#f6d36a;text-shadow:0 0 18px #e8b42299;line-height:1.1;direction:ltr}
.ar-title small{display:block;direction:rtl;font-family:var(--body);font-size:12px;letter-spacing:0;color:#e9dfc4;text-shadow:none;opacity:.8}
.ar .gh-btn{flex:none;width:34px;height:34px;min-width:0;padding:0;border-radius:50%;position:relative}
.ar-top>i{width:34px;flex:none}
.ar-stage{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:10px 14px;border-radius:28px;border:5px solid #2b2b33;box-shadow:0 0 0 2px #e8b422aa,inset 0 0 50px #000a}
.ar-recent{display:flex;gap:5px;width:100%;min-height:26px;overflow:hidden;justify-content:safe center;direction:ltr}
.ar-recent i{flex:none;font-style:normal;font-weight:800;font-size:12px;padding:4px 8px;border-radius:10px;background:#0008;border:1px solid #ffffff2a;color:#c9c0cc}
.ar-recent i.win{background:#14502f;border-color:#6fe08f;color:#d6ffe2}
.ar-msg{min-height:24px;font-size:16px;font-weight:700;text-align:center}
.ar-msg.win{color:#8dffa4;text-shadow:0 0 12px #2e9d4a}.ar-msg.lose{color:#ffab9e}
.ar-dock{display:flex;flex-direction:column;gap:7px;padding:10px;border-radius:16px;background:linear-gradient(#1d1218,#0b070a);border:1px solid #e8b42266}
.ar-row{display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap}
.ar-row>label{font-size:12px;color:#e9dfc4}
.ar-seg{display:flex;gap:4px}
.ar-seg button{min-width:52px;height:34px;padding:0 10px;border-radius:17px;background:#0007;border:1px solid #e8b42255;color:#e9dfc4;font-weight:700}
.ar-seg button.on{background:linear-gradient(#f6d36a,#c8961c);color:#241400}
.ar .ar-go{height:48px;font-family:var(--display);font-size:21px;width:100%;max-width:420px;align-self:center}
.ar-lim{text-align:center;font-size:11px;opacity:.65}
.ar button:disabled,.ar input:disabled{opacity:.45}

/* ---------- Limbo ---------- */
.lb .ar-stage{background:radial-gradient(ellipse at 50% 35%,#3a1550,#180a26 60%,#0a0410);min-height:clamp(200px,calc(100dvh - 520px),340px)}
.lb-num{font-family:var(--display);font-size:clamp(46px,11vw,92px);line-height:1;direction:ltr;color:#fff;text-shadow:0 0 26px #a45cff;font-variant-numeric:tabular-nums}
.lb-num.win{color:#8dffa4;text-shadow:0 0 30px #2e9d4a}.lb-num.lose{color:#ff8a80;text-shadow:0 0 30px #a8200f}
.lb-goal{font-size:14px;color:#e9dfc4}.lb-goal b{direction:ltr;unicode-bidi:isolate;color:#fff3b0}
.lb-stats{display:grid;grid-template-columns:1fr 1fr;gap:10px;width:100%;max-width:380px}
.lb-stats div{text-align:center;padding:5px;border-radius:12px;background:#0007;border:1px solid #ffffff22}
.lb-stats small{display:block;font-size:11px;opacity:.75}.lb-stats b{font-size:17px;color:#fff3b0}
.lb-target input{width:110px;height:38px;text-align:center;font-size:19px;font-weight:800;direction:ltr;border-radius:12px;background:#000a;color:#fff3b0;border:1px solid #e8b422aa}

/* ---------- Plinko ---------- */
.plk .ar-stage{position:relative;background:radial-gradient(ellipse at 50% 30%,#1c2f6e,#140f38 55%,#08051a);border-color:#2a2050;box-shadow:0 0 0 2px #e8b422cc,0 0 34px #5b3fd055,inset 0 0 60px #000c;padding:8px 8px 8px;gap:4px;overflow:hidden}
.plk .ar-stage::before{content:"";position:absolute;inset:0;pointer-events:none;opacity:.55;background:radial-gradient(1.5px 1.5px at 12% 22%,#fff,transparent),radial-gradient(1px 1px at 83% 14%,#fff,transparent),radial-gradient(1.5px 1.5px at 91% 52%,#bfe2ff,transparent),radial-gradient(1px 1px at 7% 63%,#bfe2ff,transparent),radial-gradient(1px 1px at 22% 40%,#fff,transparent),radial-gradient(1px 1px at 74% 36%,#fff,transparent)}
.plk-box{position:relative;width:100%;height:clamp(250px,calc(100dvh - 440px),470px);display:flex;justify-content:center}
.plk-box canvas{display:block;max-width:100%;height:100%;object-fit:contain}
.plk .ar-recent{position:relative;justify-content:safe center}
.plk .ar-recent i{background:var(--c,#333);border-color:#ffffff55;color:#fff;text-shadow:0 1px 2px #000a;animation:plk-in .25s ease-out}
.plk .ar-recent i~i{animation:none}.plk .ar-recent i:nth-child(n+7){opacity:.6}
@keyframes plk-in{from{transform:scale(1.5)}}
.plk .ar-msg{position:relative}
.plk [data-risk=low].on{background:linear-gradient(#6fe08f,#1f8a47);color:#04200f}
.plk [data-risk=high].on{background:linear-gradient(#ff7a8e,#c4113f);color:#fff}
.plk .plk-many .ar-seg button{min-width:44px;padding:0 6px}
.plk .ar-go.stop{background:linear-gradient(#ff8a7a,#b5200f);color:#fff}
/* computer: the controls stand beside the board, so the board gets the whole height */
@media(min-width:1000px){
  body:not(.phone) .plk{display:grid;grid-template-columns:330px minmax(0,1fr);grid-template-areas:"top top" "dock stage";max-width:1040px;gap:8px 12px}
  body:not(.phone) .plk .ar-top{grid-area:top}
  body:not(.phone) .plk .ar-dock{grid-area:dock;justify-content:center;gap:14px;min-width:0}
  body:not(.phone) .plk .ar-stage{grid-area:stage;min-width:0}
  body:not(.phone) .plk .ar-row{flex-direction:column;gap:5px}
  body:not(.phone) .plk .ar-lim{display:block}
  body:not(.phone) .plk .plk-box{height:clamp(260px,calc(100dvh - 270px),600px)}
}

/* ---------- War ---------- */
.wr{--wrw:clamp(66px,calc((100dvh - 540px) / 2),130px)}
.wr .ar-stage{background:radial-gradient(ellipse at 50% 30%,var(--tf1,#7a1f2b),var(--tf2,#45101a) 60%,var(--tf3,#22070c));min-height:clamp(210px,calc(100dvh - 500px),380px)}
.wr-duel{display:flex;align-items:flex-start;justify-content:center;gap:clamp(18px,7vw,70px);direction:rtl}
.wr-side{display:flex;flex-direction:column;align-items:center;gap:5px}
.wr-side>b{font-size:13px;color:#f6d36a}
.wr-slot{display:flex;gap:5px;min-height:calc(var(--wrw)*1.4);perspective:700px}
.wr-slot .pc{--cw:var(--wrw);margin:0;display:block}
.wr-slot.two .pc{--cw:calc(var(--wrw)*.72)}
.wr-empty{width:var(--wrw);height:calc(var(--wrw)*1.4);border:2px dashed #ffffff44;border-radius:calc(var(--wrw)*.08);display:flex;align-items:center;justify-content:center;font-size:calc(var(--wrw)*.45);color:#ffffff55}
.wr-ask{display:grid;grid-template-columns:1fr 1fr;gap:10px;width:100%;max-width:460px}
.wr-ask[hidden]{display:none}
.wr-ask button{min-height:52px;border-radius:16px;border:2px solid #ffffff55;color:#fff;font-weight:800;line-height:1.25;padding:5px}
.wr-ask small{display:block;font-weight:400;font-size:11px;opacity:.85}
.wr-ask [data-wr=war]{background:linear-gradient(#c8961c,#7a4d00)}.wr-ask [data-wr=surrender]{background:linear-gradient(#4a4a58,#22222c)}

@media(max-height:760px){body:not(.phone) .ar{gap:5px}body:not(.phone) .ar-title small,body:not(.phone) .ar-lim{display:none}body:not(.phone) .ar-dock{padding:6px 10px;gap:5px}body:not(.phone) .ar .ar-go{height:40px}body:not(.phone) .plk-box{height:clamp(190px,calc(100dvh - 400px),300px)}body:not(.phone) .plk .ar-dock{gap:8px}body:not(.phone) .lb .ar-stage{min-height:170px;gap:5px}body:not(.phone) .wr{--wrw:60px}body:not(.phone) .wr .ar-stage{min-height:0;gap:5px}body:not(.phone) main:has(.ar) #game{min-height:0;padding-block:8px}body:not(.phone) main:has(.ar) #chat{min-height:0;height:calc(100dvh - 130px)}}

/* ---------- phone: one screen, the stage takes what is left, the bet dock stays at the bottom ---------- */
body.phone.ingame #game:has(.ar){padding:0}
body.phone .ar{flex:1;min-height:0;max-width:100%;gap:5px;padding-top:5px}
body.phone .ar-top{padding:0 8px}
body.phone .ar .gh-btn{width:34px;height:34px}
body.phone .ar-title{font-size:19px}body.phone .ar-title small{font-size:11px}
body.phone .ar .ar-stage{flex:1;min-height:0;container-type:size;margin:0 6px;padding:6px;border-width:3px;border-radius:20px;gap:6px;justify-content:space-evenly;overflow:hidden}
body.phone .ar-dock{border:0;border-top:2px solid var(--gold2);border-radius:0;padding:6px 8px calc(env(safe-area-inset-bottom) + 6px);gap:5px}
body.phone .ar-seg button{height:40px;min-width:46px;padding:0 8px}
body.phone .ar .ar-go{height:46px}
body.phone .ar-lim{display:none}
body.phone .lb-num{font-size:clamp(40px,17cqw,76px)}
body.phone .lb-target input{height:40px}
body.phone .plk-box{flex:1;min-height:0;height:auto}
body.phone .plk-box canvas{height:100%;width:100%;object-fit:contain}
body.phone .wr .ar-stage>*{--wrw:min(26cqw,calc((100cqh - 150px)/1.4),120px)}
body.phone .wr-ask button{min-height:48px}
body.phone .wr[data-ph=playing] .ar-dock{display:none}
@media(max-height:700px){
  body.phone .ar-title small{display:none}
  body.phone .ar-recent{min-height:22px}body.phone .ar-recent i{padding:2px 6px;font-size:11px}
  body.phone .ar-msg{font-size:13px;min-height:18px}
  body.phone .lb-stats b{font-size:14px}
  body.phone .ar .ar-go{height:42px}
  body.phone .ar-seg button{height:36px}
}
