body.pes-standalone {
	margin: 0;
	padding: 0;
	height: 100vh;
	overflow: hidden;
	background: #05060a;
}

.pes-root {
	--pes-bg: #0d0f14;
	--pes-panel: #171a22;
	--pes-text: #f2f3f5;
	--pes-muted: #9aa0ac;
	--pes-accent: #3fa9ff;
	position: relative;
	width: 100vw;
	height: 100vh;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pes-controls-hint {
	position: absolute;
	top: 8px;
	left: 0;
	right: 0;
	text-align: center;
	font-size: 12px;
	color: var( --pes-muted );
	z-index: 5;
}

/* Oyun alanı ekranın alt zeminine oturur: üstte %20, sağda/solda %30'ar boşluk
   kalır — o boşluklara canlı oyuncu/lobi panelleri yerleşiyor. */
.pes-stage {
	position: absolute;
	top: 20%;
	bottom: 20%;
	left: 30%;
	right: 30%;
	background: var( --pes-bg );
	overflow: hidden;
	box-shadow: 0 0 0 1px rgba( 255, 255, 255, 0.06 );
}

.pes-stage.pes-cursor-none {
	cursor: none;
}

.pes-stage:fullscreen,
.pes-stage:-webkit-full-screen,
.pes-stage.pes-pseudo-fullscreen {
	top: 0; bottom: 0; left: 0; right: 0;
	width: 100vw;
	height: 100vh;
	background: #000;
	display: flex;
	align-items: center;
	justify-content: center;
}
/* Fallback for iOS Safari, which has no Fullscreen API for non-video
   elements: fixed-position the stage over the whole viewport instead. */
.pes-stage.pes-pseudo-fullscreen {
	position: fixed;
	z-index: 1000;
}
.pes-stage:fullscreen canvas,
.pes-stage:-webkit-full-screen canvas,
.pes-stage.pes-pseudo-fullscreen canvas {
	position: static;
	width: min( 100vw, 100vh * 16 / 9 );
	height: min( 100vh, 100vw * 9 / 16 );
}

.pes-fullscreen-btn {
	position: absolute;
	right: 10px;
	bottom: 10px;
	z-index: 6;
	width: 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba( 0, 0, 0, 0.45 );
	border: none;
	border-radius: 6px;
	color: var( --pes-text );
	cursor: pointer;
	touch-action: manipulation;
}
@media ( hover: hover ) {
	.pes-fullscreen-btn:hover {
		background: rgba( 0, 0, 0, 0.65 );
	}
}
/* Same bottom-right spot in fullscreen too — just a bigger target, and the
   icon itself swaps to the "shrink" glyph (handled in JS). */
.pes-stage:fullscreen .pes-fullscreen-btn,
.pes-stage:-webkit-full-screen .pes-fullscreen-btn,
.pes-stage.pes-pseudo-fullscreen .pes-fullscreen-btn {
	width: 42px;
	height: 42px;
	background: rgba( 0, 0, 0, 0.6 );
}

/* Saha (canvas) üstte pes-topbar'a yer açmak için o kadar küçülüyor —
   pes-stage'in kendi dış boyutu/konumu (ekranın büyük kısmı) değişmiyor,
   sadece içindeki pay topbar+saha arasında yeniden bölüşülüyor. */
.pes-stage canvas {
	position: absolute;
	top: var( --pes-topbar-h );
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: calc( 100% - var( --pes-topbar-h ) );
	display: block;
	touch-action: none;
}

/* Üst bilgi çubuğu: canlı oyuncu adları (bkz. .pes-hud-viewport) — artık
   sahanın üzerine yüzen bir overlay değil, sahanın kendisi bunun için
   yukarıdan küçülüyor. */
.pes-root {
	--pes-topbar-h: 36px;
}
.pes-topbar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: var( --pes-topbar-h );
	display: flex;
	align-items: center;
	z-index: 2;
	background: rgba( 13, 15, 20, 0.4 );
}

/* Sağ yarı: sığdığı sürece sabit durur, sığmadığında (yer varsa sabit,
   yoksa sağa doğru kayan liste) pes-ui.js scrollLeft'i kendisi ilerletir —
   linguapick'teki roster auto-scroll ile aynı teknik, yatay hali. */
.pes-hud-viewport {
	flex: 0 0 50%;
	max-width: 50%;
	margin-left: auto;
	overflow: hidden;
}
.pes-hud {
	display: none;
	align-items: center;
	gap: 6px;
	padding: 0 10px;
	width: max-content;
	white-space: nowrap;
	pointer-events: none;
}
.pes-root[data-phase="countdown"] .pes-hud,
.pes-root[data-phase="playing"] .pes-hud {
	display: flex;
}

/* Uzak bağlantının doğrudan (P2P) mı yoksa yedek (AJAX) yolla mı çalıştığını
   gösteren küçük tanı rozeti — konsol açmadan "bağlandı mı" sorusuna cevap. */
.pes-net-status {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 3;
	padding: 3px 9px;
	border-radius: 999px;
	background: rgba( 0, 0, 0, 0.5 );
	color: var( --pes-text );
	font-size: 11px;
	font-weight: 600;
	pointer-events: none;
}
.pes-net-status[hidden] { display: none; }
.pes-net-status[data-net-state="open"] { color: #3ddc84; }
.pes-net-status[data-net-state="connecting"] { color: #ffcc33; }
.pes-net-status[data-net-state="failed"],
.pes-net-status[data-net-state="disconnected"] { color: #ff9142; }
.pes-chip {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba( 0, 0, 0, 0.45 );
	color: var( --pes-text );
	font-size: 13px;
	font-weight: 600;
	transition: opacity .2s;
}
.pes-chip.is-dead {
	opacity: 0.35;
	text-decoration: line-through;
}
.pes-chip-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex: none;
}

/* Overlays */
.pes-overlay {
	position: absolute;
	inset: 0;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	text-align: center;
	color: var( --pes-text );
	z-index: 3;
	padding: 24px;
	box-sizing: border-box;
}
.pes-root[data-phase="menu"] .pes-overlay-menu { display: flex; background: rgba( 13, 15, 20, 0.5 ); }
.pes-root[data-phase="countdown"] .pes-overlay-countdown { display: flex; background: rgba( 13, 15, 20, 0.55 ); }
.pes-root[data-phase="over"] .pes-overlay-over { display: flex; background: rgba( 13, 15, 20, 0.72 ); }

/* Yeni seviye başladığında kısa süreli "LEVEL N" + konfeti — data-phase'e
   bağlı değil, .show class'ıyla JS'den açılıp kapanıyor, o yüzden .pes-overlay
   temel kuralının display:none'ını burada ayrıca ezmek gerekiyor. */
.pes-level-announce {
	z-index: 7;
	pointer-events: none;
	opacity: 0;
	transition: opacity .25s ease;
	background: transparent;
}
.pes-level-announce.show {
	display: flex;
	opacity: 1;
}
.pes-level-announce-text {
	font-size: 52px;
	font-weight: 800;
	letter-spacing: 2px;
	color: var( --pes-text );
	text-shadow: 0 4px 24px rgba( 0, 0, 0, 0.6 );
}
.pes-confetti {
	position: absolute;
	inset: 0;
	overflow: hidden;
}
.pes-confetti-piece {
	position: absolute;
	top: -14px;
	width: 8px;
	height: 14px;
	border-radius: 2px;
	opacity: 0.9;
	animation-name: pes-confetti-fall;
	animation-timing-function: ease-in;
	animation-fill-mode: forwards;
}
@keyframes pes-confetti-fall {
	0%   { transform: translateY(0) rotate(0deg); opacity: 0.9; }
	100% { transform: translateY(360px) rotate(540deg); opacity: 0; }
}

.pes-title {
	font-size: 42px;
	margin: 0 0 8px;
	letter-spacing: 1px;
}

.pes-field {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}
.pes-field[hidden] {
	display: none;
}

.pes-field label {
	font-size: 13px;
	color: var( --pes-muted );
	text-transform: uppercase;
	letter-spacing: .5px;
}
.pes-hint {
	margin: 0;
	font-size: 12px;
	color: var( --pes-muted );
}

.pes-select {
	background: var( --pes-panel );
	color: var( --pes-text );
	border: 1px solid rgba( 255, 255, 255, 0.15 );
	padding: 10px 16px;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	touch-action: manipulation;
	min-width: 180px;
	text-align: center;
	text-align-last: center;
}

.pes-btn {
	display: inline-block;
	border: none;
	background: var( --pes-panel );
	color: var( --pes-text );
	padding: 12px 28px;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	text-decoration: none;
	touch-action: manipulation;
}
.pes-btn[hidden] {
	display: none;
}
.pes-btn-primary {
	background: var( --pes-accent );
	color: #08131c;
}
.pes-btn-sm {
	padding: 6px 14px;
	font-size: 13px;
}
.pes-over-actions {
	display: flex;
	gap: 10px;
}

/* Başla/Devam split-tuş: ana buton doğrudan (kaldığı yerden) başlatır,
   yanındaki ok ise özel (native <select> DEĞİL) bir liste açıp herhangi
   bir seviyeyi seçmeyi sağlıyor. Native <select>'in aksine bu tamamen bizim
   DOM'umuzda olduğu için tam ekran modunda da sorunsuz açılıyor — native
   select popup'ları birçok tarayıcıda tam ekran elementinin içinde güvenilir
   çalışmıyor ("dropdown çalışmıyor full screende" hatasının kök sebebi buydu). */
.pes-split-btn {
	position: relative;
	display: inline-flex;
}
.pes-split-main {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}
.pes-split-caret {
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
	border-left: 1px solid rgba( 0, 0, 0, 0.25 );
	padding: 12px 16px;
	font-size: 11px;
}
.pes-dropdown-list {
	position: absolute;
	top: calc( 100% + 6px );
	left: 0;
	right: 0;
	z-index: 10;
	max-height: 260px;
	overflow-y: auto;
	background: var( --pes-panel );
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba( 0, 0, 0, 0.5 );
	padding: 4px;
}
.pes-dropdown-list[hidden] {
	display: none;
}
.pes-dropdown-list button {
	display: block;
	width: 100%;
	text-align: center;
	border: none;
	background: transparent;
	color: var( --pes-text );
	font-size: 13px;
	font-weight: 600;
	padding: 7px 10px;
	border-radius: 6px;
	cursor: pointer;
	touch-action: manipulation;
}
.pes-dropdown-list button:hover,
.pes-dropdown-list button:focus {
	background: rgba( 255, 255, 255, 0.1 );
}

.pes-countdown-num {
	font-size: 96px;
	font-weight: 800;
}

.pes-result {
	font-size: 28px;
	font-weight: 800;
}

/* Sağ/sol %30'luk boşluklara oturan paneller — sadece menü fazında görünür,
   sahanın üstüne değil YANINA biner, hiçbir zaman oyun ekranıyla çakışmaz. */
.pes-side {
	position: absolute;
	top: 20%;
	bottom: 20%;
	width: 30%;
	box-sizing: border-box;
	padding: 20px 16px;
	color: var( --pes-text );
	overflow-y: auto;
	display: none;
}
.pes-root[data-phase="menu"] .pes-side:not( [hidden] ) {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 12px;
}
.pes-side-left { left: 0; }
.pes-side-right { right: 0; }

.pes-roster-head {
	margin-bottom: 10px;
}
.pes-roster-head h2,
.pes-side-right h2 {
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: .5px;
	color: var( --pes-muted );
	margin: 0 0 2px;
	font-weight: 600;
}
.pes-roster-sub {
	font-size: 11px;
	color: var( --pes-muted );
	opacity: 0.7;
	margin: 0;
}
.pes-roster-viewport {
	width: 100%;
	overflow-y: auto;
}
.pes-roster-track {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.pes-roster-item {
	border: none;
	background: rgba( 255, 255, 255, 0.08 );
	color: var( --pes-text );
	padding: 8px 14px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 13px;
	text-align: left;
	touch-action: manipulation;
	display: flex;
	align-items: center;
	gap: 8px;
}
.pes-roster-item .pes-score {
	color: var( --pes-accent );
	font-weight: 700;
	margin-left: auto;
}
.pes-roster-name.is-confirmed {
	color: #3ddc84;
	font-weight: 700;
}
.pes-roster-status {
	font-size: 11px;
	opacity: 0.8;
}
@media ( hover: hover ) {
	.pes-roster-item:not( [disabled] ):hover {
		background: var( --pes-accent );
		color: #08131c;
	}
}
.pes-roster-item[disabled] {
	cursor: default;
	opacity: 0.7;
}
.pes-roster-empty {
	color: var( --pes-muted );
	font-size: 13px;
}

.pes-entry-gate {
	position: fixed;
	inset: 0;
	z-index: 2000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba( 5, 6, 10, 0.94 );
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.pes-entry-gate[hidden] { display: none; }
.pes-entry-box {
	background: var( --pes-panel );
	border-radius: 12px;
	padding: 32px 36px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	box-shadow: 0 12px 40px rgba( 0, 0, 0, 0.5 );
}
.pes-entry-box h2 {
	margin: 0;
	color: var( --pes-text );
	font-size: 24px;
}
.pes-entry-box input {
	background: var( --pes-bg );
	border: 1px solid rgba( 255, 255, 255, 0.15 );
	color: var( --pes-text );
	padding: 10px 14px;
	border-radius: 6px;
	font-size: 15px;
	width: 220px;
	text-align: center;
}

.pes-invite-banner {
	position: fixed;
	top: 16px;
	left: 50%;
	transform: translateX( -50% );
	z-index: 1500;
	max-width: min( 90vw, 480px );
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	justify-content: center;
	background: #12253a;
	border: 1px solid var( --pes-accent );
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 14px;
	color: var( --pes-text );
	box-shadow: 0 8px 24px rgba( 0, 0, 0, 0.4 );
}
.pes-invite-banner[hidden] { display: none; }

.pes-lobby-countdown {
	font-size: 48px;
	font-weight: 800;
	color: var( --pes-accent );
	margin-bottom: 10px;
}
.pes-lobby-list {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 8px;
	overflow-y: auto;
}

