/**
 * 幻想乡用户中心 - 前台
 */

.tuh-hub {
	--tuh-primary: #b91c1c;
	--tuh-primary-dark: #7f1d1d;
	--tuh-soft: #fef2f2;
	--tuh-accent: #d97706;
	--tuh-ink: #1f2937;
	--tuh-muted: #6b7280;
	--tuh-line: #fecaca;
	--tuh-bg: #fff7f7;
	--tuh-hero-1: #7f1d1d;
	--tuh-hero-2: #b91c1c;
	--tuh-seal: #fecaca;
	--tuh-radius: 20px;
	max-width: 1120px;
	margin: 0 auto;
	color: var(--tuh-ink);
	font-size: 15px;
	line-height: 1.65;
}

.tuh-hub *,
.tuh-hub *::before,
.tuh-hub *::after {
	box-sizing: border-box;
}

.tuh-hub a {
	color: var(--tuh-primary);
	text-decoration: none;
}

.tuh-hub a:hover {
	text-decoration: underline;
}

/* 主题 */
.tuh-theme-reimu {
	--tuh-primary: #b91c1c;
	--tuh-primary-dark: #7f1d1d;
	--tuh-soft: #fef2f2;
	--tuh-accent: #d97706;
	--tuh-line: #fecaca;
	--tuh-bg: #fff7f7;
	--tuh-hero-1: #7f1d1d;
	--tuh-hero-2: #b91c1c;
	--tuh-seal: #fecaca;
}

.tuh-theme-marisa {
	--tuh-primary: #a16207;
	--tuh-primary-dark: #1c1917;
	--tuh-soft: #fefce8;
	--tuh-accent: #f59e0b;
	--tuh-line: #fde68a;
	--tuh-bg: #fffdf2;
	--tuh-hero-1: #1c1917;
	--tuh-hero-2: #78350f;
	--tuh-seal: #fde68a;
}

.tuh-theme-sakuya {
	--tuh-primary: #1d4ed8;
	--tuh-primary-dark: #1e3a8a;
	--tuh-soft: #eff6ff;
	--tuh-accent: #64748b;
	--tuh-line: #bfdbfe;
	--tuh-bg: #f8fbff;
	--tuh-hero-1: #1e3a8a;
	--tuh-hero-2: #2563eb;
	--tuh-seal: #dbeafe;
}

.tuh-theme-youmu {
	--tuh-primary: #15803d;
	--tuh-primary-dark: #14532d;
	--tuh-soft: #f0fdf4;
	--tuh-accent: #db2777;
	--tuh-line: #bbf7d0;
	--tuh-bg: #f7fdf9;
	--tuh-hero-1: #14532d;
	--tuh-hero-2: #15803d;
	--tuh-seal: #fbcfe8;
}

/* 英雄区 */
.tuh-hero {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	gap: 22px;
	align-items: center;
	overflow: hidden;
	padding: 30px;
	border-radius: 24px;
	background:
		radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.16), transparent 28%),
		radial-gradient(circle at 18% 84%, rgba(255, 255, 255, 0.1), transparent 32%),
		linear-gradient(135deg, var(--tuh-hero-1), var(--tuh-hero-2));
	box-shadow: 0 22px 50px -26px rgba(15, 23, 42, 0.65);
	color: #fff;
	isolation: isolate;
}

.tuh-hero::before {
	content: "☯";
	position: absolute;
	top: 50%;
	right: -18px;
	z-index: -1;
	transform: translateY(-50%) rotate(-12deg);
	font-size: 230px;
	line-height: 1;
	color: rgba(255, 255, 255, 0.08);
}

.tuh-hero::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background-image: radial-gradient(rgba(255, 255, 255, 0.3) 1px, transparent 1.5px);
	background-size: 22px 22px;
	opacity: 0.18;
	pointer-events: none;
}

.tuh-petals {
	position: absolute;
	inset: 0;
	z-index: -1;
	overflow: hidden;
	pointer-events: none;
}

.tuh-petals span {
	position: absolute;
	top: -24px;
	width: 9px;
	height: 13px;
	border-radius: 70% 0 70% 0;
	background: var(--tuh-seal);
	opacity: 0.7;
	animation: tuh-fall 11s linear infinite;
}

.tuh-petals span:nth-child(1) { left: 8%; animation-delay: 0s; }
.tuh-petals span:nth-child(2) { left: 24%; animation-delay: 2.4s; animation-duration: 13s; }
.tuh-petals span:nth-child(3) { left: 42%; animation-delay: 5s; animation-duration: 9s; }
.tuh-petals span:nth-child(4) { left: 61%; animation-delay: 1.2s; animation-duration: 12s; }
.tuh-petals span:nth-child(5) { left: 78%; animation-delay: 4.1s; animation-duration: 10s; }
.tuh-petals span:nth-child(6) { left: 91%; animation-delay: 6.2s; animation-duration: 14s; }

@keyframes tuh-fall {
	0% {
		transform: translate3d(0, -20px, 0) rotate(0deg);
		opacity: 0;
	}
	12% {
		opacity: 0.75;
	}
	100% {
		transform: translate3d(34px, 560px, 0) rotate(420deg);
		opacity: 0;
	}
}

.tuh-avatar {
	position: relative;
	flex: 0 0 auto;
	width: 106px;
	height: 106px;
	padding: 4px;
	border: 2px solid rgba(255, 255, 255, 0.65);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.tuh-avatar img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
}

.tuh-avatar__seal {
	position: absolute;
	right: -6px;
	bottom: -4px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: 2px solid rgba(255, 255, 255, 0.8);
	border-radius: 50%;
	background: var(--tuh-seal);
	font-size: 1rem;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.tuh-hero__body {
	flex: 1 1 300px;
	min-width: 0;
}

.tuh-eyebrow {
	display: inline-block;
	margin-bottom: 4px;
	color: rgba(255, 255, 255, 0.7);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.tuh-name {
	margin: 0 0 4px;
	color: #fff;
	font-size: clamp(1.6rem, 3vw, 2.2rem);
	line-height: 1.2;
	word-break: break-word;
}

.tuh-title {
	display: inline-block;
	margin: 0 0 8px;
	padding: 2px 10px;
	border: 1px solid rgba(255, 255, 255, 0.32);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.12);
	color: rgba(255, 255, 255, 0.92);
	font-size: 0.78rem;
	font-weight: 600;
}

.tuh-quote {
	margin: 0 0 10px;
	color: rgba(255, 255, 255, 0.88);
	font-size: 0.94rem;
	font-style: italic;
}

.tuh-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 5px 18px;
	color: rgba(255, 255, 255, 0.68);
	font-size: 0.76rem;
}

.tuh-hero__side {
	flex: 0 1 210px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: flex-start;
}

.tuh-theme-form {
	width: 100%;
	padding: 10px;
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.08);
}

.tuh-theme-form label {
	display: block;
	margin-bottom: 6px;
	color: rgba(255, 255, 255, 0.7);
	font-size: 0.72rem;
	font-weight: 700;
}

.tuh-theme-form__row {
	display: flex;
	gap: 6px;
}

.tuh-theme-form select {
	flex: 1 1 auto;
	min-width: 0;
	height: 32px;
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.95);
	color: var(--tuh-ink);
	font-size: 0.8rem;
}

.tuh-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 38px;
	padding: 8px 16px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: var(--tuh-primary);
	color: #fff;
	font: inherit;
	font-size: 0.84rem;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
	text-decoration: none;
}

.tuh-btn:hover {
	background: var(--tuh-primary-dark);
	color: #fff;
	text-decoration: none;
}

/*
 * 主题的链接样式（.tuh-hub a）优先级高于 .tuh-btn，
 * 会把登录按钮文字改成和背景相同的颜色。这里显式保证
 * 实心按钮的文字为白色；浅色按钮仍走自己的规则。
 */
.tuh-hub a.tuh-btn:not(.tuh-btn-light) {
	color: #fff;
	-webkit-text-fill-color: #fff;
	text-decoration: none;
}

.tuh-hub a.tuh-btn:not(.tuh-btn-light):hover,
.tuh-hub a.tuh-btn:not(.tuh-btn-light):focus {
	color: #fff;
	-webkit-text-fill-color: #fff;
	text-decoration: none;
}

.tuh-btn-small {
	min-height: 30px;
	padding: 5px 12px;
	font-size: 0.76rem;
}

/* 面板操作区的实心按钮：防止主题链接颜色/背景覆盖导致文字不可见 */
.tuh-hub .tuh-panel .tuh-panel__actions a.tuh-btn-primary,
.tuh-hub .tuh-panel a.tuh-btn-primary,
.tuh-hub a.tuh-btn-primary {
	border-color: var(--tuh-primary, #b91c1c);
	background-color: var(--tuh-primary, #b91c1c);
	color: #fff;
	-webkit-text-fill-color: #fff;
	opacity: 1;
	text-decoration: none;
	text-shadow: none;
}

.tuh-hub .tuh-panel .tuh-panel__actions a.tuh-btn-primary:hover,
.tuh-hub .tuh-panel a.tuh-btn-primary:hover,
.tuh-hub a.tuh-btn-primary:hover,
.tuh-hub a.tuh-btn-primary:focus {
	border-color: var(--tuh-primary-dark, #7f1d1d);
	background-color: var(--tuh-primary-dark, #7f1d1d);
	color: #fff;
	-webkit-text-fill-color: #fff;
	text-decoration: none;
}

.tuh-btn-light {
	background: rgba(255, 255, 255, 0.92);
	color: var(--tuh-primary-dark);
}

.tuh-btn-light:hover {
	background: #fff;
	color: var(--tuh-primary-dark);
}

.tuh-profile-link {
	color: rgba(255, 255, 255, 0.72);
	font-size: 0.78rem;
	text-decoration: underline;
}

.tuh-account-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	margin-top: 10px;
}

.tuh-account-actions .tuh-btn {
	font-size: 0.76rem;
}

.tuh-hub .tuh-account-actions a.tuh-btn,
.tuh-hub .tuh-account-actions a.tuh-btn:hover,
.tuh-hub .tuh-account-actions a.tuh-btn:focus {
	text-decoration: none;
}

.tuh-hub .tuh-account-actions a.tuh-btn-light {
	border-color: rgba(255, 255, 255, 0.92);
	background-color: rgba(255, 255, 255, 0.92);
	color: var(--tuh-primary-dark, #7f1d1d);
	-webkit-text-fill-color: var(--tuh-primary-dark, #7f1d1d);
	text-decoration: none;
}

.tuh-hub .tuh-account-actions a.tuh-btn-light:hover,
.tuh-hub .tuh-account-actions a.tuh-btn-light:focus {
	border-color: #fff;
	background-color: #fff;
	color: var(--tuh-primary-dark, #7f1d1d);
	-webkit-text-fill-color: var(--tuh-primary-dark, #7f1d1d);
	text-decoration: none;
}

/* 统计 */
.tuh-stats {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
	margin: 16px 0;
}

.tuh-stat {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 15px 17px;
	border: 1px solid var(--tuh-line);
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 12px 24px -22px rgba(15, 23, 42, 0.4);
}

.tuh-stat.is-danger {
	border-color: #fecaca;
	background: #fff7f7;
}

.tuh-stat__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 12px;
	background: var(--tuh-soft);
	font-size: 1.05rem;
}

.tuh-stat strong {
	display: block;
	color: var(--tuh-primary-dark);
	font-size: 1.35rem;
	line-height: 1.1;
}

.tuh-stat.is-danger strong {
	color: #b91c1c;
}

.tuh-stat span:last-child {
	color: var(--tuh-muted);
	font-size: 0.78rem;
}

/* 标签页 */
.tuh-tabs {
	display: flex;
	gap: 4px;
	margin: 6px 0 14px;
	border-bottom: 1px solid var(--tuh-line);
}

.tuh-tab {
	padding: 9px 16px;
	border-bottom: 2px solid transparent;
	color: var(--tuh-muted);
	font-size: 0.9rem;
	font-weight: 700;
	text-decoration: none;
}

.tuh-tab:hover {
	color: var(--tuh-ink);
	text-decoration: none;
}

.tuh-tab.is-active {
	border-bottom-color: var(--tuh-primary);
	color: var(--tuh-primary);
}

/* 面板 */
.tuh-panel-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
}

.tuh-panel {
	min-width: 0;
	padding: 18px;
	border: 1px solid var(--tuh-line);
	border-radius: var(--tuh-radius);
	background: #fff;
	box-shadow: 0 16px 32px -30px rgba(15, 23, 42, 0.45);
}

.tuh-panel__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 10px;
}

.tuh-panel__head h3 {
	margin: 0;
	font-size: 1.02rem;
}

.tuh-panel__head a {
	font-size: 0.78rem;
}

.tuh-panel__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.tuh-table-wrap {
	overflow-x: auto;
}

.tuh-table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	font-size: 0.84rem;
}

.tuh-table th,
.tuh-table td {
	padding: 9px 10px;
	border-bottom: 1px solid #f1f5f9;
	text-align: left;
	vertical-align: middle;
}

.tuh-table th {
	color: var(--tuh-muted);
	font-size: 0.72rem;
	font-weight: 700;
	white-space: nowrap;
}

.tuh-table tbody tr:last-child td {
	border-bottom: 0;
}

.tuh-table a {
	font-weight: 600;
}

.tuh-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 0.7rem;
	font-weight: 700;
	line-height: 1.55;
	white-space: nowrap;
}

.tuh-badge.is-active {
	background: #dcfce7;
	color: #14532d;
}

.tuh-badge.is-warning {
	background: #fef3c7;
	color: #92400e;
}

.tuh-badge.is-danger {
	background: #fee2e2;
	color: #b91c1c;
}

.tuh-badge.is-neutral {
	background: #f1f5f9;
	color: #64748b;
}

/* 活动 */
.tuh-event-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.tuh-event-item {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 14px;
	border: 1px solid #f1f5f9;
	border-radius: 12px;
	background: #fff;
}

.tuh-event-item__body {
	flex: 1 1 300px;
	min-width: 0;
}

.tuh-event-item__badge {
	display: inline-block;
	margin-bottom: 3px;
	padding: 1px 7px;
	border-radius: 999px;
	background: #f1f5f9;
	color: var(--tuh-muted);
	font-size: 0.64rem;
	font-weight: 700;
}

.tuh-event-item__badge.is-internal {
	background: var(--tuh-primary);
	color: #fff;
}

.tuh-event-item__body h4 {
	margin: 0 0 2px;
	font-size: 0.94rem;
	line-height: 1.45;
}

.tuh-event-item__body p {
	margin: 0;
	color: var(--tuh-muted);
	font-size: 0.76rem;
}

.tuh-event-item__side {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-left: auto;
}

.tuh-empty {
	padding: 22px 12px;
	border: 1px dashed var(--tuh-line);
	border-radius: 12px;
	color: var(--tuh-muted);
	text-align: center;
	font-size: 0.84rem;
}

.tuh-missing {
	padding: 26px;
	border: 1px dashed var(--tuh-line);
	border-radius: var(--tuh-radius);
	background: var(--tuh-bg);
	text-align: center;
}

.tuh-missing h3 {
	margin: 0 0 6px;
	font-size: 1.06rem;
}

.tuh-missing p {
	margin: 0 0 14px;
	color: var(--tuh-muted);
	font-size: 0.86rem;
}

/* 通知 */
.tuh-notice {
	margin: 0 0 14px;
	padding: 10px 14px;
	border: 1px solid;
	border-radius: 10px;
	font-size: 0.86rem;
}

.tuh-notice.is-success {
	border-color: #bbf7d0;
	background: #f0fdf4;
	color: #14532d;
}

.tuh-notice.is-error {
	border-color: #fecaca;
	background: #fef2f2;
	color: #b91c1c;
}

.tuh-notice.is-warning {
	border-color: #fde68a;
	background: #fffbeb;
	color: #92400e;
}

.tuh-notice.is-warning strong {
	display: block;
	margin-bottom: 3px;
}

.tuh-notice.is-warning p {
	margin: 0;
}

/* 登录 */
.tuh-login {
	max-width: 560px;
	margin: 40px auto;
	padding: 36px 28px;
	border: 1px solid var(--tuh-line);
	border-radius: 24px;
	background:
		radial-gradient(circle at 80% 10%, var(--tuh-soft), transparent 40%),
		#fff;
	text-align: center;
	box-shadow: 0 24px 50px -34px rgba(15, 23, 42, 0.4);
}

.tuh-login__mark {
	font-size: 2.6rem;
	line-height: 1;
}

.tuh-login h2 {
	margin: 8px 0 6px;
	font-size: 1.35rem;
}

.tuh-login p {
	margin: 0 0 18px;
	color: var(--tuh-muted);
}

/* 页脚 */
.tuh-footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 8px;
	margin-top: 18px;
	padding: 12px 4px;
	color: var(--tuh-muted);
	font-size: 0.76rem;
}

/* 响应式 */
@media (max-width: 860px) {
	.tuh-panel-grid {
		grid-template-columns: 1fr;
	}

	.tuh-hero__side {
		flex: 1 1 100%;
		max-width: 320px;
	}
}

@media (max-width: 640px) {
	.tuh-hub {
		font-size: 14px;
	}

	.tuh-event-item__side {
		margin-left: 0;
	}

	.tuh-hero {
		padding: 22px 18px;
	}

	.tuh-avatar {
		width: 82px;
		height: 82px;
	}

	.tuh-hero::before {
		font-size: 160px;
		right: -30px;
	}

	.tuh-stats {
		grid-template-columns: 1fr;
	}

	.tuh-table-wrap {
		overflow: visible;
	}

	.tuh-table,
	.tuh-table tbody,
	.tuh-table tr,
	.tuh-table td {
		display: block;
		width: 100%;
	}

	.tuh-table thead {
		display: none;
	}

	.tuh-table tr {
		margin-bottom: 8px;
		padding: 4px 0;
		border: 1px solid var(--tuh-line);
		border-radius: 10px;
	}

	.tuh-table td {
		display: flex;
		justify-content: space-between;
		gap: 12px;
		padding: 6px 10px;
		border-bottom: 1px solid #f8fafc;
		text-align: right;
	}

	.tuh-table td:last-child {
		border-bottom: 0;
	}

	.tuh-table td::before {
		content: attr(data-label);
		color: var(--tuh-muted);
		font-size: 0.72rem;
		font-weight: 700;
		text-align: left;
	}

	.tuh-theme-form__row {
		flex-wrap: wrap;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tuh-petals span {
		animation: none;
		display: none;
	}
}
