MC/website/scripts/portal-navigation.mjs

95 lines
41 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{MAIN_MENU}from'./main-menu.mjs';
export const PORTAL_LINKS=MAIN_MENU;
export const PORTAL_NAV='<nav aria-label="Main navigation">'+PORTAL_LINKS.map(([name,url,icon])=>`<a href="${url}"><img src="https://www.dunerealms.com/assets/${icon}" alt="" width="34" height="34" decoding="async"><span>${name}</span></a>`).join('')+'</nav>';
export const PORTAL_CSS=`
body>header{position:relative;z-index:100;height:auto;min-height:82px;padding:14px 3%;display:flex;align-items:center;justify-content:space-between;gap:24px;background:#10251f;border-bottom:1px solid #806e45;box-shadow:none;box-sizing:border-box}
body>header>.wordmark{flex:0 0 auto;font:700 19px/1.2 system-ui,sans-serif;letter-spacing:.025em;color:#f2e6c9;white-space:nowrap}
body>header>.wordmark small{display:block;margin-top:7px;font:10px/1.2 system-ui,sans-serif;letter-spacing:.22em;color:#b89d64}
body>header>.wordmark .sun{display:none}
body>header>nav[aria-label="Main navigation"]{position:static;display:flex;align-items:center;flex-wrap:nowrap;gap:10px;padding:0;background:none;border:0;min-width:0}
body>header>nav[aria-label="Main navigation"]>a{display:flex;align-items:center;justify-content:center;min-width:0;min-height:38px;padding:8px 0;margin:0;background:none;border:0;border-radius:0;box-shadow:none;text-shadow:none;color:#ced9ce;font:500 11px/1.3 system-ui,sans-serif;white-space:nowrap;transition:color .15s}
body>header>nav[aria-label="Main navigation"]>a>img{display:block;width:30px;height:30px;object-fit:contain;filter:none;flex-shrink:0;image-rendering:auto}
body>header>nav[aria-label="Main navigation"]>a:hover,body>header>nav[aria-label="Main navigation"]>a[aria-current="page"]{background:none;border:0;box-shadow:inset 0 -2px #d4b774;color:#f3d69a;transform:none}
body>header>nav[aria-label="Main navigation"]>a:focus-visible{outline:2px solid #e4c47c;outline-offset:5px}
body>header>.menu-toggle{display:none!important;box-shadow:none;border:1px solid #6d795d;border-radius:5px;background:#19382c;color:#e3c47d;font:24px/1 system-ui;padding:8px 12px}
@media(max-width:1240px){body>header{min-height:76px;padding:15px 5%;flex-wrap:wrap;gap:0}body>header>.menu-toggle{display:block!important}body>header>nav[aria-label="Main navigation"]{display:none;flex-basis:100%;padding:20px 0 6px;gap:5px 22px}body>header>nav[aria-label="Main navigation"].open{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}body>header>nav[aria-label="Main navigation"]>a{justify-content:flex-start;font-size:14px;padding:12px 0;grid-column:auto;min-height:44px;border-bottom:1px solid #294638}}
`;
export function oldUpdatePortalNavigation(html){let updated=html.replace(/<nav aria-label="Main navigation">[\s\S]*?<\/nav>/,PORTAL_NAV);if(updated.includes(PORTAL_NAV)&&!updated.includes('href="https://www.dunerealms.com/portal-navigation.css?v=hosting-9-release-1002"'))updated=updated.replace('</head>','<link rel="stylesheet" href="https://www.dunerealms.com/portal-navigation.css?v=hosting-9-release-1002"></head>');return updated;}
export const SHARED_HEADER='<header class="dune-site-header"><a class="wordmark" href="https://www.dunerealms.com/" target="_top"><img class="masthead-logo" src="https://www.dunerealms.com/assets/dunerealms-season-logo-v2.webp" alt="dunerealms.com — The Quest for Tavren II Aedrecht — ALPHA" width="360" height="130"></a><button class="menu-toggle" aria-label="Open navigation" aria-expanded="false">☰</button>'+PORTAL_NAV+'</header>';
export const SHARED_HEAD='<link rel="stylesheet" href="/portal-navigation.css"><script src="/portal-navigation.js" defer></script>';
export const PORTAL_SCRIPT=`(()=>{let menuIndex=0;for(const header of document.querySelectorAll('.dune-site-header')){if(window.top!==window.self){header.hidden=true;continue;}const toggle=header.querySelector('.menu-toggle'),nav=header.querySelector('nav');if(!toggle||!nav)continue;if(!nav.id){do{nav.id='dune-main-navigation-'+(++menuIndex);}while(document.getElementById(nav.id)!==nav);}toggle.setAttribute('aria-controls',nav.id);const setOpen=open=>{nav.classList.toggle('open',open);toggle.setAttribute('aria-expanded',String(open));toggle.setAttribute('aria-label',open?'Close navigation':'Open navigation');};setOpen(nav.classList.contains('open'));toggle.addEventListener('click',event=>{event.stopImmediatePropagation();setOpen(!nav.classList.contains('open'));},true);header.addEventListener('keydown',event=>{if(event.key==='Escape'&&nav.classList.contains('open')){event.preventDefault();setOpen(false);toggle.focus();}});for(const a of nav.querySelectorAll('a')){const url=new URL(a.href);if(url.host===location.host&&url.pathname===location.pathname&&url.hash===location.hash)a.setAttribute('aria-current','page');}}})();`;
export function updatePortalNavigation(html){
const firstHeader=html.search(/<header\b/),main=html.search(/<main\b/);
let updated=firstHeader>=0&&(main<0||firstHeader<main)?html.replace(/<header\b[^>]*>[\s\S]*?<\/header>/,SHARED_HEADER):html.replace(/<body\b[^>]*>/,match=>match+SHARED_HEADER);
updated=updated.replace(/<body\b([^>]*)>/,(_,attrs)=>{if(/class="/.test(attrs))return '<body'+attrs.replace(/class="([^"]*)"/,(_,classes)=>'class="'+[...new Set((classes+' dune-public-page').split(/\s+/).filter(Boolean))].join(' ')+'"')+'>';return '<body'+attrs+' class="dune-public-page">';});
if(!/<footer\b/.test(updated))updated=updated.replace('</body>','<footer class="site-footer"></footer></body>');
updated=updated.replace(/<link rel="stylesheet" href="(?:https:\/\/www\.dunerealms\.com)?\/?portal-navigation\.css(?:\?[^"<>]*)?">/g,'').replace(/<script src="(?:https:\/\/www\.dunerealms\.com)?\/?portal-navigation\.js(?:\?[^"<>]*)?" defer><\/script>/g,'');
return updated.replace('</head>',SHARED_HEAD+'</head>');
}
export function pageContextFor(value,links=PORTAL_LINKS){
const url=new URL(value),host=url.hostname;if(host==='shop.dunerealms.com')return {label:'Shop',icon:'nav-shop-v1.webp'};if(host==='corp.dunerealms.com')return {label:'Company CP',icon:'clans/vaerkring-v1.png'};if(url.pathname==='/dunemark-collection.html')return {label:'Dunemark Collection',icon:'imperial-postbank-v2.png'};if(url.pathname==='/government.html')return {label:'Realm & Politics',icon:'seals/office-landsraad.png'};if(url.pathname==='/kits.html')return {label:'Kit Exchange',icon:'items/office_water.png'};if(url.pathname==='/shop.html')return {label:'Shop',icon:'nav-exchange-full-v2.webp'}; if(host==='wiki.dunerealms.com')return {label:'Manual/wiki',icon:'nav-manual-full-v2.webp'};
if(url.pathname.startsWith('/git/'))return {label:'DuneGit',icon:'nav-manual-full-v2.webp'};
if(url.pathname.startsWith('/news/'))return {label:'News dispatch',icon:'nav-discord-full-v2.webp'};
if(url.pathname==='/news-archive.html')return {label:url.searchParams.has('post')?'News dispatch':'News archive',icon:'nav-discord-full-v2.webp'};
if(host==='cp.dunerealms.com'){const pages={'#git-control':['DuneGit','manual'],'#git-admin':['Git administration','staff'],'#webmail':['Webmail','support'],'#website-posts':['Website posts','discord'],'#permissions':['Ranks & permissions','account'],'#staff-manual':['Staff manual','manual'],'#server-operations':['Server operations','home'],'#staff-tickets':['Staff ticket desk','support'],'#forum-admin':['Forum moderation','boards'],'#exchange-admin':['Exchange administration','exchange'],'#staff':['Administration','account']};const page=pages[url.hash];if(page)return {label:page[0],icon:'nav-'+page[1]+'-full-v2.webp'};}
const name=host==='forums.dunerealms.com'?'Boards':host==='support.dunerealms.com'?'Support center':host==='clans.dunerealms.com'?'Clan center':host==='cp.dunerealms.com'?(url.hash==='#exchange'?'Exchange':url.hash==='#tickets'?'Support center':url.hash==='#forum-admin'?'Boards':'Account center'):/\/(manual|wiki)\.html$/.test(url.pathname)?'Manual/wiki':/\/staff\.html$/.test(url.pathname)?'Staff roster':/\/discord\.html$/.test(url.pathname)?'Discord':/\/exchange\.html$/.test(url.pathname)?'Exchange':['/','/index.html'].includes(url.pathname)?'Home':null;
const shortNames={'Staff roster':'Roster','Support center':'Support','Account center':'CP','Clan center':'Clans','Manual/wiki':'Dunopedia'};const link=links.find(x=>x[0]===name||x[0]===shortNames[name]);
return !link?{label:typeof document!=='undefined'?(document.querySelector('h1')?.textContent.trim()||'Field guide'):'Field guide',icon:'nav-manual-full-v2.webp'}:{label:name,icon:link[2].replace('-v2.webp','-full-v2.webp')};
}
export const CONTEXT_SCRIPT=`(()=>{if(window.top!==window.self){document.documentElement.classList.add('dune-embedded');return;}const links=${JSON.stringify(PORTAL_LINKS)},choose=${pageContextFor.toString()};let welcomeName='traveller';fetch('https://cp.dunerealms.com/api/welcome',{credentials:'include',cache:'no-store'}).then(r=>r.ok?r.json():null).then(data=>{if(typeof data?.username==='string'&&data.username.length<=32){welcomeName=data.username;render();}}).catch(()=>{});function render(){if(location.hostname==='support.dunerealms.com')document.body.classList.add('dune-support');const item=choose(location.href,links);let worlds=document.querySelector('.world-status');if(!worlds){worlds=document.createElement('aside');worlds.className='world-status';worlds.setAttribute('aria-label','Live server status');const heading=document.createElement('h2');heading.textContent='Worlds online';const list=document.createElement('ul');list.className='world-status-list';const note=document.createElement('p');note.className='world-status-note';note.textContent='Checking the caravan network…';worlds.append(heading,list,note);}worlds.remove();document.querySelector('.dune-page-marker')?.remove();if(!item)return;const header=document.querySelector('.dune-site-header');if(!header)return;const panel=document.createElement('section');panel.className='dune-page-marker';panel.setAttribute('aria-label','Welcome to '+item.label);const image=document.createElement('img');image.src='https://www.dunerealms.com/assets/'+item.icon;image.alt='';image.width=160;image.height=160;const text=document.createElement('div'),small=document.createElement('small'),title=document.createElement('p');small.textContent='THE CARAVAN GUIDE';title.textContent='Welcome, '+welcomeName+', to the '+item.label+'.';const lore=document.createElement('small');const quotes={DuneGit:['Every invention begins with a mark in the caravan ledger.','Share your craft; a good idea can travel beyond the dunes.','Build with care, and leave a trail others can follow.'],Webmail:['A sealed message carries your voice across the dunes.'],Home:['The caravan gathers here; the latest word travels with the wind.','Rest beneath our banners and hear what stirs beyond the dunes.','Every journey begins with news from the road.'],Boards:['A shared tale can light the way for another traveller.','Trade your stories beneath the awning; every voice has a place.','Listen well: the quietest traveller may know the safest passage.'],Exchange:['Weigh your Dunemarks carefully; a fair bargain outlasts a fortune.','Count the coin, inspect the wares, and leave with honour.','Even in a sea of sand, a good bargain is worth finding.'],Discord:['Tune to the caravan frequency; familiar voices shorten the crossing.','Across the dunes, a friendly voice is its own shelter.','The signal is clear. Join the conversation beyond the horizon.'],'Manual/wiki':['A well-read field guide saves more water than a hurried journey.','Learn the trail before you challenge the dunes.','Turn the page; knowledge is the lightest provision you can carry.'],'Staff roster':['A watchful crew keeps the caravan moving.','Every banner is stronger with a trusted hand behind it.','Meet the keepers of the caravan and the worlds beyond.'],'Support center':['Set down your burden; the caravan clerks are here to help.','A troubled journey deserves a patient listener.','Bring us the details, and we will help find the next step.'],'Account center':['Your journey has a place in the caravan ledger.','Keep your records in order and your next crossing within reach.','Behind every banner stands a traveller with a story of their own.'],'Clan center':['Raise your banner; the strongest caravan travels together.','Choose your companions well, and no horizon is too distant.','A shared purpose binds a clan more firmly than any crest.']};const choices=quotes[item.label]||['May your water last and your journey bring good fortune.'];const key=location.hostname+location.pathname+location.hash;let seed=0;for(const character of key)seed=(seed*31+character.charCodeAt(0))>>>0;lore.textContent=choices[seed%choices.length];text.append(lore);const npc=document.createElement('img');npc.src='https://www.dunerealms.com/assets/nav-account-v2.webp';npc.alt='Caravan guide';npc.style.cssText='width:48px;height:48px;object-fit:contain';text.prepend(npc);text.append(small,title);if(worlds&&!worlds.querySelector('.dune-join-box')){const join=document.createElement('div');join.className='dune-join-box';const address=document.createElement('code');address.textContent='play.dunerealms.com';const button=document.createElement('button');button.type='button';button.textContent='Join now';button.setAttribute('aria-label','Join now: copy Minecraft server address');const help=document.createElement('p');help.className='dune-join-help';help.textContent='Java & Bedrock · copy the server address';help.setAttribute('role','status');button.addEventListener('click',async()=>{try{await navigator.clipboard.writeText('play.dunerealms.com');button.textContent='Copied ✓';help.textContent='Address copied · choose Add Server in Java or Bedrock.';}catch{help.textContent='In Minecraft Java, add a server with address play.dunerealms.com.';}});const ports=document.createElement('div');ports.className='dune-join-ports';for(const [edition,port]of [['Bedrock','19132'],['Java','25565']]){const box=document.createElement('span'),label=document.createElement('small'),value=document.createElement('code');label.textContent=edition+' port';value.textContent=port;const icon=document.createElement('img');icon.className='edition-icon';icon.alt='';icon.width=12;icon.height=12;icon.src='https://www.dunerealms.com/assets/edition-'+(edition==='Java'?'java':'bedrock')+'.svg';box.append(icon,label,value);ports.append(box);}join.append(address,button,ports,help);worlds.append(join);}if(worlds&&!worlds.querySelector('.world-network-art')){worlds.querySelector('.eyebrow')?.remove();const plate=document.createElement('img');plate.className='world-network-art';plate.src='https://www.dunerealms.com/assets/vaerkring-network-title-v1.webp';plate.alt='Vaerkring Network';plate.width=280;plate.height=80;worlds.prepend(plate);}panel.append(image,text);if(worlds)panel.append(worlds);header.after(panel);if(!document.querySelector('.dune-shared-footer')){const old=document.querySelector('body>footer,.site-footer'),foot=old||document.createElement('footer');foot.className='dune-shared-footer';foot.replaceChildren();const brand=document.createElement('a');brand.href='https://www.dunerealms.com/';brand.textContent='✦ dunerealms.com';brand.className='dune-footer-brand';const links=document.createElement('nav');links.setAttribute('aria-label','Footer navigation');for(const [label,href]of [['Manual/wiki','https://wiki.dunerealms.com/'],['Support','https://support.dunerealms.com/'],['Account','https://cp.dunerealms.com/'],['DuneGit','https://www.dunerealms.com/git/unimatrix/MC'],['Disclaimer & contact','https://www.dunerealms.com/wiki.html']]){const a=document.createElement('a');a.textContent=label;a.href=href;links.append(a);}const note=document.createElement('small');note.textContent='Independent fan project · Not affiliated with Dune rights holders, Mojang or Microsoft.';foot.append(brand,links);const host=document.createElement('a');host.className='dune-hosting-badge';host.href='https://www.hetzner.com/';host.target='_blank';host.rel='noopener noreferrer';host.setAttribute('aria-label','Powered by Hetzner — visit Hetzner');const server=document.createElement('span');server.className='dune-hosting-art';server.textContent='▤';server.setAttribute('aria-hidden','true');const hostText=document.createElement('span');const powered=document.createElement('span');powered.textContent='POWERED BY';const hostLogo=document.createElement('img');hostLogo.src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxODEuNDIgMjIuMjQiPjxkZWZzPjxzdHlsZT4uY2xzLTF7ZmlsbDojZDUwYzJkO308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y0uNywwLTEsLjI5LTEsMVYyMS4yNGMwLC43LjI5LDEsMSwxSDQ3LjkxYy43LDAsMS0uMjksMS0xVjE4LjUxQzQ4LjksMTcuODEsNDguNjEsMTcuNTIsNDcuOTEsMTcuNTJaIi8+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNMjEuNjMsMEgxOC41MmMtLjcsMC0xLC4yOS0xLDFWOC44N0g1LjEzVjFjMC0uNy0uMjktMS0xLTFIMUMuMjksMCwwLC4yOSwwLDFWMjEuMjVjMCwuNzEuMjksMSwxLDFINC4xM2MuNywwLDEtLjI4LDEtMXYtOGgxMi40djhjMCwuNy4yOSwxLDEsMWgzLjExYy43LDAsMS0uMjksMS0xVjFDMjIuNjIuMzIsMjIuMzMsMCwyMS42MywwWiIvPjwvZz48L2c+PC9nPjwvZz48L3N2Zz4=";hostLogo.alt='Hetzner';hostLogo.width=120;hostLogo.height=20;hostText.append(powered,hostLogo);host.append(server,hostText);host.title='Hosting infrastructure · Logo: Hetzner Online GmbH';foot.append(host);foot.append(note);const legal=document.querySelector('.legal-notice');if(legal){const details=document.createElement('details'),summary=document.createElement('summary');summary.textContent='Unofficial fan project';details.className='dune-footer-legal';details.append(summary,legal);foot.append(details);}if(['www.dunerealms.com','dunerealms.com'].includes(location.hostname)&&['/','/index.html'].includes(location.pathname)){const box=document.createElement('div');box.className='dune-footer-parental';const heading=document.createElement('strong');heading.textContent='Parents & guardians';const copy=document.createElement('span');copy.textContent='Parental consent or a child’s account-data request? Contact our support team.';const link=document.createElement('a');link.href='https://support.dunerealms.com/open.php';link.textContent='Parental help →';box.append(heading,copy,link);foot.append(box);}if(!old)document.body.append(foot);}const pin=()=>document.documentElement.style.setProperty('--dune-nav-height',header.getBoundingClientRect().height+'px');pin();if(!header.dataset.pinObserved){new ResizeObserver(pin).observe(header);header.dataset.pinObserved='1';}}render();async function refreshWorlds(){try{const response=await fetch('https://cp.dunerealms.com/api/worlds',{cache:'no-store',credentials:'omit',signal:AbortSignal.timeout(7000)});if(!response.ok)throw Error();const data=await response.json(),panel=document.querySelector('.dune-page-marker .world-status');if(!panel)return;const list=panel.querySelector('.world-status-list');list.replaceChildren();const glyphs={Arrakduin:'serevan',Kaladam:'pelareth',Giedermark:'varkesh',Kaiterhof:'orivane','Sigmadraken IV':'nivareth'};list.setAttribute('role','table');list.setAttribute('aria-label','World and connection status');for(const server of data.servers){const row=document.createElement('li'),name=document.createElement('span'),state=document.createElement('span'),icon=document.createElement('img');const display=server.name==='Velocity'?'Proxi':server.name;row.setAttribute('role','row');name.setAttribute('role','cell');name.className='world-name';name.title=display;icon.alt='';icon.width=14;icon.height=14;icon.src=glyphs[server.name]?'https://www.dunerealms.com/assets/planet-glyphs/'+glyphs[server.name]+'.svg':server.name==='Velocity'?'https://www.dunerealms.com/assets/network-proxy.svg':'https://www.dunerealms.com/assets/nav-home-v2.webp';name.append(icon,document.createTextNode(display));const status=server.state==='online'?'Online':server.state==='offline'?'Offline':'Unknown';state.setAttribute('role','cell');state.setAttribute('aria-label',status);state.title=status;state.className='world-state traffic-light '+server.state;for(const color of ['red','amber','green']){const lamp=document.createElement('i');lamp.className='lamp-'+color;lamp.setAttribute('aria-hidden','true');state.append(lamp);}row.append(name,state);list.append(row);}panel.querySelector('.world-status-note').textContent=data.available?'Live check · updates every 30s':'Status check unavailable';}catch{const note=document.querySelector('.dune-page-marker .world-status-note');if(note)note.textContent='Status check unavailable · retrying';}}refreshWorlds();setInterval(()=>{if(!document.hidden)refreshWorlds();},30000);addEventListener('hashchange',()=>{render();refreshWorlds();});})();`;
export const CONTEXT_CSS=`.dune-page-marker>.world-status{max-width:325px!important;min-width:245px!important;flex-basis:245px!important;padding:8px 12px!important;border:1px solid #8a7845!important;border-radius:4px;box-shadow:inset 0 0 0 3px #0b2117,0 3px 9px #0003}.dune-page-marker .world-status h2{font:600 16px/1.25 system-ui!important;margin:3px 0 7px!important;color:#ead399}.dune-page-marker .world-status .eyebrow{font:700 8px/1.4 system-ui!important;letter-spacing:.12em!important;margin:0 0 3px!important;color:#b6c5aa}.dune-page-marker .world-status-list{gap:1px 8px!important}.dune-page-marker .world-status-list li{font:10px/1.35 system-ui!important;padding:2px 0!important;border-bottom:1px solid #58654444}.dune-page-marker .world-state{font-size:9px!important;white-space:nowrap}.dune-page-marker .world-status-note{font:8px/1.4 system-ui!important;margin:5px 0 0!important}.dune-join-box{padding:6px 7px!important;margin-top:7px!important;gap:5px 7px!important}.dune-join-box>code{font-size:10px!important}.dune-join-box button{padding:5px 8px!important;font-size:10px!important}.dune-join-ports{gap:5px!important}.dune-join-ports>span{padding:3px 4px!important}.dune-join-ports small{font-size:8px!important}.dune-join-ports code{font-size:9px!important}.dune-page-marker .dune-join-help{font-size:8px!important;line-height:1.35!important}@media(max-width:1000px){.dune-page-marker>.world-status{max-width:none!important;flex-basis:100%!important}}.dune-join-ports{grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr;gap:6px}.dune-join-ports>span{display:flex;align-items:center;justify-content:space-between;gap:7px;padding:4px 6px;background:#10251b;border:1px solid #62704a;border-radius:2px}.dune-join-ports small{font:9px/1.4 system-ui!important;color:#bcc8ae!important}.dune-join-ports code{font-size:11px;color:#ead49a}.dune-join-box{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:7px 10px;margin-top:10px;padding:9px 10px;background:#1f3728;border:1px solid #98854e;border-radius:3px}.dune-join-box code{font:600 12px/1.5 ui-monospace,monospace;color:#f0dfad;background:none;padding:0;overflow-wrap:anywhere}.dune-join-box button{border:1px solid #dfc479;background:linear-gradient(#d9bd74,#b9974c);color:#12241a;padding:7px 12px;border-radius:2px;font:700 11px/1.3 system-ui;cursor:pointer;white-space:nowrap}.dune-join-box button:hover{filter:brightness(1.1)}.dune-join-box button:focus-visible{outline:2px solid #c5e4b8;outline-offset:3px}.dune-page-marker .dune-join-help{grid-column:1/-1;font:10px/1.4 system-ui!important;color:#bdcbb4!important;margin:0!important;letter-spacing:normal!important}.dune-embedded .dune-page-marker,.dune-embedded .dune-shared-footer,.dune-embedded #footer,.dune-embedded footer{display:none!important}.dune-page-marker .world-status .eyebrow,.dune-page-marker .world-status-note{font:11px/1.5 system-ui!important;letter-spacing:normal!important}.dune-footer-legal,.dune-footer-parental{flex-basis:100%;font:12px/1.6 system-ui}.dune-footer-legal summary{cursor:pointer;color:#d6ba76}.dune-footer-legal .legal-notice{max-width:none!important;margin:10px 0 0!important;padding:12px 0!important;background:none!important;border:0!important;font:11px/1.6 system-ui}.dune-footer-parental{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;border-top:1px solid #425a45;padding-top:10px;color:#bdc7b8}.dune-footer-parental strong,.dune-footer-parental a{color:#dfc17c}.dune-shared-footer{display:flex!important;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 24px!important;padding:18px max(24px,4%)!important;background:#10271f!important;border-top:1px solid #74663f!important;border-bottom:0!important;margin-top:20px;box-sizing:border-box}.dune-hosting-badge{display:inline-flex!important;align-items:center;gap:12px;padding:9px 15px!important;border:1px solid #a88e4b!important;border-radius:7px;background:linear-gradient(135deg,#294636,#0d241b)!important;box-shadow:inset 0 0 0 3px #d1b66b12,0 3px 8px #0003;text-decoration:none!important}.dune-hosting-badge>span:last-child{display:grid;gap:5px}.dune-hosting-badge span span{font:9px/1.2 system-ui;letter-spacing:.2em;color:#e4c77f}.dune-hosting-badge img{display:block;width:120px!important;height:20px!important;object-fit:contain;background:#fff;border-radius:3px;padding:6px 8px}.dune-hosting-art{font-size:38px;line-height:1;color:#d5b66b;text-shadow:2px 2px #081c14;border:1px solid #857847;padding:2px 7px;border-radius:4px}.dune-hosting-badge:hover{border-color:#f0d488!important;box-shadow:0 0 15px #dfbb4c22}.dune-shared-footer .dune-footer-brand{font:700 19px/1.4 system-ui;letter-spacing:0;color:#dfbe78}.dune-shared-footer nav{display:flex!important;position:static!important;flex-direction:row!important;flex-wrap:wrap;gap:10px 20px!important;padding:0!important;background:none!important;border:0!important;font:12px/1.5 system-ui}.dune-shared-footer nav a{color:#dfc17c!important;text-decoration:none!important;padding:0!important;min-height:0!important;background:none!important;border:0!important}.dune-shared-footer small{flex-basis:100%;border:0!important;padding:0!important;font:10px/1.5 system-ui;letter-spacing:0!important;text-align:left!important;color:#b7c3b5}.dune-page-marker{gap:20px!important;min-height:165px!important;padding-top:10px!important;padding-bottom:10px!important}.dune-page-marker>img{width:130px!important;height:140px!important;flex-basis:130px!important}.dune-page-marker p{margin:8px 0!important;font-size:21px!important}.dune-page-marker>.world-status{padding:10px 16px!important}.dune-page-marker .world-status-list{gap:3px 12px!important}#footer:not(footer){padding-top:12px!important;padding-bottom:12px!important}@media(max-width:650px){.dune-page-marker>img{width:80px!important;height:90px!important;flex-basis:80px!important}.dune-shared-footer{gap:8px!important;padding:15px 20px!important}}footer,.site-footer{background-repeat:no-repeat!important;background-size:cover!important;background-position:center!important}html,body{background-color:#0d211b!important;background-image:none!important}header.dune-site-header::after{display:none!important;content:none!important}header.dune-site-header{position:static!important;top:auto!important}.dune-page-marker{position:static!important;top:auto!important;border-bottom:3px double #b49a5c!important;box-shadow:0 5px 10px #0005}html{scroll-padding-top:0}@media(max-height:650px){.dune-page-marker{min-height:120px!important;padding-top:6px!important;padding-bottom:6px!important}.dune-page-marker>img{height:90px!important;width:90px!important;flex-basis:90px!important}.dune-page-marker p{font-size:17px!important}.dune-page-marker .world-status-list{gap:0 12px!important}.dune-page-marker>.world-status{padding:6px 12px!important}}.dune-page-marker>.world-status{position:static!important;transform:none!important;inset:auto!important;flex:1 1 320px;max-width:430px;width:auto!important;min-width:260px;margin:0 0 0 auto!important;padding:14px 20px!important;box-sizing:border-box;background:#0d211b;border:1px solid #586844;border-radius:6px}.dune-page-marker .world-status h2{font:600 20px/1.3 system-ui;margin:4px 0 10px}.dune-page-marker .world-status .eyebrow{font-size:10px;margin:0}.dune-page-marker .world-status-list{display:grid;grid-template-columns:1fr 1fr;gap:5px 16px;margin:0;padding:0;list-style:none}.dune-page-marker .world-status-list li{display:flex;justify-content:space-between;gap:8px;font:12px/1.5 system-ui;padding:2px 0}.dune-page-marker .world-status>p:last-child{font:11px/1.5 system-ui;margin:8px 0 0}@media(max-width:1000px){.dune-page-marker{flex-wrap:wrap}.dune-page-marker>.world-status{flex-basis:100%;max-width:none;margin:8px 0 0!important}}body.dune-support #landing_page .main-content,body.dune-support #content .main-content{background:#142d26!important;color:#e6dfca!important;padding:20px;box-sizing:border-box;border:1px solid #50624d}body.dune-support #content p,body.dune-support #content h1,body.dune-support #content h2{color:#e6dfca}body.dune-support #content input,body.dune-support #content select,body.dune-support #content textarea{background:#10261f;color:#eee3c7;border:1px solid #718266}header.dune-site-header[hidden]{display:none!important}.dune-page-marker{display:flex;align-items:center;gap:26px;width:100%;min-height:206px;margin:0;padding:14px max(5%,24px);background:#122c23;border-top:1px solid #596345;border-bottom:1px solid #596345;color:#e9d5aa;box-sizing:border-box;text-align:left}.dune-page-marker>img{display:block;width:164px;height:178px;object-fit:contain;flex:0 0 164px}.dune-page-marker>div{max-width:470px;text-align:center}.dune-page-marker div>img{display:inline-block;width:48px;height:48px;object-fit:contain}.dune-page-marker small{display:block;font:12px/1.5 system-ui;letter-spacing:normal;color:#cbb978}.dune-page-marker p{font:600 25px/1.35 system-ui;margin:10px 0;color:#eee3c7}@media(max-width:650px){.dune-page-marker{padding:14px 5%;min-height:160px;gap:14px}.dune-page-marker>img{width:90px;height:120px;flex-basis:90px}.dune-page-marker p{font-size:18px}.dune-page-marker small{font-size:11px}.dune-page-marker div>img{width:40px;height:40px}}
.dune-page-marker .world-network-art{display:block;width:100%!important;height:62px!important;object-fit:contain;margin:0 auto 3px}
.dune-page-marker .world-status h2{font:700 10px/1.4 system-ui!important;text-transform:uppercase;letter-spacing:.14em;margin:2px 0 5px!important;color:#cbb37a}
.dune-page-marker .world-status-list{display:table!important;width:100%;table-layout:fixed;border-collapse:collapse;margin:0!important;padding:0!important;border-top:1px solid #5c6846}
.dune-page-marker .world-status-list li{display:table-row!important;font:10px/1.3 system-ui!important}
.dune-page-marker .world-status-list li>span{display:table-cell!important;vertical-align:middle;padding:2px 3px;border-bottom:1px solid #485b3e55}
.dune-page-marker .world-status-list .world-name{width:82%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.world-name img{width:14px;height:14px;object-fit:contain;vertical-align:middle;margin-right:6px}
.dune-page-marker .traffic-light{text-align:right;white-space:nowrap}
.traffic-light i{display:inline-block;width:5px;height:5px;margin-left:3px;border-radius:50%;background:#354638;box-shadow:inset 0 1px 2px #0008;border:1px solid #68715533}
.traffic-light.online .lamp-green{background:#9bd378;box-shadow:0 0 4px #8cc86770}
.traffic-light.offline .lamp-red{background:#e28c72;box-shadow:0 0 4px #e28c7255}
.traffic-light.unknown .lamp-amber{background:#e2bd65;box-shadow:0 0 4px #e2bd6555}
.dune-join-box{position:relative;background:linear-gradient(95deg,#10271de8,#203a26c9),url('https://www.dunerealms.com/assets/sietch.webp') center/cover!important;border:1px solid #b59a52!important;box-shadow:inset 0 0 0 2px #6c643a44,0 2px 5px #0003;padding:6px!important}
.dune-join-box>code{grid-column:1/-1;text-align:center;font-size:11px!important;letter-spacing:.03em;color:#f4e4b5}
.dune-join-box button{grid-column:1/-1;height:42px;padding:6px 50px!important;font:800 13px/1.2 system-ui!important;text-transform:uppercase;letter-spacing:.06em;color:#f6e5ae!important;text-shadow:0 2px 2px #000;background-image:url('https://www.dunerealms.com/assets/nav-home-v2.webp'),url('https://www.dunerealms.com/assets/nav-clan-v2.webp'),linear-gradient(90deg,#39572d,#182d1e 45%,#4c5429)!important;background-position:right 5px center,left 5px center,center!important;background-size:46px 46px,40px 40px,cover!important;background-repeat:no-repeat!important;border:2px solid #c6a353!important;box-shadow:inset 0 0 0 2px #293c23,inset 0 0 12px #dfb55144,0 2px 0 #09160c;border-radius:3px}
.dune-join-box button:hover{filter:brightness(1.15)}
.dune-join-ports>span{justify-content:flex-start!important;gap:4px!important}
.dune-join-ports .edition-icon{width:12px;height:12px;object-fit:contain;flex:0 0 12px}
.dune-join-ports code{margin-left:auto}
.dune-page-marker>.world-status{max-width:300px!important;min-width:230px!important;flex-basis:230px!important;padding:6px 10px!important}
.dune-page-marker .world-network-art{height:32px!important;margin-bottom:1px!important}
.dune-page-marker .world-status h2{font-size:8px!important;line-height:1.2!important;margin:2px 0 3px!important}
.dune-page-marker .world-status-list li{font-size:9px!important;line-height:1.2!important}
.dune-page-marker .world-status-list li>span{padding:1px 2px!important;height:12px!important}
.dune-page-marker .world-name img{display:inline-block!important;width:10px!important;height:10px!important;margin-right:5px!important;vertical-align:middle!important}
.dune-page-marker .world-status-note{font-size:7px!important;margin-top:3px!important;line-height:1.3!important}
.dune-join-box{padding:4px 5px!important;margin-top:5px!important;gap:3px 6px!important}
.dune-join-box>code{font-size:9px!important;line-height:1.2!important}
.dune-join-box button{height:26px!important;font-size:10px!important;padding:3px 38px!important;background-size:30px 30px,26px 26px,cover!important}
.dune-join-ports>span{padding:2px 4px!important}
.dune-join-ports small,.dune-join-ports code{font-size:8px!important}
.dune-join-ports .edition-icon{width:10px!important;height:10px!important;flex-basis:10px!important}
.dune-page-marker .dune-join-help{font-size:7px!important;line-height:1.25!important}
@media(max-width:1000px){.dune-page-marker>.world-status{max-width:none!important;flex-basis:100%!important}}
.dune-page-marker .world-status-list{background:linear-gradient(100deg,#14291eea,#29412bda),url('https://www.dunerealms.com/assets/sietch.webp') center/cover!important;border:1px solid #a88e4c!important;border-radius:3px;box-shadow:inset 0 0 0 2px #b8a16022,0 2px 4px #0003;border-collapse:separate!important;border-spacing:0!important;padding:3px 4px!important;box-sizing:border-box}
.dune-page-marker .world-status-list li:nth-child(even){background:#c5ac6020}
.dune-page-marker .world-status-list li>span{border-bottom:1px solid #a3914a33!important;padding:2px 4px!important}
.dune-page-marker .world-status-list li:last-child>span{border-bottom:0!important}
.dune-page-marker .world-status-list .world-name{color:#ecdfb8}
header.dune-site-header>.wordmark .masthead-logo{display:block;width:360px;max-width:100%;height:auto;max-height:142px;object-fit:contain}header.dune-site-header>.wordmark{max-width:38vw}header.dune-site-header{min-height:140px;padding-top:8px;padding-bottom:8px}@media(max-width:1240px){header.dune-site-header>.wordmark{max-width:75vw}header.dune-site-header>.wordmark .masthead-logo{width:310px}header.dune-site-header{min-height:112px}}@media(max-width:500px){header.dune-site-header>.wordmark .masthead-logo{width:260px}header.dune-site-header{min-height:100px}}header.dune-site-header{flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:8px!important;padding-top:10px!important;padding-bottom:10px!important}header.dune-site-header>.wordmark{max-width:min(80vw,440px)!important;margin:0 auto!important;text-align:center}header.dune-site-header>.wordmark .masthead-logo{width:400px!important;max-height:none!important;margin:0 auto}header.dune-site-header>nav[aria-label="Main navigation"]{justify-content:center!important;flex-basis:auto!important}@media(max-width:1240px){header.dune-site-header>.menu-toggle{position:absolute;right:22px;top:48px}header.dune-site-header>.wordmark .masthead-logo{width:340px!important}header.dune-site-header>nav[aria-label="Main navigation"].open{width:100%;box-sizing:border-box;margin-top:8px}}@media(max-width:500px){header.dune-site-header>.wordmark{max-width:76vw!important}header.dune-site-header>.wordmark .masthead-logo{width:285px!important}header.dune-site-header>.menu-toggle{right:12px;top:35px}}
/* Shared illustrated masthead and translucent navigation frame. */
header.dune-site-header{background:linear-gradient(90deg,rgba(7,26,21,.94),rgba(12,39,32,.84),rgba(7,26,21,.94)),url('https://www.dunerealms.com/assets/sietch.webp') center 44%/cover!important;border-bottom:1px solid #b59a53!important;box-shadow:inset 0 -1px #e8cc7726!important;isolation:isolate}
header.dune-site-header>nav[aria-label="Main navigation"]{background:rgba(4,20,16,.65)!important;border:1px solid #ae914b80!important;border-radius:7px!important;padding:5px 12px!important;gap:3px!important;box-shadow:inset 0 0 0 1px #eed29410,0 5px 16px #0003!important;backdrop-filter:blur(7px);max-width:calc(100% - 28px);box-sizing:border-box}
header.dune-site-header>nav[aria-label="Main navigation"]>a{border-radius:4px;transition:background .18s,color .18s}
header.dune-site-header>nav[aria-label="Main navigation"]>a:hover{background:#b99b4930!important;color:#fff0bd!important}
@media(max-width:1240px){header.dune-site-header>nav[aria-label="Main navigation"].open{max-width:100%;background:rgba(4,20,16,.92)!important}}
`;
export const SHOP_HIGHLIGHT_CSS="\n/* Shop main-menu highlight v1 */\nheader nav[aria-label=\"Main navigation\"] a[href=\"https://www.dunerealms.com/shop.html\"]{position:relative;isolation:isolate;overflow:hidden!important;border-radius:7px!important;background:linear-gradient(115deg,#b08a2318,#e8c76b13,#b08a2306)!important;box-shadow:inset 0 0 0 1px #d9b85355,0 0 12px #d3ad3620!important;color:#ffe4a0!important;}header nav[aria-label=\"Main navigation\"] a[href=\"https://www.dunerealms.com/shop.html\"]::after{content:'';position:absolute;inset:-50% -80%;z-index:-1;pointer-events:none;background:linear-gradient(110deg,transparent 43%,#ffe9a633 49%,#fff8d455 50%,transparent 57%);transform:translateX(-65%);animation:dune-shop-shine 6s ease-in-out infinite;}header nav[aria-label=\"Main navigation\"] a[href=\"https://www.dunerealms.com/shop.html\"] img{filter:drop-shadow(0 0 3px #e8b64caa) brightness(1.12) saturate(1.12)!important;animation:dune-shop-icon-glow 6s ease-in-out infinite;}@keyframes dune-shop-shine{0%,65%{transform:translateX(-65%)}90%,100%{transform:translateX(65%)}}@keyframes dune-shop-icon-glow{0%,65%,100%{filter:drop-shadow(0 0 3px #e8b64c88) brightness(1.1)}80%{filter:drop-shadow(0 0 6px #ffcf6cbb) brightness(1.3)}}@media(prefers-reduced-motion:reduce){header nav[aria-label=\"Main navigation\"] a[href=\"https://www.dunerealms.com/shop.html\"]::after,header nav[aria-label=\"Main navigation\"] a[href=\"https://www.dunerealms.com/shop.html\"] img{animation:none!important;}}\n";
export const GIT_FOOTER_SCRIPT="\n/* DuneGit repository footer link */\n(()=>{function link(){const foot=document.querySelector('.dune-shared-footer');if(!foot)return;const nav=foot.querySelector('nav');if(!nav)return;let a=nav.querySelector('[data-dune-git-footer]');if(!a){a=document.createElement('a');a.dataset.duneGitFooter='1';nav.append(a);}a.href='https://www.dunerealms.com/git/unimatrix/MC';a.textContent='DuneGit';}link();new MutationObserver(link).observe(document.body,{childList:true});addEventListener('hashchange',link);})();\n";