:root {
	--wiki: #708090;
	--wikiborder: #444444;
	--wikiborderRight: #333344;
	--wikiborderSelected: #ffffff;
	--text: #ffffff;
	--lighttext: #eee;
	--alert: #f44336;
	--link: #333344;
	--tile: #333344;
	--close: #3a6791;
	--closeborder: #0084ff;
	--correct: #0084ff;
}

* {
	box-sizing: border-box;
}

body {
	font-family: Helvetica, Arial, sans-serif;
	font-size: 16px;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	height: 100vh;
	background: var(--wiki);
	color: var(--text);
}

header {
	position: relative;
	background: linear-gradient(to bottom, var(--wiki) 80%, rgba(112, 128, 144, 0));
	width: 100%;
	z-index: 1000;
	padding-bottom: 0;
}

h1 {
	margin: 0;
	font-size: 18px;
	padding: 5px;
	text-align: left;
}

.accent {
	color: var(--link);
}

.accent a {
	color: var(--link);
	text-decoration: none;
}

#subtitle {
	text-align: center;
	font-size: 10px;
	margin-bottom: 5px;
	text-transform: uppercase;
	letter-spacing: 1.4px;
	display: flex;
	justify-content: center;
}

#gameOptions {
	display: flex;
	color: #ffffff;
	justify-content: center;
	margin-top: -26px;
	letter-spacing: 1px;
	font-size: 18px;
	align-items: center;
}

#gameOptions a {
	color: var(--text);
	text-decoration: none;
}

#gameOptions a:hover {
	text-decoration: underline;
}

#gameOptions strong {
	font-weight: bold;
	color: var(--text);
}

#status {
	font-size: 13px;
	text-align: center;
	margin-top: 4px;
	margin-bottom: 4px;
	height: 40px;
	color: #ccc;
	width: 100%;
}

#status strong {
	color: #fff;
}

a {
	color: var(--link);
	text-decoration: none;
}

main {
	padding: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	flex-grow: 1;
}

.game-wrapper {
	position: relative;
	margin: 20px auto;
}

.game-container {
	display: grid;
	grid-template-columns: 20px 188px 188px;
	grid-template-rows: 20px 140px 140px;
	gap: 8px;
	transition: filter 0.5s ease;
}

.score {
	font-weight: bold;
	font-size: 24px;
	color: var(--text);
	text-align: center;
	display: flex;
	align-items: center;
	justify-content: center;
}

.word {
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	font-weight: bold;
	font-size: 18px;
	white-space: nowrap;
}

/* Row words rotate on narrow viewports */
#row1word,
#row2word {
	align-self: center;
	transform: rotate(-90deg);
}

.input-container {
	display: flex;
	background: #333344;
	color: var(--lighttext);
	border: 3px solid var(--wikiborder);
	border-radius: 8px;
	border-style: solid;
	flex-direction: column;
	box-sizing: border-box;
	padding: 3px;
	text-align: center;
	transition: transform 0.3s ease-in-out;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
	position: relative;
	cursor: text;
	justify-content: center;
	min-height: 100%;
}

.input-container::before {
	content: none;
}

.input-container::after {
	content: none;
}

.diagonal-text {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	transform: rotate(-37deg);
	font-size: 18px;
	font-weight: bold;
	color: rgba(255, 255, 255, 0.3);
	pointer-events: none;
	z-index: 0;
}

.input-container input {
	background: transparent;
	border: none;
	color: var(--text);
	font-size: 16px;
	padding: 5px;
	text-align: center;
	width: 100%;
	outline: none;
	position: relative;
	z-index: 1;
	margin: auto 0;
}

.input-container small {
	font-size: 12px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	padding: 0 5px;
	color: var(--lighttext);
}

.input-container small a {
	color: #88ccff;
	text-decoration: none;
}

.input-container small a:hover {
	text-decoration: underline;
}

#giveUp {
	text-align: center;
	margin: 15px auto;
	display: block;
	color: var(--lighttext);
	font-size: 14px;
}

#wikipediaFrame {
	display: none;
	width: 100%;
	height: 300px;
	border: none;
	margin-top: 20px;
	border-radius: 8px;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Media query for smaller screens */
@media only screen and (max-width: 400px) {
	.game-container {
		grid-template-columns: 15px 150px 150px;
		grid-template-rows: 15px 120px 120px;
		gap: 4px;
	}
	
	.word {
		font-size: 16px;
	}
	
	.input-container {
		font-size: 14px;
		padding: 2px;
	}
	
	.diagonal-text {
		font-size: 14px;
	}
	
	#status {
		font-size: 12px;
		margin-top: 3px;
		margin-bottom: 3px;
		height: 35px;
	}
	
	.score {
		font-size: 20px;
	}
}

/* Media query for desktop screens */
@media only screen and (min-width: 769px) {
	body {
		font-size: 19px;
	}
	
	.game-container {
		grid-template-columns: 20px 220px 220px;
		grid-template-rows: 20px 160px 160px;
		gap: 10px;
	}
	
	.input-container {
		padding: 5px;
	}
	
	.diagonal-text {
		font-size: 20px;
	}
	
	.word {
		font-size: 18px;
	}
	
	/* Row words don't rotate on desktop */
	#row1word,
	#row2word {
		transform: none;
		text-align: right;
		padding-right: 8px;
		justify-content: flex-end;
	}
	
	.score {
		font-size: 28px;
	}
	
	#wikipediaFrame {
		height: 400px;
	}
}

/* Game actions container */
.game-actions {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 20px;
	margin: 20px 0;
}

#shareButton {
	background-color: #333344;
	padding: 4px;
	border-radius: 50%;
	text-align: center;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
	cursor: pointer;
	transition: opacity 0.3s ease-in-out, transform 0.2s ease-in-out;
	opacity: 0.8;
	text-decoration: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
}

#shareButton:hover {
	opacity: 1;
	transform: scale(1.1);
}

#shareButton svg {
	width: 24px;
	height: 24px;
}

/* Share Success Message */
.share-success {
	position: fixed;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	background-color: var(--tile);
	color: var(--text);
	padding: 10px 20px;
	border-radius: 4px;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
	font-size: 14px;
	opacity: 0;
	transition: opacity 0.3s ease-in-out;
	z-index: 2000;
}

.share-success.visible {
	opacity: 1;
}

/* Popup Modal Styles */
#popup {
	position: fixed;
	top: 50vh;
	left: 50%;
	transform: translate(-50%, -50%) rotateY(0deg);
	z-index: 20;
	transition: 
		transform 0.6s ease, 
		width 0.6s ease, 
		height 0.6s ease, 
		box-shadow 0.6s ease,
		margin 0.6s ease,
		opacity 0.6s ease;
	opacity: 1;
	width: 280px;
	height: 150px;
	background-color: #f0f0ff;
	border: 2px solid #444;
	border-radius: 8px;
	box-shadow: 0 12px 16px rgba(0, 0, 0, 0.3);
	transform-style: preserve-3d;
	margin: 8px 0;
}

#popup .popup-content {
	text-align: center;
}

#popup .popup-content p {
	color: #333;
	font-size: 15px;
}

#popup #popupScore {
	font-weight: bold;
	margin-top: 10px;
	color: #333344;
}

#popup #popupScoreValue {
	font-size: 18px;
}

#popup h2 {
	margin-top: 15px;
	color: #333344;
}

#popup .popup-actions {
	margin-top: 20px;
	display: flex;
	justify-content: center;
	gap: 10px;
}

#popup a {
	background-color: #333344;
	color: #fff;
	border: none;
	padding: 5px 10px;
	border-radius: 4px;
	text-decoration: none;
	cursor: pointer;
	font-size: 14px;
}

#popup a:hover {
	background-color: #222233;
}

#popup #closePopup {
	position: absolute;
	top: 0px;
	right: 0px;
	background-color: transparent;
	color: #333344;
	border: none;
	font-size: 14px;
	font-weight: bold;
	cursor: pointer;
}

.hidden {
	display: none !important;
}

/* Loading Effects */
.blur-effect {
	filter: blur(5px);
	pointer-events: none; /* Prevent any interactions while loading */
}

.spinner-container {
	display: none;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 1000;
}

.spinner {
	border: 8px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top: 8px solid var(--text);
	width: 50px;
	height: 50px;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}