/* Mahjong (Triple Tile) — тёмная тема. Палитра как gs.css. */
.mahjong-app {
	--bg: #000;
	--panel: #0b0f19;
	--panel-b: #1f2937;
	--text: #fff;
	--muted: #94a3b8;
	--accent: #8b5cf6;
	--accent-d: #7c3aed;
	--c-green: #10b981;
	--c-red: #ef4444;
	--tile-bg: #f5e9c8;
	--tile-edge: #c9b07a;
	--tile-side: #a98f56;

	max-width: 960px;
	color: var(--text);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	padding-bottom: 40px;
}

/* ---- Шапка ---- */
.mahjong-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 14px;
}
.mahjong-title { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: .5px; }
.mahjong-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.mahjong-stats { display: flex; gap: 10px; }
.mahjong-stat {
	background: var(--panel);
	border: 1px solid var(--panel-b);
	border-radius: 12px;
	padding: 6px 14px;
	min-width: 80px;
	text-align: center;
}
.mahjong-stat-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.mahjong-stat-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- Поле ---- */
.mahjong-board-wrap {
	background: radial-gradient(120% 100% at 50% 0%, #10331f, #06140d 70%);
	border: 1px solid var(--panel-b);
	border-radius: 16px;
	padding: 14px;
	overflow-x: auto;
}
.mahjong-board {
	position: relative;
	margin: 0 auto;
	width: 100%;
	min-height: 360px;
}

/* ---- Фишка ---- */
.mj-tile {
	position: absolute;
	padding: 0;
	border: none;
	border-radius: 7px;
	background: var(--tile-bg);
	box-shadow:
		inset 0 0 0 1px var(--tile-edge),
		0 3px 0 var(--tile-side),
		0 5px 6px rgba(0, 0, 0, .45);
	cursor: default;
	overflow: hidden;
	transition: transform .08s ease, box-shadow .08s ease, filter .12s ease;
}
.mj-tile.removed { display: none; }
/* Заблокированные (накрытые) фишки притушены и некликабельны. */
.mj-tile:not(.free) { filter: brightness(.62) saturate(.8); }
.mj-tile.free { cursor: pointer; }
.mj-tile.free:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px var(--accent), 0 5px 0 var(--tile-side), 0 8px 10px rgba(0,0,0,.5); }
.mj-tile.hint {
	animation: mj-hint .4s ease-in-out 3;
	box-shadow: inset 0 0 0 2px var(--c-green), 0 3px 0 var(--tile-side), 0 5px 8px rgba(0,0,0,.5);
}
@keyframes mj-hint {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-4px); }
}

.mj-face {
	position: absolute;
	inset: 3px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: clamp(15px, 4.5vw, 26px);
	line-height: 1;
}
.mj-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	pointer-events: none;
}

/* ---- Лоток ---- */
.mahjong-tray {
	display: flex;
	gap: 8px;
	justify-content: center;
	margin: 16px auto;
	padding: 10px;
	background: var(--panel);
	border: 1px solid var(--panel-b);
	border-radius: 14px;
	max-width: 460px;
}
.mj-tray-slot {
	position: relative;
	width: 46px;
	height: 60px;
	border-radius: 8px;
	background: #070a12;
	border: 1px dashed #2a3550;
}
.mj-tray-slot.filled {
	background: var(--tile-bg);
	border: none;
	box-shadow: inset 0 0 0 1px var(--tile-edge), 0 3px 0 var(--tile-side), 0 4px 6px rgba(0,0,0,.45);
}
.mj-tray-slot .mj-face { font-size: 26px; }

/* ---- Кнопки ---- */
.mahjong-actions {
	display: flex;
	gap: 8px;
	justify-content: center;
	flex-wrap: wrap;
}
.mahjong-btn {
	background: var(--panel);
	border: 1px solid var(--panel-b);
	color: var(--text);
	border-radius: 10px;
	padding: 11px 18px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all .12s ease;
}
.mahjong-btn:hover:not(:disabled) { border-color: var(--accent); background: #11182b; }
.mahjong-btn:disabled { opacity: .42; cursor: not-allowed; }
.mahjong-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.mahjong-btn-primary:hover { background: var(--accent-d); border-color: var(--accent-d); }

/* ---- Модалка ---- */
.mahjong-modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .72);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 1050;
}
.mahjong-modal.show { display: flex; }
.mahjong-modal-card {
	background: var(--panel);
	border: 1px solid var(--panel-b);
	border-radius: 18px;
	padding: 28px 32px;
	text-align: center;
	max-width: 360px;
	width: 90%;
}
.mahjong-modal-title { margin: 0 0 14px; font-size: 24px; font-weight: 800; }
.mahjong-modal-body { color: var(--muted); font-size: 16px; line-height: 1.6; }
.mahjong-modal-body strong { color: var(--text); font-variant-numeric: tabular-nums; }
.mj-record { color: var(--c-green); font-weight: 700; }
.mj-muted { color: var(--muted); font-size: 13px; }
.mahjong-modal-actions { display: flex; gap: 8px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

/* ---- Мобильный ---- */
@media (max-width: 560px) {
	.mahjong-head { gap: 10px; margin-bottom: 10px; }
	.mahjong-title { font-size: 22px; }
	.mahjong-stats { gap: 6px; width: 100%; justify-content: space-between; }
	.mahjong-stat { min-width: 0; flex: 1; padding: 5px 8px; }
	.mahjong-stat-value { font-size: 18px; }
	.mahjong-board-wrap { padding: 8px; border-radius: 12px; }
	.mahjong-tray { gap: 6px; padding: 8px; }
	.mj-tray-slot { width: 36px; height: 48px; }
	.mj-tray-slot .mj-face { font-size: 20px; }
	.mahjong-actions { gap: 6px; }
	.mahjong-btn { padding: 10px 12px; font-size: 13px; }
}
