:root {
	--bg: #0e0f13;
	--panel: #171923;
	--muted: #babece;
	--text: #f5f7ff;
	--ok: #56d364;
	--maybe: #e3b341;
	--no: #3d3f4b;
	--accent: #5b8cff;
	--backkey: #a0453e;
	--gap: 8px;
	--tile: 100%;
}

/* Utility classes */
.hidden {
	display: none !important;
}

/* Disable transitions on initial load - only enable after user interaction */
/* Global smooth transitions for all elements during theme changes */
/* Exclude critical layout elements from transitions to prevent display issues */
body.transitions-enabled,
body.transitions-enabled *:not(.board):not(.row):not(.tile):not(.key):not(.keyboard),
body.transitions-enabled *:not(.board):not(.row):not(.tile):not(.key):not(.keyboard)::before,
body.transitions-enabled *:not(.board):not(.row):not(.tile):not(.key):not(.keyboard)::after {
	transition: background-color 2.5s ease, color 2.5s ease, border-color 2.5s ease, box-shadow 2.5s ease !important;
}

/* Game elements should only have slow transitions for theme changes, not gameplay */
body.transitions-enabled .key,
body.transitions-enabled .settings-panel,
body.transitions-enabled .stats-grid,
body.transitions-enabled .stat,
body.transitions-enabled details.stats,
body.transitions-enabled details.stats summary {
	transition: background-color 2.5s ease, color 2.5s ease, border-color 2.5s ease, box-shadow 2.5s ease !important;
}

/* Tiles keep their fast flip animations, but also transition colors during theme changes */
body.transitions-enabled .tile {
	transition: transform 0.08s ease, background-color 2.5s ease, border-color 2.5s ease, color 2.5s ease !important;
}

/* Buttons and cards need fast hover response (0.2s) but slow theme transitions (2.5s) */
body.transitions-enabled .btn,
body.transitions-enabled .theme-btn,
body.transitions-enabled .theme-toggle,
body.transitions-enabled .settings > summary,
body.transitions-enabled .home-btn,
body.transitions-enabled .back-btn,
body.transitions-enabled .mode-card,
body.transitions-enabled .selection-card {
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease !important;
}

/* During actual theme changes, override with slow transitions */
body.transitions-enabled.theme-transitioning .btn,
body.transitions-enabled.theme-transitioning .theme-btn,
body.transitions-enabled.theme-transitioning .theme-toggle,
body.transitions-enabled.theme-transitioning .settings > summary,
body.transitions-enabled.theme-transitioning .home-btn,
body.transitions-enabled.theme-transitioning .back-btn,
body.transitions-enabled.theme-transitioning .mode-card,
body.transitions-enabled.theme-transitioning .selection-card {
	transition: background-color 2.5s ease, color 2.5s ease, border-color 2.5s ease, box-shadow 2.5s ease !important;
}

/* Faster transitions on mobile for better performance */
@media (max-width: 768px) {
	body.transitions-enabled,
	body.transitions-enabled *:not(.board):not(.row):not(.tile):not(.key):not(.keyboard),
	body.transitions-enabled *:not(.board):not(.row):not(.tile):not(.key):not(.keyboard)::before,
	body.transitions-enabled *:not(.board):not(.row):not(.tile):not(.key):not(.keyboard)::after {
		transition: background-color 1.5s ease, color 1.5s ease, border-color 1.5s ease, box-shadow 1.5s ease !important;
	}
	
	body.transitions-enabled .key,
	body.transitions-enabled .settings-panel,
	body.transitions-enabled .stats-grid,
	body.transitions-enabled .stat,
	body.transitions-enabled details.stats,
	body.transitions-enabled details.stats summary {
		transition: background-color 1.5s ease, color 1.5s ease, border-color 1.5s ease, box-shadow 1.5s ease !important;
	}
	
	body.transitions-enabled .tile {
		transition: transform 0.08s ease, background-color 1.5s ease, border-color 1.5s ease, color 1.5s ease !important;
	}
	
	body.transitions-enabled .btn,
	body.transitions-enabled .theme-btn,
	body.transitions-enabled .theme-toggle,
	body.transitions-enabled .settings > summary,
	body.transitions-enabled .home-btn,
	body.transitions-enabled .back-btn,
	body.transitions-enabled .mode-card,
	body.transitions-enabled .selection-card {
		transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease !important;
	}
	
	body.transitions-enabled.theme-transitioning .btn,
	body.transitions-enabled.theme-transitioning .theme-btn,
	body.transitions-enabled.theme-transitioning .theme-toggle,
	body.transitions-enabled.theme-transitioning .settings > summary,
	body.transitions-enabled.theme-transitioning .home-btn,
	body.transitions-enabled.theme-transitioning .back-btn,
	body.transitions-enabled.theme-transitioning .mode-card,
	body.transitions-enabled.theme-transitioning .selection-card {
		transition: background-color 1.5s ease, color 1.5s ease, border-color 1.5s ease, box-shadow 1.5s ease !important;
	}
}

/* Light theme */
:root.light-theme {
	--bg: #ffffff;
	--panel: #f8f9fa;
	--muted: #6c757d;
	--text: #212529;
	--ok: #28a745;
	--maybe: #ffc107;
	--no: #e9ecef;
	--accent: #007bff;
	--backkey: #dc3545;
}

/* Ensure proper contrast for light theme tiles */
:root.light-theme .tile {
	border-color: #adb5bd;
	background: #f8f9fa;
	color: #212529 !important;
}

:root.light-theme .tile.filled {
	border-color: #6c757d;
	background: #e9ecef;
	color: #212529 !important;
}

:root.light-theme .tile.ok {
	color: #212529 !important;
}

:root.light-theme .tile.maybe {
	color: #212529 !important;
}

:root.light-theme .tile.no {
	color: #495057 !important;
	background: #adb5bd;
	border-color: #868e96;
}

/* Light theme keyboard adjustments */
:root.light-theme .key {
	background: #ced4da;
	border-color: #adb5bd;
	color: #212529;
}

:root.light-theme .key.ok {
	color: #ffffff !important;
}

:root.light-theme .key.maybe {
	color: #000000 !important;
}

:root.light-theme .key.no {
	background: #adb5bd;
	border-color: #868e96;
	color: #495057 !important;
}

/* Light theme settings panel */
/* :root.light-theme .settings-panel {
	background: #ffffff !important;
} */

:root.light-theme .reveal-section {
	border-top-color: #ced4da;
}

:root.light-theme .reveal-section .btn {
	background: #dc3545;
	color: #ffffff;
	border-color: #c82333;
}

:root.light-theme .reveal-section .btn:hover {
	background: #c82333;
}

:root.light-theme .tile.revealed {
	background: #c82333 !important; /* Slightly brighter red for light mode */
	border-color: #c82333 !important;
}

/* Light theme Enter and Backspace keys keep their original colors */
:root.light-theme .key[data-key="⏎"] {
	background: var(--accent);
	color: #ffffff;
}

:root.light-theme .key[data-key="←"] {
	background: var(--backkey);
	color: #ffffff;
}

/* Light theme stats dropdown */
:root.light-theme details.stats {
	background: #ffffff !important;
	border-color: #dee2e6 !important;
}

:root.light-theme details.stats summary {
	color: #212529 !important;
}

:root.light-theme .stat {
	background: #f8f9fa !important;
	border-color: #dee2e6 !important;
	color: #212529;
}

:root.light-theme .stat .lbl {
	color: #6c757d !important;
}

/* Light theme settings panel titles */
:root.light-theme .config {
	color: #495057 !important;
}

/* Light theme modal styles */
:root.light-theme .modal__panel {
	background: #ffffff;
	border-color: #dee2e6;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

:root.light-theme .modal__title {
	color: #212529;
}

:root.light-theme .modal__subtitle {
	color: #6c757d;
}

:root.light-theme .modal .stat {
	background: #f8f9fa;
	border-color: #dee2e6;
	color: #212529;
}

:root.light-theme .modal .stat .lbl {
	color: #6c757d;
}

:root.light-theme .btn-primary {
	color: #ffffff;
}

/* Light theme button improvements */
:root.light-theme .btn {
	background: #e9ecef;
	border-color: #adb5bd;
	color: #212529;
}

:root.light-theme .btn:hover {
	background: #dee2e6;
	border-color: #868e96;
}

/* Light theme home button */
:root.light-theme .home-btn-daily {
	background: linear-gradient(135deg, var(--ok), #22963d);
	border-color: var(--ok);
}

:root.light-theme .home-btn-daily:hover {
	box-shadow: 0 8px 32px rgba(40, 167, 69, 0.4);
}

:root.light-theme .home-btn-secondary {
	background: #f8f9fa;
	border-color: #dee2e6;
	color: #212529;
}

:root.light-theme .home-btn-secondary:hover {
	border-color: var(--accent);
}

/* Light theme mode cards */
:root.light-theme .mode-card,
:root.light-theme .selection-card {
	background: #f8f9fa;
	border-color: #dee2e6;
	color: #212529;
}

:root.light-theme .mode-card:hover:not(.mode-card-disabled),
:root.light-theme .selection-card:hover {
	background: #e9ecef;
	border-color: var(--accent);
}

:root.light-theme .mode-card-disabled {
	background: #e9ecef;
	border-color: #ced4da;
	color: #adb5bd;
}

:root.light-theme .mode-desc {
	color: #6c757d;
}

:root.light-theme .selection-label {
	color: #6c757d;
}

/* Light theme back button */
:root.light-theme .back-btn {
	color: #495057;
}

:root.light-theme .back-btn:hover {
	color: var(--accent);
}

/* Light theme screen titles */
:root.light-theme .screen-title,
:root.light-theme .home-title {
	color: #212529;
}

:root.light-theme .home-subtitle {
	color: #6c757d;
}

:root.light-theme .btn-hint {
	color: rgba(255, 255, 255, 0.9);
}

:root.light-theme .home-btn-primary .btn-hint {
	color: rgba(255, 255, 255, 0.9);
}

:root.light-theme .home-btn-secondary .btn-hint {
	color: #6c757d;
}

/* Light theme status text */
:root.light-theme #status {
	color: #495057;
}

* {
	box-sizing: border-box;
}

/* Hide scrollbars globally */
html, body {
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* IE and Edge */
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
	display: none; /* Chrome, Safari, Opera */
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: system-ui, Segoe UI, Roboto, Inter, Arial, sans-serif;
	display: flex;
	min-height: 100vh;
	min-height: 100dvh;
	max-height: 100vh;
	max-height: 100dvh;
	overflow: hidden;
	touch-action: manipulation;
}

/* Theme Toggle Button */
.theme-toggle {
	position: fixed;
	top: 20px;
	right: 50%;
	margin-right: calc(-680px / 2 + 20px);
	z-index: 1000;
	width: 44px;
	height: 44px;
	border: 2px solid var(--border);
	border-radius: 50%;
	background: var(--panel);
	color: var(--text);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	padding: 8px;
}

/* Tooltip on hover */
.theme-toggle::after,
.settings-toggle::after {
	content: attr(title);
	position: absolute;
	bottom: -36px;
	left: 50%;
	transform: translateX(-50%) translateY(4px);
	background: var(--panel);
	color: var(--text);
	padding: 6px 10px;
	border-radius: 6px;
	font-size: 12px;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s ease, transform 0.2s ease;
	border: 1px solid var(--border);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
	z-index: 1001;
}

.theme-toggle:hover::after,
.settings-toggle:hover::after {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
	.theme-toggle {
		right: 20px;
		margin-right: 0;
	}
}

/* Settings Toggle Button */
.settings-toggle {
	position: fixed;
	top: 20px;
	right: 50%;
	margin-right: calc(-680px / 2 + 74px); /* 54px gap + 20px offset = 74px */
	z-index: 1000;
	width: 44px;
	height: 44px;
	border: 2px solid var(--border);
	border-radius: 50%;
	background: var(--panel);
	color: var(--text);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	padding: 8px;
}

@media (max-width: 768px) {
	.settings-toggle {
		right: 74px; /* 54px gap + 20px from theme toggle */
		margin-right: 0;
	}
}

.settings-toggle:hover {
	transform: scale(1.1);
	border-color: var(--accent);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.settings-toggle:active {
	transform: scale(0.95);
}

.settings-icon {
	width: 100%;
	height: 100%;
}

.theme-toggle:hover {
	transform: scale(1.1);
	border-color: var(--accent);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-toggle:active {
	transform: scale(0.95);
}

.theme-icon {
	width: 24px;
	height: 24px;
	stroke: var(--text);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.theme-icon-sun {
	display: block;
}

.theme-icon-moon {
	display: none;
	position: absolute;
}

:root.light-theme .theme-icon-sun {
	display: none;
}

:root.light-theme .theme-icon-moon {
	display: block;
}

.wrap {
	display: flex;
	flex-direction: column;
	gap: 16px;
	max-width: 680px;
	margin: auto;
	width: 100%;
	padding: 20px;
	min-height: 100vh;
	min-height: 100dvh;
	max-height: 100vh;
	max-height: 100dvh;
	overflow-y: auto;
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* IE and Edge */
}

.wrap::-webkit-scrollbar {
	display: none; /* Chrome, Safari, Opera */
}
header {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}
.title {
	text-align: center;
	font-weight: 800;
	margin: 0;
}
.main {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
.controls {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	align-items: center;
}
.reveal-section {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--border);
}
.reveal-section .btn {
	width: 100%;
	background: var(--backkey);
	color: var(--text);
	font-weight: 600;
}
.btn {
	padding: 8px 10px;
	border: 1px solid #2a2d3a;
	border-radius: 6px;
	background: var(--panel);
	color: var(--text);
	cursor: pointer;
	touch-action: manipulation;
}
.btn[aria-pressed="true"] {
	outline: 2px solid var(--accent);
}

.dark-btn.active {
	background: linear-gradient(135deg, #2c3e50, #34495e);
	color: #ecf0f1;
}

.btn-hidden {
	display: none;
}
.btn-hint-hidden {
	display: none;
}
.board {
	width: 100%;
	display: grid !important;
	gap: var(--gap);
	opacity: 1 !important;
	visibility: visible !important;
}
.row {
	display: grid !important;
	gap: var(--gap);
	width: 100%;
	opacity: 1 !important;
	visibility: visible !important;
}
.tile {
	width: 100%;
	aspect-ratio: 1;
	border: 2px solid #2b2e3a;
	border-radius: 6px;
	display: grid;
	place-items: center;
	font-weight: 800;
	font-size: clamp(18px, calc(var(--tile) * 1), 36px);
	text-transform: uppercase;
	background: #121420;
	transition: transform 0.08s, background 0.15s, border-color 0.15s;
}
.tile.filled {
	border-color: #565a6c;
}
.tile.ok {
	background: var(--ok);
	border-color: var(--ok);
	color: #0a0d0a;
}
.tile.maybe {
	background: var(--maybe);
	border-color: var(--maybe);
	color: #1a1300;
}
.tile.no {
	background: var(--no);
	border-color: var(--no);
	color: #cbd0e6;
}

.tile.revealed {
	background: #8b0000 !important; /* Dark red */
	border-color: #8b0000 !important;
	color: #ffffff !important;
}

/* Water-fill animation keyframes */
@keyframes waterFill {
	0% {
		background: #121420;
		border-color: #2b2e3a;
		transform: scale(1);
	}
	50% {
		transform: scale(1.05);
	}
	100% {
		transform: scale(1);
	}
}

/* Animation classes for water-fill effect */
.tile.water-fill {
	animation: waterFill 1.2s ease-out forwards;
}

.tile.water-fill.ok {
	animation-name: waterFillOk;
}

.tile.water-fill.maybe {
	animation-name: waterFillMaybe;
}

.tile.water-fill.no {
	animation-name: waterFillNo;
}

/* Enhanced mobile animations */
@media (max-width: 768px) {
	.tile.water-fill {
		animation-duration: 1.4s;
	}
	
	.tile.water-fill.ok {
		animation-name: waterFillOkMobile;
	}
	
	.tile.water-fill.maybe {
		animation-name: waterFillMaybeMobile;
	}
	
	.tile.water-fill.no {
		animation-name: waterFillNoMobile;
	}
}

@keyframes waterFillOkMobile {
	0% {
		background: #121420;
		border-color: #2b2e3a;
		transform: scale(1);
		box-shadow: none;
	}
	20% {
		transform: scale(1.25);
		box-shadow: 0 0 25px rgba(86, 211, 100, 0.4);
	}
	40% {
		transform: scale(1.35);
		box-shadow: 0 0 35px rgba(86, 211, 100, 0.6);
		background: rgba(86, 211, 100, 0.4);
		border-color: rgba(86, 211, 100, 0.6);
	}
	60% {
		transform: scale(1.3);
		box-shadow: 0 0 30px rgba(86, 211, 100, 0.5);
	}
	80% {
		transform: scale(1.1);
		box-shadow: 0 0 20px rgba(86, 211, 100, 0.3);
	}
	100% {
		background: var(--ok);
		border-color: var(--ok);
		transform: scale(1);
		box-shadow: 0 0 10px rgba(86, 211, 100, 0.2);
	}
}

@keyframes waterFillMaybeMobile {
	0% {
		background: #121420;
		border-color: #2b2e3a;
		transform: scale(1);
		box-shadow: none;
	}
	20% {
		transform: scale(1.25);
		box-shadow: 0 0 25px rgba(227, 179, 65, 0.4);
	}
	40% {
		transform: scale(1.35);
		box-shadow: 0 0 35px rgba(227, 179, 65, 0.6);
		background: rgba(227, 179, 65, 0.4);
		border-color: rgba(227, 179, 65, 0.6);
	}
	60% {
		transform: scale(1.3);
		box-shadow: 0 0 30px rgba(227, 179, 65, 0.5);
	}
	80% {
		transform: scale(1.1);
		box-shadow: 0 0 20px rgba(227, 179, 65, 0.3);
	}
	100% {
		background: var(--maybe);
		border-color: var(--maybe);
		transform: scale(1);
		box-shadow: 0 0 10px rgba(227, 179, 65, 0.2);
	}
}

@keyframes waterFillNoMobile {
	0% {
		background: #121420;
		border-color: #2b2e3a;
		transform: scale(1);
		box-shadow: none;
	}
	20% {
		transform: scale(1.25);
		box-shadow: 0 0 25px rgba(61, 63, 75, 0.4);
	}
	40% {
		transform: scale(1.35);
		box-shadow: 0 0 35px rgba(61, 63, 75, 0.6);
		background: rgba(61, 63, 75, 0.4);
		border-color: rgba(61, 63, 75, 0.6);
	}
	60% {
		transform: scale(1.3);
		box-shadow: 0 0 30px rgba(61, 63, 75, 0.5);
	}
	80% {
		transform: scale(1.1);
		box-shadow: 0 0 20px rgba(61, 63, 75, 0.3);
	}
	100% {
		background: var(--no);
		border-color: var(--no);
		transform: scale(1);
		box-shadow: none;
	}
}

@keyframes waterFillOk {
	0% {
		background: #121420;
		border-color: #2b2e3a;
		transform: scale(1);
		box-shadow: none;
	}
	25% {
		transform: scale(1.15);
		box-shadow: 0 0 20px rgba(86, 211, 100, 0.3);
	}
	50% {
		transform: scale(1.2);
		box-shadow: 0 0 25px rgba(86, 211, 100, 0.5);
		background: rgba(86, 211, 100, 0.3);
		border-color: rgba(86, 211, 100, 0.5);
	}
	75% {
		transform: scale(1.1);
		box-shadow: 0 0 15px rgba(86, 211, 100, 0.4);
	}
	100% {
		background: var(--ok);
		border-color: var(--ok);
		transform: scale(1);
		box-shadow: 0 0 8px rgba(86, 211, 100, 0.2);
	}
}

@keyframes waterFillMaybe {
	0% {
		background: #121420;
		border-color: #2b2e3a;
		transform: scale(1);
		box-shadow: none;
	}
	25% {
		transform: scale(1.15);
		box-shadow: 0 0 20px rgba(227, 179, 65, 0.3);
	}
	50% {
		transform: scale(1.2);
		box-shadow: 0 0 25px rgba(227, 179, 65, 0.5);
		background: rgba(227, 179, 65, 0.3);
		border-color: rgba(227, 179, 65, 0.5);
	}
	75% {
		transform: scale(1.1);
		box-shadow: 0 0 15px rgba(227, 179, 65, 0.4);
	}
	100% {
		background: var(--maybe);
		border-color: var(--maybe);
		transform: scale(1);
		box-shadow: 0 0 8px rgba(227, 179, 65, 0.2);
	}
}

@keyframes waterFillNo {
	0% {
		background: #121420;
		border-color: #2b2e3a;
		transform: scale(1);
		box-shadow: none;
	}
	25% {
		transform: scale(1.15);
		box-shadow: 0 0 20px rgba(61, 63, 75, 0.3);
	}
	50% {
		transform: scale(1.2);
		box-shadow: 0 0 25px rgba(61, 63, 75, 0.5);
		background: rgba(61, 63, 75, 0.3);
		border-color: rgba(61, 63, 75, 0.5);
	}
	75% {
		transform: scale(1.1);
		box-shadow: 0 0 15px rgba(61, 63, 75, 0.4);
	}
	100% {
		background: var(--no);
		border-color: var(--no);
		transform: scale(1);
		box-shadow: none;
	}
}

/* Keyboard */
.keyboard {
	margin-top: auto;
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.kb-row {
	display: flex;
	gap: 6px;
	width: 100%;
}

.key {
	flex: 1;
	min-width: 0;
	padding: 20px 8px;
	border-radius: 6px;
	border: 1px solid #2a2d3a;
	background: #3b3f52; /* unused */
	color: #eef1ff;
	cursor: pointer;
	font-weight: 700;
	text-align: center;
	touch-action: manipulation;
}

/* Special keys get more space */
.key[data-key="⏎"] {
	flex: 1.5;
	background: var(--accent);
}
.key[data-key="←"] {
	flex: 1.5;
	background: var(--backkey);
}

/* USED keys: much higher contrast */
.key.no {
	background: #0f111a; /* very dark “not in word” */
	border-color: #2b3144;
	color: #9aa3c7;
}
.key.maybe {
	background: var(--maybe);
	border-color: #b78f1d;
	color: #1a1300;
}
.key.ok {
	background: var(--ok);
	border-color: #38b24e;
	color: #061106;
}
/* Tiles — high-contrast and override earlier rules */
.board .tile.ok {
	background: var(--ok);
	border-color: var(--ok);
	color: #061106 !important;
}
.board .tile.maybe {
	background: var(--maybe);
	border-color: #b78f1d;
	color: #1a1300 !important;
}
.board .tile.no {
	background: #0f111a;
	border-color: #2b3144;
	color: #9aa3c7 !important;
}

/* Keys — match the tile colors */
.keyboard .key.ok {
	background: var(--ok);
	border-color: #38b24e;
	color: #061106 !important;
}
.keyboard .key.maybe {
	background: var(--maybe);
	border-color: #b78f1d;
	color: #1a1300 !important;
}
.keyboard .key.no {
	background: #0f111a;
	border-color: #2b3144;
	color: #9aa3c7 !important;
}

.status {
	min-height: 24px;
	color: var(--muted);
	text-align: center;
}

.game-over-section {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	margin-top: 24px;
}

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

.game-over-message {
	font-size: 18px;
	font-weight: 600;
	color: var(--text);
	text-align: center;
}

.new-word-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 24px;
	font-size: 16px;
	font-weight: 600;
	background: var(--accent);
	color: #ffffff;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: transform 0.2s ease, background-color 0.2s ease;
}

.new-word-btn:hover {
	background: #4a7de8;
	transform: translateY(-2px);
}

.new-word-btn .arrow-icon {
	width: 20px;
	height: 20px;
	stroke: currentColor;
}

details.stats {
	background: #121420;
	border: 1px solid #2a2d3a;
	border-radius: 6px;
	padding: 10px 12px;
}
details.stats summary {
	cursor: pointer;
	color: #d7dbff;
	font-weight: 600;
	margin-bottom: 8px;
}
.stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	gap: 10px;
	margin-top: 6px;
}
.stat {
	background: #171923;
	border: 1px solid #2a2d3a;
	border-radius: 6px;
	padding: 10px;
	text-align: center;
}
.stat .num {
	font-size: 24px;
	font-weight: 800;
}
.stat .lbl {
	font-size: 12px;
	color: #a3a7b7;
}
.config {
	color: #a3a7b7;
	font-weight: 600;
	margin-right: 6px;
	text-align: left;
}

/* Mobile board and layout improvements */
@media (max-width: 768px) {
	.wrap {
		padding: 12px;
		gap: 8px;
	}
	.main {
		flex: 1;
		justify-content: flex-start;
		padding-top: 20px;
	}
	.board {
		margin-bottom: 20px;
	}
}

/* Mobile keyboard improvements */
@media (max-width: 768px) {
	.kb-row {
		gap: 4px;
	}
	.key {
		padding: 20px 4px;
		font-size: 14px;
	}
	.theme-toggle {
		top: 12px;
		right: 12px;
		width: 40px;
		height: 40px;
	}
	.settings-toggle {
		top: 12px;
		right: 66px; /* 54px gap + 12px from theme toggle */
		width: 40px;
		height: 40px;
	}
	.theme-icon {
		width: 20px;
		height: 20px;
	}
	.settings-icon {
		width: 20px;
		height: 20px;
	}
}

@media (max-width: 480px) {
	.wrap {
		padding: 8px;
		gap: 6px;
	}
	.title {
		font-size: 1.5rem;
		margin-bottom: 8px;
	}
	.main {
		padding-top: 10px;
	}
	.key {
		padding: 18px 2px;
		font-size: 12px;
	}
}

@media (max-width: 360px) {
	:root {
		--gap: 2px;
	}
	.wrap {
		padding: 6px;
		gap: 2px;
	}
	.title {
		font-size: 1.25rem;
		margin-bottom: 4px;
	}
	.main {
		padding-top: 8px;
	}
	.key {
		padding: 20px 2px;
		font-size: 11px;
	}
	.tile {
		gap: 2px;
	}
}

/* Modal */
.modal[hidden] {
	display: none;
}
.modal {
	position: fixed;
	inset: 0;
	z-index: 2000;
	display: grid;
	place-items: center;
}
.modal.hidden,
.settings-modal.hidden {
	display: none !important;
}
.modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
}
.modal__panel {
	position: relative;
	width: min(560px, 94vw);
	background: #141625;
	border: 1px solid #2a2d3a;
	border-radius: 6px;
	padding: 18px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.modal__title {
	margin: 0 0 4px;
	text-align: center;
}
.modal__subtitle {
	margin: 0 0 12px;
	text-align: center;
	color: var(--muted);
}
.modal__stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
	margin: 12px 0 16px;
}
.modal__actions {
	display: flex;
	gap: 8px;
	justify-content: center;
	flex-wrap: wrap;
}
.btn-primary {
	background: var(--accent);
	border-color: var(--accent);
	color: #0b0f1b;
}

/* Reuse existing .stat styles */
.modal .stat {
	background: #171923;
	border: 1px solid #2a2d3a;
	border-radius: 6px;
	padding: 10px;
	text-align: center;
}
.modal .stat .num {
	font-size: 22px;
	font-weight: 800;
}
.modal .stat .lbl {
	font-size: 12px;
	color: #a3a7b7;
}

/* Animations */
@keyframes modalFadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes modalSlideIn {
	from {
		opacity: 0;
		transform: scale(0.95) translateY(-20px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

.modal {
	animation: modalFadeIn 0.2s ease;
}

.settings-modal__panel {
	animation: modalSlideIn 0.3s ease;
}

/* Settings Modal */
.settings-modal__panel {
	width: min(600px, 94vw);
	max-height: 90vh;
	overflow-y: auto;
	background: var(--panel);
	border: 2px solid var(--border);
}

.modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	border: none;
	background: transparent;
	color: var(--text);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: all 0.2s ease;
	z-index: 1;
}

.modal__close:hover {
	background: var(--hover);
}

.modal__close svg {
	width: 20px;
	height: 20px;
}

.settings-panel {
	padding: 20px;
}

.settings-title {
	margin: 0 0 24px;
	text-align: center;
	font-size: 24px;
	font-weight: 700;
	color: var(--text);
}

.setting-group {
	margin-bottom: 24px;
	padding-bottom: 24px;
	border-bottom: 1px solid var(--border);
}

.setting-group:last-child {
	border-bottom: none;
	margin-bottom: 0;
	padding-bottom: 0;
}

.setting-label {
	display: block;
	margin-bottom: 12px;
	font-size: 16px;
	font-weight: 600;
	color: var(--text);
}

.setting-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.setting-help {
	margin: 8px 0 0;
	font-size: 14px;
	color: var(--muted);
	line-height: 1.4;
}

.btn-group {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.btn-length,
.btn-difficulty {
	min-width: 60px;
	padding: 10px 16px;
	background: var(--bg);
	border: 2px solid var(--border);
	border-radius: 6px;
	color: var(--text);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.btn-length:hover,
.btn-difficulty:hover {
	background: var(--hover);
	border-color: var(--accent);
}

.btn-length.active,
.btn-difficulty.active {
	background: var(--accent);
	border-color: var(--accent);
	color: #0b0f1b;
}

.toggle {
	position: relative;
	display: inline-block;
	width: 50px;
	height: 26px;
}

.toggle input {
	opacity: 0;
	width: 0;
	height: 0;
}

.toggle-slider {
	position: absolute;
	cursor: pointer;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: var(--no);
	transition: 0.3s;
	border-radius: 26px;
	border: 2px solid var(--border);
}

.toggle-slider:before {
	position: absolute;
	content: "";
	height: 18px;
	width: 18px;
	left: 4px;
	bottom: 4px;
	background-color: white;
	transition: 0.3s;
	border-radius: 50%;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle input:checked + .toggle-slider {
	background-color: var(--accent);
}

.toggle input:checked + .toggle-slider:before {
	transform: translateX(24px);
}

.stats-details {
	border: 1px solid var(--border);
	border-radius: 6px;
	margin-top: 24px;
}

.stats-summary {
	padding: 16px;
	cursor: pointer;
	font-weight: 600;
	color: var(--text);
	-webkit-user-select: none;
	user-select: none;
}

.stats-panel {
	padding: 16px;
	border-top: 1px solid var(--border);
}

.stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
	gap: 12px;
	margin-bottom: 16px;
}

.stat {
	text-align: center;
	padding: 12px;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 6px;
}

.stat .num {
	font-size: 24px;
	font-weight: 700;
	color: var(--text);
	margin-bottom: 4px;
}

.stat .lbl {
	font-size: 12px;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.btn-danger {
	background: #dc3545;
	border-color: #dc3545;
	color: white;
}

.btn-danger:hover {
	background: #c82333;
	border-color: #bd2130;
}

.reveal-section {
	display: none;
}

/* Fireworks canvas */
.fx {
	position: fixed;
	inset: 0;
	z-index: 2500;
	pointer-events: none;
}

/* === Screen Navigation System === */
.screen {
	min-height: 100vh;
	min-height: 100dvh;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow-y: auto;
}

.screen[hidden] {
	display: none !important;
}

/* Screen animations */
@keyframes slideInRight {
	from {
		transform: translateX(100%);
		opacity: 0;
	}
	to {
		transform: translateX(0);
		opacity: 1;
	}
}

@keyframes slideOutLeft {
	from {
		transform: translateX(0);
		opacity: 1;
	}
	to {
		transform: translateX(-100%);
		opacity: 0;
	}
}

@keyframes slideInLeft {
	from {
		transform: translateX(-100%);
		opacity: 0;
	}
	to {
		transform: translateX(0);
		opacity: 1;
	}
}

@keyframes slideOutRight {
	from {
		transform: translateX(0);
		opacity: 1;
	}
	to {
		transform: translateX(100%);
		opacity: 0;
	}
}

/* === Home Screen === */
.home-container {
	max-width: 600px;
	width: 100%;
	padding: 40px 20px;
	text-align: center;
}

.home-title {
	font-size: clamp(3rem, 10vw, 5rem);
	font-weight: 900;
	margin: 0 0 16px;
	background: linear-gradient(135deg, var(--accent), var(--ok));
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	letter-spacing: -0.02em;
}

.home-subtitle {
	font-size: 1.25rem;
	color: var(--muted);
	margin: 0 0 60px;
}

.home-buttons {
	display: flex;
	flex-direction: column;
	gap: 20px;
	max-width: 680px;
	margin: 0 auto;
}

.home-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 32px 24px;
	border: 2px solid #2a2d3a;
	border-radius: 16px;
	background: var(--panel);
	color: var(--text);
	cursor: pointer;
	transition: all 0.3s ease;
	text-align: center;
}

.home-btn:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.home-btn-daily {
	background: linear-gradient(135deg, #28a745, #22963d);
	border-color: #28a745;
}

.home-btn-daily:hover {
	box-shadow: 0 8px 32px rgba(40, 167, 69, 0.4);
}

.home-btn-daily .btn-icon {
	stroke: #96f32b;
}

.home-btn-primary {
	background: linear-gradient(135deg, #007bff, #0056b3);
	border-color: #007bff;
}

.home-btn-primary:hover {
	box-shadow: 0 8px 32px rgba(0, 123, 255, 0.4);
}

.home-btn-secondary {
	background: var(--panel);
	border-color: #2a2d3a;
}

.home-btn-secondary:hover {
	border-color: var(--accent);
	box-shadow: 0 8px 24px rgba(91, 140, 255, 0.2);
}

.btn-icon {
	width: 48px;
	height: 48px;
	stroke: currentColor;
}

.home-btn-primary .btn-icon {
	stroke: #ffd700;
}

.btn-text {
	font-size: 1.5rem;
	font-weight: 700;
}

.btn-hint {
	font-size: 0.875rem;
	color: var(--muted);
}

/* === Mode Selection Screens === */
.mode-container {
	max-width: 680px;
	width: 100%;
	padding: 40px 20px;
}

.back-btn {
	background: none;
	border: none;
	color: var(--text);
	font-size: 1.125rem;
	cursor: pointer;
	padding: 8px 16px;
	margin-bottom: 24px;
	border-radius: 8px;
	transition: all 0.2s ease;
}

.back-btn:hover {
	background: var(--panel);
}

.screen-title {
	font-size: 2rem;
	font-weight: 800;
	text-align: center;
	margin: 0 0 40px;
}

.mode-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 20px;
}

.mode-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 32px 24px;
	border: 2px solid #2a2d3a;
	border-radius: 12px;
	background: var(--panel);
	color: var(--text);
	cursor: pointer;
	transition: all 0.3s ease;
	text-align: center;
}

.mode-card:hover:not(.mode-card-disabled) {
	transform: translateY(-4px);
	border-color: var(--accent);
	box-shadow: 0 8px 24px rgba(91, 140, 255, 0.3);
}

.mode-card-disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.mode-icon {
	width: 40px;
	height: 40px;
	stroke: currentColor;
}

.mode-name {
	font-size: 1.25rem;
	font-weight: 700;
}

.mode-desc {
	font-size: 0.875rem;
	color: var(--muted);
}

.selection-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 16px;
	max-width: 600px;
	margin: 0 auto;
}

.selection-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 28px 20px;
	border: 2px solid #2a2d3a;
	border-radius: 12px;
	background: var(--panel);
	color: var(--text);
	cursor: pointer;
	transition: all 0.3s ease;
}

.selection-card:hover {
	transform: translateY(-4px);
	border-color: var(--accent);
	box-shadow: 0 8px 24px rgba(91, 140, 255, 0.3);
}

.selection-value {
	font-size: 2rem;
	font-weight: 800;
	color: var(--accent);
}

.selection-label {
	font-size: 0.875rem;
	color: var(--muted);
}

/* === Timer Display === */
.timer-display {
	padding: 10px 16px;
	border: 2px solid var(--accent);
	border-radius: 8px;
	background: var(--panel);
	color: var(--text);
	font-weight: 700;
	font-size: 1.125rem;
	text-align: center;
	min-width: 120px;
}

.timer-warning {
	border-color: var(--maybe);
	color: var(--maybe);
	animation: pulse 1s ease infinite;
}

.timer-critical {
	border-color: var(--backkey);
	color: var(--backkey);
	animation: pulse 0.5s ease infinite;
}

@keyframes pulse {
	0%, 100% { opacity: 1; transform: scale(1); }
	50% { opacity: 0.8; transform: scale(1.05); }
}

/* Light theme adjustments for new screens */
:root.light-theme .home-btn-secondary {
	background: #f8f9fa;
	border-color: #adb5bd;
}

:root.light-theme .mode-card,
:root.light-theme .selection-card {
	background: #f8f9fa;
	border-color: #adb5bd;
}

:root.light-theme .mode-card:hover:not(.mode-card-disabled),
:root.light-theme .selection-card:hover {
	box-shadow: 0 8px 24px rgba(0, 123, 255, 0.2);
}

:root.light-theme .back-btn:hover {
	background: #f8f9fa;
}

:root.light-theme .timer-display {
	background: #f8f9fa;
	border-color: #007bff;
}

/* Mobile adjustments */
@media (max-width: 768px) {
	.home-title {
		font-size: 3rem;
	}
	
	.mode-grid {
		grid-template-columns: 1fr 1fr;
		gap: 12px;
	}
	
	.mode-card,
	.selection-card {
		padding: 20px 16px;
	}
	
	.mode-icon {
		font-size: 2.5rem;
	}
	
	.btn-icon {
		font-size: 2.5rem;
	}
}

@media (max-width: 480px) {
	.home-container,
	.mode-container {
		padding: 20px 16px;
	}
	
	.selection-grid {
		grid-template-columns: 1fr 1fr;
		gap: 12px;
	}
	
	.screen-title {
		font-size: 1.5rem;
	}
}
