/**
 * GTAPT Profile Hover — Milk / fd_dark friendly
 * Mockup: dark card #1a1f2b, border #2d2b4d, accent #5046e5
 */

.ph-card {
	--ph-bg: #2D2B4D;
	--ph-border: #353457;
	--ph-accent: #5046e5;
	--ph-accent-hover: #635af0;
	--ph-text: #ffffff;
	--ph-muted: #9aa3b2;
	--ph-soft: #171b24;
	--ph-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
	position: fixed;
	z-index: 10050;
	width: 280px;
	max-width: calc(100vw - 24px);
	color: var(--ph-text);
	font-size: 13px;
	line-height: 1.4;
	pointer-events: auto;
}

/* Light-style fallbacks (still readable) */
html:not(.fd_dark):not(.milk-dark) .ph-card,
body:not(.fd_dark) .ph-card {
	--ph-bg: #ffffff;
	--ph-border: #d8dce3;
	--ph-text: #1f2430;
	--ph-muted: #6a7380;
	--ph-soft: #f5f7fa;
	--ph-shadow: 0 12px 32px rgba(20, 24, 40, 0.18);
}

html.fd_dark .ph-card,
body.fd_dark .ph-card,
.fd_dark .ph-card,
html.milk-dark .ph-card {
	--ph-bg: #2D2B4D;
	--ph-border: #353457;
	--ph-text: #ffffff;
	--ph-muted: #9aa3b2;
	--ph-soft: #171b24;
	--ph-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.ph-card[hidden] {
	display: none !important;
}

.ph-card-inner {
	position: relative;
	background: var(--ph-bg);
	border: 1px solid var(--ph-border);
	border-radius: 12px;
	box-shadow: var(--ph-shadow);
	padding: 0 0 14px;
	overflow: visible;
}

/* Speech-bubble tip (rotated square). Stack BEHIND the cover so the photo hides the overlapping half. */
.ph-arrow {
	position: absolute;
	width: 12px;
	height: 12px;
	background: var(--ph-bg);
	border-left: 1px solid var(--ph-border);
	border-bottom: 1px solid var(--ph-border);
	transform: rotate(45deg);
	left: -6px;
	top: 28px;
	z-index: 1;
	pointer-events: none;
	box-sizing: border-box;
}

.ph-card.ph-flip-left .ph-arrow {
	left: auto;
	right: -6px;
	border-left: none;
	border-bottom: none;
	border-right: 1px solid var(--ph-border);
	border-top: 1px solid var(--ph-border);
}

.ph-loading,
.ph-error {
	text-align: center;
	padding: 28px 16px;
	color: var(--ph-muted);
}

.ph-error {
	color: #f07178;
}


.ph-cover {
	position: relative;
	z-index: 2;
	height: 96px;
	background-color: var(--ph-soft);
	background-size: cover;
	background-repeat: no-repeat;
	background-position: 50% 50%;
	border-radius: 12px 12px 0 0;
}

.ph-cover[hidden] {
	display: none !important;
}

.ph-body:not(.ph-has-cover) .ph-header {
	padding-top: 18px;
	margin-top: 0;
}

.ph-body.ph-has-cover .ph-header {
	margin-top: -40px;
	position: relative;
	z-index: 3;
}

.ph-header {
	padding-left: 16px;
	padding-right: 16px;
}

.ph-stats,
.ph-actions,
.ph-bio {
	padding-left: 16px;
	padding-right: 16px;
}

.ph-loading,
.ph-error {
	padding-left: 16px;
	padding-right: 16px;
}
.ph-header {
	text-align: center;
	margin-bottom: 12px;
}

.ph-avatar-wrap {
	position: relative;
	z-index: 3;
	position: relative;
	width: auto;
	height: auto;
	min-height: 72px;
	margin: 0 auto 10px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ph-avatar {
	width: auto;
	height: auto;
	max-width: 96px;
	max-height: 96px;
	border-radius: 0;
	object-fit: contain;
	display: block;
	border: 2px solid var(--ph-border);
	background: var(--ph-soft);
}

.ph-avatar[hidden],
.ph-avatar-fallback[hidden] {
	display: none !important;
}

.ph-avatar-fallback {
	width: 72px;
	height: 72px;
	border-radius: 0;
	border: 2px solid var(--ph-border);
	background: linear-gradient(145deg, #2a3142, #1a1f2b);
	display: flex;
	align-items: center;
	justify-content: center;
}

.ph-avatar-fallback::before {
	content: "";
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.18);
	box-shadow: 0 14px 0 -4px rgba(255, 255, 255, 0.12);
}

.ph-username {
	font-size: 16px;
	font-weight: 700;
	color: var(--ph-text);
	word-break: break-word;
	margin-bottom: 6px;
}

.ph-username a {
	color: inherit;
	text-decoration: none;
}

.ph-rank {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px;
	border-radius: 999px;
	background: #F8A697;
	color: #fff;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.02em;
	margin-bottom: 8px;
}

.ph-rank[hidden] {
	display: none !important;
}

.ph-rank::before {
	content: "";
	width: 10px;
	height: 12px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11v8.8z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11v8.8z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.ph-meta {
	display: flex;
	justify-content: center;
	gap: 14px;
	flex-wrap: wrap;
	color: var(--ph-muted);
	font-size: 11px;
}

.ph-joined::before,
.ph-posts-meta::before {
	display: inline-block;
	margin-right: 4px;
	opacity: 0.85;
}

.ph-joined::before {
	content: "📅";
	font-size: 10px;
}

.ph-posts-meta::before {
	content: "💬";
	font-size: 10px;
}

.ph-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 6px;
	border-top: 1px solid var(--ph-border);
	padding-top: 12px;
	margin-bottom: 12px;
	text-align: center;
}

.ph-stats.ph-stats-2 {
	grid-template-columns: repeat(2, 1fr);
}

.ph-stat {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	min-width: 0;
}

.ph-stat[hidden] {
	display: none !important;
}

.ph-stat-icon {
	width: 16px;
	height: 16px;
	opacity: 0.9;
	margin-bottom: 2px;
}

.ph-icon-posts,
.ph-icon-star,
.ph-icon-trophy,
.ph-icon-user,
.ph-icon-mail {
	display: inline-block;
	background: var(--ph-muted);
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-size: contain;
	mask-size: contain;
}

.ph-icon-posts {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zm4 18H6V4h7v5h5v11z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6zm4 18H6V4h7v5h5v11z'/%3E%3C/svg%3E");
}

.ph-icon-star {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E");
}

.ph-icon-trophy {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M19 5h-2V3H7v2H5c-1.1 0-2 .9-2 2v1c0 2.55 1.92 4.63 4.39 4.94A5.01 5.01 0 0 0 11 15.9V19H7v2h10v-2h-4v-3.1a5.01 5.01 0 0 0 3.61-2.96C19.08 12.63 21 10.55 21 8V7c0-1.1-.9-2-2-2zM5 8V7h2v3.82C5.84 10.4 5 9.3 5 8zm14 0c0 1.3-.84 2.4-2 2.82V7h2v1z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M19 5h-2V3H7v2H5c-1.1 0-2 .9-2 2v1c0 2.55 1.92 4.63 4.39 4.94A5.01 5.01 0 0 0 11 15.9V19H7v2h10v-2h-4v-3.1a5.01 5.01 0 0 0 3.61-2.96C19.08 12.63 21 10.55 21 8V7c0-1.1-.9-2-2-2zM5 8V7h2v3.82C5.84 10.4 5 9.3 5 8zm14 0c0 1.3-.84 2.4-2 2.82V7h2v1z'/%3E%3C/svg%3E");
}

.ph-icon-user {
	width: 14px;
	height: 14px;
	background: #fff;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 12c2.7 0 4.8-2.1 4.8-4.8S14.7 2.4 12 2.4 7.2 4.5 7.2 7.2 9.3 12 12 12zm0 2.4c-3.2 0-9.6 1.6-9.6 4.8V22h19.2v-2.8c0-3.2-6.4-4.8-9.6-4.8z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 12c2.7 0 4.8-2.1 4.8-4.8S14.7 2.4 12 2.4 7.2 4.5 7.2 7.2 9.3 12 12 12zm0 2.4c-3.2 0-9.6 1.6-9.6 4.8V22h19.2v-2.8c0-3.2-6.4-4.8-9.6-4.8z'/%3E%3C/svg%3E");
}

.ph-icon-mail {
	width: 14px;
	height: 14px;
	background: var(--ph-text);
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z'/%3E%3C/svg%3E");
}

.ph-stat-label {
	color: var(--ph-muted);
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.ph-stat-value {
	color: var(--ph-text);
	font-weight: 500;
	font-size: 14px;
}

.ph-bio {
	color: var(--ph-muted);
	font-size: 12px;
	text-align: center;
	margin: 0 0 14px;
	padding: 0 4px;
}

.ph-bio[hidden] {
	display: none !important;
}

.ph-actions {
	display: flex;
	gap: 8px;
}

.ph-btn {
	flex: 1 1 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 8px 10px;
	border-radius: 8px;
	font-size: 12px;
	font-weight: 500;
	text-decoration: none !important;
	box-sizing: border-box;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
	min-width: 0;
	white-space: nowrap;
}

.ph-btn[hidden] {
	display: none !important;
}

.ph-btn-primary {
	background: #F8A697;
	color: #fff !important;
	border: none;
}

.ph-btn-primary:hover,
.ph-btn-primary:focus {
	background: #F4B2A6;
	border: none;
	color: #fff !important;
}

.ph-btn-secondary {
	background: transparent;
	color: var(--ph-text) !important;
	border: 1px solid var(--ph-border);
}

.ph-btn-secondary:hover,
.ph-btn-secondary:focus {
	border-color: var(--ph-accent);
	color: var(--ph-text) !important;
}

.ph-btn-text {
	overflow: hidden;
	text-overflow: ellipsis;
}

@media (max-width: 360px) {
	.ph-card {
		width: 260px;
	}
	.ph-actions {
		flex-direction: column;
	}
}


/* Action row: View profile | Topics & posts | PM */
.ph-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: stretch;
}
.ph-actions .ph-btn {
	flex: 1 1 auto;
	justify-content: center;
	text-align: center;
	min-height: 34px;
}
.ph-btn-search {
	background: #F8A697 !important;
	border: none !important;
	color: #fff !important;
}
.ph-btn-search:hover {
	background: #F4B2A6 !important;
	border: none !important;
	color: #fff !important;
}
.ph-btn-pm {
	background: transparent !important;
	border: 1px solid #5046e5 !important;
	color: #c8c4ff !important;
}
.ph-btn-pm:hover {
	background: rgba(80, 70, 229, 0.18) !important;
	color: #fff !important;
}
.ph-bio { display: none !important; }


/* v1.0.3: wider card, single-row action buttons */
.ph-card {
    width: 370px;
}
.ph-actions {
    flex-wrap: nowrap !important;
}
.ph-actions .ph-btn {
    flex: 1 1 0 !important;
    min-width: 0;
    white-space: nowrap;
}
@media (max-width: 410px) {
    .ph-card {
        width: calc(100vw - 24px);
    }
    .ph-actions {
        flex-direction: row;
        flex-wrap: nowrap !important;
    }
    .ph-actions .ph-btn {
        padding-left: 7px;
        padding-right: 7px;
        font-size: 11px;
    }
}


/* v1.0.4: unified primary buttons + online status */
.ph-btn-search {
	background: #F8A697 !important;
	border: none !important;
	color: #fff !important;
}
.ph-btn-pm {
	background: var(--ph-accent) !important;
	border: 1px solid var(--ph-accent) !important;
	color: #fff !important;
}
.ph-btn-search:hover,
.ph-btn-search:focus {
	background: #F4B2A6 !important;
	border: none !important;
	color: #fff !important;
}
.ph-btn-pm:hover,
.ph-btn-pm:focus {
	background: var(--ph-accent-hover) !important;
	border-color: var(--ph-accent-hover) !important;
	color: #fff !important;
}
.ph-meta {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}
.ph-online {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}
.ph-online::before {
	content: '';
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: currentColor;
}
.ph-online.ph-is-online {
	color: #3ddc84;
}
.ph-online.ph-is-offline {
	color: #8b93a7;
}

.ph-body,
.ph-loading,
.ph-error {
	position: relative;
	z-index: 2;
}
