/* MP Swipe – feed styles. Scoped to #mps so the theme is never affected. */

html.mps-html, .mps-body {
	margin: 0 !important;
	padding: 0 !important;
	height: 100%;
	background: #000;
	overflow: hidden;
	overscroll-behavior: none;
}

#mps {
	--mps-accent: #e17235;
	--mps-logo-w: 110px;
	--mps-top: calc(52px + env(safe-area-inset-top));
	--mps-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	position: fixed;
	inset: 0;
	background: #000;
	color: #fff;
	font-family: var(--mps-font);
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
}
#mps *, #mps *::before, #mps *::after { box-sizing: border-box; }
#mps button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; }
#mps a { color: inherit; }

/* Top bar */
.mps-top {
	position: absolute; z-index: 5; top: 0; left: 0; right: 0;
	height: var(--mps-top);
	padding: env(safe-area-inset-top) 12px 0;
	display: flex; align-items: center; gap: 6px;
	background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,0));
	pointer-events: none;
}
.mps-home {
	pointer-events: auto;
	display: grid; place-items: center;
	width: 38px; height: 38px; border-radius: 50%;
	color: #fff; text-decoration: none;
}
.mps-home:active { background: rgba(255,255,255,.15); }
.mps-brand { pointer-events: auto; font-weight: 700; font-size: 14px; opacity: .9; text-decoration: none; color: #fff !important; }
.mps-lang { pointer-events: auto; position: relative; margin-left: auto; }
.mps-lang summary {
	list-style: none; cursor: pointer;
	display: flex; align-items: center; gap: 5px;
	padding: 7px 10px; border-radius: 999px;
	background: rgba(0,0,0,.4); backdrop-filter: blur(6px);
	font-weight: 800; font-size: 13px; letter-spacing: .04em;
}
.mps-lang summary::-webkit-details-marker { display: none; }
.mps-lang[open] summary { background: var(--mps-accent); }
.mps-lang-menu {
	position: absolute; right: 0; top: calc(100% + 6px);
	min-width: 170px; padding: 6px;
	background: #fff; color: #111; border-radius: 12px;
	box-shadow: 0 10px 30px rgba(0,0,0,.35);
	display: flex; flex-direction: column;
}
.mps-lang-menu a, .mps-lang-menu span {
	display: flex; align-items: baseline; gap: 8px;
	padding: 11px 12px; border-radius: 8px;
	font-weight: 800; font-size: 15px; color: #111 !important; text-decoration: none;
}
.mps-lang-menu small { font-weight: 500; color: #666; font-size: 13px; }
.mps-lang-menu .is-current { background: #f2f2f2; }
.mps-lang-menu .is-current::after { content: "✓"; margin-left: auto; color: var(--mps-accent); }
.mps-lang-menu a:active { background: #eee; }

/* Feed */
.mps-feed {
	position: absolute; inset: 0;
	overflow-y: auto; overflow-x: hidden;
	scroll-snap-type: y mandatory;
	overscroll-behavior-y: contain;
	-webkit-overflow-scrolling: touch;
	touch-action: pan-y;
	scrollbar-width: none;
	outline: none;
}
.mps-feed::-webkit-scrollbar { display: none; }

/* Card */
.mps-card {
	position: relative;
	height: 100%;
	min-height: 100%;
	scroll-snap-align: start;
	scroll-snap-stop: always; /* one story per swipe, even on a fast flick */
	overflow: hidden;
	display: flex; flex-direction: column;
	background: #0b0b0b;
	transition: transform .18s ease-out;
	contain: layout paint;
}

/* Blurred background from the same photo */
.mps-bg {
	position: absolute; inset: -40px;
	background-size: cover; background-position: center;
	filter: blur(28px) saturate(1.2) brightness(.5);
	transform: scale(1.1);
}

/* Photo / video stage */
.mps-stage {
	position: relative; z-index: 1;
	flex: 1 1 auto;
	min-height: 0;
	display: flex; align-items: center; justify-content: center;
	padding: var(--mps-top) 0 0;
}
.mps-fig {
	position: relative;
	margin: 0;
	aspect-ratio: var(--r, 1.7778);
	width: min(100%, calc((100dvh - var(--mps-top) - 270px) * var(--r, 1.7778)));
	max-height: 100%;
	background: #111;
	box-shadow: 0 10px 40px rgba(0,0,0,.45);
	overflow: hidden;
}
@supports not (height: 100dvh) {
	.mps-fig { width: min(100%, calc((100vh - var(--mps-top) - 270px) * var(--r, 1.7778))); }
}
.mps-fig.is-empty { background: linear-gradient(135deg, #222, #111); }
.mps-img, .mps-video {
	display: block; width: 100%; height: 100%;
	object-fit: cover;
	background: #111;
}

/* Transparent logo over the photo */
.mps-logo {
	position: absolute; z-index: 2;
	width: var(--mps-logo-w); height: auto; max-width: 40%;
	filter: drop-shadow(0 1px 3px rgba(0,0,0,.45));
	pointer-events: none;
}
.mps-logo.is-theme { background: rgba(255,255,255,.92); padding: 4px 6px; border-radius: 4px; filter: none; }
.mps-logo--top-left { top: 10px; left: 10px; }
.mps-logo--top-right { top: 10px; right: 10px; }
.mps-logo--bottom-right { bottom: 10px; right: 10px; }

.mps-vbadge {
	position: absolute; z-index: 2; left: 10px; bottom: 10px;
	padding: 4px 8px; border-radius: 4px;
	background: var(--mps-accent); color: #fff;
	font-size: 11px; font-weight: 800; letter-spacing: .08em;
}
.mps-logo--bottom-right ~ .mps-vbadge { left: 10px; }

.mps-playhint {
	position: absolute; z-index: 2; inset: 0;
	display: grid; place-items: center;
	opacity: 0; transition: opacity .2s;
	pointer-events: none;
}
.mps-playhint .mps-ico {
	width: 64px; height: 64px; border-radius: 50%;
	background: rgba(0,0,0,.45);
	display: grid; place-items: center;
}
.mps-playhint svg { width: 30px; height: 30px; }
.mps-card.is-video.is-active:not(.is-playing) .mps-playhint { opacity: 1; }

/* Text */
.mps-shade {
	position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; height: 60%;
	background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.6) 40%, rgba(0,0,0,.88));
	pointer-events: none;
}
.mps-info {
	position: relative; z-index: 2;
	flex: 0 0 auto;
	padding: 18px 76px calc(22px + env(safe-area-inset-bottom)) 16px;
}
.mps-meta, .mps-art-meta {
	display: flex; align-items: center; gap: 10px;
	font-size: 12px; margin-bottom: 9px;
}
.mps-cat {
	display: inline-block;
	padding: 4px 8px; border-radius: 3px;
	background: var(--mps-accent); color: #fff;
	font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: 11px;
}
.mps-time { opacity: .8; }
.mps-title {
	margin: 0 0 8px;
	font-size: clamp(20px, 5.6vw, 26px);
	line-height: 1.2;
	font-weight: 800;
	color: #fff;
	display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
	text-wrap: balance;
}
.mps-excerpt {
	margin: 0 0 12px;
	font-size: 15px; line-height: 1.45;
	color: rgba(255,255,255,.86);
	display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.mps-more {
	font-weight: 700; font-size: 14px;
	padding: 8px 14px !important;
	border-radius: 999px;
	background: rgba(255,255,255,.16) !important;
	backdrop-filter: blur(6px);
}

/* Side actions */
.mps-actions {
	position: absolute; z-index: 3;
	right: 8px; bottom: calc(26px + env(safe-area-inset-bottom));
	display: flex; flex-direction: column; gap: 14px;
}
.mps-act {
	display: flex; flex-direction: column; align-items: center; gap: 4px;
	width: 58px;
}
.mps-act .mps-ico {
	width: 46px; height: 46px; border-radius: 50%;
	display: grid; place-items: center;
	background: rgba(0,0,0,.35);
	backdrop-filter: blur(6px);
}
.mps-act:active .mps-ico { transform: scale(.92); }
.mps-act-l { font-size: 11px; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.6); }

/* Tail: loading / end / error */
.mps-tail {
	scroll-snap-align: start;
	min-height: 120px;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
	padding: 30px 24px calc(30px + env(safe-area-inset-bottom));
	text-align: center; color: rgba(255,255,255,.8); font-size: 15px;
}
.mps-tail.is-idle { min-height: 1px; padding: 0; }
.mps-tail.is-end, .mps-tail.is-error { height: 100%; }
.mps-tail p { margin: 0; }
.mps-spin {
	width: 28px; height: 28px; border-radius: 50%;
	border: 3px solid rgba(255,255,255,.25); border-top-color: #fff;
	animation: mps-spin .8s linear infinite;
}
@keyframes mps-spin { to { transform: rotate(360deg); } }

.mps-btn {
	display: inline-flex; align-items: center; justify-content: center;
	padding: 11px 18px !important; border-radius: 999px;
	background: var(--mps-accent) !important; color: #fff !important;
	font-weight: 700; font-size: 15px; text-decoration: none;
}
.mps-btn--ghost { background: transparent !important; color: #111 !important; box-shadow: inset 0 0 0 1.5px #bbb; }

/* Toast */
.mps-toast {
	position: absolute; z-index: 60; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom));
	transform: translate(-50%, 20px); opacity: 0;
	padding: 10px 16px; border-radius: 8px; background: rgba(30,30,30,.95);
	font-size: 14px; transition: opacity .2s, transform .2s; pointer-events: none;
}
.mps-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* First-time hint */
.mps-hint {
	position: absolute; z-index: 40; inset: 0;
	display: grid; place-items: center;
	background: rgba(0,0,0,.62);
	animation: mps-fade .3s ease-out;
	transition: opacity .3s;
}
.mps-hint.is-out { opacity: 0; }
.mps-hint-box { display: flex; flex-direction: column; align-items: center; gap: 26px; padding: 24px; text-align: center; }
.mps-hint-row { display: flex; flex-direction: column; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.mps-hint-hand {
	width: 44px; height: 44px; border-radius: 50%;
	border: 3px solid #fff; background: rgba(255,255,255,.2);
}
.mps-hint-up .mps-hint-hand { animation: mps-up 1.4s ease-in-out infinite; }
.mps-hint-left .mps-hint-hand { animation: mps-left 1.4s ease-in-out .7s infinite; }
@keyframes mps-up { 0% { transform: translateY(24px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-24px); opacity: 0; } }
@keyframes mps-left { 0% { transform: translateX(30px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateX(-30px); opacity: 0; } }
@keyframes mps-fade { from { opacity: 0; } }

/* Article panel (bottom sheet) */
.mps-panel { position: absolute; inset: 0; z-index: 50; pointer-events: none; }
.mps-scrim {
	position: absolute; inset: 0; background: rgba(0,0,0,.5);
	opacity: 0; transition: opacity .25s;
}
.mps-sheet {
	position: absolute; left: 0; right: 0; bottom: 0;
	height: 92%; height: 92dvh;
	background: #fff; color: #111;
	border-radius: 16px 16px 0 0;
	display: flex; flex-direction: column;
	transform: translateY(100%);
	transition: transform .3s cubic-bezier(.2,.8,.2,1);
	box-shadow: 0 -10px 40px rgba(0,0,0,.3);
}
.mps-panel.is-open { pointer-events: auto; }
.mps-panel.is-open .mps-scrim { opacity: 1; }
.mps-panel.is-open .mps-sheet { transform: translateY(0); }
.mps-sheet-head {
	position: relative; flex: 0 0 auto;
	display: flex; align-items: center; justify-content: center;
	height: 52px; border-bottom: 1px solid #eee;
	touch-action: none;
}
.mps-grip { position: absolute; top: 7px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: #ccc; }
.mps-sheet-title { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--mps-accent); }
.mps-x { position: absolute !important; right: 8px; top: 8px; width: 36px; height: 36px; border-radius: 50%; display: grid !important; place-items: center; color: #111 !important; }
.mps-x:active { background: #eee !important; }
.mps-sheet-body {
	flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 18px 18px calc(30px + env(safe-area-inset-bottom));
}
.mps-art-title { margin: 0 0 8px; font-size: 24px; line-height: 1.22; font-weight: 800; color: #111; }
.mps-art-meta .mps-time { color: #666; opacity: 1; }
.mps-art-by { font-size: 13px; color: #777; margin-bottom: 14px; min-height: 1px; }
.mps-art-img { width: 100%; height: auto; display: block; border-radius: 8px; margin-bottom: 16px; }
.mps-art-content { font-size: 17px; line-height: 1.62; color: #222; overflow-wrap: anywhere; }
.mps-art-content p { margin: 0 0 1em; }
.mps-art-content img, .mps-art-content video, .mps-art-content iframe { max-width: 100%; height: auto; }
.mps-art-content iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; }
.mps-art-content figure { margin: 0 0 1em; }
.mps-art-content a { color: var(--mps-accent); }
.mps-art-error { color: #a00; }
.mps-skeleton span { display: block; height: 14px; margin: 0 0 12px; border-radius: 4px; background: linear-gradient(90deg, #eee, #f6f6f6, #eee); background-size: 200% 100%; animation: mps-sk 1.2s linear infinite; }
.mps-skeleton span:nth-child(3n) { width: 70%; }
@keyframes mps-sk { to { background-position: -200% 0; } }
.mps-art-foot { display: flex; gap: 10px; margin: 22px 0 8px; flex-wrap: wrap; }
.mps-rel { margin-top: 24px; border-top: 1px solid #eee; padding-top: 16px; }
.mps-rel-h { margin: 0 0 12px; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #111; }
.mps-rel-item { display: flex; gap: 12px; align-items: center; padding: 8px 0; text-decoration: none; color: #111 !important; font-weight: 700; font-size: 15px; line-height: 1.3; }
.mps-rel-item img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }

html.mps-locked .mps-feed { overflow: hidden; }

/* Desktop: show the feed as a phone-width column */
@media (min-width: 621px) {
	#mps { --mps-top: 56px; }
	.mps-feed, .mps-top, .mps-panel { left: 50%; right: auto; width: 480px; margin-left: -240px; }
	.mps-feed { box-shadow: 0 0 0 1px #222; }
	.mps-fig { width: min(100%, calc((100vh - var(--mps-top) - 270px) * var(--r, 1.7778))); }
}

@media (prefers-reduced-motion: reduce) {
	.mps-card, .mps-sheet, .mps-scrim, .mps-toast { transition: none; }
	.mps-hint-hand, .mps-spin, .mps-skeleton span { animation: none; }
}
