/* Four site themes share the same semantic tokens, including static login pages. */
:root[data-site-style="classic"][data-theme="light"],:root{--bg:#fff;--ink:#171717;--muted:#595959;--line:#dedede;--surface:#f6f6f6;--inverse:#fff;--danger:#9b2424;--site-link:#2865b2;color-scheme:light}
:root[data-site-style="classic"][data-theme="dark"],:root[data-theme="dark"]{--bg:#121116;--ink:#f1eff5;--muted:#bbb7c2;--line:#47424e;--surface:#201e24;--inverse:#17151b;--danger:#ffaaaa;--site-link:#a8c5ff;color-scheme:dark}
:root[data-site-style="pirate"][data-theme="light"]{--bg:#f8efd9;--ink:#173e47;--muted:#546763;--surface:#f0e3c4;--line:#ccbd95;--inverse:#fff8e7;--danger:#a13c2b;--site-link:#205a68;--accent:#896135;color-scheme:light}
:root[data-site-style="pirate"][data-theme="dark"]{--bg:#102c35;--ink:#f5e6bf;--muted:#b8c6b9;--surface:#193d46;--line:#45606a;--inverse:#173e47;--danger:#ffb29b;--site-link:#b8d9de;--accent:#e6bc76;color-scheme:dark}
:root[data-site-style] body{background:var(--bg);color:var(--ink)}
:root[data-site-style] .site-page{background:var(--bg);color:var(--ink)}
:root[data-site-style="pirate"] .site-page{background:radial-gradient(ellipse at 20% 0%,#c6a47112,transparent 65%),var(--bg)}
:root[data-site-style="pirate"] :is(.art,.project-card .daily-card){border:1px solid var(--line)}
:root[data-site-style] a:focus-visible,:root[data-site-style] button:focus-visible{outline:2px solid var(--ink);outline-offset:4px}
:root[data-site-style] .count{color:var(--muted)}
/* One shared control row; gameplay may position the row around its timer. */
:is(.brand-crypt-row,.site-theme-dock){height:118px;display:flex;align-items:center;justify-content:flex-end;gap:14px;padding:8px 20px 0;box-sizing:border-box}
:is(.brand-crypt-row,.site-theme-dock)[data-site-theme-controls] :is(.brand-crypt,.brand-ship){display:block;position:relative;inset:auto;flex-shrink:0;padding:0;border:0;background:transparent;color:var(--ink);cursor:pointer;min-height:44px;min-width:44px;opacity:1;touch-action:manipulation;-webkit-tap-highlight-color:transparent;isolation:isolate}
:is(.brand-crypt-row,.site-theme-dock)[data-site-theme-controls] .brand-crypt{width:62px;height:102px;flex-basis:62px}
:is(.brand-crypt-row,.site-theme-dock)[data-site-theme-controls] .brand-ship{width:92px;height:96px;flex-basis:92px}
:is(.brand-crypt-row,.site-theme-dock)[data-site-theme-controls] button:hover{opacity:1;filter:brightness(1.07)}
:is(.brand-crypt-row,.site-theme-dock)[data-site-theme-controls] button[aria-pressed="true"]::after{content:"";display:block;position:absolute;bottom:2px;left:calc(50% - 8px);width:16px;height:2px;background:currentColor;border-radius:2px;opacity:.65}
:is(.brand-crypt-row,.site-theme-dock)[data-site-theme-controls] button svg{display:block;width:100%;height:100%;overflow:visible;pointer-events:none;filter:drop-shadow(0 5px 4px #0002)}
:is(.brand-crypt-row,.site-theme-dock) .coffin-lid{transform-origin:35px 118px;transition:transform .65s .42s}
:is(.brand-crypt-row,.site-theme-dock) .vampire{transform:translateY(102px);transform-origin:65px 90px;transition:transform .65s,opacity .4s;opacity:1}
:is(.brand-crypt-row,.site-theme-dock) .vampire-hand{transform:translateY(15px);opacity:0;transition:transform .4s,opacity .2s}
:is(.brand-crypt-row,.site-theme-dock) .bat{opacity:0;transform-origin:65px 90px}
:root[data-site-style="classic"][data-theme="dark"] .brand-crypt .coffin-lid{transform:translateX(-29px) rotate(-38deg);transition-delay:0s}
:root[data-site-style="classic"][data-theme="dark"] .brand-crypt .vampire{transform:translateY(0);transition-delay:.25s}
:root[data-site-style="classic"][data-theme="dark"] .brand-crypt .vampire-hand{transform:translateY(0);opacity:1;transition-delay:.8s}
:root[data-site-style="pirate"] .brand-crypt .vampire{transform:translateY(-10px) scale(.03);opacity:0;transition-delay:0s}
:root[data-site-style="pirate"] .brand-crypt .coffin-lid{transform:translateX(-12px) rotate(-12deg);transition-delay:0s}
.theme-sky{transition:fill .65s}.theme-sun,.theme-moon{transform-origin:109px 36px;transition:transform .7s,opacity .6s}
.theme-sun{opacity:1;transform:scale(1)}.theme-moon{opacity:0;transform:translateY(16px) scale(.5)}
:root[data-theme="dark"] .theme-sky{fill:#213e4a}
:root[data-theme="dark"] .theme-sun{opacity:0;transform:translateY(20px) scale(.5)}
:root[data-theme="dark"] .theme-moon{opacity:1;transform:translateY(0) scale(1)}
.ship-voyage{transform-origin:75px 110px;transform:translate(0,0) scale(1)}
.ship-pirate{transform-origin:85px 102px;transition:transform 1.1s cubic-bezier(.3,.1,.2,1),opacity 1s;transform:translate(0,0) scale(1);opacity:1}
:root[data-site-style="classic"] .ship-pirate{transform:translate(38px,-33px) scale(.22);opacity:.2}
.pirate-arm,.pirate-legs{transform-origin:85px 93px}
:root.theme-to-pirate .brand-crypt .bat-one{animation:site-bat-flight 1.25s ease-out both}
:root.theme-to-pirate .brand-crypt .bat-two{animation:site-bat-flight 1.1s .1s ease-out both}
:root.theme-to-classic .pirate-arm{animation:site-pirate-run .18s 6 alternate}
:root.theme-to-classic .pirate-legs{animation:site-pirate-run .18s 6 alternate-reverse}
@keyframes site-bat-flight{0%{opacity:0;transform:translate(65px,90px) scale(.05)}20%{opacity:1;transform:translate(60px,48px) scale(.65)}100%{opacity:0;transform:translate(-60px,-70px) scale(.12) rotate(-20deg)}}
@keyframes site-pirate-run{from{transform:rotate(-18deg)}to{transform:rotate(18deg)}}
html.theme-restored :is(.brand-crypt-row,.site-theme-dock) :is(.coffin-lid,.vampire,.vampire-hand,.theme-sun,.theme-moon,.theme-sky,.ship-voyage,.ship-pirate){transition:none}
:root[data-site-style] .site-login-page .brand-crypt-row{position:fixed;top:0;right:0;left:0}
/* World controls theme only the observer UI; no simulation rendering/state changes. */
:root[data-site-style] .site-world{--canvas-ink:var(--ink);--panel:var(--surface);--panel-border:var(--line);--action:var(--surface);--critical:var(--danger);--focus:var(--ink)}
.site-world .brand-crypt-row[data-site-theme-controls]{position:fixed;z-index:15;right:10px;top:100px;height:94px;padding:0;gap:4px;pointer-events:none}
.site-world .brand-crypt-row[data-site-theme-controls] button{pointer-events:auto}
.site-world .brand-crypt-row[data-site-theme-controls] .brand-crypt{width:46px;flex-basis:46px;height:74px}
.site-world .brand-crypt-row[data-site-theme-controls] .brand-ship{width:66px;flex-basis:66px;height:74px}
:root[data-site-style] .site-world :is(dialog,.inspector,.details-panel,.spectator-status,.observer-tooltip,.tour-card){background:var(--surface);color:var(--ink);border-color:var(--line)}
:root[data-site-style] .site-world :is(.brand,.essentials,.essentials strong,.stat-label,.weather-status,.world-status,.world-footer,.world-footer a){color:var(--ink)}
:root[data-site-style] .site-world :is(.zoom-controls button,.tool-button,.world-status,.weather-status){background:var(--surface);color:var(--ink);border-color:var(--line)}
@media(max-width:500px){:is(.brand-crypt-row,.site-theme-dock){gap:8px;padding-right:12px;padding-left:12px}:is(.brand-crypt-row,.site-theme-dock)[data-site-theme-controls] .brand-crypt{width:44px;flex-basis:44px;height:72px}:is(.brand-crypt-row,.site-theme-dock)[data-site-theme-controls] .brand-ship{width:62px;flex-basis:62px;height:76px}.site-world .brand-crypt-row[data-site-theme-controls]{top:136px;right:6px}.site-login-page main{padding-top:96px}}
@media(prefers-reduced-motion:reduce){:is(.brand-crypt-row,.site-theme-dock)[data-site-theme-controls] *,html.theme-to-pirate :is(.brand-crypt-row,.site-theme-dock) .bat{transition:none!important;animation:none!important}:is(.brand-crypt-row,.site-theme-dock) .bat{opacity:0!important}}
:root.theme-to-classic .ship-pirate{animation:site-pirate-depart 1.1s cubic-bezier(.3,.1,.2,1) both}
@keyframes site-pirate-depart{0%{transform:translate(0,0) scale(1);opacity:1}35%{transform:translate(18px,-5px) scale(.75);opacity:.9}100%{transform:translate(38px,-33px) scale(.22);opacity:.2}}
/* Reserve room for the two controls above the world inspector and weather chip. */
.site-world .brand-crypt-row[data-site-theme-controls]{top:8px}
.site-world .world-header{right:150px;gap:12px;flex-wrap:wrap}
.site-world .weather-status{top:86px;right:12px}
.site-world .world-status{max-width:calc(100vw - 155px)}
:root[data-site-style] .site-world :is(.pov-hud,.pov-notice,.world-message,.render-error,.world-statistics>div,.audio-settings,.inspector-toolbar){background:var(--surface);color:var(--ink);border-color:var(--line)}
:root[data-site-style] .site-world .inspector-toolbar{box-shadow:0 -18px 0 var(--surface)}
:root[data-site-style] .site-world :is(.inspector,dialog,.pov-hud,.pov-notice,.world-statistics,.observer-tooltip,.tour-card) :is(h1,h2,h3,h4,p,span,strong,label,legend,summary,small,dt,dd,caption,th,td,a,button){color:var(--ink)}
:root[data-site-style] .site-world :is(dialog,.inspector,.pov-hud) :is(input,textarea,select,option){background:var(--bg);color:var(--ink);border-color:var(--line)}
:root[data-site-style] .site-world :is(.world-tools button,.world-tools summary,.pov-heading button,.follow-button){background:var(--surface);color:var(--ink);border-color:var(--line)}
@media(max-width:500px){.site-world .brand-crypt-row[data-site-theme-controls]{top:8px}.site-world .world-header{right:128px}.site-world .world-header .essentials{font-size:9px;flex-direction:row;flex-wrap:wrap;gap:4px 9px;text-align:left}}
@media(max-width:500px){.site-world .world-header .essentials{position:absolute;top:62px;left:0;right:auto;width:calc(50vw - 24px);line-height:1.3}.site-world .weather-status{max-width:calc(50vw - 20px)}.site-world .world-message{top:120px}}
/* Existing characters dance only while the shared radio is actually playing. */
:root.music-playing[data-site-style="classic"][data-theme="dark"] .brand-crypt .vampire-head{transform-origin:65px 60px;animation:music-vampire-bop .7s ease-in-out infinite}
:root.music-playing[data-site-style="classic"][data-theme="dark"] .brand-crypt .vampire-hand{rotate:-8deg;transform-origin:86px 125px;animation:music-vampire-hand .7s ease-in-out infinite}
:root.music-playing .brand-ship .ship-pirate{transform-origin:85px 91px;animation:music-pirate-bounce .65s ease-in-out infinite}
:root.music-playing .brand-ship .pirate-arm{transform-origin:85px 87px;animation:music-pirate-arms .65s ease-in-out infinite}
@keyframes music-vampire-bop{0%,100%{rotate:-7deg;translate:0 1px}50%{rotate:7deg;translate:0 -2px}}
@keyframes music-vampire-hand{0%,100%{rotate:-12deg}50%{rotate:13deg}}
@keyframes music-pirate-bounce{0%,100%{rotate:-5deg;translate:0 1px}50%{rotate:5deg;translate:0 -3px}}
@keyframes music-pirate-arms{0%,100%{rotate:12deg}50%{rotate:-13deg}}
@media(prefers-reduced-motion:reduce){:root.music-playing .brand-crypt :is(.vampire-head,.vampire-hand),:root.music-playing .brand-ship :is(.ship-pirate,.pirate-arm){animation:none!important;rotate:none;translate:none}}

/* A single viewport anchor on every product, including native login pages.
   Product-specific row styles still own their timer/goal, never this dock. */
.site-theme-dock[data-site-theme-controls]{position:fixed;inset:auto max(12px,env(safe-area-inset-right)) auto auto;top:max(8px,env(safe-area-inset-top));z-index:45;display:flex;flex-direction:row;align-items:center;justify-content:flex-end;gap:4px;width:104px;height:56px;min-height:0;margin:0;padding:0;box-sizing:border-box;isolation:isolate}
.site-theme-dock[data-site-theme-controls] .brand-crypt{width:44px;height:56px;flex-basis:44px}
.site-theme-dock[data-site-theme-controls] .brand-ship{width:56px;height:56px;flex-basis:56px}
/* The persistent music bar owns the controls across application navigation. */
.site-theme-dock[data-site-theme-hidden]{display:none}
.site-music-shell .site-music-bar>.site-theme-dock[data-site-theme-controls]{position:static;inset:auto;flex:0 0 104px;margin:0;height:56px}
/* Mobile keeps music transport and the timer at full touch size in two rows. */
@media(max-width:768px){
 .site-music-shell .site-music-bar:has(>.site-theme-dock){display:grid;grid-template-columns:44px minmax(0,1fr) 104px;align-items:center;gap:6px 8px;height:auto;min-height:0;padding:8px max(12px,env(safe-area-inset-right)) 8px max(12px,env(safe-area-inset-left))}
 .site-music-shell .site-music-bar:has(>.site-theme-dock) .site-header-crab{grid-column:1;grid-row:1}
 .site-music-shell .site-music-bar:has(>.site-theme-dock) :is(.site-music-brand,.site-music-open){display:none}
 .site-music-shell .site-music-bar:has(>.site-theme-dock) .site-timer-header{grid-column:2;grid-row:1;position:static;min-width:0;max-width:none;width:100%;margin:0}
 .site-music-shell .site-music-bar:has(>.site-theme-dock) .site-timer-panel{top:64px;right:12px}
 .site-music-shell .site-music-bar>.site-theme-dock[data-site-theme-controls]{grid-column:3;grid-row:1}
 .site-music-shell .site-music-bar:has(>.site-theme-dock) .mashup-mini{grid-column:1/-1;grid-row:2;width:100%}
}
/* Reserve the same corner rather than covering existing actions. */
.brand-crypt-row:has(#timer){padding-right:max(128px,calc(env(safe-area-inset-right) + 116px))!important}
body:has(.board-top) .board-top{padding-right:max(128px,calc(env(safe-area-inset-right) + 116px));min-height:80px}
.timer-stage:not(:has(.timer-standalone-header)){padding-top:max(72px,calc(env(safe-area-inset-top) + 64px));box-sizing:border-box}
.timer-stage .timer-standalone-header{min-height:72px;padding-right:max(128px,calc(env(safe-area-inset-right) + 116px))}
.timer-standalone-header .site-timer-current{max-width:calc(100vw - 190px)}
:root[data-site-style] body:is(.daily-voyage-intro,.daily-result-sea) .voyage-sound{right:max(128px,calc(env(safe-area-inset-right) + 116px))}
/* An embedded product no longer needs space for a second set of themes. */
body:has(>.site-theme-dock[data-site-theme-hidden]) .timer-stage:not(:has(.timer-standalone-header)){padding-top:0}
body:has(>.site-theme-dock[data-site-theme-hidden]) .board-top{padding-right:16px;min-height:0}
body:has(>.site-theme-dock[data-site-theme-hidden]) .brand-crypt-row:has(#timer){padding-right:20px!important}
:root[data-site-style] body:has(>.site-theme-dock[data-site-theme-hidden]):is(.daily-voyage-intro,.daily-result-sea) .voyage-sound{right:18px}
@media(max-width:600px){
 body:has(>.site-theme-dock[data-site-theme-hidden]) .board-top{padding-right:10px}
 body:has(>.site-theme-dock[data-site-theme-hidden]) .brand-crypt-row:has(#timer){padding-right:12px!important}
 :root[data-site-style] body:has(>.site-theme-dock[data-site-theme-hidden]):is(.daily-voyage-intro,.daily-result-sea) .voyage-sound{right:8px}
}
