/* The rules every page uses. Each page's stylesheet comes after this one and adds its own */

/* The fonts: body text, and headings with the site's name. Text sizes are in rem, so they follow the base size the
   player sets in their browser (16px unless they change it). Body text is 1rem, and each heading size is 1.25
   times the one below it; small text, such as hints and the footer, is 14px at the default */
:root {
	--font-body: 'Nunito', sans-serif;
	--font-heading: 'Alegreya', serif;
	--font-size-small: 0.875rem;
	--font-size-h3: 1.25rem;
	--font-size-h2: 1.5625rem;
	--font-size-h1: 1.953rem;
}

html,
body {
	margin: 0;
	padding: 0;
	height: 100%;
	background: #111;
}

body {
	display: flex;
	flex-direction: column;
	font-family: var(--font-body);
	color: #eee;
}

:root[data-translating] body {
	visibility: hidden;
	animation: show-untranslated 0s 1s forwards;
}

@keyframes show-untranslated {
	to {
		visibility: visible;
	}
}
[hidden] {
	display: none !important;
}

:focus-visible {
	outline: 2px solid #ffd54f;
	outline-offset: 2px;
}

[tabindex="-1"]:focus {
	outline: none;
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.shortcut-letter {
	text-decoration: underline;
	text-underline-offset: 2px;
}

kbd {
	font-family: inherit;
}

.shortcuts-explanation {
	color: #999;
}

.shortcuts-list {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 8px 16px;
	margin: 16px 0;
}
.shortcuts-list dt,
.shortcuts-list dd {
	margin: 0;
}
.shortcuts-list kbd {
	padding: 1px 6px;
	border: 1px solid #555;
	border-radius: 4px;
	background: #1d1f27;
}

main {
	display: flex;
	flex: 1;
	min-height: 0;
}

h1,
h2 {
	margin: 0;
}

/* A page's h1 is its title in the toolbar, the same size as the site's name beside it and the page's h2s */
h1 {
	font-size: var(--font-size-h2);
}

h2 {
	font-size: var(--font-size-h2);
}

h3 {
	margin: 1em 0 0.5em;
	font-size: var(--font-size-h3);
}

h1,
h2,
h3,
h4,
h5,
h6,
.site-name {
	font-family: var(--font-heading);
	line-height: 1.25;
}

button,
input,
select,
textarea {
	font: inherit;
	border-radius: 4px;
}

button,
a.button,
a.button:visited {
	padding: 6px 14px;
	border: 1px solid #4caf50;
	background: #2e7d32;
	color: #fff;
	cursor: pointer;
}
button:hover,
a.button:hover,
a.button:visited:hover {
	background: #388e3c;
}
button:disabled,
a.button:disabled,
a.button:visited:disabled {
	opacity: 0.5;
	cursor: default;
}
button .icon,
a.button .icon,
a.button:visited .icon {
	margin-inline-end: 6px;
}

a.button {
	display: inline-block;
	border-radius: 4px;
	text-decoration: none;
}

.icon {
	flex-shrink: 0;
	width: round(1.15em, 1px);
	height: round(1.15em, 1px);
	vertical-align: -0.2em;
}

input,
select,
textarea {
	padding: 6px 8px;
	border: 1px solid #444;
	background: #1d1f27;
	color: #eee;
}
input:disabled,
select:disabled,
textarea:disabled {
	opacity: 0.7;
}

input[data-code] {
	--code-cells: 6;
	--code-gap: 0.7ch;
	box-sizing: content-box;
	align-self: center;
	width: calc(var(--code-cells) * (1ch + var(--code-gap)));
	max-width: calc(100% - 32px);
	padding: 8px calc(16px - var(--code-gap)) 14px 16px;
	font-family: Consolas, Menlo, monospace;
	font-size: 1.75rem;
	font-weight: bold;
	letter-spacing: var(--code-gap);
	text-transform: uppercase;
	background-image: repeating-linear-gradient(to right, #555 0 1ch, transparent 1ch calc(1ch + var(--code-gap)));
	background-origin: content-box;
	background-repeat: no-repeat;
	background-size: calc(var(--code-cells) * (1ch + var(--code-gap)) - var(--code-gap)) 2px;
	background-position: left 0 bottom -6px;
}
input[data-code].code-long {
	--code-cells: 11;
	--code-gap: 0.1ch;
	background-image: none;
}

.form label:has(> input[data-code]) {
	align-items: center;
}

button.danger {
	border-color: #c62828;
	background: #8e1c1c;
}
button.danger:hover {
	background: #a52222;
}

button.draft {
	border-color: #9c4dcc;
	background: #6a1b9a;
}
button.draft:hover {
	background: #7b1fa2;
}

button.link-button {
	padding: 0;
	border: none;
	background: none;
	color: #00B2EE;
	text-align: left;
	text-decoration: underline;
}
button.link-button:hover {
	background: none;
	color: #ffd54f;
}

button.sort-button {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 0;
	border: none;
	background: none;
	color: inherit;
	text-align: left;
}
button.sort-button:hover {
	background: none;
	text-decoration: underline;
}
button.sort-button .sort-icon {
	display: inline-flex;
}
button.sort-button .sort-icon.unsorted {
	opacity: 0.5;
}

.screen {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
}

.panel {
	padding: 16px;
	border: 1px solid #333;
	border-radius: 6px;
	background: #181a20;
}

#status-screen {
	align-items: center;
	justify-content: center;
}

#notice-screen {
	align-items: center;
	justify-content: center;
	gap: 12px;
}

.toolbar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border-bottom: 1px solid #333;
}
.toolbar a,
.toolbar a:visited {
	color: #FFF;
}

.site-name {
	color: #eee;
	font-size: var(--font-size-h2);
	font-weight: bold;
	text-decoration: none;
	white-space: nowrap;
}

.site-name:hover,
.title-link:hover {
	text-decoration: underline;
}

.title-link {
	color: inherit;
	text-decoration: none;
}

.toolbar > .site-name {
	padding-inline-end: 12px;
	border-inline-end: 1px solid #333;
}

.toolbar-name,
.toolbar-status {
	flex: 1;
	color: #aaa;
}

.toolbar-name strong {
	color: #eee;
}

.account-menu {
	position: relative;
	margin-inline-start: auto;
}
.account-menu[hidden] {
	display: none;
}

.toolbar-link:not([hidden]) ~ .account-menu {
	margin-inline-start: 0;
}

:root[data-account-name] .account-menu[hidden] {
	display: block !important;
}

:root[data-account-name] .account-menu-name:empty::before {
	content: var(--account-name);
}

.account-menu-button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 8px;
	border-color: transparent;
	background: none;
	color: #aaa;
	white-space: nowrap;
}
.account-menu-button:hover, .account-menu-button[aria-expanded=true] {
	background: #262933;
	color: #eee;
}
.account-menu-button .icon {
	margin-inline-end: 0;
}

.account-menu-list {
	position: absolute;
	inset-inline-end: 0;
	top: calc(100% + 4px);
	z-index: 10;
	min-width: 180px;
	margin: 0;
	padding: 4px;
	border: 1px solid #333;
	border-radius: 6px;
	background: #181a20;
	list-style: none;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.account-menu-item {
	display: flex;
	align-items: center;
	gap: 8px;
	box-sizing: border-box;
	width: 100%;
	padding: 8px 10px;
	border: none;
	border-radius: 4px;
	background: none;
	color: #eee;
	text-align: left;
	text-decoration: none;
	white-space: nowrap;
}
.account-menu-item:hover, .account-menu-item:focus {
	background: #262933;
}
.account-menu-item .icon {
	margin-inline-end: 0;
}

.toolbar-time {
	color: #aaa;
	white-space: nowrap;
}

.toolbar-link {
	margin-inline-start: auto;
}

.toolbar-link + .toolbar-link {
	margin-inline-start: 0;
}

.toasts {
	position: fixed;
	top: 16px;
	left: 50%;
	z-index: 20;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	width: min(560px, 100% - 32px);
	transform: translateX(-50%);
	pointer-events: none;
}

.toast {
	padding: 10px 14px;
	border: 1px solid #444;
	border-radius: 4px;
	background: #181a20;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
	color: #eee;
	cursor: pointer;
	pointer-events: auto;
}

.toast.success {
	border-color: #81c784;
	background: #334633;
	color: #FFF;
}

.toast.closing {
	pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
	.toast {
		animation: toast-in 150ms ease-out;
	}
	.toast.closing {
		animation: toast-out 300ms ease-in forwards;
	}
}
@keyframes toast-in {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}
}
@keyframes toast-out {
	to {
		opacity: 0;
	}
}
input.money {
	max-width: 20ch;
}

.notice {
	margin: 12px 16px 0;
	padding: 8px 12px;
	border: 1px solid #8d6e1f;
	border-radius: 4px;
	background: #3a2f12;
	color: #f5d58a;
}

button.secondary,
a.button.secondary {
	border-color: #555;
	background: #2a2d36;
}
button.secondary:hover,
a.button.secondary:hover {
	background: #353945;
}

.panel-heading {
	display: flex;
	align-items: center;
	gap: 12px;
}
.panel-heading h2 {
	flex: 1;
}

.universe-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 12px 0;
	padding: 0;
	list-style: none;
}
.universe-list a,
.universe-list a:visited {
	color: #FFF;
}

button.universe-item,
a.button.universe-item {
	display: flex;
	flex-direction: column;
	gap: 4px;
	box-sizing: border-box;
	width: 100%;
	padding: 10px 14px;
	border-color: #333;
	background: #1d1f27;
	text-align: left;
}
button.universe-item:hover,
a.button.universe-item:hover {
	border-color: #4caf50;
	background: #232631;
}

.universe-ruleset {
	font-size: var(--font-size-small);
	color: #999;
}

.universe-empty {
	color: #999;
}

.player-username {
	color: #999;
	white-space: nowrap;
}

.filters {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 12px;
	margin-bottom: 12px;
}
.filters label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	color: #aaa;
}
.filters label.checkbox {
	flex-direction: row;
	align-items: center;
	gap: 6px;
	min-height: 32px;
}
.filters input[type=search] {
	flex: 1;
	min-width: 180px;
}

.pager {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 12px;
	margin-top: 12px;
	color: #aaa;
}

.dialog {
	width: min(560px, 100vw - 32px);
	color: #eee;
}
.dialog::backdrop {
	background: rgba(0, 0, 0, 0.6);
}

.dialog-buttons,
.form-buttons {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
}

.form-buttons .danger {
	margin-right: auto;
}

.form,
fieldset.plain,
.form-group {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

fieldset.plain {
	margin: 0;
	padding: 0;
	border: none;
	min-width: 0;
}

fieldset.choice {
	display: flex;
	gap: 16px;
	margin: 0;
	padding: 8px 12px;
	border: 1px solid #333;
	border-radius: 4px;
}

fieldset.choice legend {
	padding: 0 4px;
	color: #aaa;
}

fieldset.choice.stacked {
	flex-direction: column;
	gap: 10px;
}

.form label.described-choice {
	align-items: flex-start;
}
.form label.described-choice input {
	margin-top: 3px;
}

.choice-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.choice-description {
	font-size: var(--font-size-small);
	color: #999;
}

.form label,
.field-label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	color: #aaa;
}
.form label > div:empty,
.field-label > div:empty {
	margin-top: -4px;
}

.social-label .icon {
	margin-inline-end: 6px;
}

.password-field {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}
.password-field label {
	flex: 1;
}

button.password-toggle {
	padding: 6px 10px;
}
button.password-toggle .icon {
	margin-inline-end: 0;
}
button.password-toggle[aria-pressed=false] .password-shown-icon, button.password-toggle[aria-pressed=true] .password-hidden-icon {
	display: none;
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.chip {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 2px 4px 2px 10px;
	border: 1px solid #444;
	border-radius: 999px;
	background: #2a2d36;
	color: #eee;
}

button.chip-remove {
	display: flex;
	padding: 2px;
	border: none;
	border-radius: 999px;
	background: transparent;
	color: #aaa;
}
button.chip-remove:hover {
	background: #353945;
	color: #eee;
}
button.chip-remove .icon {
	margin-inline-end: 0;
}

button.player-search-clear {
	display: inline-flex;
	margin-inline-start: 4px;
	font-size: var(--font-size-small);
	vertical-align: middle;
}

.combobox-field {
	position: relative;
	display: flex;
	flex-direction: column;
}

.combobox-options {
	position: absolute;
	top: 100%;
	inset-inline: 0;
	z-index: 10;
	max-height: 240px;
	margin: 2px 0 0;
	padding: 4px 0;
	overflow-y: auto;
	border: 1px solid #444;
	border-radius: 4px;
	background: #1d1f27;
	list-style: none;
}
.combobox-options [role=option] {
	padding: 4px 8px;
	color: #eee;
	cursor: pointer;
}
.combobox-options [aria-selected=true] {
	outline: 1px solid #ffd54f;
	outline-offset: -1px;
	background: #232631;
}
.combobox-options .combobox-empty {
	color: #999;
	cursor: default;
}

.combobox-detail {
	font-size: var(--font-size-small);
	color: #999;
}

.form label.checkbox {
	flex-direction: row;
	align-items: center;
	gap: 8px;
	color: #eee;
}

.form p {
	margin: 0;
}

.form .hint {
	font-size: var(--font-size-small);
	color: #999;
}

input.username-input {
	max-width: 22ch;
}

input.username-input[type=search]::-webkit-search-cancel-button {
	appearance: none;
}

.form-error {
	color: #ef9a9a;
}

.field-error {
	margin: 0;
	font-size: var(--font-size-small);
	color: #ef9a9a;
}

.field-message-slot {
	min-height: 1lh;
}

.field-beside {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 12px;
}
.field-beside > input,
.field-beside > .combobox-field {
	flex: 0 1 22ch;
	min-width: 0;
}
.field-beside > .field-message-slot {
	flex: 1 1 10em;
}
.field-beside .combobox-options {
	inset-inline-end: auto;
	width: max-content;
	min-width: 100%;
	max-width: min(32em, 100vw - 32px);
}

.field-error.field-success {
	color: #81c784;
}

input.field-checking {
	padding-inline-end: calc(8px + 1.2em + 6px);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='%23aaa' d='M232 128a104 104 0 0 1-208 0c0-41 23.81-78.36 60.66-95.27a8 8 0 0 1 6.68 14.54C60.15 61.59 40 93.27 40 128a88 88 0 0 0 176 0c0-34.73-20.15-66.41-51.34-80.73a8 8 0 0 1 6.68-14.54C208.19 49.64 232 87 232 128'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 8px center;
	background-size: 1.2em;
}

@media (prefers-reduced-motion: no-preference) {
	input.field-checking {
		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='%23aaa' d='M232 128a104 104 0 0 1-208 0c0-41 23.81-78.36 60.66-95.27a8 8 0 0 1 6.68 14.54C60.15 61.59 40 93.27 40 128a88 88 0 0 0 176 0c0-34.73-20.15-66.41-51.34-80.73a8 8 0 0 1 6.68-14.54C208.19 49.64 232 87 232 128'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 128 128' to='360 128 128' dur='0.8s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E");
	}
}
[aria-invalid=true] {
	border-color: #c62828;
}

.form-saved {
	color: #81c784;
}

a,
a:visited {
	color: #00B2EE;
}

.markdown {
	overflow-wrap: anywhere;
}
.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
	margin: 1em 0 0.5em;
	line-height: 1.25;
	font-weight: bold;
}
.markdown h1 {
	font-size: var(--font-size-h1);
}
.markdown h2 {
	font-size: var(--font-size-h2);
}
.markdown h3 {
	font-size: var(--font-size-h3);
}
.markdown h4 {
	font-size: 1.125rem;
}
.markdown h5 {
	font-size: 1rem;
}
.markdown h6 {
	font-size: var(--font-size-small);
	color: #aaa;
}
.markdown p {
	margin: 1em 0;
}
.markdown :first-child {
	margin-top: 0;
}
.markdown :last-child {
	margin-bottom: 0;
}
.markdown pre,
.markdown code {
	background: #23252e;
}
.markdown pre {
	overflow-x: auto;
	padding: 8px;
}
.markdown table {
	border-collapse: collapse;
}
.markdown th,
.markdown td {
	padding: 4px 8px;
	border: 1px solid #333;
}
.markdown blockquote {
	margin-left: 0;
	padding-left: 12px;
	border-left: 3px solid #444;
	color: #bbb;
}

footer {
	padding: 8px 16px;
	font-size: var(--font-size-small);
	text-align: center;
	color: #999;
}
footer a,
footer a:visited,
footer .link-button {
	color: #ccc;
}
footer a:hover,
footer a:visited:hover,
footer .link-button:hover {
	color: #00B2EE;
}
footer .link-button {
	font-size: inherit;
}
footer .language-picker select {
	margin-top: 4px;
	margin-left: 4px;
	padding: 2px 4px;
}
footer .site-socials {
	display: inline-flex;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
	vertical-align: middle;
}
footer .site-socials a {
	display: inline-flex;
}
footer .site-socials .icon {
	width: 16px;
	height: 16px;
}
