/* Shared game shell styles: fullscreen-capable canvas stage + rules popup. */

/* Game pages fill the viewport exactly and never scroll: the body is locked
   to 100dvh and the flex column (header / container / footer) is allowed to
   shrink via min-height:0 so the canvas stage takes the remaining space. */
body.game-page {
	overflow: hidden;
}

body.game-page .container {
	min-height: 0;
	display: flex;
	flex-direction: column;
}

body.game-page .content {
	min-height: 0;
	flex: 1;
	display: flex;
	flex-direction: column;
}

body.game-page .game-shell {
	flex: 1;
	min-height: 0;
}

.game-shell {
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 100%;
	height: 100%;
}

/* Toolbar with fullscreen and rules controls. */
.game-toolbar {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	flex-wrap: wrap;
}

.game-btn {
	position: relative;
	padding: 6px 14px;
	font-family: inherit;
	font-size: 14px;
	cursor: pointer;
	background: #222;
	color: #eee;
	border: 1px solid #555;
	border-radius: 4px;
}

.game-btn:hover {
	background: #333;
}

/* The stage is the element that goes fullscreen; the canvas fills it. */
.game-stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 320px;
	/* Default fallback; BaseGameController overrides this inline per-game. */
	background: #0b1020;
	border: 1px solid #333;
	border-radius: 6px;
	overflow: hidden;
}

.game-stage:fullscreen {
	width: 100vw;
	height: 100vh;
	border: none;
	border-radius: 0;
}

.game-stage::backdrop {
	background: #000;
}

#game-canvas {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	width: 100%;
	height: 100%;
	touch-action: none;
}

/* Rules modal. */
.game-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.game-modal[hidden] {
	display: none;
}

.game-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
}

.game-modal-dialog {
	position: relative;
	width: min(520px, 90vw);
	max-height: 80vh;
	display: flex;
	flex-direction: column;
	background-color: #DDD;
	color: #222;
	border-image: url(https://us-ord-1.linodeobjects.com/gamegoat-static/template/nine-red-box.gif) 11 11 11 11 fill / 11px 11px 11px 11px;
	border-radius: 6px;
	box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
}

.game-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	border-bottom: 1px solid #999;
}

.game-modal-header h2 {
	margin: 0;
	font-size: 18px;
}

/* The modal close button matches the site's gold button theme. */
.game-modal-close {
	background-color: gold;
	color: #222;
	border-color: goldenrod;
	border-style: outset;
}

.game-modal-close:hover {
	background-color: #ffd700;
}

.game-modal-close:active {
	border-style: inset;
}

.game-modal-body {
	padding: 16px;
	overflow-y: auto;
	line-height: 1.5;
}

.game-modal-body h3 {
	margin: 12px 0 6px;
	color: #1e7a3a;
}

.game-modal-body ul {
	margin: 6px 0;
	padding-left: 20px;
}

/* Settings panel rows. */
.game-setting {
	padding: 10px 0;
	border-bottom: 1px solid #999;
}

.game-setting:last-child {
	border-bottom: none;
}

.game-setting-label {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
}

.game-setting-label input[type="checkbox"] {
	width: 16px;
	height: 16px;
	accent-color: goldenrod;
	cursor: pointer;
}

/* Radio group: a fieldset with a legend label and inline options. */
.game-setting-radio {
	border: none;
	margin: 0;
	padding: 0;
}

.game-setting-radio legend.game-setting-label {
	margin-bottom: 6px;
}

.game-setting-radio-option {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 4px 0;
	cursor: pointer;
}

.game-setting-radio-option input[type="radio"] {
	width: 16px;
	height: 16px;
	accent-color: goldenrod;
	cursor: pointer;
}
