/* بلوگیمز — پوسته مشترک بازی‌ها. از توکن‌های قالب بلوتیشرت با fallback استفاده می‌کند. */

.blu-games {
	--bg-blu: var(--blu-500, #00ADE6);
	--bg-blu-dark: var(--blu-700, #007AA6);
	--bg-slate: var(--slate-600, #4B555A);
	--bg-slate-strong: var(--slate-700, #394246);
	--bg-border: var(--gray-150, #EBEBEB);
	--bg-fill: var(--gray-100, #F4F4F4);
	--bg-gold: #E8932A;
	--bg-danger: var(--danger, #D23B3B);
	--bg-success: var(--success, #1F9D57);
	--bg-radius: var(--radius-lg, 16px);
	--bg-font: var(--font-fa-num, "Yekan Bakh FaNum", "Yekan Bakh", Tahoma, sans-serif);
	font-family: var(--bg-font);
	direction: rtl;
	color: var(--bg-slate);
}

/* ---------- هاب ---------- */
.blu-games__head { text-align: center; margin-bottom: 24px; }
.blu-games__title { font-size: 28px; font-weight: 800; color: var(--bg-slate-strong); margin: 0 0 8px; }
.blu-games__sub { font-size: 15px; font-weight: 300; color: var(--bg-slate); margin: 0; line-height: 1.85; }

.blu-games__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 16px;
	margin: 0 0 28px;
}

.blu-g-card {
	background: #fff;
	border: 1px solid var(--bg-border);
	border-radius: var(--bg-radius);
	padding: 20px 16px;
	text-align: center;
	cursor: pointer;
	transition: box-shadow .2s, transform .2s, border-color .2s;
	-webkit-tap-highlight-color: transparent;
}
.blu-g-card:hover, .blu-g-card:focus-visible {
	border-color: var(--bg-blu);
	box-shadow: 0 4px 12px rgba(75,85,90,.10), 0 12px 32px rgba(75,85,90,.10);
	transform: translateY(-2px);
	outline: none;
}
.blu-g-card__icon { width: 72px; height: 72px; margin: 0 auto 12px; display: block; }
.blu-g-card__name { font-size: 19px; font-weight: 800; color: var(--bg-slate-strong); margin: 0 0 6px; }
.blu-g-card__desc { font-size: 13.5px; font-weight: 300; line-height: 1.8; color: var(--bg-slate); margin: 0 0 12px; min-height: 48px; }
.blu-g-card__best { font-size: 12px; color: var(--bg-blu-dark); margin-bottom: 12px; min-height: 18px; }
.blu-g-card__btn {
	display: inline-block;
	background: var(--bg-blu);
	color: #fff;
	font-family: inherit;
	font-size: 15px;
	font-weight: 500;
	border: 0;
	border-radius: 999px;
	padding: 10px 32px;
	cursor: pointer;
	transition: background .15s;
}
.blu-g-card:hover .blu-g-card__btn { background: var(--bg-blu-dark); }

/* ---------- نوار جوایز ---------- */
.blu-games__tiers {
	background: var(--bg-fill);
	border-radius: var(--bg-radius);
	padding: 20px 16px;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 12px;
	margin-bottom: 16px;
}
.blu-g-tier { text-align: center; padding: 8px; }
.blu-g-tier__medal { width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 15px; }
.blu-g-tier--bronze .blu-g-tier__medal { background: #B08050; }
.blu-g-tier--silver .blu-g-tier__medal { background: #8E9AA3; }
.blu-g-tier--gold .blu-g-tier__medal { background: var(--bg-gold); }
.blu-g-tier__label { font-weight: 700; font-size: 14px; color: var(--bg-slate-strong); }
.blu-g-tier__req { font-size: 12.5px; font-weight: 300; color: var(--bg-slate); line-height: 1.7; }
.blu-games__rules { font-size: 12px; font-weight: 300; color: var(--bg-slate); opacity: .75; text-align: center; line-height: 1.9; }

/* ---------- اورلی بازی ---------- */
.blu-g-overlay {
	position: fixed;
	inset: 0;
	height: 100vh;
	height: 100dvh; /* سافاری iOS: ارتفاع واقعی ویوپورت با نوار آدرس جمع‌شونده */
	z-index: 99999;
	background: #fff;
	display: flex;
	flex-direction: column;
	font-family: var(--bg-font);
	direction: rtl;
	color: var(--bg-slate);
	touch-action: manipulation;
	/* جلوگیری از Select-All آبی با دابل‌تپ در iOS */
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
	-webkit-tap-highlight-color: transparent;
}
.blu-g-overlay input, .blu-g-overlay textarea { -webkit-user-select: text; user-select: text; }
body.blu-g-playing, html.blu-g-playing { overflow: hidden; overscroll-behavior: none; height: 100%; }

.blu-g-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 14px;
	padding-top: max(10px, env(safe-area-inset-top));
	border-bottom: 1px solid var(--bg-border);
	flex: 0 0 auto;
}
.blu-g-topbar__name { font-size: 16px; font-weight: 800; color: var(--bg-slate-strong); }
.blu-g-topbar__score {
	font-size: 16px; font-weight: 800; color: var(--bg-blu-dark);
	background: rgba(0,173,230,.1); border-radius: 999px; padding: 4px 16px; min-width: 90px; text-align: center;
}
.blu-g-topbar__close {
	background: none; border: 0; cursor: pointer; color: var(--bg-slate);
	font-size: 22px; line-height: 1; padding: 6px 10px; border-radius: 8px;
}
.blu-g-topbar__close:hover { background: var(--bg-fill); }
.blu-g-topbar__mute {
	background: none; border: 0; cursor: pointer;
	font-size: 18px; line-height: 1; padding: 6px 8px; border-radius: 8px;
}
.blu-g-topbar__mute:hover { background: var(--bg-fill); }

.blu-g-stage { flex: 1 1 auto; position: relative; overflow: hidden; background: #fff; }
.blu-g-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------- پنل‌های شروع/پایان ---------- */
.blu-g-panel {
	position: absolute; inset: 0; z-index: 5;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	background: rgba(255,255,255,.96);
	padding: 24px; text-align: center; overflow-y: auto;
}
.blu-g-panel__icon { width: 84px; height: 84px; margin-bottom: 16px; }
.blu-g-panel__title { font-size: 24px; font-weight: 800; color: var(--bg-slate-strong); margin: 0 0 10px; }
.blu-g-panel__text { font-size: 14.5px; font-weight: 300; line-height: 2; max-width: 420px; margin: 0 0 20px; }
.blu-g-panel__score { font-size: 42px; font-weight: 800; color: var(--bg-blu); margin: 4px 0 2px; }
.blu-g-panel__scorelabel { font-size: 13px; margin-bottom: 14px; }
.blu-g-panel__record { font-size: 13px; color: var(--bg-gold); font-weight: 700; margin-bottom: 12px; }

.blu-g-btn {
	font-family: inherit; font-size: 15.5px; font-weight: 500;
	border: 0; border-radius: 999px; padding: 13px 40px; cursor: pointer;
	background: var(--bg-blu); color: #fff; transition: background .15s;
	margin: 4px;
	-webkit-tap-highlight-color: transparent;
}
.blu-g-btn:hover { background: var(--bg-blu-dark); }
.blu-g-btn--ghost { background: transparent; color: var(--bg-slate); border: 1.5px solid var(--bg-border); }
.blu-g-btn--ghost:hover { background: var(--bg-fill); }
.blu-g-btn--gold { background: var(--bg-gold); }
.blu-g-btn--gold:hover { background: #cf7f1d; }
.blu-g-btn:disabled { opacity: .5; cursor: default; }

/* ---------- شمارش معکوس ---------- */
.blu-g-count {
	position: absolute; inset: 0; z-index: 6;
	display: flex; align-items: center; justify-content: center;
	font-size: 96px; font-weight: 800; color: var(--bg-blu);
	background: rgba(255,255,255,.85);
}

/* ---------- توست میان بازی ---------- */
.blu-g-toast {
	position: absolute; top: 16px; right: 50%; transform: translateX(50%) translateY(-70px);
	z-index: 7; background: var(--bg-slate-strong); color: #fff;
	font-size: 14px; font-weight: 500; padding: 10px 22px; border-radius: 999px;
	transition: transform .35s cubic-bezier(.25,.1,.25,1), opacity .35s;
	opacity: 0; pointer-events: none; white-space: nowrap;
}
.blu-g-toast--show { transform: translateX(50%) translateY(0); opacity: 1; }
.blu-g-toast--gold { background: var(--bg-gold); }

/* ---------- جایزه ---------- */
.blu-g-reward {
	background: var(--bg-fill); border: 1.5px dashed var(--bg-blu);
	border-radius: var(--bg-radius); padding: 18px 20px; max-width: 380px; width: 100%; margin: 0 0 16px;
}
.blu-g-reward__title { font-size: 15px; font-weight: 700; color: var(--bg-slate-strong); margin-bottom: 10px; }
.blu-g-reward__email {
	width: 100%; font-family: inherit; font-size: 14px; padding: 11px 14px;
	border: 1px solid var(--bg-border); border-radius: 10px; margin-bottom: 10px;
	direction: ltr; text-align: left; background: #fff; color: var(--bg-slate-strong);
}
.blu-g-reward__email:focus { outline: none; border-color: var(--bg-blu); box-shadow: 0 0 0 3px rgba(0,173,230,.3); }
.blu-g-reward__hint { font-size: 11.5px; font-weight: 300; opacity: .7; line-height: 1.8; margin-top: 8px; }

.blu-g-code {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	background: #fff; border: 1.5px solid var(--bg-blu); border-radius: 12px;
	padding: 12px 16px; margin: 10px 0;
}
.blu-g-code__value { font-size: 20px; font-weight: 800; letter-spacing: .08em; color: var(--bg-blu-dark); direction: ltr; }
.blu-g-code__copy {
	font-family: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
	background: var(--bg-blu); color: #fff; border: 0; border-radius: 999px; padding: 7px 16px;
}
.blu-g-error { color: var(--bg-danger); font-size: 13px; line-height: 1.8; margin: 8px 0; }
.blu-g-success { color: var(--bg-success); font-size: 13px; line-height: 1.8; margin: 8px 0; }

/* ---------- بنر معرفی (شورت‌کد [blu_games_banner]) ---------- */
.blu-g-banner {
	display: flex;
	align-items: center;
	gap: 16px;
	direction: rtl;
	font-family: var(--font-fa-num, "Yekan Bakh FaNum", "Yekan Bakh", Tahoma, sans-serif);
	background: linear-gradient(135deg, #00ADE6, #007AA6);
	color: #fff !important;
	text-decoration: none !important;
	border-radius: 16px;
	padding: 18px 22px;
	margin: 12px 0;
	box-shadow: 0 4px 12px rgba(0, 122, 166, .25);
	transition: transform .2s, box-shadow .2s;
}
.blu-g-banner:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 122, 166, .35); color: #fff; }
.blu-g-banner__art { flex: 0 0 52px; width: 52px; height: 52px; background: rgba(255,255,255,.16); border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.blu-g-banner__art svg { width: 34px; height: 34px; }
.blu-g-banner__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.blu-g-banner__title { font-size: 18px; font-weight: 800; line-height: 1.5; }
.blu-g-banner__sub { font-size: 13px; font-weight: 300; opacity: .92; line-height: 1.8; }
.blu-g-banner__btn {
	flex: 0 0 auto;
	background: #fff;
	color: #007AA6;
	font-size: 14.5px;
	font-weight: 700;
	border-radius: 999px;
	padding: 11px 26px;
	white-space: nowrap;
}
@media (max-width: 560px) {
	.blu-g-banner { flex-wrap: wrap; padding: 16px; gap: 12px; }
	.blu-g-banner__body { flex: 1 1 calc(100% - 64px); }
	.blu-g-banner__btn { flex: 1 1 100%; text-align: center; }
	.blu-g-banner__title { font-size: 16px; }
}

/* ---------- لیدربورد ---------- */
.blu-g-lb {
	background: #fff;
	border: 1px solid var(--bg-border);
	border-radius: var(--bg-radius);
	padding: 20px;
	margin-bottom: 24px;
	max-width: 560px;
	margin-left: auto;
	margin-right: auto;
}
.blu-g-lb__title { font-size: 19px; font-weight: 800; color: var(--bg-slate-strong); margin: 0 0 4px; text-align: center; }
.blu-g-lb__sub { font-size: 12.5px; font-weight: 300; color: var(--bg-slate); text-align: center; margin: 0 0 14px; }
.blu-g-lb__tabs { display: flex; gap: 6px; justify-content: center; margin-bottom: 12px; }
.blu-g-lb__tab {
	font-family: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
	background: var(--bg-fill); color: var(--bg-slate); border: 1.5px solid transparent;
	border-radius: 999px; padding: 7px 22px; transition: all .15s;
}
.blu-g-lb__tab.is-active { background: var(--bg-blu); color: #fff; }
.blu-g-lb__tab:not(.is-active):hover { border-color: var(--bg-blu); }
.blu-g-lb__prize {
	background: rgba(232,147,42,.1); border: 1px dashed var(--bg-gold);
	color: var(--bg-slate-strong); border-radius: 12px; font-size: 12.5px; font-weight: 400;
	padding: 10px 14px; margin-bottom: 12px; text-align: center; line-height: 1.9;
}
.blu-g-lb__prize b { color: var(--bg-gold); }
.blu-g-lb__row {
	display: flex; align-items: center; gap: 12px;
	padding: 8px 10px; border-radius: 10px;
}
.blu-g-lb__row:nth-child(odd) { background: var(--bg-fill); }
.blu-g-lb__row--me { outline: 1.5px solid var(--bg-blu); background: rgba(0,173,230,.07) !important; }
.blu-g-lb__medal, .blu-g-lb__num {
	width: 28px; height: 28px; border-radius: 50%; flex: 0 0 28px;
	display: flex; align-items: center; justify-content: center;
	font-size: 13px; font-weight: 800;
}
.blu-g-lb__num { color: var(--bg-slate); background: var(--bg-border); }
.blu-g-lb__medal { color: #fff; }
.blu-g-lb__medal--1 { background: var(--bg-gold); }
.blu-g-lb__medal--2 { background: #8E9AA3; }
.blu-g-lb__medal--3 { background: #B08050; }
.blu-g-lb__name { flex: 1; font-size: 14.5px; font-weight: 700; color: var(--bg-slate-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blu-g-lb__score { font-size: 14.5px; font-weight: 800; color: var(--bg-blu-dark); }
.blu-g-lb__empty { text-align: center; font-size: 13px; font-weight: 300; padding: 14px 0; opacity: .7; }
.blu-g-lb__me { text-align: center; font-size: 13px; font-weight: 500; color: var(--bg-blu-dark); margin-top: 10px; min-height: 18px; }
.blu-g-panel__rank { font-size: 13.5px; font-weight: 400; color: var(--bg-slate); margin-bottom: 12px; min-height: 20px; line-height: 1.9; }
.blu-g-panel__rank b { color: var(--bg-blu-dark); }

/* ---------- فرم ثبت‌نام بازیکن ---------- */
.blu-g-reg { width: 100%; max-width: 340px; }
.blu-g-reg input {
	width: 100%; font-family: inherit; font-size: 15px; padding: 12px 14px;
	border: 1.5px solid var(--bg-border); border-radius: 12px; margin-bottom: 10px;
	background: #fff; color: var(--bg-slate-strong); box-sizing: border-box;
}
.blu-g-reg input:focus { outline: none; border-color: var(--bg-blu); box-shadow: 0 0 0 3px rgba(0,173,230,.25); }
.blu-g-reg .blu-g-reg__phone { direction: ltr; text-align: center; letter-spacing: .12em; }
.blu-g-reg .blu-g-btn { width: 100%; }
.blu-g-reg .blu-g-reg__err { min-height: 18px; margin: 0 0 6px; }

/* ---------- ایران‌گردی بلو ---------- */
.blu-g-map {
	background: #fff; border: 1px solid var(--bg-border); border-radius: var(--bg-radius);
	padding: 20px; margin-bottom: 24px; max-width: 720px; margin-left: auto; margin-right: auto;
}
.blu-g-map__row { display: flex; align-items: flex-start; justify-content: center; flex-wrap: wrap; gap: 2px; }
.blu-g-map__city { display: flex; flex-direction: column; align-items: center; width: 62px; }
.blu-g-map__dot {
	background: var(--bg-blu); color: #fff; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	font-weight: 800; font-size: 15px; transition: transform .2s;
	box-shadow: 0 2px 8px rgba(0,173,230,.3);
}
.blu-g-map__city.is-mine .blu-g-map__dot { outline: 3px solid var(--bg-gold); }
.blu-g-map__city:hover .blu-g-map__dot { transform: scale(1.1); }
.blu-g-map__name { font-size: 11.5px; font-weight: 700; color: var(--bg-slate-strong); margin-top: 6px; text-align: center; }
.blu-g-map__n { font-size: 10.5px; font-weight: 300; color: var(--bg-slate); opacity: .8; }
.blu-g-map__link { flex: 0 0 10px; height: 3px; background: var(--bg-border); border-radius: 2px; margin-top: 22px; }
.blu-g-map__souv { font-size: 13px; margin-top: 2px; }
.blu-g-map__me { text-align: center; font-size: 13px; font-weight: 500; color: var(--bg-blu-dark); margin-top: 14px; }
@media (max-width: 560px) { .blu-g-map__city { width: 54px; } .blu-g-map__link { display: none; } }

/* ---------- کدهای من ---------- */
.blu-g-mycodes {
	background: #fff; border: 1px solid var(--bg-border); border-radius: var(--bg-radius);
	padding: 18px 20px; margin-bottom: 24px; max-width: 560px; margin-left: auto; margin-right: auto;
}
.blu-g-mycodes .blu-g-code { margin: 8px 0; }

/* ---------- کمد بلو (بازی حافظه) ---------- */
.blu-w { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 12px; }
.blu-w-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex: 0 0 auto; }
.blu-w-round { font-size: 14px; font-weight: 700; color: var(--bg-slate-strong); white-space: nowrap; }
.blu-w-timerbar { flex: 1; height: 10px; background: var(--bg-border); border-radius: 999px; overflow: hidden; }
.blu-w-timerbar span { display: block; height: 100%; background: var(--bg-blu); border-radius: 999px; transition: width .2s linear; }
.blu-w-timerbar.is-low span { background: var(--bg-danger); }
.blu-w-grid {
	flex: 1; display: grid; gap: 10px; align-content: center;
	max-width: 520px; width: 100%; margin: 0 auto;
}
.blu-w-card {
	position: relative; border: 0; background: none; padding: 0; cursor: pointer;
	aspect-ratio: 3 / 3.4; perspective: 500px; -webkit-tap-highlight-color: transparent;
}
.blu-w-inner {
	position: absolute; inset: 0; transition: transform .3s;
	transform-style: preserve-3d;
}
.blu-w-card.is-flip .blu-w-inner { transform: rotateY(180deg); }
.blu-w-face {
	position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
	border-radius: 12px; display: flex; align-items: center; justify-content: center;
}
.blu-w-face svg { width: 58%; height: 58%; }
.blu-w-back { background: rgba(0,173,230,.08); border: 1.5px solid rgba(0,173,230,.35); }
.blu-w-back img { width: 62%; height: 62%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.blu-w-back svg { opacity: .9; }
.blu-w-front { background: #fff; border: 1.5px solid var(--bg-border); transform: rotateY(180deg); box-shadow: 0 1px 3px rgba(75,85,90,.08); }
.blu-w-grid--dense { gap: 7px; max-width: 560px; }
.blu-w-card.is-match { pointer-events: none; }
.blu-w-card.is-match .blu-w-front { border-color: var(--bg-success); box-shadow: 0 0 0 2px rgba(31,157,87,.25); }
.blu-w-card.is-match .blu-w-inner { animation: bluwpop .4s; }
@keyframes bluwpop { 50% { transform: rotateY(180deg) scale(1.08); } 100% { transform: rotateY(180deg); } }

/* ---------- موبایل ---------- */
@media (max-width: 480px) {
	.blu-games__title { font-size: 23px; }
	.blu-g-card__desc { min-height: 0; }
	.blu-g-panel__title { font-size: 21px; }
	.blu-g-panel__score { font-size: 36px; }
	.blu-g-topbar__name { font-size: 14px; }
}
