/* Monkey Stories – dark video theme */
:root {
	--ms-accent: #e8b931;
	--ms-bg: #0f0f0f;
	--ms-surface: #1a1a1a;
	--ms-surface-2: #242424;
	--ms-line: #2b2b2b;
	--ms-txt: #f1f1f1;
	--ms-mut: #a3a3a3;
	--ms-radius: 12px;
	--ms-font: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Khmer', 'Khmer OS', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--ms-bg);
	color: var(--ms-txt);
	font-family: var(--ms-font);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button { font-family: inherit; }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0; border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
.ms-skip:focus { position: fixed !important; top: 8px; left: 8px; width: auto; height: auto; clip: auto; background: var(--ms-accent); color: #111; padding: 8px 14px; border-radius: 8px; z-index: 1000; margin: 0; }

.ms-wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.ms-main { min-height: 60vh; padding-bottom: 40px; }

/* ---------- Header ---------- */
.ms-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: rgba(15, 15, 15, .92);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--ms-line);
}
.admin-bar .ms-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .ms-header { top: 46px; } }
.ms-header-in {
	max-width: 1320px;
	margin: 0 auto;
	padding: 0 24px;
	height: 60px;
	display: grid;
	grid-template-columns: 1fr minmax(0, 560px) 1fr;
	align-items: center;
	gap: 16px;
}
.ms-brand { display: flex; align-items: center; min-width: 0; }
.ms-brand .custom-logo-link { display: block; line-height: 0; }
.ms-brand .custom-logo { max-height: 40px; width: auto; }
.ms-brand-text { font-weight: 700; font-size: 18px; color: var(--ms-accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ms-search { position: relative; grid-column: 2; display: flex; }
.ms-search input[type=search] {
	width: 100%;
	height: 40px;
	background: var(--ms-surface);
	color: var(--ms-txt);
	border: 1px solid var(--ms-line);
	border-radius: 999px;
	padding: 0 48px 0 18px;
	font: inherit;
	font-size: 14px;
	outline: 0;
	-webkit-appearance: none;
	appearance: none;
}
.ms-search input[type=search]::-webkit-search-cancel-button { display: none; }
.ms-search input::placeholder { color: #777; }
.ms-search input:focus { border-color: var(--ms-accent); }
.ms-search button {
	position: absolute;
	right: 4px;
	top: 4px;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--ms-accent);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.ms-search button:hover { background: rgba(255, 255, 255, .08); }

/* ---------- Buttons / chips ---------- */
.ms-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--ms-accent);
	color: #111;
	border: 0;
	border-radius: 999px;
	padding: 11px 24px;
	font-weight: 700;
	font-size: 13px;
	cursor: pointer;
	line-height: 1;
	transition: filter .15s, transform .15s;
}
.ms-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.ms-btn-ghost { background: var(--ms-surface-2); color: var(--ms-txt); border: 1px solid var(--ms-line); }
.ms-btn-ghost:hover { border-color: var(--ms-accent); }
.ms-btn[disabled] { opacity: .6; cursor: wait; }

.ms-chips {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding: 4px 2px 10px;
	margin: 20px 0 16px;
	scrollbar-width: thin;
	scrollbar-color: #333 transparent;
}
.ms-chip {
	flex: none;
	background: var(--ms-surface-2);
	color: var(--ms-txt);
	border: 1px solid var(--ms-line);
	border-radius: 999px;
	padding: 7px 16px;
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	transition: .15s;
}
.ms-chip:hover { border-color: var(--ms-accent); }
.ms-chip.is-active { background: var(--ms-accent); color: #111; border-color: var(--ms-accent); }

/* ---------- Hero ---------- */
.ms-hero {
	position: relative;
	height: clamp(280px, 34vw, 440px);
	background: #222 center / cover no-repeat;
	display: flex;
	align-items: center;
}
.ms-hero-shade {
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, rgba(0,0,0,.82) 0%, rgba(0,0,0,.55) 45%, rgba(0,0,0,.15) 100%), linear-gradient(0deg, var(--ms-bg) 0%, transparent 30%);
}
.ms-hero-in { position: relative; max-width: 1320px; width: 100%; margin: 0 auto; padding: 0 24px; }
.ms-hero-title { font-size: clamp(22px, 3.2vw, 38px); line-height: 1.2; font-weight: 700; max-width: 640px; margin-bottom: 12px; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.ms-hero-desc { color: #dcdcdc; max-width: 580px; font-size: 14px; margin-bottom: 20px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Ads ---------- */
.ms-ad { text-align: center; margin: 18px auto; overflow: hidden; }
.ms-ad-label { display: block; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: #6c6c6c; margin-bottom: 6px; }
.ms-ad-body img { max-width: 100%; height: auto; }
.ms-ad-between { grid-column: 1 / -1; margin: 4px 0; }
.ms-ad-side { margin: 0 0 14px; }

/* ---------- Grid & cards ---------- */
.ms-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 26px 18px;
	transition: opacity .2s;
}
.ms-grid.is-loading { opacity: .45; pointer-events: none; }
.ms-card { min-width: 0; }
.ms-thumb, .ms-rel-thumb {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	border-radius: 10px;
	overflow: hidden;
	background: var(--ms-surface-2);
}
.ms-thumb img, .ms-rel-thumb img, .ms-noimg { width: 100%; height: 100%; object-fit: cover; display: block; }
.ms-noimg { background: linear-gradient(135deg, #262626, #363636); }
.ms-thumb img { transition: transform .35s; }
.ms-thumb:hover img { transform: scale(1.05); }
.ms-thumb:focus-visible, .ms-rel-thumb:focus-visible { outline: 2px solid var(--ms-accent); outline-offset: 2px; }
.ms-dur {
	position: absolute;
	right: 6px;
	bottom: 6px;
	background: rgba(0, 0, 0, .82);
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	padding: 1px 6px;
	border-radius: 4px;
	line-height: 1.5;
}
.ms-card-body { display: flex; gap: 10px; margin-top: 10px; }
.ms-card-text { min-width: 0; }
.ms-card-title { font-size: 14px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ms-card-title a:hover { color: var(--ms-accent); }
.ms-card-channel, .ms-card-meta { color: var(--ms-mut); font-size: 12px; margin-top: 2px; }
.ms-card-simple .ms-card-body { margin-top: 8px; }
.ms-card-simple .ms-card-meta { margin-top: 3px; }

.ms-avatar {
	flex: none;
	border-radius: 50%;
	overflow: hidden;
	background: var(--ms-surface-2);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.ms-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ms-avatar-letter { background: var(--ms-accent); color: #111; font-weight: 700; }

.ms-more-wrap { text-align: center; margin: 34px 0 6px; }
.ms-more-wrap[hidden], .ms-empty[hidden] { display: none; }
.ms-empty { text-align: center; color: var(--ms-mut); padding: 40px 0; }

.ms-page-title { font-size: 22px; font-weight: 700; margin: 8px 0 20px; }
.ms-page-title small { color: var(--ms-mut); font-weight: 400; font-size: 14px; }

.ms-pagination { margin-top: 34px; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.ms-pagination .page-numbers, .ms-pagination .nav-links a, .ms-pagination .nav-links span {
	display: inline-block;
	padding: 7px 14px;
	border-radius: 8px;
	background: var(--ms-surface-2);
	color: var(--ms-txt);
	font-size: 13px;
}
.ms-pagination .page-numbers.current { background: var(--ms-accent); color: #111; font-weight: 700; }
.ms-pagination a.page-numbers:hover { background: #333; }

/* ---------- Watch page ---------- */
.ms-watch { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; padding-top: 22px; }
.ms-player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--ms-radius); overflow: hidden; }
.ms-player iframe, .ms-player video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.ms-watch-title { font-size: 20px; line-height: 1.35; font-weight: 700; margin: 16px 0 12px; }
.ms-watch-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.ms-channel { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ms-channel-name { font-weight: 600; font-size: 15px; }
.ms-channel-sub { color: var(--ms-mut); font-size: 12.5px; }
.ms-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ms-pill {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	background: var(--ms-surface-2);
	color: var(--ms-txt);
	border: 1px solid var(--ms-line);
	border-radius: 999px;
	padding: 8px 16px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: .15s;
}
.ms-pill:hover { background: #303030; border-color: var(--ms-accent); }

.ms-desc { background: var(--ms-surface); border-radius: var(--ms-radius); padding: 14px 16px; margin-top: 16px; }
.ms-desc-body { font-size: 14px; color: #dedede; overflow-wrap: anywhere; }
.ms-desc-body p { margin: 0 0 10px; }
.ms-desc-body.is-clamped { max-height: 7.6em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.ms-desc-body a { color: var(--ms-accent); }
.ms-desc-toggle { background: none; border: 0; color: var(--ms-txt); font-weight: 600; font-size: 13px; cursor: pointer; padding: 8px 0 0; }
.ms-desc-toggle[hidden] { display: none; }
.ms-tags { margin-top: 6px !important; display: flex; flex-wrap: wrap; gap: 6px; }
.ms-tag { display: inline-block; font-size: 12.5px; color: var(--ms-accent) !important; margin: 0 6px 8px 0; }
.ms-tags .ms-tag { margin: 0; }
.ms-tag-cat { background: rgba(232, 185, 49, .14); padding: 2px 12px; border-radius: 999px; font-weight: 600; }
.ms-tag:hover { text-decoration: underline; }

.ms-upnext-title { font-size: 16px; font-weight: 700; color: var(--ms-accent); margin-bottom: 14px; }
.ms-rel { display: flex; gap: 10px; margin-bottom: 14px; }
.ms-rel-thumb { flex: none; width: 168px; }
.ms-rel-text { min-width: 0; }
.ms-rel-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ms-rel-title a:hover { color: var(--ms-accent); }
.ms-rel-ch, .ms-rel-meta { color: var(--ms-mut); font-size: 12px; margin-top: 2px; }

/* ---------- Footer ---------- */
.ms-footer { border-top: 1px solid var(--ms-line); padding: 30px 0 40px; text-align: center; }
.ms-socials { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ms-social {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--ms-surface-2);
	color: #fff;
	transition: transform .15s, filter .15s;
}
.ms-social svg { width: 18px; height: 18px; }
.ms-social:hover { transform: translateY(-2px); filter: brightness(1.15); }
.ms-social-facebook { background: #1877f2; }
.ms-social-youtube { background: #e62117; }
.ms-social-telegram { background: #229ed9; }
.ms-social-tiktok { background: #000; box-shadow: inset 0 0 0 1px #444; }
.ms-social-instagram { background: linear-gradient(45deg, #f9a13a, #dd2a7b 55%, #8134af); }
.ms-footer-nav ul { list-style: none; margin: 0 0 12px; padding: 0; display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.ms-footer-nav a { color: var(--ms-mut); font-size: 13px; }
.ms-footer-nav a:hover { color: var(--ms-accent); }
.ms-copy { color: var(--ms-mut); font-size: 12px; }

/* ---------- Content pages ---------- */
.ms-content { padding-top: 24px; max-width: 900px; }
.ms-entry { color: #dedede; }
.ms-entry a { color: var(--ms-accent); }
.ms-post { margin-bottom: 32px; }
.ms-notice { background: var(--ms-surface); border: 1px solid var(--ms-line); border-radius: var(--ms-radius); padding: 30px; margin: 40px auto; max-width: 560px; text-align: center; }
.ms-notice h2 { color: var(--ms-accent); margin-bottom: 8px; }
.ms-404 { text-align: center; padding-top: 80px; }
.ms-404 p { color: var(--ms-mut); margin-bottom: 20px; }
.ms-404 .ms-page-title { font-size: 64px; color: var(--ms-accent); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
	.ms-watch { grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; }
	.ms-rel-thumb { width: 140px; }
}
@media (max-width: 900px) {
	.ms-watch { grid-template-columns: 1fr; }
	.ms-rel-thumb { width: 168px; }
}
@media (max-width: 680px) {
	.ms-wrap, .ms-header-in, .ms-hero-in { padding-left: 14px; padding-right: 14px; }
	.ms-header-in { grid-template-columns: auto 1fr; gap: 10px; }
	.ms-search { grid-column: 2; }
	.ms-brand-text { font-size: 15px; max-width: 120px; }
	.ms-grid { grid-template-columns: 1fr; gap: 22px; }
	.ms-hero { height: 260px; }
	.ms-watch { padding-top: 0; gap: 16px; }
	.ms-watch .ms-player { border-radius: 0; margin: 0 -14px; }
	.ms-watch-title { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
}
