/* ==========================================================================
   Qamuz Shorts: vertical feed like YouTube Shorts.
   Desktop: centered 9:16 player + action rail + comments panel on the right.
   Phone (narrow box): full-bleed player, rail over it, comments as a bottom sheet.
   --sh-h (set by the script) is the visible height available for one short.
   ========================================================================== */

.qz-main:has(.qz-shorts) {
	padding-bottom: 0;
}

.qz-shorts {
	--sh-h: 720px;
	--sh-white: #fff;
	position: relative;
	width: 100%;
	color: var(--qz-ink);
	container: qzsh / inline-size;
}

.qz-shorts *,
.qz-shorts *::before,
.qz-shorts *::after {
	box-sizing: border-box;
}

.qz-shorts-loading {
	display: grid;
	place-items: center;
	min-height: 50vh;
	margin: 0;
	color: var(--qz-soft);
}

/* ---------- top bar ---------- */

.qz-sh-top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px 20px;
	padding: 14px clamp(16px, 3vw, 32px) 6px;
}

.qz-sh-title {
	margin: 0;
	color: var(--qz-ink);
	font: 700 clamp(22px, 3cqi, 30px)/1.1 var(--qz-display);
	letter-spacing: -0.02em;
}

.qz-sh-tabs {
	display: flex;
	gap: 6px;
	overflow-x: auto;
	scrollbar-width: none;
}

.qz-sh-tab,
.qz-shorts a.qz-sh-tab {
	flex: none;
	padding: 7px 14px;
	border: 0;
	border-radius: 9px;
	background: color-mix(in srgb, var(--qz-ink) 8%, transparent);
	color: var(--qz-ink);
	font: 600 13px/1.2 var(--qz-sans);
	text-decoration: none;
	cursor: pointer;
}

.qz-sh-tab:hover,
.qz-shorts a.qz-sh-tab:hover {
	background: color-mix(in srgb, var(--qz-ink) 14%, transparent);
}

.qz-sh-tab.is-on {
	background: var(--qz-ink);
	color: var(--qz-bg);
}

/* ---------- stage + feed ---------- */

.qz-sh-stage {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	height: var(--sh-h);
}

.qz-shorts.has-panel .qz-sh-stage {
	grid-template-columns: minmax(0, 1fr) min(420px, 40%);
}

.qz-sh-feed {
	height: var(--sh-h);
	overflow-y: auto;
	overscroll-behavior-y: contain;
	scroll-snap-type: y mandatory;
	scrollbar-width: none;
	outline: none;
}

.qz-sh-feed::-webkit-scrollbar {
	display: none;
}

.qz-sh-item {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	gap: 14px;
	height: var(--sh-h);
	padding: 10px 96px 14px; /* room for the up/down buttons */
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

.qz-sh-frame {
	position: relative;
	isolation: isolate;
	flex: none;
	height: 100%;
	max-width: calc(100% - 96px);
	aspect-ratio: 9 / 16;
	overflow: hidden;
	border-radius: 16px;
	background: #05070b;
	color: var(--sh-white);
}

.qz-sh-frame::after {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.18) 34%, transparent 52%), linear-gradient(to bottom, rgba(0, 0, 0, 0.35), transparent 18%);
	content: "";
	pointer-events: none;
}

.qz-sh-bg {
	position: absolute;
	inset: -30px;
	background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--qz-accent) 45%, transparent), transparent 60%), #0b0f16;
	background-position: center;
	background-size: cover;
	filter: blur(30px) brightness(0.5) saturate(1.3);
}

.qz-sh-media {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
}

.qz-sh-video {
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: transparent;
}

.is-song .qz-sh-media {
	align-content: start;
	justify-items: center;
	gap: 22px;
	padding: 16% 7% 0;
}

.qz-sh-art {
	display: grid;
	place-items: center;
	width: 86%;
	aspect-ratio: 1;
	border-radius: 14px;
	background-position: center;
	background-size: cover;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
	transition: transform 0.6s ease;
}

.qz-sh-art.is-empty {
	background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--qz-accent) 80%, transparent), transparent 60%), linear-gradient(140deg, #16324a, #0b0f16);
	color: rgba(255, 255, 255, 0.85);
}

.qz-sh-item.is-playing .qz-sh-art {
	transform: scale(1.03);
}

.qz-sh-media audio {
	display: none;
}

/* karaoke */
.qz-sh-lyrics {
	z-index: 2;
	width: 100%;
	min-height: 4.6em;
	text-align: center;
	text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

.qz-sh-line {
	margin: 0 0 6px;
	color: rgba(255, 255, 255, 0.72);
	font: 700 clamp(16px, 2.2vh, 22px)/1.3 var(--qz-display);
}

.qz-sh-line.is-next {
	color: rgba(255, 255, 255, 0.45);
	font-size: clamp(13px, 1.7vh, 17px);
}

.qz-sh-line span {
	transition: color 0.12s;
}

.qz-sh-line span.is-sung {
	color: var(--qz-accent);
}

/* tap to play */
.qz-sh-tap {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: grid;
	place-items: center;
	align-content: center;
	gap: 12px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--sh-white);
	cursor: pointer;
}

.qz-sh-big {
	display: grid;
	place-items: center;
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(6px);
	opacity: 0;
	transform: scale(0.9);
	transition: opacity 0.2s, transform 0.2s;
}

.qz-sh-item:not(.is-playing) .qz-sh-big,
.qz-sh-tap:focus-visible .qz-sh-big {
	opacity: 1;
	transform: none;
}

.qz-sh-hint {
	display: none;
	padding: 6px 12px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.55);
	font: 600 13px/1.2 var(--qz-sans);
}

.qz-sh-item.needs-tap .qz-sh-hint {
	display: block;
}

.qz-sh-mute {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 3;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.4);
	color: var(--sh-white);
	cursor: pointer;
}

/* caption */
.qz-sh-cap {
	position: absolute;
	right: 16px;
	bottom: 20px;
	left: 16px;
	z-index: 3;
	display: grid;
	gap: 6px;
	pointer-events: none;
}

.qz-sh-who {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.qz-sh-avatar {
	flex: none;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #222;
	object-fit: cover;
}

.qz-sh-name {
	overflow: hidden;
	font: 600 14px/1.2 var(--qz-sans);
	text-overflow: ellipsis;
	white-space: nowrap;
}

.qz-sh-chip {
	flex: none;
	padding: 3px 8px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.18);
	font: 600 11px/1.2 var(--qz-sans);
}

.qz-sh-chip.is-pub {
	background: var(--qz-accent);
	color: var(--qz-accent-ink);
}

.qz-sh-song {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	color: var(--sh-white);
	font: 700 16px/1.3 var(--qz-sans);
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.qz-sh-sub {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	color: rgba(255, 255, 255, 0.78);
	font: 400 13px/1.35 var(--qz-sans);
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

/* progress */
.qz-sh-progress {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 4;
	height: 14px;
	cursor: pointer;
	touch-action: none;
}

.qz-sh-progress::before,
.qz-sh-progress i {
	position: absolute;
	bottom: 0;
	left: 0;
	height: 3px;
	content: "";
	transition: height 0.15s;
}

.qz-sh-progress::before {
	right: 0;
	background: rgba(255, 255, 255, 0.25);
}

.qz-sh-progress i {
	width: 0;
	background: var(--qz-accent);
}

.qz-sh-progress:hover::before,
.qz-sh-progress:hover i {
	height: 6px;
}

/* landscape music videos keep their shape on wide screens */
.qz-sh-item.is-wide {
	align-items: center;
}

.qz-sh-frame.is-wide {
	width: min(100% - 98px, (var(--sh-h) - 24px) * 16 / 9, 1100px);
	height: auto;
	aspect-ratio: 16 / 9;
}

/* ---------- action rail ---------- */

.qz-sh-rail {
	display: flex;
	flex: none;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	width: 84px;
	padding-bottom: 4px;
}

.qz-sh-act,
.qz-shorts a.qz-sh-act {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--qz-ink);
	font: 600 12px/1.1 var(--qz-sans);
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

.qz-sh-ico {
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: color-mix(in srgb, var(--qz-ink) 10%, transparent);
	transition: background 0.15s, color 0.15s, transform 0.15s;
}

.qz-sh-act:hover .qz-sh-ico {
	background: color-mix(in srgb, var(--qz-ink) 18%, transparent);
}

.qz-sh-act:active .qz-sh-ico {
	transform: scale(0.92);
}

.qz-sh-act.is-on .qz-sh-ico {
	background: var(--qz-ink);
	color: var(--qz-bg);
}

.qz-sh-act--pub.is-on .qz-sh-ico {
	background: var(--qz-accent);
	color: var(--qz-accent-ink);
}

.qz-sh-n {
	max-width: 84px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.qz-sh-disc {
	width: 40px;
	height: 40px;
	margin-top: 4px;
	border: 3px solid color-mix(in srgb, var(--qz-ink) 85%, transparent);
	border-radius: 50%;
	background: radial-gradient(circle at 30% 25%, var(--qz-accent), #0b0f16);
	background-position: center;
	background-size: cover;
}

.qz-sh-disc.is-spin {
	animation: qz-sh-spin 4s linear infinite;
}

@keyframes qz-sh-spin {
	to {
		transform: rotate(360deg);
	}
}

/* up / down */
.qz-sh-nav {
	position: absolute;
	top: 50%;
	right: 22px;
	z-index: 5;
	display: grid;
	gap: 14px;
	transform: translateY(-50%);
}

.qz-shorts.has-panel .qz-sh-nav {
	right: calc(min(420px, 40%) + 22px);
}

.qz-sh-navbtn {
	display: grid;
	place-items: center;
	width: 52px;
	height: 52px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: color-mix(in srgb, var(--qz-ink) 10%, transparent);
	color: var(--qz-ink);
	cursor: pointer;
}

.qz-sh-navbtn:hover {
	background: color-mix(in srgb, var(--qz-ink) 18%, transparent);
}

/* empty state */
.qz-sh-stage:has(.qz-sh-empty) .qz-sh-nav {
	display: none;
}

.qz-sh-empty {
	display: grid;
	place-content: center;
	justify-items: center;
	gap: 16px;
	height: 100%;
	max-width: 440px;
	margin: 0 auto;
	padding: 24px;
	color: var(--qz-soft);
	text-align: center;
}

.qz-sh-empty p {
	margin: 0;
}

/* ---------- comments ---------- */

.qz-sh-panel {
	display: flex;
	flex-direction: column;
	min-height: 0;
	margin: 10px clamp(12px, 2vw, 24px) 14px 0;
	overflow: hidden;
	border: 1px solid var(--qz-line);
	border-radius: 16px;
	background: var(--qz-surface);
	color: var(--qz-ink);
}

.qz-sh-panel[hidden],
.qz-sh-scrim[hidden] {
	display: none;
}

.qz-sh-phead {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px 10px;
	border-bottom: 1px solid var(--qz-line);
}

.qz-sh-phead h3 {
	margin: 0;
	font: 700 17px/1.2 var(--qz-sans);
}

.qz-sh-pcount {
	margin-left: 4px;
	color: var(--qz-soft);
	font-weight: 500;
}

.qz-sh-x {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--qz-ink);
	cursor: pointer;
}

.qz-sh-x:hover {
	background: color-mix(in srgb, var(--qz-ink) 10%, transparent);
}

.qz-sh-clist {
	flex: 1;
	min-height: 0;
	padding: 6px 16px 10px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.qz-sh-muted {
	margin: 18px 0;
	color: var(--qz-soft);
	font-size: 14px;
	text-align: center;
}

.qz-sh-c {
	display: grid;
	grid-template-columns: 36px minmax(0, 1fr);
	gap: 12px;
	padding: 10px 0;
}

.qz-sh-c .qz-sh-avatar {
	width: 36px;
	height: 36px;
}

.qz-sh-replies .qz-sh-c {
	grid-template-columns: 26px minmax(0, 1fr);
	gap: 10px;
	padding: 8px 0 0;
}

.qz-sh-replies .qz-sh-avatar {
	width: 26px;
	height: 26px;
}

.qz-sh-cmeta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin: 0 0 3px;
	color: var(--qz-soft);
	font-size: 12px;
}

.qz-sh-cmeta strong {
	color: var(--qz-ink);
	font-weight: 600;
}

.qz-sh-owner {
	padding: 1px 7px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--qz-accent) 20%, transparent);
	color: var(--qz-accent);
	font-weight: 600;
}

.qz-sh-ctext {
	margin: 0;
	color: var(--qz-ink);
	font-size: 14px;
	line-height: 1.45;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.qz-sh-pending {
	margin: 4px 0 0;
	color: var(--qz-soft);
	font-size: 12px;
	font-style: italic;
}

.qz-sh-cact {
	display: flex;
	gap: 6px;
	margin-top: 4px;
}

.qz-sh-cact button {
	display: inline-flex;
	align-items: center;
	padding: 4px 8px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--qz-soft);
	font: 600 12px/1 var(--qz-sans);
	cursor: pointer;
}

.qz-sh-cact button:hover {
	background: color-mix(in srgb, var(--qz-ink) 8%, transparent);
	color: var(--qz-ink);
}

.qz-sh-form {
	display: grid;
	gap: 8px;
	padding: 12px 16px 14px;
	border-top: 1px solid var(--qz-line);
}

.qz-sh-form.is-guest {
	grid-template-columns: 1fr auto;
	align-items: center;
}

.qz-sh-form.is-guest p {
	margin: 0;
	color: var(--qz-soft);
	font-size: 14px;
}

.qz-sh-frow {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

.qz-sh-frow textarea {
	flex: 1;
	min-height: 42px;
	max-height: 120px;
	padding: 10px 14px;
	border: 1px solid var(--qz-line);
	border-radius: 20px;
	background: var(--qz-bg);
	color: var(--qz-ink);
	font: 400 14px/1.4 var(--qz-sans);
	resize: none;
}

.qz-sh-frow textarea:focus {
	border-color: var(--qz-accent);
	outline: none;
}

.qz-sh-send {
	display: grid;
	flex: none;
	place-items: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--qz-accent);
	color: var(--qz-accent-ink);
	cursor: pointer;
}

.qz-sh-replying {
	display: flex;
	align-items: center;
	justify-content: space-between;
	color: var(--qz-soft);
	font-size: 12px;
}

.qz-sh-replying[hidden] {
	display: none;
}

.qz-sh-replying button {
	display: grid;
	place-items: center;
	padding: 2px;
	border: 0;
	background: none;
	color: inherit;
	cursor: pointer;
}

.qz-sh-scrim {
	position: fixed;
	inset: 0;
	z-index: 9998;
	background: rgba(0, 0, 0, 0.5);
}

/* toast */
.qz-sh-toast {
	position: fixed;
	bottom: 96px;
	left: 50%;
	z-index: 10000;
	max-width: calc(100vw - 32px);
	padding: 10px 16px;
	border-radius: 10px;
	background: var(--qz-ink);
	color: var(--qz-bg);
	font: 600 14px/1.3 var(--qz-sans);
	opacity: 0;
	transform: translate(-50%, 10px);
	transition: opacity 0.2s, transform 0.2s;
	pointer-events: none;
}

.qz-sh-toast.is-on {
	opacity: 1;
	transform: translate(-50%, 0);
	pointer-events: auto;
}

.qz-sh-toast a {
	color: inherit;
	font-weight: 700;
	text-decoration: underline;
}

/* login prompt for "Mi feed" */
.qz-shorts-login {
	max-width: 720px;
	margin: 12vh auto;
	padding: 36px;
	border: 1px solid var(--qz-line);
	border-radius: 16px;
	background: var(--qz-surface);
	color: var(--qz-ink);
}

.qz-shorts-kicker {
	margin: 0 0 8px;
	color: var(--qz-accent);
	font: 600 11px/1.3 var(--qz-mono);
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.qz-shorts-login h1 {
	margin: 0;
	font: 700 clamp(30px, 5vw, 48px)/1.05 var(--qz-display);
}

.qz-shorts-login p:not(.qz-shorts-kicker) {
	margin: 14px 0 24px;
	color: var(--qz-soft);
}

/* ---------- phone / narrow box ---------- */

@container qzsh (max-width: 759px) {
	.qz-sh-top {
		padding: 10px 14px 8px;
	}

	.qz-shorts.has-panel .qz-sh-stage {
		grid-template-columns: minmax(0, 1fr);
	}

	.qz-sh-item {
		position: relative;
		display: block;
		padding: 0;
	}

	.qz-sh-frame,
	.qz-sh-frame.is-wide {
		width: 100%;
		max-width: none;
		height: 100%;
		aspect-ratio: auto;
		border-radius: 0;
	}

	.is-song .qz-sh-media {
		padding-top: max(12%, 40px);
	}

	.qz-sh-art {
		width: min(78%, 46vh);
	}

	.qz-sh-cap {
		right: 82px;
		bottom: 22px;
	}

	.qz-sh-rail {
		position: absolute;
		right: 6px;
		bottom: 22px;
		z-index: 4;
		gap: 12px;
		width: 68px;
	}

	.qz-sh-act,
	.qz-shorts a.qz-sh-act {
		color: var(--sh-white);
		text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
	}

	.qz-sh-ico {
		width: 44px;
		height: 44px;
		background: rgba(0, 0, 0, 0.35);
		backdrop-filter: blur(6px);
	}

	.qz-sh-act:hover .qz-sh-ico {
		background: rgba(0, 0, 0, 0.5);
	}

	.qz-sh-act.is-on .qz-sh-ico {
		background: var(--sh-white);
		color: #0b0f16;
	}

	.qz-sh-disc {
		border-color: rgba(255, 255, 255, 0.85);
	}

	.qz-sh-nav {
		display: none;
	}

	.qz-sh-panel {
		position: fixed;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 9999;
		height: min(72dvh, 640px);
		margin: 0;
		border-width: 1px 0 0;
		border-radius: 18px 18px 0 0;
		box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
		animation: qz-sh-up 0.22s ease-out;
	}

	.qz-sh-phead::before {
		position: absolute;
		top: 6px;
		left: 50%;
		width: 36px;
		height: 4px;
		border-radius: 2px;
		background: var(--qz-line);
		content: "";
		transform: translateX(-50%);
	}

	.qz-sh-phead {
		position: relative;
		padding-top: 18px;
	}
}

@keyframes qz-sh-up {
	from {
		transform: translateY(40px);
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.qz-sh-disc.is-spin,
	.qz-sh-panel {
		animation: none;
	}

	.qz-sh-feed {
		scroll-behavior: auto;
	}
}
