/* What the start page (index.html) and the pages that open under its bar share: the controls editor
   (controls.css), the map manager (maps.css) and the file manager (files.css). Colours, the shell of
   such a page, and how a button, a field, a pair of joined buttons and a tick box look. Those files
   then only say what is their own. Rules for plain elements use :where(), which weighs nothing, so
   any class of a page's own (a key of the keyboard, a row of a list) overrides them without effort. */
@font-face { font-family: Xolonium; src: url(xolonium-regular.otf) format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: Xolonium; src: url(xolonium-bold.otf) format('opentype'); font-weight: 700; font-display: swap; }
:root {
	color-scheme: dark; /* native parts (drop-down lists, scrollbars, the search field's clear button) in the dark */
	--space: #03060d;   /* the sky of the backdrop */
	--limb: #6db4f2;    /* the planet's atmosphere line */
	--cloud: #eaf2fb;
	--haze: #93a6c0;
	--sun: #ffb347;
	--ink: #050a14;     /* a page of its own, in the game */
	--card: #0c1422;    /* a box on such a page */
	--line: rgb(147 166 192 / .45);      /* the edge of something that can be pressed or typed in */
	--line-soft: rgb(147 166 192 / .22); /* the edge of a box, a rule between rows */
	--fill: rgb(147 166 192 / .14);      /* a button */
	--fill-hover: rgb(147 166 192 / .28);
	--well: rgb(3 6 13 / .6);            /* a field, a list, a key: something dark to read on over the picture */
	--edge: #4aa8ff;                     /* the bright line round the main button; the focus ring */
	--now: rgb(109 180 242 / .14);       /* the row, card or tab that is the current one: this fill ... */
	--now-line: rgb(109 180 242 / .6);   /* ... and this line all the way round it (never a mark on one side) */
	--good: #6fd08c;                     /* a low ping, people playing */
	--pick: rgb(109 180 242 / .3);       /* the chosen one of several */
	--pad: clamp(20px, 4.5vw, 64px);
	--face: Xolonium, 'Trebuchet MS', system-ui, sans-serif;
	--mono: ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace;
}

/* ---- a page under the bar: a dialog over the game, or under the start page's tabs before it ---- */
.panel { position: fixed; inset: 0; z-index: 20; box-sizing: border-box; padding: clamp(12px, 2.4vw, 32px); background: var(--ink); color: var(--cloud); font: 400 14px/1.4 var(--face); }
.panel[hidden], .panel [hidden] { display: none !important; } /* whatever a page's own rule says its layout is */
.panel > header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; }
.panel h2 { margin: 0; font-size: 26px; font-weight: 700; }
.panel h3 { margin: 0; font-size: 17px; font-weight: 700; }
/* before the game starts it sits under the bar, lets the backdrop through, and lines up with the logo and the tabs */
html.pre .panel { top: var(--top-h, 70px); padding-left: var(--pad); padding-right: var(--pad); background: rgb(3 6 13 / .9); backdrop-filter: blur(3px); }
html.pre .panel > header h2, html.pre .panel .done { display: none; }
@media (max-width: 700px), (max-height: 520px) { .panel, html.pre .panel { padding: 10px 12px; } }

/* ---- scroll bars: a thin haze-coloured handle on the page's dark, lighter under the pointer ---- */
:root { scrollbar-color: rgb(147 166 192 / .45) transparent; } /* inherited by everything that scrolls */
:where(#loader, .panel, .panel *) { scrollbar-width: thin; }
/* browsers without those two properties (Safari) */
@supports not (scrollbar-color: auto) {
	:where(#loader, .panel, .panel *)::-webkit-scrollbar { width: 8px; height: 8px; }
	:where(#loader, .panel, .panel *)::-webkit-scrollbar-track, :where(#loader, .panel, .panel *)::-webkit-scrollbar-corner { background: transparent; }
	:where(#loader, .panel, .panel *)::-webkit-scrollbar-thumb { background: rgb(147 166 192 / .45); border-radius: 4px; }
	:where(#loader, .panel, .panel *)::-webkit-scrollbar-thumb:hover { background: var(--haze); }
}
:where(#loader, .panel, .panel *):hover { scrollbar-color: var(--haze) transparent; }

/* ---- buttons, fields ---- */
:where(.panel, #setup, #corner, .sheet, #keys) :where(button, select, input, textarea) { font: inherit; }
:where(.panel, #setup, #corner, .sheet, #keys) :where(button):where(:not(.tc-frame *)) { color: var(--cloud); background: var(--fill); border: 1px solid var(--line); border-radius: 3px; padding: 6px 14px; cursor: pointer; }
:where(.panel, #setup, #corner, .sheet, #keys) :where(button):where(:not(.tc-frame *)):hover:not(:disabled) { background: var(--fill-hover); }
:where(.panel, #setup, #corner, .sheet, #keys) :where(button):disabled { opacity: .45; cursor: default; }
:where(.panel, #setup) :where(input[type=text], input[type=search], textarea, select) { color: var(--cloud); background: var(--well); border: 1px solid var(--line); border-radius: 3px; padding: 6px 9px; box-sizing: border-box; }
:where(.panel, #setup) :where(input[type=number]) { color: var(--cloud); background: var(--well); border: 1px solid var(--line); border-radius: 3px; } /* else the browser's grey */
:where(.panel, #setup) :where(select) { cursor: pointer; }
:where(.panel, #setup) :where(input)::placeholder { color: var(--haze); opacity: .8; }
:where(.panel, #setup, #corner, #top, .sheet, #keys) :where(button, select, input, textarea):focus-visible { outline: 2px solid var(--edge); outline-offset: 2px; } /* the blue of the main button's edge; amber is kept for warnings and the key being set */
/* the one button that goes on: Play, Save, Done */
/* the one thing to press: a deep blue with a bright edge of the planet's blue, where everything else pressable is grey */
.primary { background: #1a4f8f; color: #fff; font-weight: 700; border-color: var(--edge); }
.primary:hover:not(:disabled) { background: #2364b0; border-color: #a9d4fa; }
/* two or three buttons that are one choice, joined */
.seg { display: inline-flex; }
.seg > button { border-radius: 0; }
.seg > button + button { margin-left: -1px; }
.seg > button:first-child { border-radius: 3px 0 0 3px; }
.seg > button:last-child { border-radius: 0 3px 3px 0; }
.seg > .is-current { position: relative; background: var(--pick) !important; border-color: var(--limb); }
/* a line that says what just happened */
.panel .status { margin: 0; color: var(--haze); font-size: 13px; }
.panel .status:empty { display: none; }
@media (pointer: coarse) { .seg > button { min-height: 40px; font-size: 16px; } }
@media (max-width: 700px) { .seg { display: flex; flex: 1 1 100%; } .seg > button { flex: 1; padding-inline: 6px; font-size: 15px; white-space: nowrap; } }

/* form controls drawn in the page's own colours, here and in the map manager and controls editor */
:is(#setup, .panel) input:is([type=radio], [type=checkbox]) { appearance: none; -webkit-appearance: none; flex: none; display: inline-grid; place-content: center; width: 17px; height: 17px; margin: 0;
	background: var(--well); border: 1px solid rgb(147 166 192 / .7); cursor: pointer; }
:is(#setup, .panel) input[type=radio] { border-radius: 50%; }
:is(#setup, .panel) input[type=checkbox] { border-radius: 3px; }
:is(#setup, .panel) input:is([type=radio], [type=checkbox]):hover { border-color: var(--cloud); }
:is(#setup, .panel) input[type=radio]::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--limb); transform: scale(0); transition: transform .12s; }
:is(#setup, .panel) input[type=radio]:checked { border-color: var(--limb); }
:is(#setup, .panel) input[type=radio]:checked::before { transform: scale(1); }
:is(#setup, .panel) input[type=checkbox]:checked { background: var(--limb); border-color: var(--limb); }
:is(#setup, .panel) input[type=checkbox]:checked::before { content: ''; width: 9px; height: 5px; margin-top: -2px; border: solid var(--space); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
:is(#setup, .panel) select option { background: #0c1422; color: var(--cloud); }
/* the slider: a thin line like the progress bar, lit up to the handle (--at is kept by the script) */
:is(#setup, .panel) input[type=range] { appearance: none; -webkit-appearance: none; height: 18px; background: none; cursor: pointer; }
:is(#setup, .panel) input[type=range]::-webkit-slider-runnable-track { height: 3px; background: linear-gradient(to right, var(--limb) var(--at, 70%), rgb(147 166 192 / .3) var(--at, 70%)); }
:is(#setup, .panel) input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; margin-top: -6px; border: 0; border-radius: 50%; background: var(--cloud); }
:is(#setup, .panel) input[type=range]::-moz-range-track { height: 3px; background: rgb(147 166 192 / .3); }
:is(#setup, .panel) input[type=range]::-moz-range-progress { height: 3px; background: var(--limb); }
:is(#setup, .panel) input[type=range]::-moz-range-thumb { width: 15px; height: 15px; border: 0; border-radius: 50%; background: var(--cloud); }
:is(#setup, .panel) input[type=range]:hover::-webkit-slider-thumb { background: #fff; }
:is(#setup, .panel) input[type=range]:hover::-moz-range-thumb { background: #fff; }
@media (prefers-reduced-motion: reduce) { :is(#setup, .panel) input[type=radio]::before { transition: none; } }

/* ---- short lists that open under a button (ui/sitemenu.js): the start page's bar, and the site menu of every page ---- */
.nav-group { position: relative; }
.nav-group > .top::after { content: ""; display: inline-block; width: .4em; height: .4em; margin-left: .5em; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-.22em) rotate(45deg); opacity: .7; }
.nav-drop { display: none; position: absolute; top: 100%; right: 0; z-index: 40; min-width: 12.5em; padding: 6px; background: #0a1220; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 12px 32px rgb(0 0 0 / .55); }
.nav-group.open > .nav-drop { display: grid; }
.nav-drop :is(button, a) { font: inherit; font-size: 15px; text-align: left; text-decoration: none; white-space: nowrap; color: var(--cloud); background: none; border: 0; border-radius: 3px; padding: 9px 12px; cursor: pointer; opacity: 1; }
.nav-drop :is(button, a):is(:hover, :focus-visible) { background: var(--now); outline: none; }
/* where you are: the row filled, its words bright, a thin line all the way round it (a mark on one side only read as a sliver) */
.nav-drop [aria-current] { background: var(--now); color: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px var(--now-line); }
.nav-drop [aria-current]:is(:hover, :focus-visible) { background: rgb(109 180 242 / .24); }
.nav-drop [hidden] { display: none; }
.nav-drop hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 6px; }
.nav-drop.to-right, #tabs > .nav-group:first-child > .nav-drop { left: 0; right: auto; }
.site-menu > .top { display: inline-flex; align-items: center; gap: .45em; font: inherit; font-size: 13px; color: var(--cloud); background: var(--well); border: 1px solid var(--line); border-radius: 3px; padding: 4px 10px 4px 7px; cursor: pointer; }
.site-menu > .top img { width: 18px; height: 18px; }
.site-menu.open > .top { border-color: var(--limb); }
/* The workshops want a mouse, a keyboard and a wide screen: a phone or a tablet is not shown the way to them. */
@media (max-width: 560px), (pointer: coarse) and (hover: none) { .desk { display: none !important; } }
@media (pointer: coarse) { .site-menu > .top { padding: 8px 12px 8px 9px; } .nav-drop :is(button, a) { padding: 12px 14px; } }
