/* Motion and finish across the site. Loaded last. motion.js sets html[data-motion=full] unless the site's own
   Low-power mode (or ?render=basic) is on, and every animation here hangs off that attribute: the computer's "reduce
   motion" setting no longer switches the site to still pictures, Low-power mode does. Entrance animations run only
   when a page opens (body[data-entering], set by view-navigation.js), never when data refreshes, so polling cannot
   replay them. Looping effects stay on small elements and animate transform/opacity only. */

/* Loading screen: no large background art while the app is still arriving, and a gold spinner for slow links. */
html body:has(#loading:not([hidden])){background-image:none!important}
#loading .loading-note{display:grid;justify-items:center;gap:10px;margin-top:6px}
#loading .loading-note p{margin:0;color:#e9e2cf;font:600 15px/1.4 system-ui,sans-serif}
#loading .loading-note button{min-height:40px;padding:8px 18px;border:1px solid rgba(215,180,90,.7);border-radius:10px;background:rgba(255,255,255,.06);color:#fff3cf;font:700 14px system-ui,sans-serif;cursor:pointer}
#loading .loading-spinner{width:28px;height:28px;border:3px solid rgba(215,180,90,.25);border-top-color:#d7b45a;border-radius:50%;animation:realm-spin 1s linear infinite}

/* Low-power mode and the basic render mode: still visuals everywhere (spinners keep turning). */
html:is([data-low-power=true],[data-render-mode=basic]) *:not(.loading-spinner):not(.hub-spinner),html:is([data-low-power=true],[data-render-mode=basic]) *::before,html:is([data-low-power=true],[data-render-mode=basic]) *::after{animation:none!important;transition:none!important}

@keyframes realm-spin{to{transform:rotate(360deg)}}
@keyframes realm-view-in{from{opacity:0;transform:translateY(26px) scale(.985)}to{opacity:1;transform:none}}
@keyframes realm-card-in{from{opacity:0;transform:translateY(34px) scale(.95)}to{opacity:1;transform:none}}
@keyframes realm-pop-in{0%{opacity:0;transform:scale(.86)}60%{opacity:1;transform:scale(1.025)}100%{opacity:1;transform:none}}
@keyframes realm-fade-in{from{opacity:0}}
@keyframes realm-slide-in{from{opacity:0;transform:translateX(-30px)}to{opacity:1;transform:none}}
@keyframes realm-glow-pulse{0%{box-shadow:0 0 0 0 rgba(215,180,90,.6)}100%{box-shadow:0 0 0 16px rgba(215,180,90,0)}}
@keyframes realm-sheen{0%{transform:translateX(-160%) skewX(-18deg)}30%,100%{transform:translateX(320%) skewX(-18deg)}}
@keyframes realm-text-shine{from{background-position:200% 50%}to{background-position:-100% 50%}}
@keyframes realm-float{0%,100%{translate:0 0}50%{translate:0 -10px}}
@keyframes realm-float-small{0%,100%{translate:0 0}50%{translate:0 -5px}}
@keyframes realm-nav-glow{0%,100%{box-shadow:0 0 0 1px rgba(215,180,90,.4),0 0 8px rgba(215,180,90,.12)}50%{box-shadow:0 0 0 1px rgba(240,208,130,.9),0 0 22px rgba(215,180,90,.4)}}
@keyframes realm-ripple{from{transform:scale(0);opacity:.55}to{transform:scale(1);opacity:0}}
@keyframes realm-route{0%{transform:scaleX(0);opacity:1}70%{transform:scaleX(1);opacity:1}100%{transform:scaleX(1);opacity:0}}
@keyframes realm-square-in{from{opacity:0;transform:scale(.5)}to{opacity:1;transform:none}}
@keyframes realm-piece-drop{0%{opacity:0;transform:translateY(-80%) scale(.55)}65%{opacity:1;transform:translateY(6%) scale(1.06)}100%{opacity:1;transform:none}}
@keyframes realm-land{0%{box-shadow:inset 0 0 0 0 rgba(255,224,140,.95),0 0 0 0 rgba(255,214,120,.75)}100%{box-shadow:inset 0 0 0 40px rgba(255,224,140,0),0 0 0 12px rgba(255,214,120,0)}}
@keyframes realm-piece-bob{0%,100%{translate:0 -4%;scale:1.08}50%{translate:0 -12%;scale:1.11}}
@keyframes realm-dot-in{from{transform:translate(-50%,-50%) scale(0)}to{transform:translate(-50%,-50%) scale(1)}}
@keyframes realm-ghost{0%{opacity:1;transform:scale(1) rotate(0)}100%{opacity:0;transform:scale(1.75) rotate(28deg)}}
@keyframes realm-spark{0%{opacity:1;transform:rotate(var(--a)) translateY(0) scale(1.2)}100%{opacity:0;transform:rotate(var(--a)) translateY(-300%) scale(.3)}}
@keyframes realm-toast-in{0%{opacity:0;transform:translateX(46px) scale(.9)}60%{opacity:1;transform:translateX(-6px) scale(1.02)}100%{opacity:1;transform:none}}
@keyframes realm-toast-timer{from{transform:scaleX(1)}to{transform:scaleX(0)}}
@keyframes realm-wiggle{0%,100%{rotate:0deg}25%{rotate:-9deg}75%{rotate:7deg}}

/* Effect layers drawn by motion.js. */
.realm-ripple-layer{position:fixed;z-index:2147483600;overflow:hidden;pointer-events:none}
.realm-ripple{position:absolute;border-radius:50%;background:radial-gradient(circle,rgba(255,238,175,.6) 0%,rgba(215,180,90,.3) 38%,rgba(215,180,90,0) 68%);animation:realm-ripple .65s cubic-bezier(.2,.7,.3,1) forwards}
.realm-spotlight{position:fixed;z-index:2147483500;pointer-events:none;opacity:0;transition:opacity .3s ease;background:radial-gradient(280px circle at var(--x,50%) var(--y,50%),rgba(255,226,145,.16),rgba(255,226,145,.05) 45%,rgba(255,226,145,0) 70%);mix-blend-mode:screen}
.realm-spotlight.on{opacity:1}
.realm-route-bar{position:fixed;left:0;top:0;z-index:2147483600;width:100%;height:3px;transform-origin:0 50%;transform:scaleX(0);opacity:0;background:linear-gradient(90deg,#8a6a22,#f3d27a 45%,#fff3c4 60%,#d7b45a);box-shadow:0 0 14px rgba(243,210,122,.85);pointer-events:none}
.realm-route-bar.run{animation:realm-route .95s cubic-bezier(.3,.7,.2,1) forwards}
.realm-tilting{transition:transform .12s ease-out!important;will-change:transform}

/* Pages rise in when opened; their cards follow one after another. */
html[data-motion=full] main .app-view:not([hidden]){animation:realm-view-in .55s cubic-bezier(.2,.75,.2,1) backwards}
html[data-motion=full] body[data-entering] main .app-view:not([hidden]) :is(.home-welcome,.home-panel,.dashboard-recent,.dashboard-events,.hub-panel,.hub-board,.hub-mode,.hub-online,.hub-links>*,.profile-panel,.learn-heading,.learn-course,.learn-lesson,.course-lesson,.empty-state-card,.wgc-panel,.tv-card,.card,.theme-card,.avatar-tile,.setup-nav>*,#settings>label,#settings>section):not(#scheduled *){animation:realm-card-in .65s cubic-bezier(.2,.75,.2,1) backwards}
html[data-motion=full] body[data-entering] main :is(.home-main-grid,.home-bottom-grid,.hub-modes,.hub-links,.learn-courses,.profile-grid,.avatar-grid,.theme-grid,#settings,#setupContent>aside,.setup-nav,.app-view)>*:nth-child(2){animation-delay:.07s}
html[data-motion=full] body[data-entering] main :is(.home-main-grid,.home-bottom-grid,.hub-modes,.hub-links,.learn-courses,.profile-grid,.avatar-grid,.theme-grid,#settings,#setupContent>aside,.setup-nav,.app-view)>*:nth-child(3){animation-delay:.14s}
html[data-motion=full] body[data-entering] main :is(.home-main-grid,.home-bottom-grid,.hub-modes,.hub-links,.learn-courses,.profile-grid,.avatar-grid,.theme-grid,#settings,#setupContent>aside,.setup-nav,.app-view)>*:nth-child(4){animation-delay:.21s}
html[data-motion=full] body[data-entering] main :is(.home-main-grid,.home-bottom-grid,.hub-modes,.hub-links,.learn-courses,.profile-grid,.avatar-grid,.theme-grid,#settings,#setupContent>aside,.setup-nav,.app-view)>*:nth-child(5){animation-delay:.28s}
html[data-motion=full] body[data-entering] main :is(.home-main-grid,.home-bottom-grid,.hub-modes,.hub-links,.learn-courses,.profile-grid,.avatar-grid,.theme-grid,#settings,#setupContent>aside,.setup-nav,.app-view)>*:nth-child(n+6){animation-delay:.34s}
html[data-motion=full] body[data-entering] main .home-hero-art{animation:realm-pop-in .8s cubic-bezier(.2,.8,.2,1) .15s backwards,realm-float 7s ease-in-out 1s infinite}
/* Long pages: cards further down rise in as they scroll into view (motion.js marks them). */
html[data-motion=full] [data-reveal=wait]{opacity:0}
html[data-motion=full] [data-reveal=in]{animation:realm-card-in .7s cubic-bezier(.2,.75,.2,1) backwards}

/* Things that keep gently moving: the logo and the artwork float, the current menu item glows. */
html[data-motion=full] body>header .brand-logo{animation:realm-float-small 6s ease-in-out infinite;transition:filter .3s ease,scale .3s ease}
@media (hover:hover){html[data-motion=full] body>header .brand:hover .brand-logo{scale:1.06;filter:drop-shadow(0 0 14px rgba(255,214,120,.6))}}
html[data-motion=full] main .home-hero-art{animation:realm-float 7s ease-in-out infinite}
html[data-motion=full] main .home-bottom-grid>* img{animation:realm-float-small 5s ease-in-out infinite}
html[data-motion=full] main .home-bottom-grid>*:nth-child(2) img{animation-duration:5.8s;animation-delay:-1.2s}
html[data-motion=full] main .home-bottom-grid>*:nth-child(3) img{animation-duration:6.4s;animation-delay:-2.4s}
html[data-motion=full] main .home-bottom-grid>*:nth-child(4) img{animation-duration:5.4s;animation-delay:-3.1s}
html[data-motion=full] #sectionNav a[aria-current=page]{animation:realm-nav-glow 2.8s ease-in-out infinite}

/* Gold headings shimmer. */
html[data-motion=full] :is(#playHome .hub-panel h1,#setupView>h1,main .home-hero h1 em){background:linear-gradient(100deg,#d4a94e 0%,#f3d68a 28%,#fff8de 42%,#f3d68a 56%,#d4a94e 100%);background-size:260% 100%;-webkit-background-clip:text;background-clip:text;color:transparent!important;-webkit-text-fill-color:transparent;text-shadow:none!important;filter:drop-shadow(0 2px 8px rgba(0,0,0,.45));animation:realm-text-shine 5.5s linear infinite}
html[data-motion=full] #settingsView #settings::before{background:linear-gradient(100deg,#d4a94e 0%,#f3d68a 28%,#fff8de 42%,#f3d68a 56%,#d4a94e 100%);background-size:260% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;-webkit-text-fill-color:transparent;animation:realm-text-shine 5.5s linear infinite}

/* Buttons and links that look like buttons: lift, grow and glow on hover, press in on click. Board squares are left
   to the board. The individual translate/scale properties add to any transform an element already has. */
html[data-motion=full] :is(main,dialog,.mobile-drawer,body>header,.toast-host) :is(button,a.home-cta,a.dashboard-play,a.dashboard-event,.hub-links a,.setup-nav a,#customGameSettings):not(:disabled):not(:is(#board,.board,.quick-board,.course-board,.puzzle-board,.puzzle-preview-board,.lesson-example-board) *){transition:translate .2s cubic-bezier(.2,.8,.3,1.5),scale .2s cubic-bezier(.2,.8,.3,1.5),box-shadow .25s ease,filter .25s ease,background-color .25s ease,border-color .25s ease,color .2s ease}
@media (hover:hover){html[data-motion=full] :is(main,dialog,.mobile-drawer,body>header,.toast-host) :is(button,a.home-cta,a.dashboard-play,a.dashboard-event,.hub-links a,.setup-nav a,#customGameSettings):not(:disabled):not(:is(#board,.board,.quick-board,.course-board,.puzzle-board,.puzzle-preview-board,.lesson-example-board) *):hover{translate:0 -2px;scale:1.03;filter:brightness(1.1);box-shadow:0 10px 24px rgba(0,0,0,.34),0 0 0 1px rgba(231,198,114,.55),0 0 20px rgba(215,180,90,.25)}}
html[data-motion=full] :is(main,dialog,.mobile-drawer,body>header,.toast-host) :is(button,a.home-cta,a.dashboard-play,a.dashboard-event,.hub-links a,.setup-nav a,#customGameSettings):not(:disabled):not(:is(#board,.board,.quick-board,.course-board,.puzzle-board,.puzzle-preview-board,.lesson-example-board) *):active{translate:0 1px;scale:.95;transition-duration:.07s}
html[data-motion=full] :is(main,dialog) :is(select,input:not([type=checkbox]):not([type=radio]):not([type=range]),textarea){transition:box-shadow .25s ease,border-color .25s ease,translate .2s ease}
@media (hover:hover){html[data-motion=full] :is(main,dialog) :is(select,input:not([type=checkbox]):not([type=radio]):not([type=range]),textarea):hover{border-color:rgba(231,198,114,.75)!important;box-shadow:0 0 0 3px rgba(215,180,90,.14)}}
html[data-motion=full] :is(main,dialog) :is(select,input,textarea):focus-visible{box-shadow:0 0 0 4px rgba(215,180,90,.3)!important}
/* Drop-down headers sit flush inside their panels, so they glow instead of lifting. */
@media (hover:hover){html[data-motion=full] main summary:hover{color:#ffe7a6;text-shadow:0 0 12px rgba(255,214,120,.45);transition:color .2s ease,text-shadow .2s ease}}
/* Icons inside buttons and menu items wiggle on hover. */
@media (hover:hover){html[data-motion=full] :is(button,a):hover>:is(svg,.hub-icon,.hub-mode-icon){animation:realm-wiggle .45s ease-in-out}}
@media (hover:hover){html[data-motion=full] .hub-mode:hover .hub-mode-icon{animation:realm-wiggle .5s ease-in-out;scale:1.1;transition:scale .25s ease}}

/* Gold and green call-to-action buttons: a beam of light passes over them every few seconds. */
html[data-motion=full] :is(.hub-primary,.dashboard-play,#playView #actions [data-act=review],#setupView #create,#resultDialog .result-actions .primary,.hub-mode>.hub-secondary,.hub-mode-bot>.hub-secondary){position:relative;overflow:hidden;isolation:isolate}
html[data-motion=full] :is(.hub-primary,.dashboard-play,#playView #actions [data-act=review],#setupView #create,#resultDialog .result-actions .primary,.hub-mode>.hub-secondary,.hub-mode-bot>.hub-secondary)::after{content:'';position:absolute;top:-10%;bottom:-10%;left:0;width:42%;z-index:1;background:linear-gradient(100deg,rgba(255,255,255,0),rgba(255,255,255,.45),rgba(255,255,255,0));transform:translateX(-160%) skewX(-18deg);animation:realm-sheen 4.8s ease-in-out 1.2s infinite;pointer-events:none}
html[data-motion=full] .hub-mode-bot>.hub-secondary::after{animation-delay:2.6s}
html[data-motion=full] .hub-mode>.hub-secondary::after{animation-delay:3.4s}

/* Cards: lift with a gold edge on hover (the light that follows the pointer and the tilt come from motion.js). */
html[data-motion=full] main :is(.home-bottom-grid>*,.home-puzzle,.dashboard-recent,.dashboard-events,.profile-panel,.hub-mode,.tv-card,.learn-course,.theme-card,.empty-state-card,#setupContent .card){transition:translate .28s cubic-bezier(.2,.8,.3,1.3),box-shadow .3s ease,border-color .3s ease}
@media (hover:hover){html[data-motion=full] main :is(.home-bottom-grid>*,.home-puzzle,.dashboard-recent,.dashboard-events,.profile-panel,.hub-mode,.tv-card,.empty-state-card,#setupContent .card):hover{translate:0 -5px;border-color:rgba(231,198,114,.85)!important;box-shadow:0 20px 44px rgba(0,0,0,.42),0 0 0 1px rgba(231,198,114,.5),0 0 30px rgba(215,180,90,.18)}}
@media (hover:hover){html[data-motion=full] main .learn-course:hover{translate:6px 0}}
html[data-motion=full] .theme-card img{transition:scale .7s cubic-bezier(.2,.7,.2,1)}
/* Store cards sit in a clipped gallery: they glow and their artwork zooms instead of lifting. */
@media (hover:hover){html[data-motion=full] .theme-card:hover{border-color:#e7c672!important;box-shadow:0 0 0 1px rgba(231,198,114,.6),0 0 26px rgba(215,180,90,.3)}}
@media (hover:hover){html[data-motion=full] .theme-card:hover img{scale:1.07}}
html[data-motion=full] .avatar-tile .player-portrait{transition:scale .3s cubic-bezier(.2,.8,.3,1.5),box-shadow .3s ease}
@media (hover:hover){html[data-motion=full] .avatar-tile>button:not(:disabled):hover .player-portrait{scale:1.1;box-shadow:0 0 0 2px #d7b45a,0 0 22px rgba(215,180,90,.5)}}

/* Menu: items slide and their icons turn on hover; the phone drawer deals its rows in one after another. */
html[data-motion=full] #sectionNav a{transition:background-color .25s ease,color .25s ease,box-shadow .25s ease}
@media (hover:hover){html[data-motion=full] #sectionNav a:not([aria-current=page]):hover{background-color:rgba(215,180,90,.12);box-shadow:inset 3px 0 0 #d7b45a,0 0 16px rgba(215,180,90,.16)}}
html[data-motion=full] #sectionNav a svg{transition:scale .25s cubic-bezier(.2,.8,.3,1.6),rotate .25s ease}
@media (hover:hover){html[data-motion=full] #sectionNav a:hover svg{scale:1.2;rotate:-8deg}}
html[data-motion=full] .mobile-drawer[data-open] :is(.mobile-drawer-row,.mobile-drawer-me){animation:realm-slide-in .45s cubic-bezier(.2,.8,.2,1) backwards}
html[data-motion=full] .mobile-drawer[data-open] .mobile-drawer-row:nth-child(2){animation-delay:.04s}
html[data-motion=full] .mobile-drawer[data-open] .mobile-drawer-row:nth-child(3){animation-delay:.08s}
html[data-motion=full] .mobile-drawer[data-open] .mobile-drawer-row:nth-child(4){animation-delay:.12s}
html[data-motion=full] .mobile-drawer[data-open] .mobile-drawer-row:nth-child(5){animation-delay:.16s}
html[data-motion=full] .mobile-drawer[data-open] .mobile-drawer-row:nth-child(6){animation-delay:.2s}
html[data-motion=full] .mobile-drawer[data-open] .mobile-drawer-row:nth-child(n+7){animation-delay:.24s}

/* The clock of the player to move breathes a gold glow, and the turn label pulses. */
@keyframes realm-clock-glow{0%,100%{box-shadow:0 0 0 1px rgba(255,214,120,.55),0 0 10px rgba(255,214,120,.25)}50%{box-shadow:0 0 0 2px rgba(255,226,150,.95),0 0 26px rgba(255,214,120,.6)}}
@keyframes realm-label-pulse{0%,100%{opacity:1}50%{opacity:.55}}
html[data-motion=full] .playerbar[data-active-turn=true] .clock{animation:realm-clock-glow 1.6s ease-in-out infinite}
html[data-motion=full] .playerbar[data-active-turn=true] .turn-indicator{animation:realm-label-pulse 1.6s ease-in-out infinite}
/* Pop-ups zoom in over a fading backdrop; toasts bounce in and show how long they stay. */
html[data-motion=full] dialog[open]{animation:realm-pop-in .4s cubic-bezier(.2,.8,.2,1)}
html[data-motion=full] dialog[open]::backdrop{animation:realm-fade-in .35s ease}
html[data-motion=full] .toast{animation:realm-toast-in .55s cubic-bezier(.2,.9,.3,1.2)}
html[data-motion=full] .toast::after{content:'';position:absolute;left:12px;right:12px;bottom:4px;height:2px;border-radius:2px;background:linear-gradient(90deg,#d7b45a,#fff1c1);transform-origin:0 50%;animation:realm-toast-timer 2.8s linear forwards}
html[data-motion=full] :is(.rs-accept,#playView #actions [data-act=accept]){animation:realm-glow-pulse 1.3s ease-out infinite}

/* The board: squares and pieces arrive rank by rank when a game opens; pieces rise when you point at them, the
   picked-up piece hovers, move targets pop in, the landing square flashes and captures burst into sparks. */
html[data-motion=full] #board.board-intro .square{animation:realm-square-in .45s cubic-bezier(.2,.8,.2,1) backwards}
html[data-motion=full] #board.board-intro .piece{animation:realm-piece-drop .65s cubic-bezier(.2,.8,.3,1.1) .18s backwards}
html[data-motion=full] #board.board-intro .square:nth-child(n+9){animation-delay:.04s}
html[data-motion=full] #board.board-intro .square:nth-child(n+17){animation-delay:.08s}
html[data-motion=full] #board.board-intro .square:nth-child(n+25){animation-delay:.12s}
html[data-motion=full] #board.board-intro .square:nth-child(n+33){animation-delay:.16s}
html[data-motion=full] #board.board-intro .square:nth-child(n+41){animation-delay:.2s}
html[data-motion=full] #board.board-intro .square:nth-child(n+49){animation-delay:.24s}
html[data-motion=full] #board.board-intro .square:nth-child(n+57){animation-delay:.28s}
html[data-motion=full] #board.board-intro .square:nth-child(n+9) .piece{animation-delay:.24s}
html[data-motion=full] #board.board-intro .square:nth-child(n+49) .piece{animation-delay:.42s}
html[data-motion=full] #board.board-intro .square:nth-child(n+57) .piece{animation-delay:.48s}
html[data-motion=full] #board:not([data-presentation=gallant]) .piece{transition:translate .18s cubic-bezier(.2,.8,.3,1.5),scale .18s cubic-bezier(.2,.8,.3,1.5),filter .2s ease}
@media (hover:hover){html[data-motion=full] #board:not([data-presentation=gallant]) .square:not(.selected):not(:disabled):hover>.piece:not(.moving){translate:0 -6%;scale:1.09;filter:drop-shadow(0 8px 7px rgba(0,0,0,.42))}}
html[data-motion=full] #board:not([data-presentation=gallant]) .square.selected>.piece:not(.moving){animation:realm-piece-bob 1.2s ease-in-out infinite;filter:drop-shadow(0 12px 10px rgba(0,0,0,.45)) drop-shadow(0 0 10px rgba(255,214,120,.6))}
html[data-motion=full] #board .piece.moving{filter:drop-shadow(0 14px 12px rgba(0,0,0,.5))}
html[data-motion=full] #board .square.landed{animation:realm-land .6s ease-out}
html[data-motion=full] #board .square.target:not(:has(.piece))::after{animation:realm-dot-in .28s cubic-bezier(.2,.9,.3,1.6) backwards;transition:width .15s ease,height .15s ease,background-color .15s ease}
@media (hover:hover){html[data-motion=full] #board .square.target:not(:has(.piece)):hover::after{width:40%;height:40%;background:rgba(215,180,90,.55)}}
html[data-motion=full] #board .capture-ghost{animation:none}
html[data-motion=full] #board .capture-ghost img{animation:realm-ghost .5s cubic-bezier(.3,.6,.4,1) forwards}
html[data-motion=full] #board .capture-ghost i{position:absolute;left:43%;top:43%;width:14%;height:14%;border-radius:50%;background:radial-gradient(circle,#fffef4,#ffd76a 45%,rgba(244,201,92,0) 72%);box-shadow:0 0 14px 3px rgba(255,214,120,.95);animation:realm-spark .7s cubic-bezier(.15,.7,.3,1) forwards}
#board .capture-ghost i:nth-of-type(1){--a:0deg}#board .capture-ghost i:nth-of-type(2){--a:45deg}#board .capture-ghost i:nth-of-type(3){--a:90deg}#board .capture-ghost i:nth-of-type(4){--a:135deg}
#board .capture-ghost i:nth-of-type(5){--a:180deg}#board .capture-ghost i:nth-of-type(6){--a:225deg}#board .capture-ghost i:nth-of-type(7){--a:270deg}#board .capture-ghost i:nth-of-type(8){--a:315deg}
html:not([data-motion=full]) #board .capture-ghost i{display:none}

/* Finish: consistent gold focus rings and smoother text everywhere. */
:focus-visible{outline:2px solid #e7c672;outline-offset:2px}
body{-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}

/* Store and avatar galleries: the chosen portrait glows. */
#settingsView .avatar-tile>button[aria-pressed=true] .player-portrait{box-shadow:0 0 0 3px #e7c672,0 0 22px rgba(215,180,90,.5)}

/* Settings: a proper title, each option on its own row, and animated on/off switches instead of plain checkboxes. */
#settingsView #settings::before{content:'Settings';display:block;margin:0 0 14px;color:#f4e3b0;font:700 34px/1.15 Georgia,'Noto Serif KR',serif;letter-spacing:.01em}
html[lang^=ko] #settingsView #settings::before{content:'설정'}
#settingsView #settings>label:not([hidden]){display:flex!important;flex-direction:row-reverse;align-items:center;justify-content:space-between;gap:16px;min-height:58px;margin:0!important;padding:8px 6px;border-bottom:1px solid rgba(255,255,255,.08);color:#ece5d0;font-size:15px;cursor:pointer;border-radius:10px;transition:background-color .2s ease}
#settingsView #settings>label:not([hidden]):hover{background:rgba(215,180,90,.06)}
#settingsView #settings>#customGameSettings{margin:16px 0 4px}
#settingsView input[type=checkbox]{-webkit-appearance:none;appearance:none;position:relative;flex:none;width:48px!important;height:28px!important;min-height:28px!important;margin:0;border:1px solid rgba(215,180,90,.5);border-radius:999px;background:#13343a;cursor:pointer;transition:background-color .22s ease,border-color .22s ease,box-shadow .22s ease}
#settingsView input[type=checkbox]::before{content:'';position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#cbd5d0;box-shadow:0 1px 3px rgba(0,0,0,.45);transition:transform .22s cubic-bezier(.2,.8,.2,1),background-color .22s ease}
#settingsView input[type=checkbox]:checked{border-color:#e7c672;background:linear-gradient(180deg,#e3c574,#b38b38);box-shadow:0 0 12px rgba(215,180,90,.35)}
#settingsView input[type=checkbox]:checked::before{transform:translateX(20px);background:#fffaf0}
#settingsView input[type=checkbox]:disabled{opacity:.5;cursor:not-allowed}
#settingsView #audio{margin-top:18px}


/* Custom game: room between the invite and computer sections, a gold title and a proper empty state. */
#setupView>h1{color:#f4e3b0!important;font:700 36px/1.15 Georgia,'Noto Serif KR',serif!important;text-shadow:0 2px 12px rgba(0,0,0,.55)}
#setupView #create{margin-bottom:6px}
#setupView #create+label{display:block;margin-top:16px!important;padding-top:16px;border-top:1px solid rgba(255,255,255,.1)}
#setupView #games>p.muted:only-child{display:grid;place-items:center;min-height:120px;margin:8px 0 0;border:1px dashed rgba(215,180,90,.35);border-radius:12px;color:#c9d8d0;text-align:center}
@media (max-width:760px){#setupView>h1{font-size:30px!important}}

/* Pop-ups: the confirm, draw-offer and theme pop-ups share one look: a gold medallion with an icon over a dark emerald
   card, a gold title, clear text and big buttons (red to resign, gold to go ahead, a quiet outline to cancel). */
html body dialog:is(#appDialog,.draw-offer-dialog,.theme-leave-dialog){width:min(440px,calc(100vw - 32px))!important;max-width:none!important;box-sizing:border-box;padding:84px 28px 24px!important;border:1px solid rgba(215,180,90,.85)!important;border-radius:20px!important;background:radial-gradient(120% 70% at 50% 0%,rgba(215,180,90,.22),rgba(215,180,90,0) 60%),linear-gradient(180deg,#154442 0%,#0d2a2c 62%,#0a1f22 100%)!important;color:#efe6cf!important;text-align:center;box-shadow:0 30px 80px rgba(0,0,0,.65),inset 0 1px 0 rgba(255,255,255,.08),0 0 50px rgba(215,180,90,.18)!important}
html body dialog.theme-leave-dialog{width:min(500px,calc(100vw - 32px))!important}
html body dialog:is(#appDialog,.draw-offer-dialog,.theme-leave-dialog)::backdrop{background:rgba(2,10,12,.68);backdrop-filter:blur(5px)}
html body dialog:is(#appDialog,.draw-offer-dialog,.theme-leave-dialog)::before{content:'\2654';position:absolute;top:18px;left:50%;width:54px;height:54px;margin-left:-27px;display:grid;place-items:center;border-radius:50%;background:radial-gradient(circle at 35% 30%,#fff3c8,#dcb65e 46%,#8a6420 100%);color:#2a1d05;font:700 28px/1 'Segoe UI Symbol','Noto Sans Symbols 2','Apple Symbols',serif;box-shadow:0 0 0 5px rgba(215,180,90,.16),0 8px 20px rgba(0,0,0,.5),0 0 28px rgba(255,214,120,.4)}
html body dialog#appDialog[data-tone=resign]::before{content:'\2691';background:radial-gradient(circle at 35% 30%,#ffd2c4,#d4604c 46%,#7c2418 100%);color:#fff6ef;box-shadow:0 0 0 5px rgba(212,96,76,.18),0 8px 20px rgba(0,0,0,.5),0 0 28px rgba(230,110,90,.4)}
html body dialog#appDialog[data-tone=info]::before{content:'\265E'}
html body dialog.draw-offer-dialog:is(#appDialog,.draw-offer-dialog)::before{content:'\2696'}
html body dialog.theme-leave-dialog:is(#appDialog,.theme-leave-dialog)::before{content:'\265B'}
html body dialog:is(#appDialog,.draw-offer-dialog,.theme-leave-dialog) h2{margin:0 0 10px!important;background:linear-gradient(100deg,#d4a94e,#f6dd94 40%,#fff6d8 50%,#f6dd94 60%,#d4a94e);-webkit-background-clip:text;background-clip:text;color:transparent!important;-webkit-text-fill-color:transparent;font:700 27px/1.2 Georgia,'Noto Serif KR',serif!important;letter-spacing:.01em}
html body dialog:is(#appDialog,.draw-offer-dialog,.theme-leave-dialog) p{margin:0 auto 6px!important;max-width:34ch;color:#d3e0d9!important;font:500 15.5px/1.55 system-ui,sans-serif!important}
html body dialog:is(#appDialog,.draw-offer-dialog,.theme-leave-dialog) p:empty,html body dialog#appDialog [data-dialog-content][hidden]{display:none!important}
html body dialog#appDialog .buttons,html body dialog.theme-leave-dialog .theme-leave-actions{display:grid!important;grid-template-columns:1fr 1fr;gap:12px;margin:22px 0 0!important}
html body dialog.theme-leave-dialog .theme-leave-actions{grid-template-columns:1fr 1fr}
html body dialog.theme-leave-dialog .theme-leave-actions .primary{grid-column:1/-1;order:-1}
html body dialog#appDialog .buttons:has(>[data-dialog-cancel][hidden]){grid-template-columns:1fr}
html body dialog.draw-offer-dialog[open]{display:grid!important;grid-template-columns:1fr 1fr;gap:12px;align-content:start}
html body dialog.draw-offer-dialog[open]>:is(h2,p){grid-column:1/-1}
html body dialog.draw-offer-dialog[open]>p{margin-bottom:10px!important}
html body dialog:is(#appDialog,.draw-offer-dialog,.theme-leave-dialog) button{min-height:50px!important;margin:0!important;padding:10px 16px!important;border-radius:13px!important;border:1px solid rgba(215,180,90,.6)!important;background:rgba(255,255,255,.04)!important;color:#f3e6c2!important;font:700 16px/1.2 system-ui,sans-serif!important;letter-spacing:.01em;box-shadow:none}
html body dialog:is(#appDialog,.draw-offer-dialog,.theme-leave-dialog) :is([data-dialog-confirm],[data-draw-response=accept],.primary){border:0!important;background:linear-gradient(180deg,#f0d483,#c99a3c)!important;color:#1d1608!important;box-shadow:0 4px 0 #8a6420,0 10px 22px rgba(0,0,0,.35)!important}
html body dialog#appDialog[data-tone=resign] [data-dialog-confirm]{background:linear-gradient(180deg,#d9614c,#9e2f22)!important;color:#fff7f2!important;box-shadow:0 4px 0 #6b1d14,0 10px 22px rgba(0,0,0,.35)!important}
@media (hover:hover){html body dialog:is(#appDialog,.draw-offer-dialog,.theme-leave-dialog) button:not(:disabled):hover{filter:brightness(1.1);border-color:#e7c672!important}}
html body dialog:is(#appDialog,.draw-offer-dialog,.theme-leave-dialog) button:not(:disabled):active{translate:0 2px}
html[data-motion=full] body dialog:is(#appDialog,.draw-offer-dialog,.theme-leave-dialog)[open]{animation:realm-pop-in .42s cubic-bezier(.2,.9,.3,1.2)!important}
html[data-motion=full] body dialog:is(#appDialog,.draw-offer-dialog,.theme-leave-dialog)[open]::before{animation:realm-medal-in .6s cubic-bezier(.2,.9,.3,1.4) .08s backwards}
@keyframes realm-medal-in{from{opacity:0;transform:scale(.3) rotate(-30deg)}to{opacity:1;transform:none}}
@media (max-width:420px){html body dialog:is(#appDialog,.draw-offer-dialog,.theme-leave-dialog){padding:76px 18px 18px!important}html body dialog:is(#appDialog,.draw-offer-dialog,.theme-leave-dialog) h2{font-size:23px!important}}

/* Learn: Lessons and Puzzles are real tabs - only the chosen section shows (a display rule used to keep both visible). */
#learnView>[hidden]{display:none!important}
html body #learnTabs{display:inline-flex!important;gap:4px!important;padding:5px!important;margin:6px 0 14px!important;border:1px solid rgba(215,180,90,.45);border-radius:14px;background:rgba(8,28,31,.82);box-shadow:0 8px 24px rgba(0,0,0,.3)}
html body #learnTabs button{min-width:132px!important;min-height:42px!important;margin:0!important;padding:8px 22px!important;border:0!important;border-radius:10px!important;background:transparent!important;color:#d4ded5!important;font:700 15px/1.2 system-ui,sans-serif!important;transition:background-color .25s ease,color .25s ease,box-shadow .25s ease}
html body #learnTabs button[aria-pressed=true]{background:linear-gradient(180deg,#f0d483,#c99a3c)!important;color:#1d1608!important;box-shadow:0 4px 14px rgba(215,180,90,.35)!important}
@media (max-width:700px){html body #learnTabs{display:flex!important}html body #learnTabs button{flex:1;min-width:0!important}}
html[data-motion=full] #learnView>:not([hidden]):is(#learnContent,#puzzleContent){animation:realm-view-in .45s cubic-bezier(.2,.75,.2,1) backwards}

/* Puzzles: a proper panel - progress meter, hidden typing boxes (the board is the way to move), move dots, a glowing
   picked-up piece, and motion: pieces drop in, wrong moves shake, the solving move lands with a flash, the mated king
   glows red and a "Checkmate!" banner bursts over the board. */
html body #puzzleContent{padding:24px 26px!important;border:1px solid rgba(215,180,90,.6)!important;border-radius:18px!important;background:radial-gradient(120% 60% at 50% 0%,rgba(215,180,90,.12),rgba(215,180,90,0) 60%),linear-gradient(180deg,#123638,#0b2326)!important}
html body #puzzleContent>h2{margin:0 0 6px!important;font:700 34px/1.15 Georgia,'Noto Serif KR',serif!important;color:#f4e3b0!important}
html body #puzzleContent>p{margin:0 0 18px!important;max-width:80ch;color:#c9d8d0!important;font-size:14px!important;line-height:1.5}
html body #puzzleContent .puzzle-board{position:relative;border:3px solid #c9a24c;border-radius:6px;box-shadow:0 18px 40px rgba(0,0,0,.45),0 0 0 6px rgba(13,40,43,.9),0 0 34px rgba(215,180,90,.18);overflow:visible}
html body #puzzleContent .puzzle-square{position:relative;border:0!important;border-radius:0!important;cursor:pointer;transition:filter .2s ease}
html body #puzzleContent .puzzle-square img{position:relative;z-index:1;transition:translate .18s cubic-bezier(.2,.8,.3,1.5),scale .18s cubic-bezier(.2,.8,.3,1.5),filter .2s ease}
@media (hover:hover){html body #puzzleContent .puzzle-square:not(:disabled):hover img{translate:0 -6%;scale:1.09;filter:drop-shadow(0 8px 7px rgba(0,0,0,.42))}}
html body #puzzleContent .puzzle-square[aria-pressed=true]{box-shadow:inset 0 0 0 4px #f1cf6c!important;background-image:radial-gradient(circle,rgba(255,226,140,.55),rgba(255,226,140,.12) 70%)!important}
html body #puzzleContent .puzzle-square[aria-pressed=true] img{translate:0 -8%;scale:1.1;filter:drop-shadow(0 10px 9px rgba(0,0,0,.45)) drop-shadow(0 0 10px rgba(255,214,120,.6))}
html body #puzzleContent .puzzle-square[data-target=true]::after{content:'';position:absolute;left:50%;top:50%;z-index:2;width:28%;height:28%;border-radius:50%;background:rgba(14,32,26,.4);transform:translate(-50%,-50%);pointer-events:none}
html body #puzzleContent .puzzle-square[data-target=true]:has(img)::after{width:88%;height:88%;background:transparent;box-shadow:inset 0 0 0 5px rgba(14,32,26,.45)}
html body #puzzleContent .puzzle-controls{padding:22px!important;border:1px solid rgba(215,180,90,.55)!important;border-radius:16px!important;background:rgba(8,28,31,.78)!important;box-shadow:0 12px 30px rgba(0,0,0,.3)}
html body #puzzleContent .puzzle-progress{display:grid;gap:8px;margin:0 0 14px!important;color:#e9dfc4;font:700 14px/1.2 system-ui,sans-serif}
html body #puzzleContent .puzzle-meter{display:block;height:8px;border-radius:999px;background:rgba(255,255,255,.08);overflow:hidden}
html body #puzzleContent .puzzle-meter-fill{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#b8862f,#f3d27a,#fff1c1);box-shadow:0 0 12px rgba(243,210,122,.6);transition:width .8s cubic-bezier(.2,.75,.2,1)}
html body #puzzleContent .puzzle-controls select{width:100%;min-height:44px;border-radius:12px}
html body #puzzleContent .puzzle-controls h3{margin:16px 0 4px!important;font:700 26px/1.2 Georgia,'Noto Serif KR',serif!important;color:#fff3d7}
html body #puzzleContent .puzzle-turn{margin:0 0 6px!important;color:#f0d483!important;font:800 14px/1.3 system-ui,sans-serif!important;letter-spacing:.06em;text-transform:uppercase}
html body #puzzleContent .puzzle-move-field{position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip:rect(0 0 0 0)!important;white-space:nowrap!important}
html body #puzzleContent .puzzle-move-form{display:block!important}
html body #puzzleContent .puzzle-feedback{min-height:0;margin:12px 0 0!important;padding:0;border-radius:12px;font:700 15px/1.4 system-ui,sans-serif}
html body #puzzleContent .puzzle-feedback:empty{display:none}
html body #puzzleContent .puzzle-feedback[data-tone=good]{padding:12px 14px;background:linear-gradient(90deg,rgba(46,160,105,.3),rgba(46,160,105,.1));border:1px solid rgba(80,200,140,.6);color:#d9ffe9}
html body #puzzleContent .puzzle-feedback[data-tone=bad]{padding:12px 14px;background:linear-gradient(90deg,rgba(200,70,55,.3),rgba(200,70,55,.08));border:1px solid rgba(230,110,90,.6);color:#ffe3dc}
html body #puzzleContent .puzzle-hint{position:relative;margin:12px 0 0!important;padding:12px 14px 12px 42px;border:1px solid rgba(215,180,90,.55);border-radius:12px;background:rgba(215,180,90,.1);color:#fbefcf;font:600 15px/1.45 system-ui,sans-serif}
html body #puzzleContent .puzzle-hint::before{content:'\2726';position:absolute;left:14px;top:11px;color:#f3d27a;font-size:18px}
html body #puzzleContent .puzzle-controls>button{display:inline-flex!important;align-items:center;gap:7px;min-height:44px;margin:14px 8px 0 0!important;padding:8px 16px!important;border:1px solid rgba(215,180,90,.55)!important;border-radius:12px!important;background:rgba(255,255,255,.04)!important;color:#f3e6c2!important;font:700 14px/1.2 system-ui,sans-serif!important}
html body #puzzleContent .puzzle-controls>button[data-action=next]{border:0!important;background:linear-gradient(180deg,#f0d483,#c99a3c)!important;color:#1d1608!important;box-shadow:0 4px 0 #8a6420!important}
html body #puzzleContent .puzzle-controls>button::before,html body #puzzleContent .puzzle-controls>button::after{display:inline-block;font-size:16px;line-height:14px;height:14px}
html body #puzzleContent .puzzle-controls>button[data-action=hint]::before{content:'\2726';color:#f3d27a}
html body #puzzleContent .puzzle-controls>button[data-action=reset]::before{content:'\21BA'}
html body #puzzleContent .puzzle-controls>button[data-action=previous]::before{content:'\2039';font-size:22px;line-height:14px}
html body #puzzleContent .puzzle-controls>button[data-action=next]::after{content:'\203A';font-size:22px;line-height:14px}
/* The "Checkmate!" banner over the solved board. */
html body #puzzleContent .puzzle-banner{position:absolute;left:50%;top:50%;z-index:5;display:grid;justify-items:center;gap:2px;width:max-content;max-width:92%;padding:16px 24px;border:2px solid #f0d483;border-radius:16px;background:linear-gradient(180deg,rgba(18,58,52,.95),rgba(8,30,30,.95));box-shadow:0 18px 50px rgba(0,0,0,.6),0 0 40px rgba(255,214,120,.45);transform:translate(-50%,-50%);pointer-events:none;text-align:center}
html body #puzzleContent .puzzle-banner strong{background:linear-gradient(100deg,#d4a94e,#f6dd94 40%,#fff6d8 50%,#f6dd94 60%,#d4a94e);-webkit-background-clip:text;background-clip:text;color:transparent;-webkit-text-fill-color:transparent;font:700 34px/1.1 Georgia,'Noto Serif KR',serif;white-space:nowrap}
html body #puzzleContent .puzzle-banner span{color:#cfe9db;font:700 13px/1.3 system-ui,sans-serif;letter-spacing:.12em;text-transform:uppercase}
html body #puzzleContent .puzzle-banner i{position:absolute;left:50%;top:50%;width:12px;height:12px;margin:-6px;border-radius:50%;background:radial-gradient(circle,#fffef4,#ffd76a 50%,rgba(255,215,106,0) 72%);opacity:0}
html body #puzzleContent .puzzle-square[data-mated=true]{background-image:radial-gradient(circle,rgba(255,60,45,.9) 0%,rgba(230,30,20,.5) 40%,rgba(200,0,0,0) 72%)!important}

@keyframes realm-puzzle-shake{0%,100%{translate:0 0}20%{translate:-9% 0}40%{translate:8% 0}60%{translate:-6% 0}80%{translate:4% 0}}
@keyframes realm-puzzle-banner{0%{opacity:0;transform:translate(-50%,-50%) scale(.4) rotate(-6deg)}60%{opacity:1;transform:translate(-50%,-50%) scale(1.08) rotate(1deg)}100%{opacity:1;transform:translate(-50%,-50%) scale(1)}}
@keyframes realm-puzzle-spark{0%{opacity:1;transform:rotate(var(--a)) translateY(0) scale(1.2)}100%{opacity:0;transform:rotate(var(--a)) translateY(-160px) scale(.3)}}
@keyframes realm-puzzle-mated{0%,100%{filter:none}50%{filter:brightness(1.35) saturate(1.3)}}
html[data-motion=full] #puzzleContent .puzzle-board.puzzle-intro .puzzle-square{animation:realm-square-in .45s cubic-bezier(.2,.8,.2,1) backwards}
html[data-motion=full] #puzzleContent .puzzle-board.puzzle-intro .puzzle-square img{animation:realm-piece-drop .6s cubic-bezier(.2,.8,.3,1.1) .15s backwards}
html[data-motion=full] #puzzleContent .puzzle-board.puzzle-intro .puzzle-square:nth-child(n+17){animation-delay:.06s}
html[data-motion=full] #puzzleContent .puzzle-board.puzzle-intro .puzzle-square:nth-child(n+33){animation-delay:.12s}
html[data-motion=full] #puzzleContent .puzzle-board.puzzle-intro .puzzle-square:nth-child(n+49){animation-delay:.18s}
html[data-motion=full] #puzzleContent .puzzle-square.puzzle-shake img{animation:realm-puzzle-shake .45s ease-in-out}
html[data-motion=full] #puzzleContent .puzzle-square.puzzle-landed{animation:realm-land .65s ease-out}
html[data-motion=full] #puzzleContent .puzzle-square[aria-pressed=true] img{animation:realm-piece-bob 1.2s ease-in-out infinite}
html[data-motion=full] #puzzleContent .puzzle-square[data-target=true]:not(:has(img))::after{animation:realm-dot-in .28s cubic-bezier(.2,.9,.3,1.6) backwards}
html[data-motion=full] #puzzleContent .puzzle-square[data-mated=true]{animation:realm-puzzle-mated 1.1s ease-in-out .45s 3}
html[data-motion=full] #puzzleContent .puzzle-banner{animation:realm-puzzle-banner .7s cubic-bezier(.2,.9,.3,1.2) .45s backwards}
html[data-motion=full] #puzzleContent .puzzle-board.puzzle-celebrate .puzzle-banner i{animation:realm-puzzle-spark .9s cubic-bezier(.15,.7,.3,1) forwards}
#puzzleContent .puzzle-banner i:nth-of-type(1){--a:0deg}#puzzleContent .puzzle-banner i:nth-of-type(2){--a:30deg}#puzzleContent .puzzle-banner i:nth-of-type(3){--a:60deg}#puzzleContent .puzzle-banner i:nth-of-type(4){--a:90deg}
#puzzleContent .puzzle-banner i:nth-of-type(5){--a:120deg}#puzzleContent .puzzle-banner i:nth-of-type(6){--a:150deg}#puzzleContent .puzzle-banner i:nth-of-type(7){--a:180deg}#puzzleContent .puzzle-banner i:nth-of-type(8){--a:210deg}
#puzzleContent .puzzle-banner i:nth-of-type(9){--a:240deg}#puzzleContent .puzzle-banner i:nth-of-type(10){--a:270deg}#puzzleContent .puzzle-banner i:nth-of-type(11){--a:300deg}#puzzleContent .puzzle-banner i:nth-of-type(12){--a:330deg}
@media (max-width:700px){html body #puzzleContent{padding:16px 14px!important}html body #puzzleContent>h2{font-size:28px!important}html body #puzzleContent .puzzle-banner strong{font-size:26px}}
html body #puzzleContent .puzzle-controls>button{vertical-align:top}

/* Gallant board (gallant.js): the regular board drawn with the Gallant pieces, either flat or tilted in real 3D with
   the pieces standing upright. Switching views tilts the board smoothly; pieces rise into place when a game opens,
   lift off the board when pointed at, and the picked-up piece floats. Elements between the board and the pieces must
   not get a filter or opacity, or the browser flattens the 3D scene - so those effects go on the piece images. */
#playView .gallant-toolbar:not([hidden]){position:relative;z-index:6;display:inline-flex!important;justify-self:center;align-self:center;gap:3px;width:auto!important;height:auto!important;margin:0!important;padding:4px!important;border:1px solid rgba(215,180,90,.55);border-radius:12px;background:rgba(6,24,26,.88);box-shadow:0 6px 18px rgba(0,0,0,.35)}
#playView .gallant-toolbar button{flex:none!important;min-height:32px!important;margin:0!important;padding:5px 14px!important;border:0!important;border-radius:9px!important;background:transparent!important;color:#e9dfc4!important;font:700 13px/1.2 system-ui,sans-serif!important}
#playView .gallant-toolbar button[aria-pressed=true]{background:linear-gradient(180deg,#f0d483,#c99a3c)!important;color:#1d1608!important;box-shadow:0 3px 10px rgba(215,180,90,.35)}
#board[data-presentation=gallant3d]{border-radius:6px;box-shadow:0 0 0 6px #3a2a12,0 0 0 8px #d4ad57,0 26px 54px rgba(0,0,0,.55)!important;transition:transform .8s cubic-bezier(.2,.75,.2,1)}
#board[data-presentation=gallant3d][data-gallant-view=perspective]{transform:perspective(1500px) rotateX(30deg) scale(.9);transform-origin:50% 64%;transform-style:preserve-3d}
#board[data-presentation=gallant3d][data-gallant-view=perspective]>button.square,#board[data-presentation=gallant3d][data-gallant-view=perspective] .piece{transform-style:preserve-3d;overflow:visible!important}
#board[data-presentation=gallant3d] .piece img{object-fit:contain}
#board[data-presentation=gallant3d] .piece{position:relative}
#board[data-presentation=gallant3d][data-gallant-view=flat] .piece img{position:absolute;left:50%;top:4%;width:auto!important;height:92%!important;max-width:none!important;max-height:none!important;transform:translateX(-50%);filter:drop-shadow(0 3px 3px rgba(0,0,0,.4))}
#board[data-presentation=gallant3d][data-gallant-view=perspective] .piece img{position:absolute;left:50%;bottom:12%;width:auto!important;height:158%!important;max-width:none!important;max-height:none!important;transform-origin:50% 100%;transform:translateX(-50%) rotateX(-30deg);filter:drop-shadow(0 7px 5px rgba(0,0,0,.5));transition:scale .25s cubic-bezier(.2,.8,.3,1.5),filter .25s ease}
#board[data-presentation=gallant3d][data-gallant-view=perspective] .piece,#board[data-presentation=gallant3d][data-gallant-view=perspective] .piece.moving{filter:none!important}
@media (hover:hover){html[data-motion=full] #board[data-presentation=gallant3d][data-gallant-view=perspective] .square:not(.selected):not(:disabled):hover>.piece:not(.moving){translate:none;scale:1;filter:none!important}
 html[data-motion=full] #board[data-presentation=gallant3d][data-gallant-view=perspective] .square:not(.selected):not(:disabled):hover>.piece:not(.moving) img{scale:1.06;filter:drop-shadow(0 12px 8px rgba(0,0,0,.5)) drop-shadow(0 0 8px rgba(255,214,120,.45))}}
@keyframes realm-piece-float3d{0%,100%{translate:0 0 12px}50%{translate:0 0 30px}}
@keyframes realm-piece-rise{from{opacity:0;scale:.3}to{opacity:1;scale:1}}
html[data-motion=full] #board[data-presentation=gallant3d][data-gallant-view=perspective] .square.selected>.piece:not(.moving){animation:realm-piece-float3d 1.2s ease-in-out infinite;filter:none!important}
html[data-motion=full] #board[data-presentation=gallant3d][data-gallant-view=perspective] .square.selected>.piece img{filter:drop-shadow(0 16px 10px rgba(0,0,0,.5)) drop-shadow(0 0 12px rgba(255,214,120,.7))}
html[data-motion=full] #board[data-presentation=gallant3d][data-gallant-view=perspective].board-intro .square,html[data-motion=full] #board[data-presentation=gallant3d][data-gallant-view=perspective].board-intro .piece{animation:none!important}
html[data-motion=full] #board[data-presentation=gallant3d][data-gallant-view=perspective].board-intro .piece img{animation:realm-piece-rise .6s cubic-bezier(.2,.9,.3,1.3) backwards}
html[data-motion=full] #board[data-presentation=gallant3d][data-gallant-view=perspective].board-intro .square:nth-child(n+9) .piece img{animation-delay:.05s}
html[data-motion=full] #board[data-presentation=gallant3d][data-gallant-view=perspective].board-intro .square:nth-child(n+49) .piece img{animation-delay:.2s}
html[data-motion=full] #board[data-presentation=gallant3d][data-gallant-view=perspective].board-intro .square:nth-child(n+57) .piece img{animation-delay:.26s}
/* The 2D/3D switch sits under "Flip board" in the game panel. */
#matchEssential .gallant-toolbar:not([hidden]){display:flex!important;width:100%!important;margin:8px 0 0!important;box-sizing:border-box}
#matchEssential .gallant-toolbar button{flex:1 1 0!important}
/* 3D: once a piece is picked up, clicks pass through the other standing pieces to the board square under the pointer. */
#board[data-presentation=gallant3d][data-gallant-view=perspective]:has(.square.selected) .square:not(.selected) .piece img{pointer-events:none}
/* 3D: squares sit a hair above the board plane so the browser's hit test finds them, not the board behind. */
#board[data-presentation=gallant3d][data-gallant-view=perspective]>button.square{transform:translateZ(.6px)}
/* On the desktop game screen the side panel already holds the chat (or the paused note), so the floating button
   stays out of the way of the player bars; it returns on every other screen. */
@media (min-width:1001px){html body.msgr-fab-game .msgr-fab:not(.msgr-fab-open){display:none!important}}
/* 3D board (board3d.js): the WebGL canvas covers the board; the 2D squares stay underneath for keyboard play. */
#board .board3d{position:absolute;inset:-6% -6% -4%;z-index:30;width:112%;height:110%;touch-action:none;cursor:grab;outline:0;user-select:none;-webkit-user-select:none}
#board .board3d.dragging{cursor:grabbing}
#board .board3d[hidden]{display:none}
#board[data-view3d=on]{background:transparent!important;box-shadow:none!important;border-color:transparent!important;outline:0!important}
#board[data-view3d=on]>button.square,#board[data-view3d=on]>svg,#board[data-view3d=on]>.capture-ghost{opacity:0!important}
html[data-motion=full] #board .board3d:not([hidden]){animation:realm-fade-in .5s ease}
html body #playView #play>#board[data-view3d=on],html body #board.board[data-view3d=on]{background:transparent!important;box-shadow:none!important;border-color:transparent!important;outline:0!important}
html body #playView #play:has(>#board[data-view3d=on])>#board.board[data-view3d=on]{background:transparent!important;box-shadow:none!important;border-color:transparent!important;outline:0!important}
/* "Sign in with WGC" pop-up: the shared pop-up look, with a WGC emblem and gold-edged fields. */
html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only){width:min(440px,calc(100vw - 32px))!important;max-width:none!important;box-sizing:border-box;padding:84px 28px 24px!important;border:1px solid rgba(215,180,90,.85)!important;border-radius:20px!important;background:radial-gradient(120% 70% at 50% 0%,rgba(215,180,90,.22),rgba(215,180,90,0) 60%),linear-gradient(180deg,#154442 0%,#0d2a2c 62%,#0a1f22 100%)!important;color:#efe6cf!important;text-align:center;box-shadow:0 30px 80px rgba(0,0,0,.65),inset 0 1px 0 rgba(255,255,255,.08),0 0 50px rgba(215,180,90,.18)!important}
html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only)::backdrop{background:rgba(2,10,12,.68);backdrop-filter:blur(5px)}
html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only)::before{content:'WGC';position:absolute;top:18px;left:50%;width:58px;height:58px;margin-left:-29px;display:grid;place-items:center;border-radius:50%;background:radial-gradient(circle at 35% 30%,#fff3c8,#dcb65e 46%,#8a6420 100%);color:#2a1d05;font:900 15px/1 system-ui,sans-serif;letter-spacing:.04em;box-shadow:0 0 0 5px rgba(215,180,90,.16),0 8px 20px rgba(0,0,0,.5),0 0 28px rgba(255,214,120,.4)}
html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only) h2{margin:0 0 8px!important;background:linear-gradient(100deg,#d4a94e,#f6dd94 40%,#fff6d8 50%,#f6dd94 60%,#d4a94e);-webkit-background-clip:text;background-clip:text;color:transparent!important;-webkit-text-fill-color:transparent;font:700 27px/1.2 Georgia,'Noto Serif KR',serif!important}
html body .wgc-login-intro{margin:0 auto 16px!important;max-width:34ch;color:#d3e0d9!important;font:500 15px/1.5 system-ui,sans-serif!important}
html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only) .wgc-login-form{display:grid;gap:12px;text-align:left}
html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only) label{display:grid;gap:6px;color:#e9dfc4;font:700 13px/1.2 system-ui,sans-serif}
html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only) input{min-height:46px;padding:10px 14px;border:1px solid rgba(215,180,90,.55);border-radius:12px;background:rgba(4,20,22,.75);color:#fff6dd;font:500 16px/1.2 system-ui,sans-serif;outline:0;transition:border-color .2s ease,box-shadow .2s ease}
html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only) input:focus{border-color:#f0d483;box-shadow:0 0 0 4px rgba(215,180,90,.25)}
html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only) .wgc-login-status{min-height:0;margin:0;font:600 14px/1.4 system-ui,sans-serif;color:#cfe4dc;text-align:center}
html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only) .wgc-login-status:empty{display:none}
html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only) .wgc-login-status[data-tone=bad]{padding:10px 12px;border:1px solid rgba(230,110,90,.6);border-radius:12px;background:rgba(200,70,55,.18);color:#ffe3dc}
html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only) .buttons{display:grid!important;grid-template-columns:1fr 1fr;gap:12px;margin:6px 0 0!important}
html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only) button{min-height:50px!important;margin:0!important;padding:10px 16px!important;border-radius:13px!important;border:1px solid rgba(215,180,90,.6)!important;background:rgba(255,255,255,.04)!important;color:#f3e6c2!important;font:700 16px/1.2 system-ui,sans-serif!important}
html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only) button.primary{border:0!important;background:linear-gradient(180deg,#f0d483,#c99a3c)!important;color:#1d1608!important;box-shadow:0 4px 0 #8a6420,0 10px 22px rgba(0,0,0,.35)!important}
html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only) button:disabled{opacity:.6}
html[data-motion=full] body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only)[open]{animation:realm-pop-in .42s cubic-bezier(.2,.9,.3,1.2)!important}
html[data-motion=full] body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only)[open]::before{animation:realm-medal-in .6s cubic-bezier(.2,.9,.3,1.4) .08s backwards}
/* A WGC-only site: the sign-in pop-up is just the WGC form (local accounts are for owners and staff on /admin). */
html body dialog.login-dialog.wgc-only>#identity{display:none!important}
html body dialog.login-dialog:not(.wgc-only)>#wgcOnlyLogin{display:none!important}
html body dialog.login-dialog.wgc-only{max-height:calc(100dvh - 24px);overflow:auto}
html body dialog.login-dialog.wgc-only .login-dialog-note{margin:0 0 14px!important;padding:9px 12px!important;font-size:14px!important;text-align:center}
html body dialog.login-dialog.wgc-only .login-dialog-close{top:12px;right:12px}
html body .wgc-login-join{margin:16px 0 0!important;color:#b9c8c1;font:500 13.5px/1.4 system-ui,sans-serif;text-align:center}
html body .wgc-login-join a{color:#f0d483;font-weight:700;text-decoration:underline;text-underline-offset:3px}
@media (max-height:640px){html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only){padding-top:72px!important}html body :is(dialog.wgc-login-dialog,dialog.login-dialog.wgc-only)::before{top:12px;width:48px;height:48px;margin-left:-24px}html body .wgc-login-intro{margin-bottom:10px!important}}
/* Staff sign-in (/?staff=1 on a WGC-only site): only the account sign-in form. */
html body dialog.login-dialog.staff-only :is(#welcome-register-tab,.welcome-guest,.wgc-welcome,.welcome-provider,.welcome-tabs){display:none!important}
html body dialog.login-dialog.staff-only{width:min(460px,calc(100vw - 32px))!important}
html body dialog.login-dialog.staff-only>#identity{display:block!important;padding:22px 24px!important}
html body dialog.login-dialog.staff-only #identity>*{max-width:none!important;width:auto!important;grid-column:1/-1!important}
html body dialog.login-dialog.staff-only .welcome-copy h1{text-align:center}
html body dialog.login-dialog.staff-only .welcome-copy{display:block!important;text-align:center}
/* WGC page while WGC games are not open yet: a readable card with a way to play now. */
html body .wgc-panel>.wgc-closed{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:14px 20px;padding:20px 22px!important;border:1px solid rgba(215,180,90,.6)!important;border-radius:16px!important;background:linear-gradient(180deg,rgba(14,46,44,.94),rgba(8,30,30,.94))!important;box-shadow:0 12px 30px rgba(0,0,0,.35)}
html body .wgc-panel>.wgc-closed p{flex:1 1 320px;margin:0;color:#e9e2cf;font:500 15.5px/1.55 system-ui,sans-serif}
html body .wgc-closed-play{display:inline-flex;align-items:center;min-height:46px;padding:10px 22px;border-radius:12px;background:linear-gradient(180deg,#f0d483,#c99a3c);color:#1d1608!important;font:800 15px/1 system-ui,sans-serif;text-decoration:none;box-shadow:0 4px 0 #8a6420}

/* Desktop sidebar on shorter screens (a 768-pixel laptop leaves about 650): all eight menu items stay visible even with
   the WGC balance chip, because the logo, rows, chip and account row get more compact as the height drops. */
@media (min-width:1001px) and (max-height:820px){
 html body>header .brand img.brand-logo{width:72px!important;height:72px!important;max-height:72px!important}
 html body>header .brand{padding-top:8px!important;padding-bottom:0!important}
 html body>header #sectionNav a{min-height:36px!important;padding-top:2px!important;padding-bottom:2px!important}
 html body>header #wgcBalance.wgc-balance-chip{min-height:32px!important;padding-top:4px!important;padding-bottom:4px!important;margin-top:6px!important;margin-bottom:6px!important}
 html body>header #accountMenu>summary{min-height:40px!important;padding-top:2px!important;padding-bottom:2px!important}
}
@media (min-width:1001px) and (max-height:700px){
 html body>header .brand img.brand-logo{width:58px!important;height:58px!important;max-height:58px!important}
 html body>header #sectionNav a{min-height:33px!important}
 html body>header #sectionNav a::before{width:19px!important;height:19px!important;flex-basis:19px!important}
 html body>header #railToggle{top:62px!important}
 html body>header>nav:last-of-type{gap:2px!important}
 html body>header #language{min-height:32px!important;padding-top:2px!important;padding-bottom:2px!important}
}
@media (min-width:1001px) and (max-height:640px){
 html body>header .brand img.brand-logo{width:44px!important;height:44px!important;max-height:44px!important}
 html body>header .brand{padding-top:4px!important}
 html body>header #railToggle{top:44px!important}
 html body>header #sectionNav a{min-height:30px!important;font-size:12.5px!important}
 html body>header #connection{display:none!important}
 html body>header #wgcBalance.wgc-balance-chip{min-height:28px!important;margin-top:4px!important;margin-bottom:4px!important}
 html body>header #accountMenu>summary{min-height:36px!important}
}

/* Board coordinates sit inside the edge squares (rank numbers top-left of the a-file, file letters bottom-right of the
   first rank), in the opposite square colour, so nothing hangs outside the board or runs into the player bars. */
html body .board .square>.coordinate{position:absolute!important;z-index:2;width:auto!important;height:auto!important;padding:0!important;background:none!important;border-radius:0!important;transform:none!important;text-shadow:none!important;font:700 clamp(9px,.85vw,13px)/1 system-ui,'Segoe UI',sans-serif!important;pointer-events:none;opacity:.92}
html body .board .square>.coordinate-rank{left:4%!important;top:4%!important;right:auto!important;bottom:auto!important}
html body .board .square>.coordinate-file{right:5%!important;bottom:4%!important;left:auto!important;top:auto!important}
html body .board .square:not(.dark)>.coordinate{color:var(--theme-dark,#5f8566)!important}
html body .board .square.dark>.coordinate{color:var(--theme-light,#f0e8d2)!important}
@media (max-width:760px){html body .board .square>.coordinate{font-size:10px!important}}
/* Profile heading: the back link and the title sit on a dark band, readable over any background art. */
html body .profile-page-heading>div{display:inline-flex;flex-direction:column;align-items:flex-start;gap:4px;padding:12px 20px 12px 16px;border:1px solid rgba(215,180,90,.45);border-radius:14px;background:linear-gradient(180deg,rgba(10,36,38,.9),rgba(8,28,30,.9));box-shadow:0 10px 26px rgba(0,0,0,.3)}
html body .profile-page-heading a[href="#home"]{display:inline-flex;align-items:center;gap:4px;color:#f0d483!important;font:700 13px/1.2 system-ui,sans-serif;text-decoration:none;opacity:1!important}
html body .profile-page-heading a[href="#home"]:hover{color:#fff1c1!important;text-decoration:underline}
html body .profile-page-heading h1{margin:0!important;color:#f4e3b0!important;text-shadow:0 2px 10px rgba(0,0,0,.5)}
html body #setupView>h1{display:inline-block;margin:6px 0 14px!important;padding:8px 20px!important;border:1px solid rgba(215,180,90,.45);border-radius:14px;background-color:rgba(8,28,30,.9)!important;filter:none!important}
html[data-motion=full] body #setupView>h1{background-image:linear-gradient(100deg,#d4a94e 0%,#f3d68a 28%,#fff8de 42%,#f3d68a 56%,#d4a94e 100%),linear-gradient(rgba(8,28,30,.9),rgba(8,28,30,.9))!important;background-clip:text,padding-box!important;-webkit-background-clip:text,padding-box!important}
/* Phones: the chat button stays bottom-right on the Play screens too, so it never covers the WGC balance in the top bar. */
@media (max-width:1000px){html body.msgr-fab-game .msgr-fab{top:auto!important;bottom:14px!important;right:12px!important;width:48px!important;height:48px!important}}
