/* The mode and gem controls now live in the Play dialog on every screen size. */
body #lobby #play-setup{box-sizing:border-box;width:min(1100px,calc(100vw - 28px));max-height:calc(100dvh - 24px);padding:26px;margin:auto;border:1px solid #cfb27d;border-bottom:5px solid #382248;border-radius:23px;background:radial-gradient(ellipse at 20% 0,#70468b66,transparent 70%),#21162f;color:#f5e7c8;box-shadow:0 18px 70px #09061299;overflow:auto}
#play-setup::backdrop{background:#100a21d9}
#play-setup>header{display:flex;justify-content:space-between;align-items:center;padding:0;height:auto;gap:18px;margin-bottom:20px}
#play-setup header small{font-size:9px;letter-spacing:.2em;color:#c5a4dd}
#play-setup h2{font:700 26px Georgia,serif;margin:5px 0 0;color:#f4d99d}
#play-setup h3{font-size:11px;text-transform:uppercase;letter-spacing:.13em;color:#d9c3eb;margin:0 0 12px}
#play-setup .setup-close{font-size:12px;background:#4d365f;color:#f4e7ce;border:1px solid #a787c1;border-radius:9px;padding:8px 14px;min-height:36px}
#play-setup .setup-content{display:grid;grid-template-columns:1fr;gap:24px}
body #lobby #play-setup .battle-type-picker{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr));width:100%;gap:14px;background:none;border:0;padding:0;margin:0}
body #lobby #play-setup .battle-type-picker button{position:relative;display:flex;justify-content:center;align-items:center;box-sizing:border-box;flex:none;width:100%;height:214px;min-height:214px;padding:14px;overflow:hidden;border:1px solid var(--mode-edge);border-bottom-width:5px;border-radius:16px;background:linear-gradient(110deg,var(--mode-dark),#21182e);color:var(--mode-light);font:700 clamp(15px,1.8vw,23px) Georgia,serif;letter-spacing:.05em;text-transform:uppercase}
body #lobby #play-setup .battle-type-picker button[aria-pressed=true]{border-color:var(--mode-light);box-shadow:inset 3px 0 var(--mode-light),0 0 8px #b79dde33}
body #lobby #play-setup .queue-gems{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:min(540px,100%);gap:20px;margin:0 auto}
#play-setup .setup-size h3{text-align:center}
#play-setup>header{justify-content:flex-end;margin-bottom:12px}
#play-setup .setup-selection{text-align:center;font-size:15px;font-weight:bold;color:#f2d59a;margin:17px 0 9px}
#play-setup .setup-hint{text-align:center;font-size:12px;line-height:1.6;color:#c4b3d6;margin:0}
#play-setup>footer{display:flex;justify-content:center;padding:0;margin-top:20px}
#play-setup .setup-start{width:100%;min-height:48px;border:1px solid #d4b573;border-bottom:4px solid #342040;border-radius:12px;background:linear-gradient(120deg,#7850a1,#4a2d65);font:700 22px Georgia,serif;letter-spacing:.05em;color:#ffe4ab}
#play-setup .setup-start:disabled{opacity:.55}
#play-setup button:focus-visible{outline:2px solid #ffe4ab;outline-offset:3px}
/* Hidden setup effects must not keep ticking behind the main menu. */
body #lobby #play-setup:not([open]),body #lobby #play-setup:not([open]) *,body #lobby #play-setup:not([open]) *::before,body #lobby #play-setup:not([open]) *::after{animation-play-state:paused!important}
body.element-title-paused #play-setup[open] .mode-element-effects *{animation-play-state:running!important}
body.hex-fixed-home #fixed-home .fh-queues,body.hex-fixed-home #fixed-home .fh-mode-button{display:none!important}
@media(max-height:580px){body #lobby #play-setup{padding:12px 18px}#play-setup>header{margin-bottom:8px}#play-setup h3{margin-bottom:7px}#play-setup .setup-content{gap:12px}body #lobby #play-setup .battle-type-picker button{height:140px;min-height:140px}#play-setup .setup-hint{display:none}#play-setup .setup-selection{margin:6px 0}#play-setup>footer{margin-top:10px}#play-setup .setup-start{min-height:42px}}
@media(max-width:560px){body #lobby #play-setup{padding:16px}body #lobby #play-setup .battle-type-picker{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}body #lobby #play-setup .battle-type-picker button{height:140px;min-height:140px}#play-setup .setup-hint{display:none}}
/* Tall landscape cards: still scenery, elemental motion confined to the perimeter. */
body #lobby #play-setup .battle-type-picker{gap:18px}
body #lobby #play-setup .battle-type-picker button{height:300px;min-height:300px;overflow:visible;isolation:isolate;padding:12px}
body #lobby #play-setup .mode-landscape{opacity:1;border-radius:14px;overflow:hidden}
/* Landscape motion uses lightweight transforms, opacity and stroke offsets. */
body #lobby #play-setup .mode-name{box-sizing:border-box;width:100%;padding:16px 3px;line-height:1.2;font-size:clamp(16px,2vw,25px);letter-spacing:.025em;text-align:center;white-space:normal;overflow-wrap:normal;background:linear-gradient(90deg,transparent,#101622a8 25%,#101622a8 75%,transparent);text-shadow:0 2px 3px #090d19,0 0 9px #090d19}
.mode-border-magic{position:absolute;inset:-5px;width:calc(100% + 10px);height:calc(100% + 10px);overflow:visible;pointer-events:none;fill:none;stroke:var(--mode-light);z-index:2}
.mode-border-magic .border-aura{stroke-width:6;opacity:.2;animation:mode-border-breathe 3s ease-in-out infinite}
.mode-border-magic .border-trail{stroke-width:2;stroke-dasharray:9 17 2 22;animation:mode-border-orbit 12s linear infinite}
.mode-border-magic .border-motes{stroke-width:4;stroke-dasharray:.1 12 .1 21;stroke-linecap:round;animation:mode-border-orbit 19s linear infinite reverse}
[data-menu-element=earth] .mode-border-magic .border-motes{stroke-width:6;stroke-dasharray:1 21 2 26;stroke-linecap:square;animation-duration:27s}
[data-menu-element=wind] .mode-border-magic .border-trail{stroke-dasharray:17 8 5 20;stroke-linecap:round;animation-duration:8s}
[data-menu-element=fire] .mode-border-magic .border-aura{stroke:#ff943e;animation-duration:1.7s}
[data-menu-element=fire] .mode-border-magic .border-motes{stroke:#ffb75c;stroke-dasharray:.2 8 .4 13;animation-duration:10s}
[data-menu-element=water] .mode-border-magic .border-trail{stroke:#85e6ff;stroke-width:3;stroke-dasharray:7 3 3 12;stroke-linecap:round;animation-duration:16s}
@keyframes mode-border-orbit{to{stroke-dashoffset:-100}}
@keyframes mode-border-breathe{0%,100%{opacity:.12}50%{opacity:.4}}
body.element-title-paused #play-setup[open] .mode-border-magic *{animation-play-state:running!important}
@media(max-height:580px){body #lobby #play-setup .battle-type-picker button{height:190px;min-height:190px}}
@media(max-width:560px){body #lobby #play-setup .battle-type-picker button{height:210px;min-height:210px}}
@media(prefers-reduced-motion:reduce){.mode-border-magic *{animation:none!important}}
html[data-motion=gentle] .mode-border-magic *,body.gentle-motion .mode-border-magic *{animation:none!important}
body #lobby #play-setup .battle-type-picker button{contain:layout style}
/* Living landscapes, active only while match setup is visible. */
.land-float{animation:land-rock-drift 6s ease-in-out infinite}
.land-glimmer,.land-crystals{animation:land-shimmer 3.6s ease-in-out infinite alternate}
.land-dust{animation:land-dust-rise 7s linear infinite}
.land-cloud{animation:land-cloud-drift 12s ease-in-out infinite alternate}
.land-cloud-far{animation-duration:18s;animation-delay:-6s}
.land-gust{stroke-width:2;stroke-dasharray:70 18 12 25;animation:land-wind-flow 7s linear infinite}
.land-ribbons{stroke-dasharray:50 12 6 12;animation:land-wind-flow 5s linear infinite reverse}
.land-leaves{animation:land-leaf-drift 6s ease-in-out infinite}
.land-smoke-puff{transform-origin:123px 125px;animation:land-smoke-rise 8s linear infinite;opacity:0}
.land-lava,.land-lava-veins{animation:land-lava-pulse 3s ease-in-out infinite alternate}
.land-heat{animation:land-heat-shift 2.5s ease-in-out infinite alternate}
.land-embers{animation:land-ember-rise 4s linear infinite}
.land-embers-late{animation-delay:-2s;animation-duration:5s}
.land-surf{animation:land-ocean-roll 5s ease-in-out infinite}
.land-surf-fine{animation:land-ocean-roll 4s ease-in-out infinite reverse}
.land-ripples{animation:land-ripple-slide 6s ease-in-out infinite alternate}
.land-foam,.land-bubbles{animation:land-sea-spray 3.5s ease-out infinite}
.land-bubbles{animation-delay:-1.7s}
@keyframes land-rock-drift{0%,100%{transform:translateY(5px) rotate(-1deg)}50%{transform:translateY(-10px) rotate(1deg)}}
@keyframes land-shimmer{from{opacity:.35}to{opacity:1}}
@keyframes land-dust-rise{0%{transform:translateY(12px);opacity:0}20%{opacity:.9}100%{transform:translate(8px,-35px);opacity:0}}
@keyframes land-cloud-drift{from{transform:translateX(-12px)}to{transform:translateX(20px)}}
@keyframes land-wind-flow{to{stroke-dashoffset:-250}}
@keyframes land-leaf-drift{0%{transform:translate(-35px,12px);opacity:0}20%,70%{opacity:.85}100%{transform:translate(50px,-20px);opacity:0}}
@keyframes land-smoke-rise{0%{transform:translate(0,0) scale(.4);opacity:0}12%{opacity:.8}55%{transform:translate(10px,-65px) scale(1.35);opacity:.6}100%{transform:translate(32px,-135px) scale(2.2);opacity:0}}
@keyframes land-lava-pulse{from{opacity:.65}to{opacity:1}}
@keyframes land-heat-shift{from{transform:translate(-2px,3px);opacity:.15}to{transform:translate(3px,-5px);opacity:.55}}
@keyframes land-ember-rise{0%{transform:translateY(10px);opacity:0}15%{opacity:1}100%{transform:translate(13px,-65px);opacity:0}}
@keyframes land-ocean-roll{0%,100%{transform:translate(-7px,3px)}50%{transform:translate(7px,-5px)}}
@keyframes land-ripple-slide{from{transform:translateX(-6px);opacity:.3}to{transform:translateX(8px);opacity:.8}}
@keyframes land-sea-spray{0%{transform:translate(0,8px);opacity:0}25%{opacity:1}100%{transform:translate(-9px,-22px);opacity:0}}
@media(prefers-reduced-motion:reduce){body #lobby #play-setup .mode-landscape *{animation:none!important}.land-smoke-puff:first-child{opacity:.65;transform:translate(7px,-25px)}}
html[data-motion=gentle] .mode-landscape *,body.gentle-motion .mode-landscape *{animation:none!important}
html[data-motion=gentle] .land-smoke-puff:first-child,body.gentle-motion .land-smoke-puff:first-child{opacity:.65;transform:translate(7px,-25px)}
/* Enchanted library: illustrated shelving stays still to keep the menu light. */
body #lobby #play-setup{background:#171320 url('art/play-library.svg') center/100% 100% no-repeat;border-color:#a68859;border-bottom-color:#483126;box-shadow:inset 0 0 0 4px #17101fb0,inset 0 0 0 6px #b8955144,0 18px 70px #090612bb}
#play-setup .setup-close{background:linear-gradient(#654b3e,#352632);border-color:#b29668;color:#f5deb0;box-shadow:inset 0 0 0 2px #21172380;font-family:Georgia,serif}
#play-setup .setup-selection{width:fit-content;margin:17px auto 9px;padding:5px 24px;border-top:1px solid #b99b6255;border-bottom:1px solid #b99b6255;background:linear-gradient(90deg,transparent,#171321e8 20%,#171321e8 80%,transparent);text-shadow:0 2px 3px #080611}
#play-setup .setup-start{position:relative;isolation:isolate;overflow:hidden;min-height:56px;padding:12px 65px;border:1px solid #c3a46c;border-bottom:4px solid #392a25;border-radius:8px;background:radial-gradient(ellipse at 50% 120%,#a27bd944,transparent 65%),repeating-linear-gradient(0deg,#ffffff03 0 1px,transparent 1px 7px),linear-gradient(100deg,#30212c,#584037 28%,#392b3e 50%,#584037 72%,#30212c);box-shadow:inset 0 0 0 3px #251b26,inset 0 0 0 4px #a78b5366,0 4px 12px #0a071966;color:#ffe2a4;font:700 23px Georgia,serif;letter-spacing:.075em;text-shadow:0 2px 2px #140c20;transition:box-shadow .2s,color .2s}
#play-setup .setup-start::before,#play-setup .setup-start::after{content:'✦';position:absolute;top:50%;transform:translateY(-50%);font-size:27px;color:#cda76c;text-shadow:0 0 9px #d3a55d55;pointer-events:none}
#play-setup .setup-start::before{left:26px}
#play-setup .setup-start::after{right:26px}
#play-setup .setup-start:hover:not(:disabled),#play-setup .setup-start:focus-visible{color:#fff3ca;box-shadow:inset 0 0 0 3px #251b26,inset 0 0 0 4px #d2b87c,inset 0 0 25px #b48be82e,0 0 18px #cca75b44}
#play-setup .setup-start:hover::before,#play-setup .setup-start:hover::after{color:#ffedb2;text-shadow:0 0 12px #ffd177}
@media(max-height:580px){#play-setup .setup-start{min-height:46px;padding:8px 50px;font-size:21px}}
@media(prefers-reduced-motion:reduce){#play-setup .setup-start{transition:none}}
body #lobby #play-setup{padding-top:22px;padding-bottom:22px}
#play-setup .setup-content{gap:20px}
#play-setup>footer{margin-top:16px}
#play-setup .setup-start::before,#play-setup .setup-start::after{content:'✦' / '';}
@media(max-height:580px){body #lobby #play-setup{padding-top:12px;padding-bottom:12px}#play-setup .setup-content{gap:12px}#play-setup>footer{margin-top:10px}}
body #lobby #play-setup .queue-gems{width:100%;gap:14px} @media(max-width:560px){body #lobby #play-setup .queue-gems{gap:6px}}
/* A clear primary action within the enchanted library. */
body #lobby #play-setup .setup-start{min-height:60px;border:2px solid #f1cf82;border-bottom:4px solid #80532d;background:radial-gradient(ellipse at 50% 0%,#d9a4ff80,transparent 68%),linear-gradient(105deg,#50325e,#8a54ae 35%,#744496 65%,#50325e);box-shadow:inset 0 0 0 2px #40243e,inset 0 0 0 3px #edcb8077,inset 0 2px 15px #f4cbff3b,0 0 17px #d6a64d55,0 5px 12px #0b071bcc;color:#fff1bd;font-size:28px;letter-spacing:.09em;text-shadow:0 2px 2px #311734,0 0 10px #ffd87c44;transition:box-shadow .18s,background .18s,color .18s}
body #lobby #play-setup .setup-start::before,body #lobby #play-setup .setup-start::after{font-size:33px;color:#ffe4a1;text-shadow:0 0 10px #ffc85999}
body #lobby #play-setup .setup-start:hover:not(:disabled),body #lobby #play-setup .setup-start:focus-visible{background:radial-gradient(ellipse at 50% 0%,#edc7ff99,transparent 70%),linear-gradient(105deg,#674078,#a267c6 35%,#955cb5 65%,#674078);color:#fff8d9;box-shadow:inset 0 0 0 2px #40243e,inset 0 0 0 3px #ffe9a9,inset 0 0 23px #efd0ff44,0 0 24px #f5c77488,0 5px 12px #0b071bcc}
@media(max-height:580px){body #lobby #play-setup .setup-start{min-height:50px;font-size:25px}}
@media(max-width:430px){body #lobby #play-setup .setup-start{font-size:23px;letter-spacing:.04em;padding-inline:40px}body #lobby #play-setup .setup-start::before{left:13px}body #lobby #play-setup .setup-start::after{right:13px}}
@media(prefers-reduced-motion:reduce){body #lobby #play-setup .setup-start{transition:none}}
/* Persistent selection cue shared by desktop and compact/mobile match setup. */
body #lobby .battle-type-picker button[aria-pressed=true],
body #lobby .mode-picker button[aria-pressed=true]{
 border-color:#ffe49a!important;
 outline:2px solid #f5cf70!important;
 outline-offset:2px;
 box-shadow:inset 0 0 0 1px #ffeab380,inset 0 0 22px #f5c75d24,0 0 12px #ffd66e85,0 0 24px #e7b34d45!important;
 color:#fff2c4!important;
}

/* Selection must read clearly even without motion or elemental color cues. */
body #lobby #play-setup .battle-type-picker button[aria-pressed=true],
body #lobby #play-setup .mode-picker button[aria-pressed=true]{
 outline:3px solid #ffe08a!important;outline-offset:2px;
 box-shadow:inset 0 0 0 3px #fff0b5,inset 0 0 36px #ffc94c55,0 0 22px #ffd66e99!important;
}
body #lobby #play-setup .battle-type-picker button[aria-pressed=false] .mode-landscape{opacity:.60;filter:saturate(.65)}
body #lobby #play-setup .battle-type-picker button[aria-pressed=false] .mode-border-magic{opacity:.25}
body #lobby #play-setup .battle-type-picker button[aria-pressed=true]::after{
 content:'✓ SELECTED';position:absolute;z-index:5;top:12px;left:50%;transform:translateX(-50%);
 padding:7px 12px;border:1px solid #fff3bf;border-radius:6px;
 background:linear-gradient(#fff0b4,#edbd54);color:#35213f;
 font:800 12px/1.2 system-ui,sans-serif;letter-spacing:.055em;white-space:nowrap;
 text-shadow:none;box-shadow:0 3px 10px #100a24aa;pointer-events:none;
}
body #lobby #play-setup .battle-type-picker button[aria-pressed=true] .mode-name{
 color:#fff4cf;background:linear-gradient(90deg,#523e20aa,#745b2ee8,#523e20aa);
 border-top:1px solid #ffe08a;border-bottom:1px solid #ffe08a;
}
body #lobby #play-setup .mode-picker button[aria-pressed=true]::after{
 content:'✓';position:absolute;z-index:5;right:9px;top:50%;transform:translateY(-50%);
 width:23px;height:23px;display:grid;place-items:center;border-radius:50%;background:#ffe08a;color:#35213f;
 font:900 16px/1 system-ui,sans-serif;text-shadow:none;pointer-events:none;
}
body #lobby #play-setup .mode-picker button[aria-pressed=false]{filter:saturate(.65) brightness(.8)}
@media(max-width:560px){body #lobby #play-setup .battle-type-picker button[aria-pressed=true]::after{top:8px;padding:5px 8px;font-size:11px}}

/* Reserve space for the action; shrink artwork to the available viewport. */
body #lobby #play-setup[open]{display:flex;flex-direction:column;height:min(700px,calc(100dvh - 24px));max-height:calc(100dvh - 24px);overflow:hidden;padding:16px 20px;gap:12px}
body #lobby #play-setup>header{flex:0 0 auto;margin:0;min-height:36px}
body #lobby #play-setup .setup-content{flex:1;min-height:0;grid-template-rows:minmax(0,1fr) auto;gap:14px}
body #lobby #play-setup .setup-modes{min-height:0}
body #lobby #play-setup .battle-type-picker{height:100%;min-height:0;gap:14px;grid-auto-rows:minmax(0,1fr)}
body #lobby #play-setup .battle-type-picker button{height:100%;min-height:0;padding:8px}
body #lobby #play-setup .setup-selection{margin:7px auto 0;font-size:13px}
body #lobby #play-setup>footer{flex:0 0 auto;margin:0;padding-bottom:env(safe-area-inset-bottom,0px)}
body #lobby #play-setup .queue-gems .queue-gem{height:clamp(44px,10dvh,76px);min-height:0}
@media(max-height:500px){
 body #lobby #play-setup[open]{height:calc(100dvh - 12px);max-height:calc(100dvh - 12px);padding:8px 14px;gap:7px}
 body #lobby #play-setup .setup-content{gap:10px}
 body #lobby #play-setup .mode-name{font-size:16px;padding:7px 2px}
 body #lobby #play-setup .battle-type-picker button[aria-pressed=true]::after{top:5px;font-size:10px;padding:3px 6px}
 body #lobby #play-setup .setup-start{min-height:44px;padding-block:6px;font-size:21px}
 body #lobby #play-setup .setup-selection{margin-top:4px;font-size:11px}
}

#play-setup .setup-error{margin:0 0 8px;color:#ffe0ac;font:600 13px/1.35 system-ui;text-align:center}
/* Match-size selection uses its illuminated frame, without check badges. */
body #lobby #play-setup .mode-picker button[data-queue]::after{content:none!important;display:none!important}
body #lobby #play-setup .mode-picker button[data-queue] .hex-icon-check{display:none!important}
