:root {
	color-scheme: dark;
	--bg: #0b0b0b;
	--bg-alt: #141414;
	--fg: #d8d8d8;
	--fg-dim: #8a8a8a;
	--line: #2a2a2a;
	--accent: #7ac0ff;
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
}

#root,
astro-island,
.app-root {
	height: 100%;
	min-height: 0;
}

#root,
astro-island {
	display: block;
	flex: 1;
}

.app-root {
	display: flex;
	flex-direction: column;
}

body {
	margin: 0;
	display: flex;
	flex-direction: column;
	background: var(--bg);
	color: var(--fg);
	font:
		13px/1.4 ui-monospace,
		SFMono-Regular,
		Menlo,
		Consolas,
		monospace;
}

a {
	color: var(--accent);
}

button {
	padding: 2px 8px;
	border: 1px solid var(--line);
	background: var(--bg-alt);
	color: var(--fg);
	font: inherit;
	cursor: pointer;
}

button:hover:not(:disabled) {
	border-color: var(--fg-dim);
	color: #fff;
}

button:disabled {
	opacity: 0.35;
	cursor: default;
}

button[aria-pressed="true"] {
	border-color: var(--accent);
	color: var(--accent);
}

.toolbar {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 5px 6px;
	background: var(--bg-alt);
	border-bottom: 1px solid var(--line);
}

.toolbar__left,
.toolbar__right {
	display: flex;
	gap: 4px;
}

.omnibox {
	flex: 1;
	min-width: 0;
}

.omnibox input {
	width: 100%;
	padding: 3px 6px;
	border: 1px solid var(--line);
	background: var(--bg);
	color: var(--fg);
	font: inherit;
}

.omnibox input:focus {
	outline: 0;
	border-color: var(--accent);
}

.menu {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	padding: 5px 6px;
	background: var(--bg-alt);
	border-bottom: 1px solid var(--line);
}

.menu[hidden] {
	display: none;
}

.popup {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: grid;
	place-items: center;
	padding: 18px;
	background: rgb(0 0 0 / 0.62);
	backdrop-filter: blur(6px);
}

.popup[hidden] {
	display: none;
}

.popup__panel {
	width: min(48rem, 100%);
	height: min(42rem, calc(100vh - 36px));
	display: grid;
	grid-template-rows: auto minmax(0, 1fr);
	border: 1px solid var(--line);
	background: var(--bg);
	box-shadow: 0 20px 60px rgb(0 0 0 / 0.45);
}

.popup__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 34px;
	padding: 4px 6px 4px 12px;
	border-bottom: 1px solid var(--line);
	background: var(--bg-alt);
	font-weight: 700;
}

.popup__frame {
	width: 100%;
	height: 100%;
	border: 0;
	background: var(--bg);
}

.tabs {
	display: flex;
	overflow-x: auto;
	gap: 1px;
	padding: 4px 6px;
	background: var(--bg-alt);
	border-bottom: 1px solid var(--line);
}

.tab {
	flex: 1 0 9rem;
	min-width: 7rem;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 2px 6px;
	border: 1px solid var(--line);
	background: var(--bg);
	color: var(--fg-dim);
	cursor: default;
	user-select: none;
}

.tab--active {
	border-color: var(--accent);
	color: var(--fg);
}

.tab__label {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tab__close {
	padding: 0 3px;
	border: 0;
	background: none;
	color: var(--fg-dim);
}

.status {
	margin: 0;
	padding: 3px 8px;
	background: var(--bg-alt);
	border-bottom: 1px solid var(--line);
	color: var(--fg-dim);
}

.status[hidden] {
	display: none;
}

.frames {
	position: relative;
	flex: 1;
	min-height: 0;
}

.frame {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: none;
	background: var(--bg);
}

.frame--active {
	display: block;
}

.internal {
	max-width: 46rem;
	margin: 0;
	padding: 18px 16px 40px;
}

.internal h1 {
	margin: 0 0 4px;
	font-size: 15px;
	font-weight: 700;
}

.internal h1 + p {
	margin: 0 0 20px;
	color: var(--fg-dim);
}

.internal h2 {
	margin: 24px 0 8px;
	padding-bottom: 3px;
	border-bottom: 1px solid var(--line);
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--fg-dim);
}

.internal ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.internal li {
	padding: 3px 0;
	border-bottom: 1px solid var(--line);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.internal li .dim {
	color: var(--fg-dim);
}

.field {
	display: grid;
	grid-template-columns: 14rem minmax(0, 1fr);
	gap: 4px 12px;
	align-items: start;
	padding: 8px 0;
	border-bottom: 1px solid var(--line);
}

.field > label {
	padding-top: 3px;
}

.field__help {
	grid-column: 2;
	margin: 0;
	color: var(--fg-dim);
}

.field input[type="text"],
.field input[type="url"],
.field select {
	width: 100%;
	padding: 3px 6px;
	border: 1px solid var(--line);
	background: var(--bg);
	color: var(--fg);
	font: inherit;
}

.field input[type="text"]:focus,
.field input[type="url"]:focus,
.field select:focus {
	outline: 0;
	border-color: var(--accent);
}

.field input[type="checkbox"] {
	justify-self: start;
	margin: 4px 0 0;
	accent-color: var(--accent);
}

.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 16px;
}

@media (max-width: 40rem) {
	button {
		min-height: 30px;
	}

	.toolbar {
		flex-wrap: wrap;
	}

	.omnibox {
		order: 3;
		flex-basis: 100%;
	}

	.toolbar__right {
		margin-left: auto;
	}

	.field {
		grid-template-columns: minmax(0, 1fr);
	}

	.field__help {
		grid-column: 1;
	}

	.internal li {
		white-space: normal;
		overflow-wrap: anywhere;
	}
	.popup {
		padding: 8px;
	}

	.popup__panel {
		height: calc(100vh - 16px);
	}
}
