*{box-sizing:border-box}body{margin:0;background:radial-gradient(at top,#294b79,#10192f 65%);color:#fff;font:16px system-ui;min-height:100dvh}main{max-width:1200px;margin:auto;padding:16px}header{display:flex;justify-content:space-between;align-items:center}h1{color:#ffda87;letter-spacing:2px}button,select{font:inherit;border:0;border-radius:10px;padding:12px;background:#ffcf77;color:#34230b;font-weight:bold;cursor:pointer}button:disabled{opacity:.4}select{background:#e5eaf4} .panel{background:#ffffff12;border-radius:18px;padding:20px;margin:12px 0}.setup{text-align:center;max-width:550px;margin:5vh auto}.setup label{display:block;margin:20px}.tile{background:linear-gradient(#fffdf5,#dedbd0);width:46px;height:60px;padding:3px;border-bottom:4px solid #a9a69b;font-size:26px;line-height:1;border-radius:8px;box-shadow:0 3px 5px #0005}.tile small{display:block;font-size:12px;margin-top:5px}.c0{color:#c92e42}.c1{color:#1764c4}.c2{color:#b87900}.c3{color:#222e42}.c4{color:#8e36bf}.sel{outline:3px solid #ffd35b;transform:translateY(-4px)}.tiles,.actions,.players{display:flex;flex-wrap:wrap;gap:8px}.players>div{flex:1;background:#ffffff10;padding:10px;border-radius:12px;text-align:center}.active{outline:2px solid #ffd77d}.board{background:radial-gradient(#286568,#163c48);min-height:30vh;border:1px solid #6b9b99;border-radius:18px;padding:16px;display:flex;flex-wrap:wrap;align-content:flex-start;gap:12px}.group{background:#08273388;padding:8px;border-radius:10px}.bad{outline:2px dashed salmon}.group button.add{display:block;padding:5px;margin-top:7px;background:#b3e8d8;font-size:12px}.rack{background:#080f23;border-bottom:5px solid #96774f;padding:14px;border-radius:12px}.muted{color:#b9c9e6}.actions{margin-top:14px}.actions button{flex:1;min-width:120px}.secondary{background:#354867;color:white}#msg{min-height:24px;color:#ffe1a0} @media(max-width:500px){main{padding:9px}.tile{width:37px;height:49px;font-size:21px}.tiles{gap:5px}h1{font-size:22px}.panel{padding:12px}}body[data-theme="forest"]{background:radial-gradient(at top,#48794b,#102c24 70%)}body[data-theme="forest"] .board{background:radial-gradient(#477b36,#21482d)}body[data-theme="space"]{background:radial-gradient(at top,#563e91,#100c2b 70%)}body[data-theme="space"] .board{background:radial-gradient(#55448d,#221a4b)}body[data-theme="lava"]{background:radial-gradient(at top,#a94c29,#32131d 70%)}body[data-theme="lava"] .board{background:radial-gradient(#9b462e,#4b2023)}.tile:disabled{opacity:1}.setup select{max-width:100%}.toolbar{display:flex;gap:8px;flex-wrap:wrap}.badge{display:inline-block;background:#ffffff20;padding:8px;border-radius:10px;margin:4px}.group{animation:appear .2s ease-out}@keyframes appear{from{opacity:.5;transform:scale(.97)}to{opacity:1;transform:scale(1)}} .worlds{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:14px;margin:20px 0}.world{padding:20px;border-radius:20px;background:linear-gradient(145deg,#ffffff22,#ffffff08);border:1px solid #ffffff30;text-align:center}.world h2{font-size:21px}.landicon{font-size:65px;filter:drop-shadow(0 6px 8px #0005)}.xp{height:12px;background:#0005;border-radius:20px;overflow:hidden;margin-top:12px}.xp i{display:block;height:100%;background:linear-gradient(90deg,#ff9d42,#ffe88a)}[data-land=forest]{background:linear-gradient(145deg,#477b36,#163a30)}[data-land=lava]{background:linear-gradient(145deg,#9b462e,#451b26)}[data-land=space]{background:linear-gradient(145deg,#55448d,#221a4b)}[data-land=ice]{background:linear-gradient(145deg,#437d9e,#243c68)}[data-land=royal]{background:linear-gradient(145deg,#826239,#30233e)}body[data-theme=ice]{background:linear-gradient(145deg,#437d9e,#243c68)}body[data-theme=ice] .board{background:#356780}body[data-theme=royal]{background:linear-gradient(145deg,#826239,#30233e)}body[data-theme=royal] .board{background:#54425e}[data-skin=gold] .tile,[data-preview=gold] .tile{background:linear-gradient(#fff5b0,#d6a64a)}[data-skin=crystal] .tile,[data-preview=crystal] .tile{background:linear-gradient(#fff,#b6e4ff)}[data-skin=obsidian] .tile,[data-preview=obsidian] .tile{background:linear-gradient(#e0d9f9,#b6a8d7)}.world span.tile{display:inline-flex;align-items:center;justify-content:center}.world button{width:100%}
:root{color-scheme:dark;--accent:#73e5d3;--glow:#183f43;--base:#0a101a;--line:#ffffff20}body,body[data-theme]{background:radial-gradient(ellipse at 75% 0%,var(--glow),transparent 65%),var(--base);color:#e8edf5;font-family:system-ui,-apple-system,sans-serif}body[data-theme=forest]{--accent:#a8e68b;--glow:#203b30}body[data-theme=space]{--accent:#b9a2ff;--glow:#32254e}body[data-theme=lava]{--accent:#ffab79;--glow:#482822}body[data-theme=ice]{--accent:#a2d9ff;--glow:#203b53}body[data-theme=royal]{--accent:#e7c77f;--glow:#3d3426}main{max-width:1440px;padding:24px}header{gap:12px;border-bottom:1px solid var(--line);padding-bottom:16px;margin-bottom:20px}h1{font-size:clamp(16px,3vw,30px);letter-spacing:.14em;color:var(--accent);font-weight:850;margin:0}h2,h3{letter-spacing:.025em}button,select{border-radius:5px;border:1px solid transparent;background:var(--accent);color:#091820;font-size:14px;min-height:42px;padding:10px 15px;transition:filter .15s,transform .15s}button:hover:not(:disabled){filter:brightness(1.13)}button:active:not(:disabled){transform:translateY(1px)}button:focus-visible,select:focus-visible{outline:2px solid white;outline-offset:3px}select,.secondary{background:#192331;color:#e3eaf3;border-color:var(--line)}.panel{background:#111b28dd;border:1px solid var(--line);border-radius:9px;padding:22px}.setup{max-width:820px;margin:20px auto;text-align:left}.setup>h2{font-size:clamp(25px,5vw,43px);margin:14px 0}.setup label{display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid var(--line);padding:10px 0;margin:5px 0}.setup .panel{background:#0b1420;border-left:3px solid var(--accent)}.brandmark{display:inline-grid;place-items:center;width:68px;height:68px;background:var(--accent);color:#0a1520;font-size:46px;font-weight:950;clip-path:polygon(25% 0,75% 0,100% 25%,100% 75%,75% 100%,25% 100%,0 75%,0 25%)}.board,body[data-theme] .board{background:linear-gradient(90deg,#ffffff06 1px,transparent 1px),linear-gradient(#ffffff06 1px,transparent 1px),radial-gradient(ellipse at center,var(--glow),#0b1722);background-size:28px 28px,28px 28px,auto;border:1px solid var(--line);border-radius:8px;min-height:34vh;padding:18px;position:relative}.group{background:#050b14b0;border:1px solid #ffffff22;border-radius:6px;padding:8px}.group button.add{background:#233b43;color:var(--accent);border:1px solid #ffffff18;width:100%;min-height:28px}.tile{border-radius:5px;background:linear-gradient(155deg,#f9fafb,#dce2e7);border:1px solid #fff;border-bottom:3px solid #9ba8b5;box-shadow:0 3px 5px #0007;font-variant-numeric:tabular-nums;font-weight:850;width:48px;height:63px;font-size:27px;padding:3px;min-height:0}.tile small{font-size:10px}.c0{color:#bd263f}.c1{color:#1555b5}.c2{color:#9a6400}.c3{color:#1e293b}.c4{color:#7843ad}.sel{outline:3px solid var(--accent);outline-offset:2px;transform:translateY(-4px);box-shadow:0 0 15px var(--accent)}.rack{border:1px solid var(--line);border-bottom:3px solid var(--accent);background:#0b121e;border-radius:7px}.players>div{border:1px solid var(--line);border-radius:6px;background:#111b28;color:#aab8ca;text-align:left;min-width:100px}.players>div b{color:#f0f5fa}.active{outline:1px solid var(--accent);border-left:4px solid var(--accent)!important}.worlds{gap:12px}.world,.world[data-land]{background:linear-gradient(135deg,#182637,#101923);border:1px solid var(--line);border-radius:7px;text-align:left;position:relative;overflow:hidden;padding:18px}.world[data-land]{background:linear-gradient(135deg,#1c3440,#101923)}.world[data-land=forest]{background:linear-gradient(135deg,#263f35,#101923)}.world[data-land=lava]{background:linear-gradient(135deg,#512c25,#101923)}.world[data-land=space]{background:linear-gradient(135deg,#392d57,#101923)}.world[data-land=ice]{background:linear-gradient(135deg,#28445c,#101923)}.world[data-land=royal]{background:linear-gradient(135deg,#4b3b26,#101923)}.landicon{font-size:64px;font-weight:900;letter-spacing:-.08em;color:#ffffff30;line-height:1;filter:none}.world small{color:var(--accent);letter-spacing:.18em}.world h2{margin:8px 0}.world.locked{opacity:.55}.badge{border:1px solid var(--line);background:#182534;border-radius:4px;font-size:12px}.xp{height:6px;border-radius:2px}.xp i{background:var(--accent)}#msg{color:var(--accent)}.actions{gap:8px}.actions button{flex:1}.muted{color:#9daec2}details{color:#b4c3d4}summary{cursor:pointer} @media(max-width:600px){main{padding:10px}header{flex-wrap:wrap}header .toolbar{width:100%}header .toolbar>*{flex:1}.panel{padding:13px}.setup{margin:10px auto}.tile{width:38px;height:51px;font-size:22px}.board{padding:9px;gap:8px}.group{padding:5px}.players>div{min-width:65px;font-size:12px}.actions button{min-width:105px;font-size:12px}.setup label select{max-width:68%}}@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
@keyframes nexusPulse{from{filter:brightness(1.25)}to{filter:brightness(1)}} .tile.sel{animation:nexusPulse .22s ease-out;transition:transform .15s,box-shadow .15s} @media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}@media (orientation:landscape) and (max-height:850px){main{padding:8px 14px}header h1{font-size:20px;margin:6px 0}.panel{padding:12px;margin:8px 0}.setup{margin:12px auto}.tile{min-width:40px}.board{min-height:120px}}button:focus-visible,select:focus-visible{outline:3px solid #73e5d3;outline-offset:3px}body{padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}.drawn93{outline:3px solid #70dfce!important;outline-offset:2px;animation:draw93 1s ease-in-out 2}.played93{outline:3px solid #ffab66!important;outline-offset:2px}.changed93{box-shadow:inset 0 0 0 2px #ffab66!important}.legend93{display:block;font-size:12px;opacity:.85;margin-top:12px}.hand [data-online-tile],.rack [data-tile]{touch-action:none}@keyframes draw93{50%{filter:brightness(1.35)}} 
:root{--gold:#e9bd70;--line:#b9914b66}body,body[data-theme]{background:linear-gradient(180deg,#07101caa,#070d17 65%),url('art/realm.webp') center top/cover fixed;color:#f6ead5}header{border-bottom:1px solid #b9914b88}h1,h2,h3{font-family:Georgia,serif;color:#f4d28e}h1{letter-spacing:.07em;text-shadow:0 2px 8px #000}button:not(.tile),select{border:1px solid #c69b58;background:linear-gradient(180deg,#ffe1a0,#b88336);color:#241508;border-radius:6px;box-shadow:0 2px 5px #0007}button.secondary,select{background:linear-gradient(#243447,#101b2a);color:#f7e5c4}.panel,.setup .panel,.world,.world[data-land]{background:linear-gradient(145deg,#17283aee,#0c1421f5);border:1px solid #a17d476e;border-radius:10px}.setup{max-width:1000px}.arcane-banner{position:relative;min-height:clamp(240px,48vw,560px);background:url('art/menu.webp') center/cover;border:2px solid #d5ab62;border-radius:14px;overflow:hidden;box-shadow:0 8px 35px #000a}.arcane-caption{position:absolute;inset:auto 0 0;background:linear-gradient(transparent,#070c18f5 35%);padding:36px 16px 15px;display:flex;align-items:center;gap:12px;flex-wrap:wrap}.arcane-caption strong{font: bold clamp(18px,3vw,30px) Georgia;color:#ffdb91}.arcane-caption span{flex:1;min-width:140px}.board,body[data-theme] .board{background:linear-gradient(#091725a8,#091725b8),url('art/stone.webp') center/cover;border:3px solid #8e7046;box-shadow:inset 0 0 30px #000b,0 4px 12px #0008;border-radius:14px}.group{background:#07121cce;border-color:#b9914b55}.rack{background:linear-gradient(#233042,#0c1320);border:2px solid #9c7948;border-bottom:4px solid #d4a65d}.tile{background:linear-gradient(135deg,#fff8e9,#e8d6b7);border:1px solid #fff3d4;border-bottom:4px solid #a98a57;font-family:Georgia,serif;box-shadow:0 3px 6px #0009}.players>div{background:linear-gradient(#1b2c40,#0e1725);border-color:#9c7948}.hero-avatar{width:44px;height:44px;object-fit:cover;object-position:center 25%;border:2px solid #d9b36b;border-radius:50%;vertical-align:middle;margin-right:6px}.hero-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(115px,1fr));gap:10px}.hero-grid button{display:flex;flex-direction:column;align-items:center;gap:5px;padding:5px!important;background:#152237!important;color:#f7e4bf!important}.hero-art{width:100%;aspect-ratio:2/3;object-fit:cover;border-radius:4px}.hero-grid small{font-size:11px}.hero-grid button:disabled{opacity:.6}.muted{color:#c6c6ca}.brandmark{background:#e8bc70}.active{outline-color:#f6d48b;border-left-color:#f6d48b!important}@media(max-width:600px){.arcane-banner{min-height:260px;background-size:cover}.hero-avatar{width:32px;height:32px}.hero-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.arcane-caption{padding-top:25px}.arcane-caption span{display:none}}.hero-detail101{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.5fr);gap:20px;margin-top:18px}.hero-detail101 .hero-art{max-height:520px;object-fit:contain}.hero-card101{border:2px solid var(--rarity)!important}.outfits101{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}.outfits101 button{padding:5px;display:grid;gap:4px;justify-items:center;min-width:0}.outfits101 img{width:100%;aspect-ratio:2/3;object-fit:cover}.outfit-silver{filter:saturate(.35) brightness(1.15)}.outfit-royal{filter:sepia(.4) saturate(1.5)}.outfit-shadow{filter:hue-rotate(35deg) brightness(.75) saturate(1.4)}@media(max-width:600px){.hero-detail101{grid-template-columns:1fr}.hero-detail101 .hero-art{max-height:340px}.outfits101{grid-template-columns:repeat(2,minmax(0,1fr))}}
body[data-arena102] .board{position:relative;isolation:isolate;background:radial-gradient(ellipse at 50% 40%,var(--arena-glow),transparent 65%),linear-gradient(135deg,#07101c55,#070d17b8),url('art/stone.webp') center/cover;border-color:var(--arena-color);box-shadow:inset 0 0 32px var(--arena-glow),0 4px 16px #0009}
body[data-arena102] .board:before{content:'';position:absolute;inset:0;z-index:-1;pointer-events:none;background:var(--arena-pattern);opacity:.35;border-radius:10px}
.arena-grid102{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px}.arena-card102{display:grid;gap:8px;padding:8px!important;text-align:left}.arena-preview102{height:90px;border:1px solid var(--arena-color);border-radius:8px;background:var(--arena-pattern),radial-gradient(ellipse,var(--arena-glow),#07101c),url('art/stone.webp') center/cover;display:grid;place-items:center;font-size:36px;color:var(--arena-color);text-shadow:0 0 14px currentColor}.arena-bar102{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:6px 0;color:var(--arena-color);font-size:13px}.arena-bar102 button{font-size:12px;padding:5px 8px}.arena-victory102{text-align:center;padding:12px;color:#ffdb91}.arena-victory102 img{width:100px;height:120px;object-fit:cover;border:2px solid #e9bd70;border-radius:12px}.arena-victory102 strong{display:block;font: bold 24px Georgia}.arena-fx102 .board:before{animation:arenaGlow102 5s ease-in-out infinite alternate}.arena-fx102 .arena-victory102 img{animation:arenaWin102 .7s ease-out}.arena-fx102 .arena-bar102 span{animation:arenaGlow102 3s ease-in-out infinite alternate}@keyframes arenaGlow102{from{opacity:.35}to{opacity:.85}}@keyframes arenaWin102{from{transform:scale(.75);opacity:0}to{transform:scale(1);opacity:1}}@media(prefers-reduced-motion:reduce){.arena-fx102 .board:before,.arena-fx102 .arena-victory102 img,.arena-fx102 .arena-bar102 span{animation:none}} 
#audioPanel104{position:fixed;right:12px;top:65px;z-index:1000;background:#142133;border:1px solid #b99a61;border-radius:12px;padding:16px;max-width: min(320px,90vw);box-shadow:0 10px 40px #0009}#audioPanel104 label{display:block;margin:10px 0}#audioPanel104 input[type=range]{width:100%}.nav105{max-width:740px;margin:12px auto}.hero105{min-height:145px;border:1px solid #ad8955;border-radius:14px;background:linear-gradient(90deg,#08101cee,#08101c55),url('art/menu.webp') center 43%/cover;padding:20px;display:flex;flex-direction:column;justify-content:end}.hero105 h2{margin:0;font-size:clamp(23px,5vw,36px)}.hero105 p{margin:6px 0}.navgrid105{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:14px 0}.nav105 button.navcard105{display:flex;align-items:center;text-align:left;gap:10px;width:100%;min-height:84px;padding:12px;background:linear-gradient(135deg,#27374a,#101b29);color:#f6ead5;border:1px solid #a68a58;border-radius:12px}.navcard105 b{display:block;font-size:17px;color:#ffe0a2}.nav105 small{display:block;font-size:12px;color:#d0d6df;margin-top:4px;line-height:1.35}.navcard105>span{font-size:26px;color:#e9bd70}.profile105{display:flex;align-items:center;gap:10px;margin-top:12px}.profile105 .hero-avatar{width:44px;height:44px;object-fit:cover}.profile105 button{margin-left:auto}.wide105{width:100%;margin-top:12px;min-height:48px}.nav105 .setup{max-width:none;margin:0;text-align:left}.nav105 .setup label{display:block;margin:14px 0}.nav105 .setup select{width:100%;margin-top:5px}.nav105 button{min-height:44px}.nav105 details{margin:14px 0}body:has(.nav105) header .toolbar,body:has(.nav105) #audioButton104{display:none}body:has(.nav105) header h1{font-size:clamp(15px,3vw,22px)}@media(max-width:390px){.navgrid105{gap:7px}.nav105 button.navcard105{padding:9px;gap:7px}.navcard105 b{font-size:15px}.navcard105>span{font-size:21px}}@media(orientation:landscape) and (max-height:500px){.hero105{min-height:90px;padding:10px}.nav105 button.navcard105{min-height:62px}}

main{padding-top:max(12px,env(safe-area-inset-top));padding-bottom:max(20px,env(safe-area-inset-bottom))} .hfLobby{max-width:620px;margin:12px auto;display:grid;gap:14px}.hfLobby h2,.hfLobby h3{margin:0 0 10px}.hfLobby section{display:grid;gap:10px;padding:14px;background:#1b2c40;border:1px solid #ffffff20;border-radius:12px}.hfLobby .hfGrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.hfLobby label{display:grid;gap:6px;margin:0;min-width:0}.hfLobby select,.hfLobby button{width:100%;min-width:0}.hfLobby .hfCheck{display:grid;grid-template-columns:24px minmax(0,1fr);align-items:start;gap:10px}.hfCheck input{width:20px;height:20px;margin:3px 0}.hfCheck small{display:block;margin-top:5px;color:#b9c9e6;line-height:1.4}.hfPlayer{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px;background:#101d2b;border-radius:8px}.hfPlayer button{width:auto}.hfCode{overflow-wrap:anywhere;font-family:monospace;font-size:18px}.hfLobby p:empty{display:none}.rack108{display:grid;gap:6px;width:100%}.row108{display:flex;flex-wrap:wrap;gap:5px;align-items:center;min-height:8px}.row108:empty{display:none}.rowMoveH3{font-size:11px;padding:6px}.historyH3,.actionsH3{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:10px 0}.historyH3 button,.actionsH3 button{min-width:0!important;font-size:14px;min-height:44px;padding:9px}.ownH3{outline:2px solid #5bd7f2;outline-offset:-2px}.hfPlace{align-self:flex-start;margin:4px;min-height:40px}.hfGame h2{font-size:18px;overflow-wrap:anywhere}.hfGame h3{margin:12px 0 8px}.hfGame .hand,.rack{padding:10px;background:#17283b;border-radius:12px}.hfGame .board{min-height:25vh}.hfGame p{line-height:1.4}.hfGame button[onclick="home()"]{margin-top:8px}.hfGame button[onclick^="react1091"]{margin:3px;padding:9px}.hfGame .group{max-width:100%;display:flex;flex-wrap:wrap;gap:4px}.hfGame .group button:not(.tile){padding:6px}.hfGame .tile,.rack .tile{flex:0 0 auto}@media(max-width:600px){header{flex-wrap:wrap;gap:6px}header h1{font-size:16px;margin:6px 0}header .toolbar{gap:6px}header button,header select{font-size:12px;padding:7px;min-height:34px}.hfLobby{padding:12px}.hfLobby h2{font-size:24px}.hfLobby h3{font-size:18px}.hfLobby button,.hfLobby select{font-size:14px;padding:10px}.hfGame .tile,.rack .tile{width:clamp(30px,9vw,42px);height:46px;font-size:21px}.hfGame .board{padding:8px;gap:7px}.hfGame .panel{padding:10px}}

.reactionH4{position:fixed;top:max(70px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:9999;background:#172b40;border:1px solid #d6b16b;color:#f5e4bd;padding:12px 20px;border-radius:16px;font-size:24px;pointer-events:none;animation:reactH4 3s both;white-space:nowrap;max-width:90vw;overflow:hidden;text-overflow:ellipsis}@keyframes reactH4{0%{opacity:0;transform:translate(-50%,12px) scale(.8)}15%,80%{opacity:1;transform:translate(-50%,0) scale(1)}100%{opacity:0;transform:translate(-50%,-10px)}}@media(prefers-reduced-motion:reduce){.reactionH4{animation:none}}
.h5Controls{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}#chatPanelH5{padding:12px;border:1px solid #a88b56;border-radius:12px;background:#172b40;color:#fff}#chatPanelH5[hidden]{display:none}#chatListH5{max-height:210px;overflow:auto;overflow-wrap:anywhere}.chatMsgH5{padding:8px;margin:5px 0;background:#263b50;border-radius:8px}.chatMsgH5 small{color:#e5c58a}#chatPanelH5 form{display:flex;gap:6px;margin:8px 0}#chatInputH5{min-width:0;flex:1;font-size:16px}
.premiumE .playerE{position:relative;display:flex;align-items:center;gap:8px;min-width:0;padding:8px;border:1px solid #536478;border-radius:12px;background:#142334;color:#f5e4bd}.premiumE .playerE.active,.premiumE .players .active{border-color:#eac47d;box-shadow:0 0 15px #eac47d55}.playerE .hero-avatar{width:38px;height:38px;object-fit:cover}.playerE small{display:block;color:#b9c5d1}.playersE{display:grid;grid-template-columns:repeat(auto-fit,minmax(125px,1fr));gap:7px;margin:10px 0}.toolsE{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0}.toolsE button{min-height:36px;padding:6px 10px}.premiumE .board{max-height:55dvh;overflow:auto;overscroll-behavior:contain}.premiumE .board.zoomE .tile{min-width:44px;min-height:57px;font-size:23px}.premiumE .rack,.premiumE .hand{border:1px solid #9a8054;border-radius:12px;background:#142334;padding:8px}.premiumE .dockE{position:sticky;bottom:0;z-index:5;background:#101d2b;padding:6px 0 max(6px,env(safe-area-inset-bottom));box-shadow:0 -6px 18px #0005}.premiumE .dockE .historyH3,.premiumE .dockE .actionsH3{display:flex;flex-wrap:wrap;gap:5px}.premiumE .dockE button{min-height:36px}.bubbleE{position:absolute;right:4px;top:-12px;font-size:30px;z-index:8;pointer-events:none;animation:popE 3s both}.victoryE{text-align:center;border:1px solid #d6b16b;border-radius:16px;padding:20px;background:radial-gradient(ellipse at top,#70512b,#142334 70%);color:#ffe0a0;font: bold 24px Georgia}.victoryE .hero-avatar{width:80px;height:80px}.freshE{animation:tileE .24s ease-out}@keyframes tileE{from{opacity:.5;transform:translateY(-5px)}to{opacity:1;transform:none}}@keyframes popE{0%{opacity:0;transform:scale(.5)}15%,75%{opacity:1;transform:scale(1)}100%{opacity:0;transform:translateY(-12px)}}.quietE *{animation:none!important;transition:none!important}@media(prefers-reduced-motion:reduce){.premiumE *,.bubbleE{animation:none!important;transition:none!important}}@media(max-width:600px){.premiumE .board{max-height:42dvh;min-height:120px}.premiumE .dockE .tile{touch-action:none}.premiumE .playersE{grid-template-columns:repeat(2,minmax(0,1fr))}.premiumE .dockE{position:sticky;bottom:0}.premiumE .dockE button{font-size:12px;padding:6px 8px}} 

/* E2 compact responsive game shell */
body.e2game main{max-width:1450px;padding: max(4px,env(safe-area-inset-top)) 8px max(4px,env(safe-area-inset-bottom));height:100dvh;display:flex;flex-direction:column;overflow:hidden}body.e2game header{display:none}body.e2game #app{flex:1;min-height:0;display:flex;flex-direction:column;gap:5px;overflow:hidden}body.e2game .hfGame{display:flex;flex-direction:column;flex:1;min-height:0;gap:5px;margin:0;padding:7px;overflow:hidden;max-width:none;width:100%}body.e2game .board{flex:1;min-height:70px!important;max-height:none!important;overflow:auto;margin:0!important}body.e2game .dockE{position:static!important;flex:none;padding:3px 0;box-shadow:none}body.e2game .dockE .hand,body.e2game .dockE .rack{max-height:24dvh;overflow:auto;padding:5px;margin:0}body.e2game .playersE,body.e2game .players{margin:0;gap:4px}body.e2game .playerE{padding:4px;gap:5px;font-size:13px}body.e2game .playerE .hero-avatar{width:30px;height:30px}body.e2game .playerE small{font-size:11px}body.e2game .hfGame>p,body.e2game #app>p{margin:0;font-size:12px}body.e2game .hfGame>h3{display:none}body.e2game .dockE .historyH3,body.e2game .dockE .actionsH3,.e2actions{display:flex!important;gap:4px;flex-wrap:wrap;margin:3px 0}body.e2game .dockE button,.e2actions button,.e2top button,.e2social button{font-size:12px!important;padding:5px 7px!important;min-height:32px!important;margin:0!important;flex:1 1 auto} .e2top,.e2social{display:flex;align-items:center;gap:5px;flex:none}.e2top strong{color:#e5c58a;margin-right:auto;font-size:13px}.e2social{justify-content:space-between}.e2social button{flex:0 1 auto}.e2settings{position:absolute;inset:auto 8px 8px;max-height:75dvh;overflow:auto;z-index:25;background:#142334;border:1px solid #d6b16b;border-radius:12px;padding:12px;box-shadow:0 0 0 100vmax #0008}.e2settings[hidden]{display:none!important}.e2settings button{margin:3px;min-height:36px}.e2settings .h5Controls{display:flex;flex-wrap:wrap;gap:4px}.e2game #chatPanelH5:not([hidden]){position:absolute;bottom:8px;left:8px;right:8px;z-index:30;background:#142334;max-height:65dvh;overflow:auto;padding:10px;border:1px solid #d6b16b;border-radius:12px}.e2game #chatPanelH5[hidden]{display:none!important}.e2game .arena-bar102,.e2game .toolsE{margin:0}.e2game .hfGame>h2{display:none}.e2game .tile{width:clamp(28px,8vw,40px);height:40px;font-size:19px}.e2game .board.zoomE .tile{width:44px;height:57px}.e2game .row108{gap:3px}.e2game .rack .tiles{gap:3px}.e2game .hfGame>button{margin:0}.hfLobby .hfCode{font-size:30px;letter-spacing:4px;text-align:center;color:#e5c58a}.e2entry label{display:grid;gap:5px;margin:10px 0}.e2entry input{width:100%;padding:12px;font:inherit;border-radius:8px;border:1px solid #a68a58;background:#142334;color:white}.e2entry{max-width:540px;margin:auto}.e2game .hfGame{position:relative}.e2game #app{position:relative}@media(orientation:landscape) and (max-height:550px){body.e2game .hfGame,body.e2game #app:not(:has(.hfGame)){display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr) auto;gap:4px}body.e2game #app:has(.hfGame){display:flex}body.e2game .e2top,body.e2game .playersE,body.e2game .players{grid-column:1/-1}body.e2game .board{grid-column:1;grid-row:3/5;height:100%}body.e2game .dockE{grid-column:2;grid-row:3;overflow:auto;min-height:0}body.e2game .dockE .hand,body.e2game .dockE .rack{max-height:none}body.e2game .e2social{grid-column:2;grid-row:4}body.e2game .e2status{display:none}body.e2game .tile{width:30px;height:36px;font-size:17px}} 

/* E3: independent layout tracks, fixed tile geometry */
body.e2game {overflow:hidden;--tile-w:32px;--tile-h:42px}
body.e2game:not(.e4play) .dockE button.tile,body.e2game:not(.e4play) .board button.tile{flex:0 0 var(--tile-w)!important;width:var(--tile-w)!important;min-width:var(--tile-w)!important;max-width:var(--tile-w)!important;height:var(--tile-h)!important;min-height:var(--tile-h)!important;max-height:var(--tile-h)!important;padding:2px!important;font-size:19px!important;margin:0!important}
body.e2game:not(.e4play) .board.zoomE button.tile{--tile-w:44px;--tile-h:57px;font-size:23px!important}
body.e2game .dockE{display:flex;flex-direction:column;min-height:0;gap:3px;overflow:auto;max-height:48dvh;z-index:auto!important}
body.e2game .dockE .hand,body.e2game .dockE .rack{position:static!important;flex:0 0 auto;max-height:none;overflow:visible}
body.e2game .dockE .row108,body.e2game .dockE .tiles{justify-content:flex-start;align-items:flex-start;gap:3px}
body.e2game .dockE button:not(.tile){flex:0 0 auto}
body.e2game .e2top{display:grid;grid-template-columns:auto minmax(0,1fr) 36px;gap:4px;align-items:center}
body.e2game .e2top strong{margin:0;white-space:nowrap;font-size:11px}
body.e2game .e2top #connectionC{font-size:11px;white-space:nowrap;justify-self:end}
body.e2game .e2top .e2status{grid-column:1/-1;grid-row:2;display:block;margin:0;font-size:12px;text-align:center}
body.e2game .e2top button{grid-column:3;grid-row:1;width:36px;min-width:0;justify-self:end}
body.e2game .e2social{position:static!important;z-index:auto!important;display:flex;flex-wrap:wrap;justify-content:flex-start;gap:4px;min-height:36px;padding:2px 0}
body.e2game .e2social button{flex:0 0 auto!important;min-width:0!important}
body.e2game .hfGame,body.e2game #app{padding-bottom: max(4px,env(safe-area-inset-bottom))}
@media(orientation:landscape) and (max-height:550px){body.e2game{--tile-w:29px;--tile-h:38px}body.e2game .hfGame,body.e2game #app:not(:has(.hfGame)){grid-template-rows:auto auto minmax(0,1fr) auto;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr)}body.e2game .dockE{max-height:none;height:auto;align-self:stretch;overflow:auto}body.e2game .board{height:auto;min-height:0!important;grid-row:3/5;align-self:stretch}body.e2game .e2top{grid-template-columns:auto auto minmax(0,1fr) 36px}body.e2game .e2top .e2status{grid-column:3;grid-row:1;display:block;font-size:11px}body.e2game .e2top button{grid-column:4}body.e2game .e2social{grid-column:2;grid-row:4;align-self:end;min-height:32px}body.e2game:not(.e4play) .dockE button.tile{font-size:17px!important}}

/* E4 unified shell: independent board, rack and action tracks */
body.e4play{overflow:hidden}body.e4play main{height:100dvh!important;max-width:1450px!important;padding: max(5px,env(safe-area-inset-top)) max(6px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left))!important;display:flex;flex-direction:column;justify-content:flex-start!important;overflow:hidden}body.e4play header{display:none!important}body.e4play #app{flex:1;min-height:0;overflow:hidden;position:relative;margin:0!important;padding:0!important}body.e4play .e4shell{height:100%;width:100%;min-height:0;box-sizing:border-box;display:grid!important;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto minmax(65px,1fr) auto auto;gap:5px!important;padding:5px!important;margin:0!important;overflow:hidden;position:relative;align-content:stretch;--tw:clamp(36px,10vw,50px);--th:calc(var(--tw)*1.28);--tn:clamp(21px,5.6vw,29px)} .e4head{display:flex;flex-direction:column;gap:3px;min-width:0}.e4head .e2top{display:flex!important;gap:6px;align-items:center}.e4head .e2top strong{margin-right:auto!important}.e4head .e2top button{flex:none!important;width:36px!important}.e4head .e2status{flex:1;text-align:center;font-size:12px!important}.e4head>p,.e4head .chapter103{margin:0!important;font-size:12px!important;padding:2px!important}.e4shell .players,.e4shell .playersE{display:grid!important;grid-template-columns:repeat(var(--seats,2),minmax(0,1fr));gap:4px!important;margin:0!important}.e4shell .playerE{display:flex!important;align-items:center;gap:5px!important;min-width:0;padding:4px!important}.e4shell .playerE .hero-avatar{width:28px!important;height:28px!important;flex:none}.e4shell .playerE small{display:block;font-size:10px!important}.e4shell .playerE b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block}.e4shell .board{grid-area:3/1!important;height:auto!important;min-height:0!important;max-height:none!important;overflow:auto!important;margin:0!important;align-self:stretch}.e4shell .dockE{display:flex!important;flex-direction:column;gap:3px!important;min-height:0!important;max-height:none!important;overflow:hidden!important;grid-area:4/1!important;position:static!important;padding:0!important}.e4shell .e4rackscroll{overflow:auto;min-height:0;max-height:24dvh;overscroll-behavior:contain}.e4shell .rack,.e4shell .hand{position:static!important;max-height:none!important;overflow:visible!important;margin:0!important;padding:4px!important}.e4shell .rack>div:first-child{margin-bottom:3px!important}.e4shell button.tile{flex:0 0 var(--tw)!important;width:var(--tw)!important;min-width:var(--tw)!important;max-width:var(--tw)!important;height:var(--th)!important;min-height:var(--th)!important;max-height:var(--th)!important;padding:2px!important;margin:0!important;font-size:var(--tn)!important}.e4shell .board.zoomE button.tile{--tw:clamp(50px,12vw,64px);--th:calc(var(--tw)*1.28);--tn:clamp(29px,6vw,36px)}.e4shell .tiles,.e4shell .row108{justify-content:flex-start!important;gap:3px!important}.e4shell .e4actions{display:flex;flex-wrap:wrap;gap:3px;flex:none;align-items:center}.e4shell .e4actions button,.e4shell .e2social button,.e4shell .dockE button:not(.tile){font-size:11px!important;min-height:32px!important;padding:4px 6px!important;margin:0!important;flex:0 0 auto!important}.e4shell .e2social{grid-area:5/1!important;min-height:0!important;gap:4px!important;flex-wrap:wrap;position:static!important}.e4shell .e2social:empty{display:none!important}.e4shell .e4msg{font-size:11px;margin:0;overflow-wrap:anywhere}.e4shell .e2settings{z-index:100!important;bottom:5px!important;max-height:80dvh!important}.e4shell .e4head{grid-area:1/1}.e4shell .e4players{grid-area:2/1}.e4shell .e4players:empty{display:none}.e4shell .e4rackscroll>button{margin:0 0 3px!important}body:not(.e4play) #app label{display:flex!important;flex-direction:column;align-items:stretch!important;gap:5px;margin:8px 0!important}body:not(.e4play) #app label select,body:not(.e4play) #app label input:not([type=checkbox]):not([type=radio]){width:100%!important;max-width:none!important;box-sizing:border-box}body:not(.e4play) #app .setup{max-width:650px;width:100%;box-sizing:border-box}body:not(.e4play) #app .worlds{grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr))}body:not(.e4play) #app .panel{min-width:0}body:not(.e4play) #app button{margin-bottom:4px}body:not(.e4play) #app label:has(input[type=checkbox]){flex-direction:row!important;align-items:center!important}body:not(.e4play) #app .board .tile{flex:none}
@media(orientation:landscape) and (max-height:600px){body.e4play .e4shell{grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr) auto;--tw:36px;--th:46px;--tn:21px}.e4shell .e4head{grid-area:1/1/2/3}.e4shell .e4players{grid-area:2/1/3/3}.e4shell .board{grid-area:3/1/5/2!important}.e4shell .dockE{grid-area:3/2!important}.e4shell .e2social{grid-area:4/2!important}.e4shell .e4rackscroll{flex:1;max-height:none;min-height:25px}.e4shell .e4actions{flex:none}.e4shell .e4head .chapter103{display:none}.e4shell .e4actions button{min-height:29px!important}.e4shell .e4head .e2top{min-height:30px}.e4shell .e4head .e2top button{min-height:30px!important}.e4shell .e4msg{max-height:24px;overflow:auto}}

.b2ChatHeader{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:6px 0}.b2ChatHeader small{color:#b4c6d9}.chatMsgH5.b2Own{background:#304659;border-left:3px solid #d5ad63}#chatQuickB2{display:flex;gap:5px;overflow-x:auto;padding:5px 0}#chatQuickB2 button{white-space:nowrap;min-height:32px;font-size:12px;padding:5px 9px}#chatMuteB2:not([hidden]){display:flex;flex-wrap:wrap;gap:5px;padding-top:8px}#chatMuteB2 small{flex-basis:100%}#chatMuteB2 button{font-size:12px}#chatBtnH5.b2Unread{outline:2px solid #e6b96a;outline-offset:1px}#chatPanelH5{overflow-y:auto;overscroll-behavior:contain}#chatListH5{max-height:min(210px,28dvh)}#chatErrorH5{display:block;color:#ffcc87;min-height:1em}
 .tile{touch-action:none}.dropzone{outline:2px solid #70dfce!important}.dragghost{position:fixed;pointer-events:none;z-index:9999;opacity:.85;transform:translate(-50%,-50%)}.competitive{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:8px}.competitive button{min-height:48px} @media(orientation:landscape) and (max-height:850px){main{max-width:1500px;padding:8px 18px}.board{min-height:24vh}.rack{position:sticky;bottom:0;z-index:2}.players>div{padding:5px}.actions{margin-top:7px}} 

/* E5: scroll-safe layouts; never clip controls at viewport boundary */
html{overflow-y:auto!important}body,body.e2game,body.e4play{overflow-y:auto!important;height:auto!important;min-height:100dvh;box-sizing:border-box}
body.e4play main,body.e2game main{height:auto!important;min-height:0!important;overflow:visible!important;padding:8px 8px max(76px,env(safe-area-inset-bottom))!important;display:block!important}
body.e4play #app,body.e2game #app{height:auto!important;min-height:0!important;overflow:visible!important;display:block!important}
body.e4play .e4shell{height:auto!important;min-height:0!important;overflow:visible!important;grid-template-rows:auto auto auto auto auto!important;align-content:start!important}
body.e4play .e4shell .board{height:clamp(190px,42dvh,470px)!important;min-height:0!important;overflow:auto!important}
body.e4play .e4shell .dockE{height:auto!important;overflow:visible!important;min-height:0!important;max-height:none!important}
body.e4play .e4shell .e4rackscroll{max-height: none!important;overflow:visible!important;flex:none!important}
body.e4play .e4shell .rack,body.e4play .e4shell .hand{height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;box-sizing:border-box}
body.e4play .e4shell .e4actions{overflow:visible!important;min-height:0!important}
body.e4play .e4shell .e2settings{position:fixed!important;inset:auto 10px max(76px,env(safe-area-inset-bottom))!important;max-height:65dvh!important;overflow:auto!important}
body.e4play #chatPanelH5:not([hidden]){position:fixed!important;bottom:76px!important;max-height:60dvh!important}
body:not(.e4play) main{padding-bottom:85px!important}
.map103{display:grid;gap:12px;grid-template-columns:repeat(auto-fit,minmax(min(100%,290px),1fr))}.map103 article{display:grid;grid-template-columns:minmax(80px,30%) minmax(0,1fr);gap:10px;align-items:start;padding:10px;border:1px solid #536478;border-radius:12px}.map103 article img{width:100%!important;height:auto!important;max-height:180px;object-fit:cover;border-radius:8px}.map103 article h3,.map103 article p{margin:5px 0}.seal103{display:flex;flex-wrap:wrap;gap:6px}.seal103 span{padding:4px 6px;border:1px solid #536478;border-radius:6px}
@media(orientation:landscape) and (max-height:600px){body.e4play .e4shell{grid-template-rows:auto auto auto auto!important;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr)!important}body.e4play .e4shell .board{height:clamp(165px,52dvh,330px)!important;grid-area:3/1/5/2!important}body.e4play .e4shell .dockE{grid-area:3/2!important}body.e4play .e4shell .e2social{grid-area:4/2!important}body.e4play .e4shell .e4head .chapter103{display:block!important}}

/* E7: dialogs use the browser top layer, independent of game layout */
#arcaneDialogE6{position:fixed;inset:0;margin:auto;width:min(420px,calc(100% - 32px));max-width:calc(100% - 32px);max-height:calc(100dvh - 32px);padding:0;border:1px solid #d7b16b;border-radius:16px;background:#142334;color:#f4e4c4;box-sizing:border-box;overflow:auto;z-index:2147483647;box-shadow:0 12px 60px #000b}
#arcaneDialogE6::backdrop{background:#050a12b8;backdrop-filter:blur(3px)}
#arcaneDialogE6 .arcaneBox{padding:24px;text-align:center;box-sizing:border-box}#arcaneDialogE6 h2{margin:8px 0 12px;color:#edcc88;font-size:clamp(20px,5vw,27px)}#arcaneDialogE6 p{margin:0 0 20px;line-height:1.45;overflow-wrap:anywhere}#arcaneDialogE6 input{width:100%;box-sizing:border-box;margin-bottom:16px}#arcaneDialogE6 .arcaneActions{display:flex;flex-wrap:wrap;gap:8px}#arcaneDialogE6 .arcaneActions button{flex:1 1 120px;min-height:44px;margin:0}#arcaneToastE6{position:fixed;top:max(12px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);width:min(420px,90%);z-index:2147483646;pointer-events:none}#arcaneToastE6>div{background:#142334;color:#f4e4c4;border:1px solid #d7b16b;border-radius:10px;padding:12px;margin:6px 0;box-shadow:0 4px 20px #0009}

.c3Result{max-width:680px;margin:12px auto;display:grid;gap:12px}.c3Result section{display:grid;gap:10px;padding:14px;background:#1b2c40;border:1px solid #ffffff20;border-radius:12px}.c3Result h3{margin:0}.c3Result .c3Row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center;padding:10px;border-radius:8px;background:#112235}.c3Result .c3Winner{border:1px solid #eac47d;color:#f5dfa4}.c3Result .c3Row span:first-child{overflow-wrap:anywhere}.c3Result label{display:grid;gap:6px;margin:0}.c3Result .hfCheck{grid-template-columns:24px minmax(0,1fr);align-items:center}.c3Result .hfCheck input{width:20px;height:20px}.c3Result button{width:100%;min-height:44px}.c3Result small,.c3LobbyHint{color:#bdcbd9}.c3Result .c3Grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.c3Result .c3Grid button{white-space:normal}.c3Result [role=status]{min-height:1em}.c3LobbyHint{margin:0;font-size:.85rem}

/* D1.1: preserve compact shell and dock space during an offline bot turn. */
body.e4play .e4shell .dockE.botDockD11{min-height:var(--bot-dock-min,0px)!important}
body.e4play .e4shell .botWaitingD11{width:100%;min-width:0;pointer-events:none}
.botWaitingD11 .botStatusD11{margin:0 0 8px;color:#edcc88;font-size:13px;font-weight:600;line-height:1.4}
.botWaitingD11 .row108{min-height:0}

/* D2 — Premium Battlefield. Scoped to the existing unified gameplay shell. */
body.e4play{background:#0b1521;color:#f3e8d1}
body.e4play .e4shell{--d2gold:#e4bd77;--d2line:#8c714b;--d2muted:#a6b6c8;--d2panel:#122235;box-sizing:border-box;gap:8px!important;max-width:1450px;margin-inline:auto!important;background:none;border:0;box-shadow:none}
body.e4play .e4head{background:linear-gradient(120deg,#1d3046,#111f30);border:1px solid #6f583b;border-radius:12px;padding:8px 10px;gap:5px}
body.e4play .e4head .e2top strong{color:var(--d2gold);font-size:14px;letter-spacing:.13em}
body.e4play .e4head .e2status{color:#e8e1d3;line-height:1.35}
body.e4play .e4head>p{color:var(--d2muted);font-variant-numeric:tabular-nums}
body.e4play .e4players .playerE{border:1px solid #45566b;background:linear-gradient(145deg,#20344a,#111d2b);border-radius:11px;gap:8px!important;padding:7px!important;text-align:left;overflow:hidden;min-width:0}
body.e4play .e4players .playerE.active{border-color:var(--d2gold);box-shadow:inset 0 0 0 1px #e4bd7760,0 0 9px #e4bd7725;background:linear-gradient(145deg,#4b3b29,#192c3d)}
body.e4play .e4players .playerE .hero-avatar{width:42px!important;height:42px!important;object-fit:cover;border:1px solid #ba965e;border-radius:9px}
body.e4play .e4players .playerE>div{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:650}
body.e4play .e4players .playerE small{color:#c1cedc;font-size:11px!important;font-weight:400}
body.e4play .e4players .playerE.active small{color:#f4d18e}
body.e4play .e4shell .board{box-sizing:border-box;align-items:flex-start;align-content:flex-start;gap:9px;padding:10px;border:2px solid #8e7046;border-radius:12px;background-color:#172839;box-shadow:inset 0 0 38px #0009,0 3px 8px #0005;scrollbar-color:#9c7948 #142434;overscroll-behavior:contain}
body.e4play[data-arena102] .e4shell .board{border-color:var(--arena-color,#8e7046)}
body.e4play .e4shell .board>.muted{margin:auto;align-self:center;color:#c5cfda;text-align:center;padding:15px;font-size:14px}
body.e4play .e4shell .group{max-width:100%;min-width:0;box-sizing:border-box;align-self:flex-start;border-radius:9px;background:#0a1422d9;border:1px solid #b39a704f;padding:6px;gap:4px;box-shadow:0 2px 6px #0005;animation:none}
body.e4play .e4shell .group.bad{border:2px solid #ef6964;background:#49222bd9;padding:5px}
body.e4play .e4shell .group .tiles{flex-wrap:wrap;max-width:100%}
body.e4play .e4shell .group button:not(.tile){min-height:26px;padding:3px 7px;border-radius:5px;font-size:11px;background:#1b3444;color:#e3c18a;border:1px solid #a68a5b;box-shadow:none}
body.e4play .e4shell .group button.add{width:100%;margin-top:5px}
body.e4play .e4shell .tile{box-sizing:border-box;display:inline-flex;flex-direction:column;justify-content:center;align-items:center;gap:2px;line-height:1;letter-spacing:-.04em;font-family:system-ui,-apple-system,BlinkMacSystemFont,sans-serif;font-weight:800;border-radius:7px;box-shadow:0 2px 4px #0008,inset 0 1px 1px #fff8;transition:box-shadow .12s,transform .12s;touch-action:none}
body.e4play .e4shell .tile small{font-size:clamp(9px,2.4vw,12px);margin:0;line-height:1;letter-spacing:0}
body.e4play .e4shell .tile.c0{color:#a71533}body.e4play .e4shell .tile.c1{color:#1446a1}body.e4play .e4shell .tile.c2{color:#805200}body.e4play .e4shell .tile.c3{color:#202936}body.e4play .e4shell .tile.c4{color:#6531a0}
body.e4play .e4shell .tile.freshE{outline:2px solid #71dfce;outline-offset:1px;box-shadow:0 0 8px #71dfce70;animation:tileE .24s ease-out}
body.e4play .e4shell .tile.sel{outline:3px solid #f1bd57;outline-offset:1px;transform:translateY(-2px);box-shadow:0 0 10px #f1bd5780;z-index:1}
body.e4play .e4shell .rack,body.e4play .e4shell .hand{background:linear-gradient(155deg,#1d3448,#102133);border:1px solid #90744b;border-radius:10px;padding:9px!important;box-shadow:inset 0 1px 0 #ffffff12}
body.e4play .e4shell .rack b{color:#f3d9a8;font-size:13px}
body.e4play .e4shell .rack .row108,body.e4play .e4shell .hand .row108,body.e4play .e4shell .rack .tiles{gap:5px!important;padding:2px}
body.e4play .e4shell .dockE{gap:6px!important;min-width:0}
body.e4play .e4shell .e4msg{color:#e0c58f;min-height:1.35em;font-size:12px;line-height:1.35}
body.e4play .e4shell .e4actions{gap:5px;align-items:stretch}
body.e4play .e4shell .e4actions button,body.e4play .e4shell .e2social button,body.e4play .e4shell .dockE button:not(.tile){min-height:38px!important;font-size:12px!important;padding:6px 10px!important;border-radius:8px;white-space:normal}
body.e4play .e4shell .e4actions button[onclick="finish()"],body.e4play .e4shell .e4actions button[onclick="act9('play')"]{background:linear-gradient(#ffe1a3,#c49346);color:#25190b;font-weight:800;flex:1 1 125px!important}
body.e4play .e4shell .e4actions button[onclick="draw()"],body.e4play .e4shell .e4actions button[onclick="act9('draw')"]{background:linear-gradient(#294658,#1b3146);color:#ecdfc8;border-color:#7893a3}
body.e4play .e4shell .e4actions button:disabled{opacity:.55}
body.e4play .e4shell .botWaitingD11{pointer-events:none}
body.e4play .e4shell .botWaitingD11 .tile{opacity:1;filter:saturate(.8)}
body.e4play .e4shell .botStatusD11{color:#e8ca91;min-height:1.35em}
@media(max-width:480px){body.e4play .e4shell{gap:6px!important}body.e4play .e4players .playerE{padding:5px!important;gap:4px!important}body.e4play .e4players .playerE .hero-avatar{width:32px!important;height:32px!important}body.e4play .e4players .playerE>div{font-size:11px}body.e4play .e4players .playerE small{font-size:10px!important}body.e4play .e4shell .board{padding:7px;gap:7px}body.e4play .e4shell .e4actions button{padding:5px 8px!important}}
@media(orientation:landscape) and (max-height:600px){body.e4play .e4shell{gap:5px!important}body.e4play .e4head{padding:4px 8px}body.e4play .e4players .playerE{padding:4px!important}body.e4play .e4players .playerE .hero-avatar{width:34px!important;height:34px!important}body.e4play .e4shell .e4actions button{min-height:34px!important}body.e4play .e4shell .rack,body.e4play .e4shell .hand{padding:6px!important}}
@media(prefers-reduced-motion:reduce){body.e4play .e4shell .tile,body.e4play .e4shell .freshE{animation:none!important;transition:none!important}}
body.e4play.quietE .e4shell .tile{animation:none!important;transition:none!important}

@media (orientation:portrait) and (max-width:480px){body.e4play .e4players :is(.players,.playersE):has(>:nth-child(3)){grid-template-columns:repeat(2,minmax(0,1fr));}}

/* D3 mobile landscape: fit the viewport; scroll only table/rack (and dock if necessary). */
body.e4play .e4shell .board,body.e4play .e4shell .e4rackscroll{touch-action:pan-y;overscroll-behavior:contain;scrollbar-width:thin;-webkit-overflow-scrolling:touch}
body.e4play .e4shell :is(button.tile){touch-action:none;-webkit-touch-callout:none;user-select:none;-webkit-user-select:none}
.dragghost{pointer-events:none!important;box-sizing:border-box;min-height:0!important;max-height:none!important;transition:none!important;animation:none!important}
@media (orientation:landscape) and (min-height:300px) and (max-height:600px){
 body.e4play{height:100dvh!important;min-height:0!important;overflow:hidden!important;padding:0!important}
 body.e4play main{height:100dvh!important;min-height:0!important;box-sizing:border-box;display:flex!important;flex-direction:column;overflow:hidden!important;padding:max(4px,env(safe-area-inset-top)) max(5px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(5px,env(safe-area-inset-left))!important}
 body.e4play #app{flex:1;min-height:0!important;height:100%!important;overflow:hidden!important}
 body.e4play #app.e4shell{display:grid!important}
 body.e4play .e4shell{height:100%!important;min-height:0!important;overflow:hidden!important;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr)!important;grid-template-rows:auto auto minmax(0,1fr) auto!important;align-content:stretch!important;gap:4px!important;padding:3px!important}
 body.e4play .e4shell .e4head{padding:3px 6px;max-height:24dvh;overflow:auto;min-width:0}
 body.e4play .e4shell .e4head .chapter103{font-size:11px!important}
 body.e4play .e4shell .e4head .e2top{min-height:28px;flex-shrink:0}
 body.e4play .e4shell .e4head .e2top strong{font-size:12px;letter-spacing:.08em}
 body.e4play .e4shell .e4players{min-height:0;min-width:0}
 body.e4play .e4shell .playerE .hero-avatar{width:30px!important;height:30px!important}
 body.e4play .e4shell .board{height:auto!important;grid-area:3/1/5/2!important;align-self:stretch;min-height:0!important;min-width:0;overflow:auto!important;padding:6px 19px 6px 6px;gap:6px}
 body.e4play .e4shell .dockE,body.e4play .e4shell .dockE.botDockD11{height:100%!important;min-height:0!important;min-width:0;overflow:hidden!important;gap:4px!important;display:grid!important;grid-template-rows:auto minmax(0,1fr) auto}
 body.e4play .e4shell .e4rackscroll{flex:1 1 0!important;min-height:0;max-height:none!important;overflow:auto!important;padding-right:15px;grid-row:2;align-self:stretch}
 body.e4play .e4shell .e4actions{flex:0 0 auto;gap:3px;grid-row:3;position:static;max-height:34dvh;overflow:auto!important}
 body.e4play .e4shell .e4actions button,body.e4play .e4shell .e2social button{min-height:34px!important;padding:4px 7px!important;font-size:12px!important}
 body.e4play .e4shell .e2social{grid-area:4/2!important;min-width:0;flex-wrap:nowrap;overflow-x:auto;gap:3px!important}
 body.e4play .e4shell .e2social button{flex:0 0 auto!important;min-width:34px!important}
 body.e4play .e4shell .e2settings{inset:auto max(8px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))!important;max-height:85dvh!important}
 body.e4play #chatPanelH5:not([hidden]){bottom:max(6px,env(safe-area-inset-bottom))!important;max-height:85dvh!important}
}
/* Compact portrait retains page scrolling for large hands / accessibility. */
@media (orientation:portrait){body.e4play .e4shell .e4rackscroll{max-height:32dvh!important;overflow:auto!important}}

/* D4 – Premium Experience. Non-game screens use shared navy/gold tokens.
   Gameplay geometry and D3 scroll/pointer rules are intentionally untouched. */
body:not(.e4play) #app{--d4gold:#e4bd77;--d4muted:#b7c5d6;--d4line:#927448;--d4card:#182b40}
.d4Home{max-width:920px;margin:12px auto;display:grid;gap:12px}
.d4Home .hero105{min-height:clamp(210px,32vw,340px);box-sizing:border-box;padding:clamp(16px,4vw,36px);background:linear-gradient(90deg,#08101cee 0%,#08101ca0 46%,#08101c22),linear-gradient(0deg,#08101caa,transparent 55%),url('art/menu.webp') center 43%/cover;border-color:#ad8955;border-radius:18px;box-shadow:0 12px 35px #0005;align-items:flex-start}
.d4Eyebrow,.d4Home .hero105 .d4Eyebrow{font-size:11px;letter-spacing:.24em;font-weight:700;color:#e4bd77;text-transform:uppercase}
.d4Home .hero105 h2{font-family:Georgia,serif;font-size:clamp(34px,6vw,62px);color:#fff1d2;line-height:1.04;letter-spacing:-.03em;margin:8px 0}
.d4Home .hero105 p{color:#d8e1eb;font-size:clamp(14px,2vw,18px);margin:0 0 14px}
.d4HeroActions,.d4ResumeRow{display:flex;flex-wrap:wrap;gap:8px}.d4ResumeRow:empty{display:none}
.d4HeroActions button,.d4ResumeRow button{min-height:44px;white-space:normal;flex:0 1 auto}
.d4Home .profile105{margin:0;padding:12px;border:1px solid #796441;border-radius:12px;background:linear-gradient(130deg,#20364b,#111e2c)}
.d4Home .profile105 .hero-avatar{width:56px;height:56px;border:1px solid #c6a575;border-radius:10px}
.d4ProfileInfo{min-width:0;flex:1;overflow-wrap:anywhere}.d4ProfileInfo small{margin:2px 0 5px}
.d4ProfileInfo progress,.d4CampaignProgress progress{width:100%;height:8px;display:block;accent-color:#e4bd77;appearance:none;border:none;background:#0a1422;border-radius:10px;overflow:hidden}
.d4ProfileInfo progress::-webkit-progress-bar,.d4CampaignProgress progress::-webkit-progress-bar{background:#0a1422;border-radius:10px}
.d4ProfileInfo progress::-webkit-progress-value,.d4CampaignProgress progress::-webkit-progress-value{background:linear-gradient(90deg,#9d7135,#f4d18e);border-radius:10px}
.d4SectionTitle{display:flex;align-items:baseline;justify-content:space-between;gap:8px}.d4SectionTitle h3{margin:0;font:700 19px Georgia,serif;color:#f5e4c4}.d4SectionTitle span{color:#e4bd77;font-size:12px}
.d4Home .navgrid105,.d4Page .navgrid105{gap:10px;grid-template-columns:repeat(2,minmax(0,1fr))}
.d4Home button.navcard105,.d4Page button.navcard105{min-height:86px;padding:13px;border:1px solid #927448;border-radius:12px;background:linear-gradient(135deg,#253b50,#111e2d);box-shadow:0 3px 8px #0003;transition:border-color .15s,background .15s}
.d4Home .navcard105>span,.d4Page .navcard105>span{display:grid;place-items:center;flex:0 0 36px;height:36px;border-radius:9px;background:#d5ae6820;border:1px solid #bd96574d;color:#e4bd77;font-size:23px}
.d4Home .navcard105>div,.d4Page .navcard105>div{min-width:0;overflow-wrap:anywhere}.d4Home .navcard105 small,.d4Page .navcard105 small{line-height:1.35;color:#c3d0df}
.d4Footer{color:#9eafc2;font-size:10px;letter-spacing:.16em;text-align:center;padding:5px}
.d4Page{max-width:920px}.d4Page>h2{font-family:Georgia,serif;color:#f1d8a4;margin:16px 0}
body:not(.e4play) #app :is(.hero-grid,.arena-grid102){grid-template-columns:repeat(auto-fit,minmax(min(100%,150px),1fr));gap:12px}
body:not(.e4play) #app .hero-card101{min-width:0;border-radius:12px;padding:9px!important;position:relative;background:linear-gradient(155deg,#23364b,#101c2a)!important;box-shadow:0 4px 10px #0004}
body:not(.e4play) #app .hero-card101 .hero-art{width:100%;height:clamp(125px,25vw,205px);object-fit:cover;border-radius:8px;object-position:center 25%}
body:not(.e4play) #app .hero-card101.d4ActiveHero{box-shadow:0 0 0 2px #e4bd77,0 0 18px #e4bd7740}
body:not(.e4play) #app .hero-card101.d4LockedHero .hero-art{filter:saturate(.6) brightness(.8)}
.d4HeroDetail section h2{font-family:Georgia,serif;color:#f5d69c}.d4HeroDetail .outfits101 button{min-width:0}
.d4CampaignProgress{display:grid;gap:8px;padding:14px;background:#101d2d;border:1px solid #947548;border-radius:10px;margin:10px 0;color:#f1d59d}
.map103 article.d4ChapterOpen{border-color:#b08b53;background:linear-gradient(120deg,#26394a,#142335)}
.map103 article.d4ChapterDone{border-color:#d5bc83;background:linear-gradient(120deg,#3b352b,#192c3d)}
.map103 article.locked103{opacity:.76}.map103 article button{min-height:44px;white-space:normal}.map103 article div{min-width:0}
.d4LobbySummary{padding:10px 12px;background:#0d1d2c;border:1px solid #9c7d4e;border-radius:9px;color:#edcc88;font-size:13px;overflow-wrap:anywhere}
.hfLobby section,.c3Result section{background:linear-gradient(140deg,#23384d,#142234);border-color:#92744880}
.hfLobby section h3,.c3Result section h3{color:#eed4a2;font-family:Georgia,serif}
.hfLobby .hfCode{font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.hfLobby button{min-height:44px;white-space:normal}
.d4OfflineResult{display:grid;gap:12px;text-align:center;background:radial-gradient(ellipse at top,#59432b,#142334 55%);border-color:#ba965e;padding:clamp(14px,4vw,32px)}
.d4OfflineResult h2{margin:0;color:#ffe0a0;font-family:Georgia,serif}.d4ResultEmblem{font-size:42px;color:#e4bd77;line-height:1.2}
.d4ScoreList{display:grid;gap:6px}.d4ScoreRow{display:flex;justify-content:space-between;gap:8px;padding:12px;background:#101e2d;border:1px solid #54657a;border-radius:9px;text-align:left}.d4ScoreRow span{overflow-wrap:anywhere;min-width:0}.d4ScoreRow strong{white-space:nowrap}.d4ScoreWinner{border-color:#e4bd77;color:#ffe0a0}
.c3Result .victoryE{display:grid;gap:8px;justify-items:center;overflow-wrap:anywhere}.c3Result .victoryE .hero-art{max-width:100px;max-height:120px;object-fit:cover;border-radius:10px}
#chatPanelH5 .b2ChatHeader{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:2px 8px}
#chatPanelH5 .b2ChatHeader strong{grid-area:1/1;color:#f2d39b}#chatPanelH5 .b2ChatHeader small{grid-area:2/1;color:#bdcbd9}
#chatPanelH5 .d4ChatClose{grid-area:1/2/3/3;min-width:40px;min-height:40px;padding:6px;align-self:start}
#chatPanelH5 .chatMsgH5{max-width:90%;overflow-wrap:anywhere;background:#20384e;border:1px solid #53677b;border-radius:10px 10px 10px 3px}
#chatPanelH5 .chatMsgH5.b2Own{margin-left:auto;background:#344559;border-color:#b7a16d;border-radius:10px 10px 3px 10px}
#chatPanelH5 form input{min-width:0;flex:1;font-size:16px}#chatPanelH5 form button{flex:0 0 auto;min-height:40px}
body:not(.e4play) #app button:focus-visible,#chatPanelH5 :is(button,input):focus-visible{outline:2px solid #f1cf8b;outline-offset:3px}
@media (max-width:380px){.d4Home .navgrid105,.d4Page .navgrid105{grid-template-columns:1fr}.d4Home .hero105{min-height:190px}.d4HeroActions button,.d4ResumeRow button{flex:1 1 130px}}
@media (orientation:landscape) and (max-height:600px){.d4Home .hero105{min-height:160px;padding:14px}.d4Home .hero105 h2{font-size:34px}.d4Home button.navcard105,.d4Page button.navcard105{min-height:68px}.d4Home .profile105 .hero-avatar{width:42px;height:42px}}
@media(prefers-reduced-motion:reduce){.d4Home button.navcard105,.d4Page button.navcard105{transition:none}}

#gUpdate{position:fixed;bottom:max(10px,env(safe-area-inset-bottom));right:10px;z-index:10000;max-width:90vw;background:#e4bd77;color:#241907;box-shadow:0 3px 15px #0008}body.e4play #gUpdate{display:none}
