* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
}

body {
	display: flex;
	min-height: 100svh;
	flex-direction: column;
	background: #000 url("/black.jpg") center center / cover fixed no-repeat;
	color: #ddd;
	font-family: "Courier New", Courier, monospace;
}

.PageHeader {
	width: min(98vw, 1440px);
	margin: 0 auto;
	padding-top: 1.5rem;
	text-align: center;
}

.PageHeader h1 {
	margin: 0;
	font-size: clamp(1rem, 2.4vw, 1.6rem);
	font-weight: normal;
}

.RadioPage {
	display: flex;
	flex: 1;
}

.RadioLayout {
	display: grid;
	width: min(98vw, 1440px);
	grid-template-columns: minmax(0, 1fr) minmax(24rem, 28rem);
	align-items: start;
	gap: 1rem;
	margin: auto;
	padding: clamp(1rem, 4vh, 2.5rem) 0 2rem;
}

.VisualNovelLayout {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.ScenePanel {
	position: relative;
}

.SceneStage {
	position: relative;
	aspect-ratio: 978 / 404;
	overflow: hidden;
	border: 3px solid #fff;
	background: #000;
}

#SceneImage {
	position: absolute;
	top: -23.02%;
	left: -15.34%;
	display: block;
	width: 130.88%;
}

#SceneImage[hidden] {
	display: none;
}

#SceneErrorMessage {
	position: absolute;
	max-width: 90%;
	color: #ffb5b5;
	text-align: center;
}

.SceneLabel {
	position: absolute;
	z-index: 1;
	bottom: -0.8rem;
	left: 4%;
	width: min(340px, 56vw);
}

.SceneLabel img {
	display: block;
	width: 100%;
	height: auto;
}

.SceneLabel > span {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.15rem;
	padding: 0 0.25rem;
	font-size: clamp(0.55rem, 1.2vw, 0.85rem);
	line-height: 1.1;
	text-align: center;
	white-space: nowrap;
}

#TrackTitle {
	margin-left: 0.25rem;
}

.RadioFrame {
	position: relative;
	height: clamp(185px, 28vh, 230px);
	flex: none;
	background: #000 url("/frame.png") center / 100% 100% no-repeat;
}

.RadioFrameContent {
	position: absolute;
	inset: 10% 8%;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 0.7rem;
	overflow: hidden;
	font-size: 1.15rem;
	text-align: left;
}

.RadioFrameContent p {
	margin: 0;
}

.RadioDetails {
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
	font-size: 1.05rem;
}

.RadioControls {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
}

.RadioControls button,
.RadioDialog button,
.ChatForm button,
.ChatHeader button,
#OpenChatButton {
	border: 1px solid #aaa;
	border-radius: 0;
	padding: 0.4rem 0.75rem;
	background: #000;
	color: #ddd;
	font: inherit;
	cursor: pointer;
}

.RadioControls button:disabled {
	color: #888;
	cursor: default;
}

.ChatForm button:disabled {
	color: #888;
	cursor: default;
}

.ChatHeader button {
	padding: 0.1rem 0.35rem;
}

#OpenChatButton {
	display: block;
	margin-left: auto;
}

#OpenChatButton[hidden] {
	display: none;
}

.RadioControls .SiteControlStart {
	margin-left: 0.75rem;
}

.ChatSidebar {
	min-width: 0;
}

.ChatPanel {
	display: flex;
	height: clamp(22rem, 55vh, 38rem);
	flex-direction: column;
	border: 3px solid #fff;
	padding: 0.8rem;
	background: #000;
}

.ChatPanel[hidden] {
	display: none;
}

.ChatHeader {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.6rem;
}

.ChatHeader h2 {
	margin: 0;
	font-size: 1rem;
	font-weight: normal;
}

.ChatMessages {
	min-height: 0;
	flex: 1;
	overflow-y: auto;
	margin-bottom: 0.75rem;
	border: 1px solid #666;
	padding: 0.5rem;
}

.ChatMessages p {
	margin: 0 0 0.35rem;
	overflow-wrap: anywhere;
}

.ChatForm {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: end;
	gap: 0.5rem;
}

.ChatForm label {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.ChatForm .ChatNameField {
	grid-column: 1 / -1;
}

.ChatForm .ChatTextField {
	min-width: 0;
}

.ChatForm input {
	width: 100%;
	min-width: 0;
	border: 1px solid #aaa;
	border-radius: 0;
	padding: 0.35rem;
	background: #000;
	color: #ddd;
	font: inherit;
}

.RadioDialog {
	width: min(90vw, 46rem);
	min-height: min(17rem, 60vh);
	border: 2px solid #ddd;
	padding: 1.5rem;
	background: #000;
	color: #ddd;
	font: inherit;
}

.CreditsDialog {
	width: min(90vw, 52rem);
	min-height: min(26rem, 75vh);
}

.TrackListDialog {
	width: min(90vw, 42rem);
	height: min(80vh, 48rem);
}

.RadioDialog[open] {
	display: flex;
	flex-direction: column;
}

.RadioDialogContent {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
}

#TrackList {
	margin: 0;
	padding-left: 0;
	list-style-position: inside;
	line-height: 1.5;
}

.RadioDialog button {
	align-self: flex-end;
	margin-top: auto;
}

.RadioDialog::backdrop {
	background: rgb(0 0 0 / 80%);
}

.RadioDialog h2,
.RadioDialog p {
	margin: 0 0 1rem;
	font-size: 1rem;
	font-weight: normal;
}

.RadioDialog a,
.RadioDialog a:visited {
	color: #ddd;
	text-decoration-color: #888;
	text-underline-offset: 0.15em;
}

.RadioDialog a:hover,
.RadioDialog a:focus-visible {
	color: #fff;
	text-decoration-color: #fff;
}

#ErrorMessage {
	color: #ffb5b5;
}

#ChatErrorMessage {
	margin: 0.6rem 0 0;
	color: #ffb5b5;
}

#AudioPlayer {
	display: none;
}

@media (max-width: 1000px) {
	.RadioLayout {
		display: flex;
		width: 94vw;
		flex-direction: column;
		gap: 0.8rem;
		padding-top: 4vh;
		padding-bottom: 1.5rem;
	}

	.VisualNovelLayout {
		width: 100%;
		gap: 0.8rem;
	}

	.PageHeader {
		width: 94vw;
	}

	.ChatSidebar {
		width: 100%;
	}

	.ChatPanel {
		height: 24rem;
		max-height: 60vh;
		min-height: 14rem;
	}

	.SceneLabel {
		width: min(340px, 88vw);
	}

	.RadioFrame {
		height: clamp(175px, 28vh, 220px);
	}
}

@media (max-height: 540px) {
	.RadioLayout {
		gap: 0.6rem;
		padding-top: 1rem;
		padding-bottom: 1rem;
	}

	.VisualNovelLayout {
		gap: 0.6rem;
	}

	.PageHeader {
		padding-top: 1rem;
	}

	.RadioFrame {
		height: 170px;
	}

	.ChatPanel {
		height: min(75vh, 32rem);
	}
}
