:root {
	--navy-blue: #003366;
	--button-blue: rgb(47, 85, 151);
	--teal: #0d9488;
	--bg-start: #e0f7fa;
	--bg-end: #b3e5fc;
	--dark-grey: #333;
	--emergency-color: rgb(127, 127, 127);
	--ambulatory-color: rgb(35, 146, 210);
	--inpatient-color: rgb(72, 90, 162);
	--correct-glow: 0 0 25px 5px rgba(76, 175, 80, 0.8);
	--incorrect-glow: 0 0 25px 5px rgba(244, 67, 54, 0.8);
	--hover-glow: 0 0 25px 5px rgba(13, 148, 136, 0.7);
}
* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}
html {
	height: 100%;
}
body {
	font-family: "Roboto", sans-serif;
	background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
	color: var(--navy-blue);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	min-height: 100%;
	text-align: center;
	overflow-y: auto;
	padding: 20px 0 100px 0;
}
#app {
	width: 100%;
	max-width: 950px;
	padding: 20px;
}
.screen {
	display: none;
}
.screen.active {
	display: block;
}
.container {
	width: 100%;
	padding: 20px;
	background-color: rgba(255, 255, 255, 0.85);
	border-radius: 15px;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
h1,
h2,
h3 {
	font-family: "Cascadia Code", monospace;
}
h1 {
	font-size: 2.2em;
	margin-bottom: 20px;
}
h2 {
	font-size: 1.8em;
	margin-bottom: 15px;
}
h3 {
	font-size: 1.4em;
	margin-bottom: 10px;
}
p {
	line-height: 1.6;
	margin-bottom: 20px;
	max-width: 650px;
	margin-left: auto;
	margin-right: auto;
}
button {
	font-family: "Cascadia Code", monospace;
	font-size: 1.1em;
	padding: 12px 25px;
	border-radius: 8px;
	border: none;
	cursor: pointer;
	background-color: var(--button-blue);
	color: white;
	transition:
		background-color 0.3s,
		transform 0.1s;
	margin: 5px;
}
button:hover:not(:disabled) {
	background-color: var(--navy-blue);
	transform: translateY(-2px);
}
button:disabled {
	background-color: #999;
	cursor: not-allowed;
}
.begin-round-btn {
	background-color: var(--teal);
}
input[type="text"] {
	padding: 10px;
	font-size: 1em;
	border-radius: 5px;
	border: 1px solid #ccc;
	width: 80%;
	max-width: 350px;
	margin-top: 5px;
	text-align: center;
}
.disclaimer {
	font-size: 0.8em;
	color: #666;
	margin-top: 25px;
	padding: 0 20px;
}
.fixed-ui-container {
	position: fixed;
	top: 15px;
	right: 15px;
	z-index: 1000;
}
#sound-toggle-btn,
#pause-btn {
	font-size: 1.5em;
	padding: 5px 10px;
}
.footer-bar {
	position: fixed;
	bottom: 0;
	left: 0;
	width: 100%;
	background-color: white;
	padding: 10px;
	box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
	z-index: 999;
	text-align: center;
}
.footer-bar img {
	max-height: 40px;
}
.container.welcome-screen {
	color: var(--dark-grey);
}
.round-banner {
	padding: 10px;
	color: white;
	font-family: "Cascadia Code", monospace;
	font-size: 2em;
	border-radius: 8px;
	margin: 0 auto 5px auto;
	width: 100%;
	transition: background-color 0.5s;
}
#timer {
	font-size: 2.5em;
	font-family: "Cascadia Code";
	margin-bottom: 10px;
	transition: color 0.5s;
}
#timer.warning {
	color: red;
}
#card-counter {
	font-size: 1.2em;
	font-family: "Cascadia Code";
	margin-bottom: 10px;
}
@keyframes flash {
	0%,
	100% {
		border-color: var(--navy-blue);
	}
	50% {
		border-color: var(--teal);
	}
}
#game-card {
	width: 400px;
	height: 110px;
	background-color: var(--teal);
	color: white;
	border: 4px solid var(--navy-blue);
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.5em;
	font-weight: bold;
	cursor: grab;
	user-select: none;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
	word-wrap: break-word;
	padding: 5px;
	animation: flash 1.5s infinite;
	transition:
		background-color 0.5s,
		color 0.5s;
}
#game-card.dragging {
	background-color: var(--navy-blue);
	color: white;
	animation: none;
}
.drop-zone-container {
	display: flex;
	justify-content: space-around;
	width: 100%;
	gap: 20px;
}
.drop-zone {
	width: 220px;
	padding: 15px;
	border: 3px dashed #ccc;
	border-radius: 15px;
	transition:
		background-color 0.3s,
		box-shadow 0.3s;
}
.drop-zone img {
	height: 80px;
	width: auto;
	pointer-events: none;
	margin-bottom: 10px;
}
.drop-zone h3 {
	font-family: "Cascadia Code", monospace;
	line-height: 1.2;
}
.drop-zone h3 span {
	font-size: 1.6em;
	font-weight: bold;
	display: block;
}
.drop-zone h3 small {
	font-size: 0.75em;
}
.drop-zone.hover-glow {
	box-shadow: var(--hover-glow);
}
.drop-zone.correct-glow {
	box-shadow: var(--correct-glow);
}
.drop-zone.incorrect-glow {
	box-shadow: var(--incorrect-glow);
}
.score-table,
.debrief-table-container {
	margin: auto;
	padding: 10px;
	background: rgba(255, 255, 255, 0.6);
	border-radius: 10px;
	max-width: 800px;
	overflow-x: auto;
}
table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 15px;
}
th,
td {
	border: 1px solid var(--navy-blue);
	padding: 12px;
	text-align: center;
}
th {
	background-color: var(--navy-blue);
	color: white;
	font-family: "Cascadia Code";
}
.leaderboard-container td {
	text-align: left;
	padding-left: 20px;
}
/* --- CHANGE: New styles for elegant leaderboard table --- */
.leaderboard-container table,
.leaderboard-container th,
.leaderboard-container td {
	border: none;
}
.leaderboard-container tr {
	border-bottom: 1px dotted var(--navy-blue);
}
.leaderboard-container tr:last-child {
	border-bottom: none;
}
#pause-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.7);
	display: none;
	justify-content: center;
	align-items: center;
	z-index: 1001;
	cursor: pointer;
}
#pause-overlay h1 {
	color: white;
	font-size: 4em;
	text-shadow: 2px 2px 5px #000;
}
tfoot td {
	font-weight: bold;
	background-color: #e0e0e0;
}
.logo-riz-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin-top: 20px;
}
#riz-return-btn {
	background-color: var(--navy-blue);
	margin-top: 15px;
}
#riz-return-btn:hover {
	background-color: #000000;
}
.leaderboard-welcome-btn {
	background-color: rgb(133, 186, 206);
	color: white;
	width: 220px;
	margin-bottom: 10px;
}
#game-card {
	touch-action: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}
@media screen and (max-width: 768px) {
	.score-table,
	.debrief-table-container {
		overflow-x: hidden;
	}
	.score-table table,
	.debrief-table-container table,
	.score-table thead,
	.debrief-table-container thead,
	.score-table tbody,
	.debrief-table-container tbody,
	.score-table tfoot,
	.debrief-table-container tfoot,
	.score-table th,
	.debrief-table-container th,
	.score-table td,
	.debrief-table-container td,
	.score-table tr,
	.debrief-table-container tr {
		display: block;
	}
	.score-table thead tr,
	.debrief-table-container thead tr {
		position: absolute;
		top: -9999px;
		left: -9999px;
	}
	.score-table tr,
	.debrief-table-container tr {
		border: 1px solid #ccc;
		margin-bottom: 10px;
	}
	.score-table td,
	.debrief-table-container td {
		border: none;
		border-bottom: 1px solid #eee;
		position: relative;
		padding-left: 50%;
		text-align: right;
		min-height: 38px;
	}
	.score-table tbody td:before,
	.score-table tfoot td:before,
	.debrief-table-container td:before {
		content: attr(data-label);
		position: absolute;
		left: 6px;
		width: 45%;
		padding-right: 10px;
		white-space: nowrap;
		text-align: left;
		font-weight: bold;
	}
	.leaderboard-container td {
		padding-left: 50%;
	}
	.leaderboard-container td:before {
		padding-left: 6px;
	}
	#game-card {
		width: 300px;
	}
}

/* Ambulatory type selection buttons */
#ambulatory-selection {
	display: flex;
	justify-content: center;
	gap: 15px;
	margin: 10px 0 20px 0;
	flex-wrap: wrap;
}

.ambul-type-btn {
	background-color: var(--button-blue);
	border: 7px solid transparent;
	transition:
		border-color 0.2s,
		background-color 0.3s;
	width: 280px;
	min-height: 80px;
	white-space: normal;
	line-height: 1.4;
	vertical-align: top;
	font-size: 1.05em;
	padding: 15px 18px;
}

.ambul-type-btn.ambul-type-selected {
	border-color: var(--teal);
	background-color: var(--navy-blue);
	box-shadow: 0 0 20px 6px rgba(13, 148, 136, 0.8);
}

@media screen and (max-width: 768px) {
	.ambul-type-btn {
		width: 100%;
		min-height: unset;
	}
}

.ambul-btn-list {
	list-style: disc;
	text-align: left;
	padding-left: 18px;
	font-size: 1em;
	margin: 0;
	line-height: 1.7;
}

.ambul-btn-list > li {
	white-space: nowrap;
}

.ambul-btn-list ul {
	list-style: circle;
	padding-left: 18px;
}

.ambul-btn-list ul li {
	white-space: nowrap;
}

/* Round summary review sections */
.review-section {
	margin: 15px auto;
	max-width: 800px;
	text-align: left;
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid #ddd;
}

.review-section-header {
	padding: 12px 18px;
	color: white;
	font-family: "Cascadia Code", monospace;
	font-size: 1em;
	font-weight: bold;
}

.header-incorrect {
	background-color: #c62828;
}

.header-correct {
	background-color: #2e7d32;
}

.review-slider-card {
	height: 350px;
	overflow-y: auto;
	padding: 15px;
	background: rgba(255, 255, 255, 0.7);
}

.review-slider-empty {
	padding: 20px;
	text-align: center;
	color: #666;
	background: rgba(255, 255, 255, 0.7);
}

.slider-controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 20px;
	padding: 10px;
	background: rgba(0, 0, 0, 0.05);
	border-top: 1px solid #ddd;
}

.slider-arrow {
	background: var(--navy-blue);
	color: white;
	border: none;
	border-radius: 50%;
	width: 44px;
	height: 44px;
	font-size: 1.8em;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	line-height: 1;
	margin: 0;
	transition: background-color 0.2s;
}

.slider-arrow:hover:not(:disabled) {
	background-color: var(--button-blue);
	transform: none;
}

.slider-arrow:disabled {
	background: #ccc;
	cursor: not-allowed;
}

.slider-counter {
	font-family: "Cascadia Code", monospace;
	font-size: 0.95em;
	color: var(--dark-grey);
	min-width: 80px;
	text-align: center;
}

.review-card {
	border-bottom: 1px solid #eee;
	padding: 10px 5px 10px 12px;
	border-left: 4px solid transparent;
}

.review-card.card-incorrect {
	border-left-color: #e53935;
}

.review-card.card-correct {
	border-left-color: #43a047;
}

.review-card:last-child {
	border-bottom: none;
}

.review-card-header {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 6px;
}

.review-card-name {
	font-weight: bold;
	font-family: "Cascadia Code", monospace;
	flex: 1;
}

.review-card-setting {
	color: white;
	padding: 3px 10px;
	border-radius: 12px;
	font-size: 0.8em;
	white-space: nowrap;
}

.review-card-answer {
	font-size: 0.9em;
	color: var(--dark-grey);
	white-space: nowrap;
}

.review-card-reason {
	font-size: 0.9em;
	color: #555;
	line-height: 1.5;
	padding-left: 4px;
}

/* Debrief note section */
.debrief-note {
	text-align: left;
	max-width: 800px;
	margin: 20px auto;
	padding: 20px 25px;
	background: rgba(255, 255, 255, 0.7);
	border-radius: 10px;
	border-left: 5px solid var(--navy-blue);
	background: rgba(0, 0, 0, 0.04);
}

.debrief-note h3 {
	text-decoration: underline;
	margin-bottom: 15px;
	font-size: 1.1em;
}

.debrief-list {
	margin: 15px 0 15px 20px;
	line-height: 1.8;
}

.debrief-list li {
	margin-bottom: 8px;
}
