/* PCG Tech Help
 * Every colour is a variable. A theme can set --pcg-* (shared across the PCG
 * plugins) or override the --th-* values directly on .pcg-th.
 */

.pcg-th {
	--th-accent: var(--pcg-accent, var(--th-accent-default, #3DF5A0));
	--th-on-accent: var(--pcg-on-accent, #062016);
	--th-bg: var(--pcg-bg, #F6F8FC);
	--th-surface: var(--pcg-surface, #FFFFFF);
	--th-surface-2: var(--pcg-surface-2, #EEF2F8);
	--th-line: var(--pcg-line, #DCE3EE);
	--th-text: var(--pcg-text, #0E1628);
	--th-text-2: var(--pcg-text-2, #3D4B66);
	--th-muted: var(--pcg-muted, #5D6B85);
	--th-link: var(--pcg-link, #1F5FD6);
	--th-accent-ink: var(--pcg-accent-ink, #087A4B);   /* accent used as text on light */
	--th-solved-bg: var(--pcg-solved-bg, #E6FBF1);
	--th-warn: #9A4A0B;
	--th-warn-bg: #FFF0E3;
	--th-danger: #B42318;
	--th-radius: var(--pcg-radius, 14px);
	--th-font: var(--pcg-font, inherit);

	box-sizing: border-box;
	max-width: 760px;
	margin: 0 auto;
	padding: 0 16px 96px;
	color: var(--th-text);
	background: var(--th-bg);
	font-family: var(--th-font), "Noto Sans Sinhala", "Iskoola Pota", system-ui, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	-webkit-text-size-adjust: 100%;
}

/* Dark: forced, or following the theme's own switch, or the device. */
.pcg-th[data-mode="dark"],
html[data-theme="dark"] .pcg-th[data-mode="auto"],
html.dark .pcg-th[data-mode="auto"],
body.dark-mode .pcg-th[data-mode="auto"] {
	--th-bg: var(--pcg-bg, #0B1220);
	--th-surface: var(--pcg-surface, #121B2E);
	--th-surface-2: var(--pcg-surface-2, #17223A);
	--th-line: var(--pcg-line, #22304D);
	--th-text: var(--pcg-text, #E6EDF7);
	--th-text-2: var(--pcg-text-2, #C9D6EE);
	--th-muted: var(--pcg-muted, #9AA8C2);
	--th-link: var(--pcg-link, #7FB0FF);
	--th-accent-ink: var(--th-accent);
	--th-solved-bg: var(--pcg-solved-bg, #0F2622);
	--th-warn: #FFB37A;
	--th-warn-bg: #3A2412;
	--th-danger: #FF8A80;
}
@media (prefers-color-scheme: dark) {
	html:not([data-theme="light"]):not(.light) body:not(.light-mode) .pcg-th[data-mode="auto"] {
		--th-bg: var(--pcg-bg, #0B1220);
		--th-surface: var(--pcg-surface, #121B2E);
		--th-surface-2: var(--pcg-surface-2, #17223A);
		--th-line: var(--pcg-line, #22304D);
		--th-text: var(--pcg-text, #E6EDF7);
		--th-text-2: var(--pcg-text-2, #C9D6EE);
		--th-muted: var(--pcg-muted, #9AA8C2);
		--th-link: var(--pcg-link, #7FB0FF);
		--th-accent-ink: var(--th-accent);
		--th-solved-bg: var(--pcg-solved-bg, #0F2622);
		--th-warn: #FFB37A;
		--th-warn-bg: #3A2412;
		--th-danger: #FF8A80;
	}
}

.pcg-th *, .pcg-th *::before, .pcg-th *::after { box-sizing: border-box; }
.pcg-th [hidden] { display: none !important; }
.pcg-th a { color: var(--th-link); }
.pcg-th button, .pcg-th input, .pcg-th textarea { font: inherit; color: inherit; }
.pcg-th h1, .pcg-th h2, .pcg-th h3 { color: var(--th-text); }
.pcg-th .th-icon { flex-shrink: 0; }
.pcg-th .th-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pcg-th :focus-visible { outline: 2px solid var(--th-link); outline-offset: 2px; }
.th-spacer { flex-grow: 1; }
.th-muted { color: var(--th-muted); font-weight: 400; }

/* ------------------------------------------------------------- top bar */
.th-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0 8px; }
.th-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--th-text) !important; }
.th-brand__mark { width: 34px; height: 34px; border-radius: 10px; background: var(--th-accent); color: var(--th-on-accent); display: flex; align-items: center; justify-content: center; }
.th-brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.th-brand__name { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.th-brand__by { font-size: 12px; color: var(--th-muted); }
.th-account { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.th-account a { text-decoration: none; }

.th-avatar { position: relative; flex-shrink: 0; border-radius: 50%; background: var(--th-surface-2); color: var(--th-text); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; overflow: hidden; }
.th-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.th-avatar--ring { box-shadow: 0 0 0 2px var(--th-accent); }

/* ------------------------------------------------------------- hero + search */
.th-hero { display: flex; flex-direction: column; gap: 12px; padding: 12px 0 4px; }
.th-hero__title { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 600; }
.th-hero__title span { display: block; margin-top: 4px; color: var(--th-muted); font-size: 18px; font-weight: 400; }
.th-search { margin: 0; }
.th-search__box { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 8px 0 14px; border-radius: 16px; background: var(--th-surface); border: 1.5px solid var(--th-accent); color: var(--th-muted); }
.th-search__box input { flex-grow: 1; min-width: 0; height: 100%; border: 0 !important; background: transparent !important; outline: none; box-shadow: none !important; padding: 0 !important; color: var(--th-text); font-size: 16px; /* 16px stops iOS zooming */ }
.th-search__box input::-webkit-search-cancel-button { display: none; }
.th-search__clear { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--th-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.th-trending { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.th-trending__label { font-size: 12px; color: var(--th-muted); text-transform: uppercase; letter-spacing: 0.08em; }

/* ------------------------------------------------------------- chips, tabs */
.th-chip { flex-shrink: 0; display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--th-line); background: var(--th-surface); color: var(--th-text-2); font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.th-chip.is-active { background: var(--th-text); border-color: var(--th-text); color: var(--th-bg); font-weight: 600; }
.th-chip--soft { height: 32px; padding: 0 12px; font-size: 13px; border: 0; background: var(--th-surface-2); color: var(--th-text-2) !important; }
.th-cats { display: flex; gap: 8px; overflow-x: auto; padding: 16px 0 4px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.th-cats::-webkit-scrollbar { display: none; }
.th-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 12px; border-bottom: 1px solid var(--th-line); }
.th-tabs button { height: 44px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--th-muted); font-size: 14px; cursor: pointer; padding: 0 4px; }
.th-tabs button[aria-selected="true"] { color: var(--th-text); font-weight: 600; border-bottom-color: var(--th-accent); }

/* ------------------------------------------------------------- cards */
.th-stack { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; }
.th-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--th-radius); background: var(--th-surface); border: 1px solid var(--th-line); text-decoration: none; color: var(--th-text) !important; transition: border-color .15s; }
.th-card:hover { border-color: var(--th-muted); }
.th-card--static { cursor: default; }
.th-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.th-card__cat { font-size: 12px; color: var(--th-link); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.th-card__title { font-size: 16px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.th-card__meta { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--th-muted); }
.th-card__meta > span:first-child { flex-grow: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-card__stat { display: inline-flex; align-items: center; gap: 4px; }

.th-badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.th-badge--solved { background: var(--th-accent); color: var(--th-on-accent); }
.th-badge--open { background: var(--th-warn-bg); color: var(--th-warn); }
.th-badge--wait { background: var(--th-surface-2); color: var(--th-text-2); }

.th-label { margin: 8px 0 0; font-size: 13px; color: var(--th-muted) !important; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.th-empty { color: var(--th-muted); padding: 16px 0; margin: 0; }
.th-ask-cta { display: flex; align-items: center; gap: 12px; padding: 12px 0; color: var(--th-text-2); font-weight: 600; font-size: 14px; }
.th-ask-cta__line { flex-grow: 1; height: 1px; background: var(--th-line); }

/* ------------------------------------------------------------- buttons */
.th-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--th-line); background: var(--th-surface); color: var(--th-text) !important; font-weight: 600; cursor: pointer; text-decoration: none; }
.th-btn--primary { background: var(--th-accent); border-color: var(--th-accent); color: var(--th-on-accent) !important; }
.th-btn--ghost { background: transparent; }
.th-btn--block { display: flex; width: 100%; }
.th-btn--big { min-height: 54px; font-size: 16px; border-radius: 14px; }
.th-btn[disabled], .th-pill[disabled] { opacity: .55; cursor: progress; }

.th-pill { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--th-line); background: transparent; color: var(--th-text-2); font-size: 14px; cursor: pointer; }
.th-pill[aria-pressed="true"] { background: var(--th-accent); border-color: var(--th-accent); color: var(--th-on-accent); font-weight: 600; }
.th-pill--accent { border-color: var(--th-accent-ink); color: var(--th-accent-ink); }
.th-pill__n { font-variant-numeric: tabular-nums; }

.th-iconbtn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 12px; background: transparent; color: var(--th-text); cursor: pointer; text-decoration: none; flex-shrink: 0; }
.th-iconbtn--sm { width: 40px; height: 40px; color: var(--th-muted); }
.th-iconbtn--box { width: 48px; height: 48px; border: 1px solid var(--th-line); background: var(--th-surface); color: var(--th-text-2); }
.th-iconbtn input[type="file"], .th-photos__add input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* ------------------------------------------------------------- views + forms */
.th-subhead { display: flex; align-items: center; gap: 8px; padding: 4px 0 8px; margin-left: -10px; }
.th-subhead h2 { margin: 0; font-size: 20px; font-weight: 600; }
.th-form { display: flex; flex-direction: column; gap: 18px; padding: 4px 0 24px; }
.th-field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.th-field > label, .th-field > legend, .th-field__label { font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 2px; }
.th-field small { color: var(--th-muted); font-size: 13px; }
.th-field input:not([type]), .th-field input[type="text"], .th-field textarea, .th-tagadd input {
	width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--th-line); background: var(--th-surface); color: var(--th-text); font-size: 16px; line-height: 1.5; box-shadow: none; }
.th-field textarea { resize: vertical; }
.th-field input:focus, .th-field textarea:focus, .th-tagadd input:focus { border-color: var(--th-accent); outline: none; }

.th-catgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.th-cattile { position: relative; cursor: pointer; }
.th-cattile input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.th-cattile__box { height: 76px; border-radius: 12px; border: 1px solid var(--th-line); background: var(--th-surface); color: var(--th-text-2); font-size: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 4px; }
.th-cattile input:checked + .th-cattile__box { border: 2px solid var(--th-accent); background: var(--th-solved-bg); color: var(--th-text); font-weight: 600; }
.th-cattile input:focus-visible + .th-cattile__box { outline: 2px solid var(--th-link); outline-offset: 2px; }

.th-photos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.th-photos__add { position: relative; aspect-ratio: 1; border-radius: 10px; border: 1.5px dashed var(--th-line); color: var(--th-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.th-thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--th-surface-2); }
.th-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.th-thumb.is-loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent); animation: th-shine 1s infinite; }
.th-thumb button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
@keyframes th-shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.th-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.th-tags:empty { display: none; }
.th-tagbtn { height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--th-line); background: transparent; color: var(--th-text-2); font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.th-tagbtn[aria-pressed="true"] { border-color: var(--th-accent); background: var(--th-solved-bg); color: var(--th-text); }
.th-tagadd { display: flex; gap: 8px; }
.th-tagadd input { min-height: 44px; padding: 8px 12px; font-size: 15px; }
.th-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--th-warn-bg); color: var(--th-warn); font-size: 14px; }
.th-note { margin: 0; text-align: center; font-size: 13px; color: var(--th-muted); }
.th-signin-box { padding: 16px; border-radius: var(--th-radius); background: var(--th-surface); border: 1px solid var(--th-line); display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.th-signin-box p { margin: 0; color: var(--th-text-2); }
.th-similar { display: flex; flex-direction: column; }
.th-similar .th-stack { padding-top: 6px; }

/* ------------------------------------------------------------- thread */
.th-q { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 18px; border-bottom: 1px solid var(--th-line); }
.th-q__labels { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.th-q__cat { font-size: 12px; color: var(--th-link) !important; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-right: 4px; text-decoration: none; }
.th-tag { font-size: 12px; color: var(--th-text-2) !important; background: var(--th-surface-2); padding: 3px 9px; border-radius: 999px; text-decoration: none; }
.th-q__title { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 600; overflow-wrap: anywhere; }
.th-q__actions { display: flex; align-items: center; gap: 8px; }
.th-person { display: flex; align-items: center; gap: 10px; }
.th-person__text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.th-person__name { font-weight: 600; font-size: 14px; }
.th-person__sub { font-size: 12px; color: var(--th-muted); }
.th-staff { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: var(--th-surface-2); color: var(--th-text-2); vertical-align: 1px; }
.th-prose { color: var(--th-text-2); line-height: 1.6; overflow-wrap: anywhere; }
.th-prose p { margin: 0 0 10px; }
.th-prose p:last-child { margin-bottom: 0; }
.th-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.th-gallery a { display: block; border-radius: 12px; overflow: hidden; background: var(--th-surface-2); aspect-ratio: 4 / 3; }
.th-gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }

.th-answers { padding-top: 12px; }
.th-answer { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--th-radius); background: var(--th-surface); border: 1px solid var(--th-line); scroll-margin-top: 80px; }
.th-answer.is-solved { background: var(--th-solved-bg); border: 1.5px solid var(--th-accent); }
.th-answer.is-pending { border-style: dashed; }
.th-answer.is-new { animation: th-in .4s ease-out; }
@keyframes th-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.th-answer__solved { display: flex; align-items: center; gap: 6px; color: var(--th-accent-ink); font-size: 13px; font-weight: 700; }
.th-answer__pending { font-size: 13px; color: var(--th-warn); }
.th-answer__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.th-cta { display: flex; align-items: center; gap: 12px; padding: 14px; margin-top: 4px; border-radius: var(--th-radius); background: var(--th-surface); border: 1px dashed var(--th-line); text-decoration: none; color: var(--th-link) !important; }
.th-cta > span { display: flex; flex-direction: column; gap: 2px; }
.th-cta strong { color: var(--th-text); font-size: 14px; }
.th-cta span span { font-size: 13px; color: var(--th-muted); }

.th-composer { position: sticky; bottom: 0; z-index: 20; margin: 16px -16px 0; padding: 10px 12px 14px; background: var(--th-surface); border-top: 1px solid var(--th-line); display: flex; flex-direction: column; gap: 8px; }
.th-composer__row { display: flex; gap: 8px; align-items: flex-end; }
.th-composer__box { flex-grow: 1; min-width: 0; }
.th-composer textarea { width: 100%; min-height: 48px; max-height: 40vh; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--th-line); background: var(--th-bg); color: var(--th-text); font-size: 16px; line-height: 1.4; resize: none; display: block; box-shadow: none; }
.th-composer textarea:focus { border-color: var(--th-accent); outline: none; }
.th-composer .th-btn { min-height: 48px; }
.th-composer__photos:empty { display: none; }

.pcg-th--thread { padding-bottom: 0; }

/* ------------------------------------------------------------- bottom nav */
.th-bottom { position: sticky; bottom: 0; z-index: 20; margin: 8px -16px 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center; padding: 8px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--th-surface); border-top: 1px solid var(--th-line); }
.th-bottom button { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 48px; justify-content: center; border: 0; background: none; color: var(--th-muted); font-size: 12px; cursor: pointer; }
.th-bottom button.is-active { color: var(--th-text); }
.th-bottom .th-bottom__ask { justify-self: center; flex-direction: row; gap: 6px; height: 48px; padding: 0 22px; border-radius: 999px; background: var(--th-accent); color: var(--th-on-accent); font-weight: 700; font-size: 15px; }

.th-toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 99999; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 12px; background: #0E1628; color: #fff; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }

/* ------------------------------------------------------------- wider screens */
@media (min-width: 700px) {
	.pcg-th { padding-bottom: 48px; }
	.th-hero__title { font-size: 32px; }
	.th-cats { margin: 0; padding-left: 0; padding-right: 0; flex-wrap: wrap; }
	.th-catgrid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
	.th-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.th-bottom { position: static; margin: 16px 0 0; border: 1px solid var(--th-line); border-radius: var(--th-radius); }
	.th-composer { margin-left: 0; margin-right: 0; border: 1px solid var(--th-line); border-radius: var(--th-radius); }
}

@media (prefers-reduced-motion: reduce) {
	.th-answer.is-new, .th-thumb.is-loading::after { animation: none; }
}

/* ------------------------------------------------------------- 1.1: theme-proofing
   Themes often style every h1/h2 inside page content (margins, padding, sizes).
   These keep the Tech Help headings where the layout expects them. */
.pcg-th .th-subhead h2,
.pcg-th .th-label,
.pcg-th .th-hero__title,
.pcg-th .th-q__title,
.pcg-th .th-prof__name,
.pcg-th .th-prof__h { padding: 0 !important; border: 0 !important; }
.pcg-th .th-subhead h2 { margin: 0 !important; font-size: 20px; line-height: 1.3; }
.pcg-th .th-label { margin: 8px 0 0 !important; }
.pcg-th .th-hero__title, .pcg-th .th-q__title, .pcg-th .th-prof__name { margin: 0 !important; }

/* ------------------------------------------------------------- names + levels */
.th-person__name a { color: var(--th-text) !important; text-decoration: none; }
.th-person__name a:hover { text-decoration: underline; }
.th-person__rank { color: var(--th-text-2); }
.th-link { border: 0; background: none; padding: 8px 0; color: var(--th-link); font-size: 14px; cursor: pointer; }
.th-center { text-align: center; }
.th-row { display: flex; gap: 8px; justify-content: flex-end; }
.th-section { padding-top: 18px; }
.th-tabs--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 8px; }
.th-check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 15px; font-weight: 400 !important; cursor: pointer; }
.th-check input { width: 20px; height: 20px; accent-color: var(--th-accent); }
.th-note--left { text-align: left; }

/* ------------------------------------------------------------- top helpers */
.th-helpers { padding-top: 14px; }
.th-helpers__head { display: flex; align-items: baseline; justify-content: space-between; }
.th-helpers__row { display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px 2px; margin: 0 -16px; scrollbar-width: none; }
.th-helpers__row::-webkit-scrollbar { display: none; }
.th-helper { flex-shrink: 0; width: 84px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; background: var(--th-surface); border: 1px solid var(--th-line); text-decoration: none; color: var(--th-text) !important; text-align: center; }
.th-helper__name { font-size: 13px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-helper__pts { font-size: 12px; color: var(--th-muted); }

.th-leaders { list-style: none; margin: 0; padding: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.th-leader { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--th-surface); border: 1px solid var(--th-line); text-decoration: none; color: var(--th-text) !important; }
.th-leader__rank { width: 24px; text-align: center; font-weight: 700; color: var(--th-muted); font-variant-numeric: tabular-nums; }
.th-leaders li:nth-child(-n+3) .th-leader__rank { color: var(--th-accent-ink); }
.th-leader__who { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.th-leader__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-leader__lvl { font-size: 12px; color: var(--th-muted); }
.th-leader__pts { font-weight: 700; font-variant-numeric: tabular-nums; }
.th-leader__pts small { font-weight: 400; color: var(--th-muted); margin-left: 3px; }

/* ------------------------------------------------------------- profile */
.th-prof { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0 18px; text-align: center; }
.th-prof .th-avatar { font-size: 28px; box-shadow: 0 0 0 3px var(--th-accent); }
.th-prof__name { font-size: 24px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.th-prof__chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; align-items: center; }
.th-prof__chips .th-chip--soft { height: 28px; gap: 4px; cursor: default; }
.th-level { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--th-accent); color: var(--th-on-accent); font-size: 14px; font-weight: 700; }
.th-prof__headline { margin: 0; color: var(--th-text-2); }
.th-prof__since { margin: 0; font-size: 13px; color: var(--th-muted); }
.pcg-th .th-prof__edit { margin-bottom: 12px; padding: 16px; gap: 16px; cursor: default; }
.th-prof__h { margin: 0 !important; font-size: 17px; font-weight: 600; }

.th-points { gap: 10px; cursor: default; }
.th-points__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.th-points__n { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.th-points__n span { font-size: 13px; font-weight: 400; color: var(--th-muted); }
.th-bar { height: 10px; border-radius: 999px; background: var(--th-surface-2); overflow: hidden; }
.th-bar span { display: block; height: 100%; border-radius: 999px; background: var(--th-accent); min-width: 4px; }
.th-levels { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); font-size: 11px; color: var(--th-muted); text-align: center; }
.th-levels li { margin: 0; }
.th-levels .is-done { color: var(--th-text-2); }
.th-levels .is-current { color: var(--th-text); font-weight: 700; }

.th-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding-top: 10px; }
.th-stats div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px; border-radius: 12px; background: var(--th-surface); border: 1px solid var(--th-line); font-size: 12px; color: var(--th-muted); }
.th-stats span { font-size: 20px; font-weight: 700; color: var(--th-text); font-variant-numeric: tabular-nums; }

.th-badges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding-top: 10px; }
.th-badgecard { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 12px; border: 1px dashed var(--th-line); text-align: center; color: var(--th-muted); }
.th-badgecard.is-earned { border: 1px solid var(--th-line); background: var(--th-surface); color: var(--th-text); }
.th-badgecard__icon { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--th-surface-2); }
.th-badgecard.is-earned .th-badgecard__icon { background: var(--th-solved-bg); color: var(--th-accent-ink); box-shadow: inset 0 0 0 2px var(--th-accent); }
.th-badgecard__name { font-size: 12px; font-weight: 600; line-height: 1.3; }
.th-badgecard__prog { font-size: 11px; font-variant-numeric: tabular-nums; }

.th-howto { margin-top: 16px; cursor: default; }
.th-howto summary { font-weight: 600; cursor: pointer; min-height: 28px; }
.th-howto ul { list-style: none; margin: 4px 0 8px; padding: 0; }
.th-howto li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--th-line); font-size: 14px; color: var(--th-text-2); }
.th-howto b { color: var(--th-accent-ink); font-variant-numeric: tabular-nums; }
.th-howto p { margin: 0; font-size: 13px; }
.pcg-th--profile .th-center { padding: 16px 0 24px; }

@media (min-width: 700px) {
	.th-helpers__row { margin: 0; padding-left: 0; padding-right: 0; flex-wrap: wrap; }
	.th-badges { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------- 1.2: editing */
.th-edited { color: var(--th-muted); font-style: italic; cursor: help; }
.th-editbox { display: flex; flex-direction: column; gap: 8px; }
.th-editbox textarea, .th-select {
	width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--th-line); background: var(--th-bg); color: var(--th-text); font-size: 16px; line-height: 1.5; box-shadow: none; }
.th-editbox textarea { resize: vertical; min-height: 120px; }
.th-editbox textarea:focus, .th-select:focus { border-color: var(--th-accent); outline: none; }
.th-select { min-height: 50px; background: var(--th-surface); }
.th-editq { padding-top: 4px; }
.th-editq .th-field input { background: var(--th-surface); }
