/* ============================================================
   RESET
============================================================ */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	font-family: Arial, Helvetica, sans-serif;
}

html, body {
	width: 100%;
	height: 100%;
	background: #000;
	color: #fff;
	user-select: none;
	overflow: hidden; /* Canvas fullscreen */
}

/* ============================================================
   CANVAS — FULL MOBILE SUPPORT (Android/iPhone)
============================================================ */
#pong {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    width: auto;
    height: 100svh;      /* Hoogte 100% scherm */
    max-width: 100vw;    /* Breedte nooit groter dan scherm */
    max-height: 100svh;  /* Geen overschot */

    z-index: 1;
}

/* HUD boven canvas */
#gameTitle,
#rallyBadge,
#glitchWarning,
#pauseBtn,
#startRoundBtn {
	z-index: 5000;
}

/* ============================================================
   GAME TITLE
============================================================ */
#gameTitle {
	position: absolute;
	bottom: 20px;
	width: 100%;
	text-align: center;
	font-size: 32px;
	letter-spacing: 2px;
	pointer-events: none;
}

/* Neon Titels */
body.theme-neon #gameTitle {
	color: #00eaff;
	text-shadow: 0 0 8px #00eaff, 0 0 14px #00eaff, 0 0 28px #00b7ff,
	             0 0 42px #009cff, 0 0 58px #0088ff;
}
body.theme-retro #gameTitle {
	color: #00ff55;
	text-shadow: 0 0 8px #00ff55, 0 0 14px #00ff55, 0 0 28px #00cc44,
	             0 0 42px #00aa33, 0 0 58px #008822;
}
body.theme-purple #gameTitle {
	color: #b066ff;
	text-shadow: 0 0 8px #b066ff, 0 0 14px #b066ff, 0 0 28px #a040ff,
	             0 0 42px #9020ff, 0 0 58px #8010ff;
}

/* ============================================================
   PAUSE & START BUTTONS
============================================================ */
#pauseBtn {
	position: absolute;
	top: 20px;
	right: 20px;
	font-size: 28px;
	padding: 8px 16px;
	background: rgba(0,0,0,0.4);
	border: 2px solid rgba(255,255,255,0.25);
	color: #fff;
	border-radius: 10px;
	cursor: pointer;
	z-index: 2000;
}
#pauseBtn:hover { background: rgba(255,255,255,0.15); }

#startRoundBtn {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-size: 34px;
	padding: 14px 28px;
	background: rgba(0,0,0,0.6);
	border: 2px solid #00eaff;
	border-radius: 16px;
	color: #00eaff;
	text-shadow: 0 0 10px #00eaff;
	cursor: pointer;
	z-index: 2000;
	display: none;
}

/* ============================================================
   POWERUP MESSAGE
============================================================ */
#powerupMessage {
	position: absolute;
	top: 14%;
	width: 100%;
	text-align: center;
	font-size: 40px;
	font-weight: bold;
	color: #fff;
	text-shadow: 0 0 12px #fff;
	opacity: 0;
	transition: opacity .4s;
	pointer-events: none;
	z-index: 1500;
}

/* ============================================================
   OVERLAY
============================================================ */
.overlay {
	position: fixed;
	inset: 0;
	display: none;
	justify-content: center;
	align-items: center;
	padding: 30px;
	background: rgba(0,0,0,0.55);
	backdrop-filter: blur(6px);
	z-index: 9999;
	overflow-y: auto !important;
	overflow-x: hidden;
}

/* Home zichtbaar bij start */
#homeMenu { display: flex; }

/* ============================================================
   MENU WINDOW — DESKTOP
============================================================ */
.menu-window {
	background: rgba(0,0,0,0.45);
	border: 2px solid rgba(255,255,255,0.18);
	border-radius: 18px;
	padding: 36px 45px;
	width: 95%;
	max-width: 750px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 0 25px rgba(0,255,255,0.25);
}

/* Scrollbar */
.menu-window::-webkit-scrollbar { width: 10px; }
.menu-window::-webkit-scrollbar-thumb {
	background: rgba(255,255,255,0.25);
	border-radius: 4px;
}

/* Settings inner */
#settingsInner {
	max-height: 60vh;
	overflow-y: auto;
	padding-right: 10px;
	margin-top: 10px;
}

/* ============================================================
   TEXT STYLING
============================================================ */
.menu-title {
	font-size: 32px;
	margin-bottom: 10px;
	text-shadow: 0 0 10px #00eaff;
	color: #00eaff;
}

.menu-desc {
	font-size: 17px;
	margin-bottom: 18px;
	color: #ddd;
}

/* ============================================================
   BUTTONS
============================================================ */
.button {
	padding: 12px 22px;
	font-size: 20px;
	border-radius: 12px;
	border: 2px solid rgba(255,255,255,0.28);
	background: rgba(0,0,0,0.25);
	color: #fff;
	cursor: pointer;
	margin-top: 10px;
	width: 100%;
	transition: 0.15s;
}
.button:hover { background: rgba(255,255,255,0.20); }
.button-secondary {
	border-color: rgba(255,255,255,0.15);
	background: rgba(255,255,255,0.08);
}
.button-secondary:hover {
	background: rgba(255,255,255,0.18);
}

.menu-buttons {
	margin-top: 10px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* ============================================================
   INPUTS
============================================================ */
.input {
	width: 100%;
	padding: 12px;
	border-radius: 10px;
	border: 1px solid rgba(255,255,255,0.25);
	margin-top: 12px;
	margin-bottom: 12px;
	font-size: 18px;
	background: rgba(255,255,255,0.05);
	color: #fff;
}

/* ============================================================
   HOME POWERUP LIST
============================================================ */
.home-info {
	margin-top: 25px;
	padding: 22px;
	background: rgba(255,255,255,0.05);
	border: 1px solid rgba(255,255,255,0.12);
	border-radius: 14px;
	box-shadow: 0 0 18px rgba(0,255,255,0.18);
}

.home-info-title {
	text-align: center;
	font-size: 24px;
	margin-bottom: 16px;
	color: #00eaff;
	text-shadow: 0 0 8px #00eaff;
}

.home-info-list {
	display: grid;
	gap: 12px;
}

.home-info-item {
	font-size: 16px;
	color: #e8ffff;
	background: rgba(255,255,255,0.04);
	padding: 10px;
	border-radius: 10px;
	border: 1px solid rgba(255,255,255,0.08);
	box-shadow: inset 0 0 10px rgba(0,255,255,0.15);
	transition: transform 0.15s ease, background 0.3s;
}
.home-info-item:hover {
	transform: scale(1.03);
	background: rgba(0,255,255,0.1);
}

/* ============================================================
   LEADERBOARD
============================================================ */
.lb-container {
	max-height: 55vh;
	overflow-y: auto;
	margin-top: 12px;
	padding-right: 6px;
	text-align: left;
}

.lb-mode-block {
	background: rgba(255,255,255,0.06);
	border: 2px solid rgba(255,255,255,0.15);
	margin: 18px 0;
	padding: 18px 22px;
	border-radius: 14px;
}

.lb-mode-title {
	font-size: 26px;
	margin-bottom: 12px;
	color: #00eaff;
	text-shadow: 0 0 10px #00eaff;
	text-align: center;
}

.lb-ai-title {
	margin-top: 12px;
	margin-bottom: 6px;
	font-size: 20px;
	color: #fff;
	opacity: 0.75;
	border-bottom: 1px solid rgba(255,255,255,0.2);
	padding-bottom: 4px;
}

.lb-sublist { list-style: none; }
.lb-sublist li {
	margin: 8px 0;
	padding: 8px 12px;
	background: rgba(0,0,0,0.25);
	border-radius: 8px;
}

.lb-name { font-size: 18px; font-weight: bold; }
.lb-score { font-size: 16px; color: #ccc; }
.lb-meta  { font-size: 14px; opacity: 0.7; }

/* ============================================================
   FOOTER
============================================================ */
.menu-footer {
	margin-top: 28px;
	padding-top: 14px;
	font-size: 14px;
	color: #cfcfcf;
	opacity: 0.85;
	border-top: 1px solid rgba(255,255,255,0.18);
	text-align: center;
}
.menu-footer b { color: #ff2255; }
.menu-footer a { color: #fff; font-weight: bold; text-decoration: none; }
.menu-footer a:hover { text-shadow: 0 0 8px var(--accent-color); }

/* ============================================================
   RALLY BADGE
============================================================ */
#rallyBadge {
	position: absolute;
	top: 20px;
	right: -200px;
	padding: 10px 22px;
	font-size: 22px;
	font-weight: bold;
	color: #fff;
	background: rgba(0,0,0,0.45);
	border: 2px solid var(--accent-color);
	border-radius: 12px;
	text-shadow: 0 0 8px var(--accent-color);
	box-shadow: 0 0 18px var(--accent-color);
	opacity: 0;
	transition: right .35s ease-out, opacity .35s ease-out, transform .25s ease-out;
	z-index: 9999;
}
#rallyBadge.active {
	right: 20px;
	opacity: 1;
	transform: scale(1.08);
}

/* ============================================================
   GLITCH WARNING
============================================================ */
.glitch-warning {
	position: fixed;
	top: 90px;
	right: 30px;
	padding: 10px 18px;
	border-radius: 10px;
	background: rgba(255, 60, 60, 0.18);
	color: #ff6b6b;
	font-size: 18px;
	font-weight: bold;
	box-shadow: 0 0 12px rgba(255,50,50,0.65);
	opacity: 0;
	transform: translateY(-15px);
	transition: opacity .3s, transform .3s;
}
.glitch-warning.active {
	opacity: 1;
	transform: translateY(0);
}

/* ============================================================
   THEMES
============================================================ */
body.theme-neon {
	--player-color: #00aaff;
	--ai-color: #ff3366;
	--accent-color: #00eaff;
}

body.theme-retro {
	--player-color: #00ff55;
	--ai-color: #22ff99;
	--accent-color: #00ff88;
}

body.theme-purple {
	--player-color: #c066ff;
	--ai-color: #ff44ee;
	--accent-color: #dd99ff;
}

/* ============================================================
   SETTINGS MENU
============================================================ */
#settingsMenu .menu-window {
	max-width: 760px;
	padding: 40px 50px;
	background: rgba(0,0,0,0.55);
	border: 2px solid rgba(255,255,255,0.22);
	border-radius: 20px;
	box-shadow: 0 0 40px rgba(0,255,255,0.20),
	            inset 0 0 25px rgba(0,255,255,0.08);
}
#settingsMenu .menu-title {
	font-size: 34px;
	margin-bottom: 20px;
	color: var(--accent-color);
	text-shadow: 0 0 14px var(--accent-color);
}

/* ============================================================
   SETTINGS UI ELEMENTS
============================================================ */
.setting-group {
	margin-bottom: 28px;
	padding: 18px 20px;
	background: rgba(255,255,255,0.03);
	border: 1px solid rgba(255,255,255,0.12);
	border-radius: 14px;
	box-shadow: inset 0 0 16px rgba(0,255,255,0.08);
	transition: background .25s, transform .25s;
}
.setting-group:hover {
	background: rgba(255,255,255,0.06);
	transform: scale(1.015);
}

.setting-group label {
	font-size: 18px;
	font-weight: bold;
	color: var(--accent-color);
	display: flex;
	justify-content: space-between;
	margin-bottom: 10px;
	text-shadow: 0 0 6px var(--accent-color);
}

.setting-row {
	display: flex;
	justify-content: space-between;
	margin-top: 6px;
	font-size: 14px;
	color: #aaa;
}

/* SLIDERS */
.setting-group input[type=range] {
	width: 100%;
	height: 8px;
	appearance: none;
	background: rgba(255,255,255,0.15);
	border-radius: 10px;
	cursor: pointer;
	margin-top: 5px;
	margin-bottom: 4px;
}
.setting-group input[type=range]::-webkit-slider-thumb {
	appearance: none;
	width: 22px;
	height: 22px;
	background: var(--accent-color);
	border-radius: 50%;
	box-shadow: 0 0 14px var(--accent-color);
	cursor: pointer;
	transition: .15s;
}

/* DROPDOWNS */
.setting-group select {
	width: 100%;
	padding: 12px 16px;
	font-size: 17px;
	border-radius: 12px;
	background: rgba(10,10,20,0.55);
	border: 1px solid rgba(255,255,255,0.22);
	color: #e8ffff;
	text-shadow: 0 0 6px rgba(0,255,255,0.45);
	appearance: none;
	cursor: pointer;
	background-image:
		linear-gradient(45deg, transparent 50%, var(--accent-color) 50%),
		linear-gradient(135deg, var(--accent-color) 50%, transparent 50%),
		linear-gradient(to right, rgba(255,255,255,0.2), rgba(255,255,255,0));
	background-position:
		calc(100% - 18px) calc(50% - 4px),
		calc(100% - 13px) calc(50% - 4px),
		calc(100% - 40px) 0;
	background-size: 6px 6px, 6px 6px, 1px 100%;
	background-repeat: no-repeat;
}
.setting-group select:hover {
	background: rgba(15,25,35,0.7);
	border-color: var(--accent-color);
	box-shadow: 0 0 14px var(--accent-color);
}

/* CHECKBOXES */
.setting-group input[type=checkbox] {
	transform: scale(1.4);
	margin-right: 10px;
	accent-color: var(--accent-color);
}

/* Settings back btn */
#settingsBackBtn {
	margin-top: 20px;
	font-size: 20px;
	padding: 12px;
	border-radius: 12px;
}

body.theme-neon {
	--bg1: rgba(0, 180, 255, 0.35);
	--bg2: rgba(0, 20, 40, 0.9);
	--bg3: rgba(0, 0, 0, 1);

	--player-color: #00aaff;
	--ai-color: #ff3366;
	--accent-color: #00eaff;
}

body.theme-retro {
	--bg1: rgba(0, 255, 140, 0.35);
	--bg2: rgba(0, 40, 20, 0.9);
	--bg3: rgba(0, 0, 0, 1);

	--player-color: #00ff55;
	--ai-color: #22ff99;
	--accent-color: #00ff88;
}

body.theme-purple {
	--bg1: rgba(200, 100, 255, 0.35);
	--bg2: rgba(40, 0, 40, 0.9);
	--bg3: rgba(0, 0, 0, 1);

	--player-color: #c066ff;
	--ai-color: #ff44ee;
	--accent-color: #dd99ff;
}

/* ============================================================
   📱 MOBILE PERFECT FIX
============================================================ */
@media (max-width: 780px) {

	.overlay {
		position: fixed;
		inset: 0;
		width: 100vw;
		height: 100svh;
		display: none;
		justify-content: flex-start;
		align-items: center;
		overflow-y: auto !important;
		padding: 0;
		background: rgba(0,0,0,0.65);
		backdrop-filter: blur(6px);
	}

	.menu-window {
		width: 92vw !important;
		max-width: 92vw !important;
		max-height: calc(100svh - 40px) !important;
		margin: 20px auto !important;
		padding: 22px 20px !important;
		border-radius: 18px !important;
		overflow-y: auto !important;
		-webkit-overflow-scrolling: touch;
	}

	#settingsInner {
		max-height: calc(100svh - 220px) !important;
	}

	.menu-title { font-size: 24px !important; }
	.menu-desc  { font-size: 15px !important; }

	.button { font-size: 18px !important; padding: 10px 12px !important; }

	.home-info { padding: 16px !important; }

	.menu-footer {
		font-size: 12px !important;
		margin-top: 18px !important;
	}
}

/* ============================================
   📱 LANDSCAPE FIX (Android/S22/Chrome)
============================================ */
@media (orientation: landscape) {

    #pong {
        width: 100vw !important;
        height: auto !important;

        max-height: 100svh;
        max-width: 100vw;

        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    /* Pause / home / settings menu groter en beter gecentreerd */
    .menu-window {
        max-width: 70vw !important;
        max-height: 80svh !important;
        padding: 28px 32px !important;
    }

    .menu-buttons .button {
        font-size: 20px !important;
        padding: 12px 16px !important;
    }

    .menu-title {
        font-size: 30px !important;
    }
}