/* =========================================
   1. GLOBAL & RESET
   ========================================= */
body,
html {
	height: 100%;
	margin: 0;
	overflow: hidden;
	font-family: var(--font-main);
	-webkit-font-smoothing: antialiased;
	background-color: #000000 !important;
	/* Pure black outer */
	color: var(--neon-cyan);
}

/* =========================================
   2. APP LAYOUT
   ========================================= */
.app-container {
	display: flex;
	flex-direction: column;
	height: 100dvh;
	max-width: 600px;
	margin: 0 auto;
	background-color: var(--bg-main) !important;
	/* Off-black inner */
	border-left: 1px solid #222;
	border-right: 1px solid #222;
	box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
	position: relative;
}

header.main-header {
	height: var(--header-height);
	background-color: var(--bg-header) !important;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 15px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	flex-shrink: 0;
}

.main-title a {
	font-family: var(--font-game);
	font-weight: 700;
	font-size: 2rem;
	letter-spacing: -1px;
	text-transform: uppercase;
	color: var(--neon-cyan) !important;
	text-decoration: none;
	text-shadow: 0 0 10px rgb(133, 133, 133), 0 0 20px white;
}

.italic-le {
	font-style: italic;
	color: color-mix(in srgb, var(--neon-cyan), white 60%);
}

.header-side i,
.logo-text {
	color: var(--neon-cyan) !important;
}

.logo-stencil {
	/* Colorizes white logo to Neon Cyan */
	filter: brightness(0) saturate(100%) invert(85%) sepia(85%) saturate(2854%) hue-rotate(135deg) brightness(108%) contrast(108%);
	drop-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

.team-banner {
	background-color: var(--bg-strap);
	color: var(--strap-top) !important;
	text-align: center;
	padding: 6px 0;
	/* Adjusted padding to keep it tight */
	font-size: 0.9rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 1px;

	/* DYNAMIC BORDERS */
	border-top: 2px solid var(--strap-bottom, var(--neon-cyan));
	border-bottom: 2px solid var(--strap-bottom, var(--neon-cyan));
}

/* =========================================
   3. GAME BOARD
   ========================================= */
main#game-container {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	padding: 10px;
	background: transparent !important;
}

#game-board {
	display: flex;
	flex-direction: column;
	gap: 6px;
	width: 100%;
}

.letter-row {
	display: flex;
	justify-content: center;
	gap: 4px;
	width: 100%;
}

.letter-box {
	flex: 1;
	max-width: 60px;
	min-width: 0;
	aspect-ratio: 1 / 1;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 900;
	text-transform: uppercase;
	border-radius: 2px;
	font-size: clamp(1rem, 4vw, 2rem);
	line-height: 1;

	/* This keeps your starting state Neon Cyan */
	background-color: transparent;
	border: 1px solid var(--neon-cyan);
	color: var(--neon-cyan);

	background-clip: padding-box;
	/* Reduced transition time to avoid "color ghosting" */
	transition: border-color 0.1s ease;
}

/* Typing Animation */
.letter-box.pop {
	animation: pop 0.1s ease-in-out;
	box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
	/* REMOVED !important from here */
	border-color: var(--neon-cyan);
}

@keyframes pop {
	0% {
		transform: scale(1);
	}

	50% {
		transform: scale(1.08);
	}

	100% {
		transform: scale(1);
	}
}

/* =========================================
   4. KEYBOARD
   ========================================= */
footer {
	padding: 10px 5px 15px 5px;
	/* Extra padding for mobile home-bars */
	padding-bottom: calc(15px + env(safe-area-inset-bottom));
	background-color: rgba(0, 0, 0, 0.2);
	border-top: 1px solid rgba(0, 255, 255, 0.1);
	flex-shrink: 0;
}

.keyboard-row {
	display: flex;
	justify-content: center;
	gap: 4px;
	padding: 0 2px;
	margin-bottom: 4px;
}

.key {
	flex: 1;
	height: 45px;
	max-width: 45px;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: var(--bg-key-normal);
	color: var(--key-normal);
	border: 1px solid var(--key-border);
	border-radius: 4px;
	font-family: var(--font-main);
	font-weight: 700;
	font-size: 1.3rem;
	text-transform: uppercase;
	cursor: pointer;
	transition: all 0.2s;
}

.key.wide {
	max-width: 70px;
	flex: 1.5;
	font-size: 0.8rem;
	background-color: var(--bg-key-long);
	color: var(--key-long);
}

/* Key States (Wordle logic) */
.key.correct {
	background-color: var(--green) !important;
	color: white !important;
	border: none;
}

.key.present {
	background-color: var(--yellow) !important;
	color: white !important;
	border: none;
}

.key.absent {
	background-color: var(--gray) !important;
	color: #888 !important;
	border: none;
}

/* =========================================
   5. UTILITIES
   ========================================= */
.shake {
	animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

	10%,
	90% {
		transform: translate3d(-1px, 0, 0);
	}

	20%,
	80% {
		transform: translate3d(2px, 0, 0);
	}

	30%,
	50%,
	70% {
		transform: translate3d(-4px, 0, 0);
	}

	40%,
	60% {
		transform: translate3d(4px, 0, 0);
	}
}

/* =========================================
   GAME CONTAINER WITH DYNAMIC BG
   ========================================= */
main#game-container {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	padding: 10px;
	position: relative;
	/* This is the anchor for the background */
	z-index: 1;
	/* Creates a new stacking context */
	overflow: hidden;
	/* Ensure the container itself doesn't have a solid color blocking the image */
	background-color: transparent !important;
}

main#game-container::before {
	content: "";
	position: absolute;
	bottom: 20px;
	right: 20px;
	width: 70px;
	height: 70px;

	background-image: var(--bg-image);
	background-size: contain;
	background-position: center;
	background-repeat: no-repeat;

	/* THE DEFINITION FIX:
       1. grayscale(1) makes it B&W to keep internal details sharp.
       2. sepia/hue-rotate tints those details to your brand cyan.
       3. brightness/contrast makes the lines pop. */
	filter: grayscale(100%) sepia(100%) hue-rotate(140deg) brightness(1.2) contrast(1.5) drop-shadow(0 0 4px rgba(0, 255, 255, 0.8));

	opacity: 0.6;
	/* Slightly higher so the internal lines are visible */
	transform: rotate(var(--bg-image-rotate));
	pointer-events: none;
	z-index: 5;
}

#game-board {
	/* Ensure the board sits above the pseudo-element background */
	position: relative;
	z-index: 10;
	width: 100%;
}

/* Correct Letter - Sharp & Bright */
.letter-box.correct {
	background-color: transparent;
	border: 3px solid #00ff00;
	/* Pure Neon Green */
	color: #00ff00;
	font-weight: bold;
}

/* Present Letter - Distinct but secondary */
.letter-box.present {
	background-color: transparent;
	border: 2px solid #ffff00;
	/* Pure Neon Yellow */
	color: #ffff00;
}

/* Absent Letter - Recedes into the background */
.letter-box.absent {
	background-color: transparent;
	border: 1px solid #333333;
	/* Dark Grey */
	color: #333333;
}

/* =========================================
   NEON MODAL THEME
   ========================================= */

/* The dark background overlay */
.modal-backdrop {
	background-color: rgba(0, 0, 0, 0.85) !important;
}

/* The Modal Container */
.modal-content {
	background-color: var(--bg-main) !important;
	/* Dark off-black */
	border: 2px solid var(--neon-cyan) !important;
	/* Cyan border by default */
	border-radius: 0 !important;
	/* Sharp corners */
	color: var(--neon-cyan) !important;
	/* Cyan text */
	box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
}

/* The Header */
.modal-header {
	border-bottom: 1px solid rgba(0, 255, 255, 0.2) !important;
	background-color: var(--bg-header) !important;
}

.modal-title {
	font-family: var(--font-game);
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--neon-cyan) !important;
}

/* Close Button - make it white/cyan instead of black */
.btn-close {
	filter: invert(1) grayscale(100%) brightness(200%);
}

/* Modal Body & Text */
.modal-body {
	color: #eee !important;
	/* Light grey text for readability */
}

/* Modal Footer */
.modal-footer {
	border-top: 1px solid rgba(0, 255, 255, 0.1) !important;
}

/* Buttons inside modals */
.modal .btn-secondary {
	background: transparent;
	border: 1px solid #666;
	color: #999;
	border-radius: 0;
}

.modal .btn-primary {
	background: transparent;
	border: 1px solid var(--neon-cyan);
	color: var(--neon-cyan);
	border-radius: 0;
	text-transform: uppercase;
	font-weight: bold;
}

.modal .btn-primary:hover {
	background: var(--neon-cyan);
	color: #000;
}

/* List items in the Teams Modal */
.modal .list-group-item {
	background-color: transparent !important;
	border-color: rgba(255, 255, 255, 0.05) !important;
	color: #ccc !important;
	border-radius: 0 !important;
}

.modal .list-group-item:hover {
	background-color: rgba(0, 255, 255, 0.1) !important;
	color: var(--neon-cyan) !important;
}

.clue-box {
	border: 1px solid var(--neon-cyan);
	background: rgba(0, 255, 255, 0.05);
	padding: 10px 15px;
	border-radius: 0;
	/* Sharp corners */
	font-family: var(--font-main);
	font-size: 0.9rem;
	color: #fff;
	text-transform: uppercase;
	box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.1);
	max-width: 90%;
	margin: 0 auto;
}

.clue-label {
	color: var(--neon-cyan);
	font-weight: 900;
	margin-right: 8px;
	text-shadow: 0 0 5px var(--neon-cyan);
}

/* Section 4: Clue Specific Styles */
.letter-box.is-clue {
	border-color: var(--key-clue) !important;
	/* Deep Purple */
	color: var(--key-clue) !important;
	box-shadow: 0 0 10px rgba(160, 32, 240, 0.3);
}

/* When a letter is revealed inside a clue row, keep the border purple 
   but let the background/text color be the result of the guess */
.letter-box.is-clue.correct {
	background-color: var(--green) !important;
	color: white !important;
	border-color: var(--key-clue) !important;
}

.letter-box.is-clue.present {
	background-color: var(--yellow) !important;
	color: white !important;
	border-color: var(--key-clue) !important;
}

.key.del {
	flex: 1.5;
	font-size: 0.8rem;
	background-color: var(--bg-key-long);
	color: var(--key-del);
	border-color: var(--key-del);
}

.key.clue {
	flex: 1.5;
	font-size: 0.8rem;
	background-color: var(--bg-key-long);
	color: var(--key-clue);
	border-color: var(--key-clue);
}

.key.enter {
	flex: 1.5;
	font-size: 0.8rem;
	background-color: var(--bg-key-long);
	color: var(--key-enter);
	border-color: var(--key-enter);
}

/* Force the modal to be visible when Bootstrap adds the .show class */
.modal.show {
	display: block !important;
	padding-right: 0px;
}

/* Ensure the modal is ALWAYS on top of the game board */
.modal {
	z-index: 1060 !important;
}

.modal-backdrop {
	z-index: 1050 !important;
}

/* In your CSS file */
.letter-box {
	transition: all 0.3s ease;
	/* Makes the glow "fade in" when you type */
}

/* The default 'Empty' state glow using your cyan */
.letter-box:not(:empty) {
	/* When a letter is typed but not yet submitted */
	box-shadow: 0 0 5px rgba(255, 89, 0, 0.2);
}

.neon-glow {
	/* Uses the color variable set by JS (e.g., colClue or colGreen) */
	box-shadow: 0 0 10px currentcolor, inset 0 0 5px currentcolor;
	text-shadow: 0 0 5px currentcolor;
	transition: all 0.3s ease;
}

/* The 'Dimmed' version for empty boxes */
.letter-box {
	/* Set a default dim cyan border for empty boxes */
	border: 2px solid rgba(0, 255, 255, 0.5);
	background-color: transparent;
}